Sync with the latest private repository.
authorSung-jae Park <nicesj.park@samsung.com>
Wed, 12 Nov 2014 10:00:20 +0000 (19:00 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Wed, 12 Nov 2014 10:00:57 +0000 (19:00 +0900)
Initiate project using Tizen 2.x private repository.

Change-Id: I2915283db90db87e46186f416165d32054126bbe

80 files changed:
CMakeLists.txt [changed mode: 0755->0644]
data-provider-master.rule [deleted file]
data/CMakeLists.txt
data/abi.ini
data/dump_dynamicbox.sh [new file with mode: 0644]
data/dump_livebox.sh [deleted file]
data/mobile.data-provider-master.service [deleted file]
data/wayland.mobile.conf.ini
data/wayland.wearable.conf.ini
data/x11.mobile.320x480.conf.ini [new file with mode: 0644]
data/x11.mobile.320x480.resolution.ini [new file with mode: 0644]
data/x11.mobile.360x480.conf.ini [new file with mode: 0644]
data/x11.mobile.360x480.resolution.ini [new file with mode: 0644]
data/x11.mobile.480x800.conf.ini [new file with mode: 0644]
data/x11.mobile.480x800.resolution.ini [new file with mode: 0644]
data/x11.mobile.conf.ini
data/x11.wearable.360x480.conf.ini [new file with mode: 0644]
data/x11.wearable.360x480.resolution.ini [new file with mode: 0644]
data/x11.wearable.conf.ini
data/x11.wearable.resolution.ini
include/buffer_handler.h
include/client_life.h
include/conf.h
include/debug.h
include/event.h
include/group.h
include/instance.h
include/io.h
include/lite-errno.h
include/package.h
include/parser.h
include/setting.h
include/slave_life.h
include/util.h
packaging/data-provider-master.manifest
packaging/data-provider-master.spec
pkgmgr_dynamicbox/CMakeLists.txt [moved from pkgmgr_livebox/CMakeLists.txt with 83% similarity]
pkgmgr_dynamicbox/dynamicbox.xml [new file with mode: 0644]
pkgmgr_dynamicbox/dynamicbox.xsd [new file with mode: 0644]
pkgmgr_dynamicbox/include/dlist.h [moved from pkgmgr_livebox/include/dlist.h with 100% similarity]
pkgmgr_dynamicbox/src/dlist.c [moved from pkgmgr_livebox/src/dlist.c with 100% similarity]
pkgmgr_dynamicbox/src/service_register.c [moved from pkgmgr_livebox/src/service_register.c with 77% similarity]
pkgmgr_livebox/livebox.xml [deleted file]
res/edje/CMakeLists.txt
src/abi.c
src/badge_service.c
src/buffer_handler.c
src/buffer_handler_wayland.c
src/client_life.c
src/client_rpc.c
src/conf.c
src/critical_log.c
src/dead_monitor.c
src/event.c
src/fault_manager.c
src/file_service.c
src/group.c
src/instance.c
src/io.c
src/liveinfo.c
src/main.c
src/notification_service.c
src/package.c
src/parser.c
src/pkgmgr.c
src/script_handler.c
src/server.c
src/service_common.c
src/setting.c
src/shortcut_service.c
src/slave_life.c
src/slave_rpc.c
src/util.c
src/util_wayland.c
src/util_x11.c
src/utility_service.c
src/xmonitor.c
src/xmonitor_wayland.c
util_liveinfo/CMakeLists.txt
util_liveinfo/src/liveinfo.c

old mode 100755 (executable)
new mode 100644 (file)
index f11d495..ecc8ea1
@@ -3,7 +3,6 @@ PROJECT(data-provider-master C)
 
 INCLUDE(FindPkgConfig)
 pkg_check_modules(pkg REQUIRED
-       ail
        dlog
        aul
        vconf
@@ -22,12 +21,12 @@ pkg_check_modules(pkg REQUIRED
        badge-service
        libsmack
        shortcut
-       libsystemd-daemon
+       pkgmgr-info
 )
 
 IF (LIVEBOX)
 pkg_check_modules(pkg_livebox REQUIRED
-       livebox-service
+       dynamicbox_service
 )
 ENDIF (LIVEBOX)
 
@@ -78,6 +77,7 @@ ADD_DEFINITIONS("-DSHORTCUT_SMACK_LABEL=\"data-provider-master::shortcut\"")
 ADD_DEFINITIONS("-DNOTIFICATION_SMACK_LABEL=\"data-provider-master::notification\"")
 ADD_DEFINITIONS("-DBADGE_SMACK_LABEL=\"data-provider-master::badge\"")
 ADD_DEFINITIONS("-DDATA_SHARE_LABEL=\"data-provider-master::share\"")
+ADD_DEFINITIONS("-DDEFAULT_SMACK_LABEL=\"data-provider-master\"")
 
 ADD_DEFINITIONS("-DDEFAULT_MASTER_CONF=\"/usr/share/data-provider-master/conf.ini\"")
 
@@ -100,7 +100,6 @@ SET(BUILD_SOURCE
        src/badge_service.c
        src/notification_service.c
        src/service_common.c
-       src/conf.c
 )
 
 IF (LIVEBOX)
@@ -126,11 +125,12 @@ IF (LIVEBOX)
                src/pkgmgr.c
                src/event.c
                src/file_service.c
+               src/conf.c
        )
 
        IF (WAYLAND_SUPPORT)
                ADD_DEFINITIONS("-DHAVE_WAYLAND")
-               SET(BUILD_SOURCE
+               SET(BUILD_SOURCE 
                        ${BUILD_SOURCE}
                        src/xmonitor_wayland.c
                        src/buffer_handler_wayland.c
@@ -140,7 +140,7 @@ IF (LIVEBOX)
 
        IF (X11_SUPPORT)
                ADD_DEFINITIONS("-DHAVE_X11")
-               SET(BUILD_SOURCE
+               SET(BUILD_SOURCE 
                        ${BUILD_SOURCE}
                        src/xmonitor.c
                        src/buffer_handler.c
@@ -151,7 +151,7 @@ ENDIF (LIVEBOX)
 
 IF (WAYLAND_SUPPORT)
        ADD_DEFINITIONS("-DHAVE_WAYLAND")
-       SET(BUILD_SOURCE
+       SET(BUILD_SOURCE 
                ${BUILD_SOURCE}
                src/util_wayland.c
        )
@@ -159,7 +159,7 @@ ENDIF (WAYLAND_SUPPORT)
 
 IF (X11_SUPPORT)
        ADD_DEFINITIONS("-DHAVE_X11")
-       SET(BUILD_SOURCE
+       SET(BUILD_SOURCE 
                ${BUILD_SOURCE}
                src/util_x11.c
        )
@@ -182,26 +182,40 @@ IF (LIVEBOX)
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/abi.ini DESTINATION /usr/share/data-provider-master PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PRODUCT}.conf.ini DESTINATION /usr/share/data-provider-master RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PRODUCT}.resolution.ini DESTINATION /usr/share/data-provider-master RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/x11.mobile.320x480.conf.ini DESTINATION /usr/share/data-provider-master/320x480 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/x11.mobile.320x480.resolution.ini DESTINATION /usr/share/data-provider-master/320x480 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/x11.mobile.480x800.conf.ini DESTINATION /usr/share/data-provider-master/480x800 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/x11.mobile.480x800.resolution.ini DESTINATION /usr/share/data-provider-master/480x800 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/x11.wearable.360x480.conf.ini DESTINATION /usr/share/data-provider-master/360x480 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/x11.wearable.360x480.resolution.ini DESTINATION /usr/share/data-provider-master/360x480 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/x11.mobile.conf.ini DESTINATION /usr/share/data-provider-master/720x1280 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/x11.mobile.resolution.ini DESTINATION /usr/share/data-provider-master/720x1280 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/x11.wearable.conf.ini DESTINATION /usr/share/data-provider-master/320x320 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/x11.wearable.resolution.ini DESTINATION /usr/share/data-provider-master/320x320 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PRODUCT}.conf.ini DESTINATION /usr/share/data-provider-master RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PRODUCT}.resolution.ini DESTINATION /usr/share/data-provider-master RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+
 ENDIF (LIVEBOX)
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME "${PROJECT_NAME}")
-IF (MOBILE)
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE SETUID)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.rule DESTINATION /opt/etc/smack/accesses.d)
-ELSE (MOBILE)
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
-ENDIF (MOBILE)
 
 # INCLUDE FOR BUILD & INSTALL .PO FILES
 ADD_SUBDIRECTORY(res)
 ADD_SUBDIRECTORY(data)
 IF (LIVEBOX)
-ADD_SUBDIRECTORY(pkgmgr_livebox)
+ADD_SUBDIRECTORY(pkgmgr_dynamicbox)
+ENDIF (LIVEBOX)
 
 IF (X11_SUPPORT)
        IF ("${ENGINEER_BINARY}" STREQUAL "true")
                ADD_SUBDIRECTORY(util_liveinfo)
        ENDIF ("${ENGINEER_BINARY}" STREQUAL "true")
 ENDIF (X11_SUPPORT)
-ENDIF (LIVEBOX)
 
 # End of a file
diff --git a/data-provider-master.rule b/data-provider-master.rule
deleted file mode 100644 (file)
index c8dc2de..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-data-provider-master notification::db rw
-data-provider-master ail::db rw
-data-provider-master svi-data x
-data-provider-master data-provider-master::db rw
-data-provider-master system::vconf_system rwxat
index af462e3..56d64c4 100644 (file)
@@ -1,7 +1,4 @@
-#INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/data-provider-master DESTINATION /etc/rc.d/init.d/ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
-IF (MOBILE)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/mobile.data-provider-master.service DESTINATION /usr/lib/systemd/user/ RENAME data-provider-master.service PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
-ELSE (MOBILE)
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/data-provider-master.service DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/dump_livebox.sh DESTINATION /opt/etc/dump.d/module.d/ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
-ENDIF (MOBILE)
+IF (LIVEBOX)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/dump_dynamicbox.sh DESTINATION /opt/etc/dump.d/module.d/ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+ENDIF (LIVEBOX)
index ad8eec3..d2dbfb1 100644 (file)
@@ -1,8 +1,8 @@
 [c]
-package=org.tizen.data-provider-slave
+package=com.samsung.data-provider-slave
 
 [cpp]
-package=org.tizen.data-provider-slave
+package=com.samsung.data-provider-slave
 
 [html]
 package=dbox.web-provider
@@ -12,6 +12,3 @@ package=gi2qxenosh.osp-appwidget-service
 
 [app]
 package=/APPID/
-
-[dali]
-package=provider.multi-livebox
diff --git a/data/dump_dynamicbox.sh b/data/dump_dynamicbox.sh
new file mode 100644 (file)
index 0000000..1791a31
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+DBOX_DEBUG=$1/dynamicbox
+mkdir -p ${DBOX_DEBUG}
+/bin/cp -r /opt/usr/share/live_magazine ${DBOX_DEBUG}
+/bin/cp -r /tmp/.dbox.service ${DBOX_DEBUG}/log
+/bin/cp -r /opt/dbspace/.dynamicbox.db ${DBOX_DEBUG}
+ls -la /tmp/ | /bin/grep srw > ${DBOX_DEBUG}/log/tmp.hidden_files
diff --git a/data/dump_livebox.sh b/data/dump_livebox.sh
deleted file mode 100644 (file)
index 2fb6c32..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-LIVEBOX_DEBUG=$1/livebox
-mkdir -p ${LIVEBOX_DEBUG}
-/bin/cp -r /opt/usr/share/live_magazine ${LIVEBOX_DEBUG}
-/bin/cp -r /tmp/.dbox.service ${LIVEBOX_DEBUG}/log
-ls -la /tmp/ | /bin/grep srw > ${LIVEBOX_DEBUG}/log/tmp.hidden_files
diff --git a/data/mobile.data-provider-master.service b/data/mobile.data-provider-master.service
deleted file mode 100644 (file)
index ee61361..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# Copyright 2012  Samsung Electronics Co., Ltd
-#
-# Licensed under the Flora License, Version 1.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.tizenopensource.org/license
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-[Unit]
-Description=Data Provider daemon
-After=xorg.target
-
-[Service]
-Type=notify
-Environment=BUFMGR_LOCK_TYPE="once"
-Environment=BUFMGR_MAP_CACHE="true"
-ExecStart=/usr/bin/data-provider-master
-RestartSec=1
-
-[Install]
-WantedBy=tizen-middleware.target
index c9b95c7..468b696 100644 (file)
@@ -16,7 +16,7 @@ slave_relaunch_count=3
 max_log_line=1000
 max_log_file=3
 sqilte_flush_max=1048576
-#db_path=/opt/dbspace/.livebox.db
+#db_path=/opt/dbspace/.dynamicbox.db
 #share_path=/opt/usr/share/live_magazine/
 log_path=/tmp/.dbox.service
 #always_path=/opt/usr/share/live_magazine/always
@@ -31,7 +31,8 @@ overwrite_content=false
 com_core_thread=true
 use_xmonitor=false
 #input=/dev/input/event2
-pd_request_timeout=5.0
+gbar_request_timeout=5.0
 premultiplied=1
 #emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
-#services=[livebox],[shortcut],[notification],[utility],[badge],[file]
+#services=[dynamicbox],[shortcut],[notification],[utility],[badge],[file]
+#auto_align=true
index 2866b74..034a081 100644 (file)
@@ -16,7 +16,7 @@ slave_relaunch_count=3
 max_log_line=1000
 max_log_file=3
 sqilte_flush_max=1048576
-#db_path=/opt/dbspace/.livebox.db
+#db_path=/opt/dbspace/.dynamicbox.db
 #share_path=/opt/usr/share/live_magazine/
 log_path=/tmp/.dbox.service
 #always_path=/opt/usr/share/live_magazine/always
@@ -31,7 +31,8 @@ overwrite_content=false
 com_core_thread=true
 use_xmonitor=false
 #input=/dev/input/event2
-pd_request_timeout=5.0
+gbar_request_timeout=5.0
 premultiplied=0
 #emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
-services=[livebox],[shortcut],[badge]
+services=[dynamicbox],[shortcut],[badge]
+#auto_align=true
diff --git a/data/x11.mobile.320x480.conf.ini b/data/x11.mobile.320x480.conf.ini
new file mode 100644 (file)
index 0000000..4811331
--- /dev/null
@@ -0,0 +1,38 @@
+base_width=320
+base_height=480
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=1048576
+#replace_tag=/APPID/
+slave_ttl=30.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/opt/dbspace/.dynamicbox.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.dbox.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=240.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+#input=/dev/input/event2
+gbar_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+#services=[dynamicbox],[shortcut],[notification],[utility],[badge],[file]
+#auto_align=true
diff --git a/data/x11.mobile.320x480.resolution.ini b/data/x11.mobile.320x480.resolution.ini
new file mode 100644 (file)
index 0000000..c848adf
--- /dev/null
@@ -0,0 +1,14 @@
+1x1=0x0
+2x1=0x0
+2x2=0x0
+4x1=0x0
+4x2=0x0
+4x3=0x0
+4x4=302x302
+4x5=0x0
+4x6=0x0
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=320x480
+base=320x480
diff --git a/data/x11.mobile.360x480.conf.ini b/data/x11.mobile.360x480.conf.ini
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/data/x11.mobile.360x480.resolution.ini b/data/x11.mobile.360x480.resolution.ini
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/data/x11.mobile.480x800.conf.ini b/data/x11.mobile.480x800.conf.ini
new file mode 100644 (file)
index 0000000..df724d1
--- /dev/null
@@ -0,0 +1,43 @@
+base_width=480
+base_height=800
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=1048576
+#replace_tag=/APPID/
+slave_ttl=30.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/opt/dbspace/.dynamicbox.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.dbox.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=240.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+input=/dev/input/event1
+gbar_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+#services=[dynamicbox],[shortcut],[notification],[utility],[badge],[file]
+auto_align=false
+use_event_time=false
+use_gettimeofday=true
+slave_event_boost_on=-10
+slave_event_boost_off=0
+event_filter=0.5
diff --git a/data/x11.mobile.480x800.resolution.ini b/data/x11.mobile.480x800.resolution.ini
new file mode 100644 (file)
index 0000000..63ad36e
--- /dev/null
@@ -0,0 +1,14 @@
+1x1=126x126
+2x1=0x0
+2x2=0x0
+4x1=0x0
+4x2=470x234
+4x3=0x0
+4x4=470x470
+4x5=0x0
+4x6=0x0
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=480x800
+base=480x800
index d0bdfb5..174ff1a 100644 (file)
@@ -9,14 +9,14 @@ default_packet_time=0.0001
 #default_content=default
 minimum_space=104857600
 #replace_tag=/APPID/
-slave_ttl=30.0
+slave_ttl=0.0
 slave_activate_time=30.0
 slave_relaunch_time=3.0
 slave_relaunch_count=3
 max_log_line=1000
 max_log_file=3
 sqilte_flush_max=1048576
-#db_path=/opt/dbspace/.livebox.db
+#db_path=/opt/dbspace/.dynamicbox.db
 #share_path=/opt/usr/share/live_magazine/
 log_path=/tmp/.dbox.service
 #always_path=/opt/usr/share/live_magazine/always
@@ -31,7 +31,10 @@ overwrite_content=false
 com_core_thread=true
 use_xmonitor=false
 #input=/dev/input/event2
-pd_request_timeout=5.0
+gbar_request_timeout=5.0
 premultiplied=0
 #emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
-#services=[livebox],[shortcut],[notification],[utility],[badge],[file]
+#services=[dynamicbox],[shortcut],[notification],[utility],[badge],[file]
+#auto_align=true
+#use_event_time=true
+event_filter=0.5
diff --git a/data/x11.wearable.360x480.conf.ini b/data/x11.wearable.360x480.conf.ini
new file mode 100644 (file)
index 0000000..f540ec3
--- /dev/null
@@ -0,0 +1,38 @@
+base_width=360
+base_height=480
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=1048576
+#replace_tag=/APPID/
+slave_ttl=0.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/opt/dbspace/.dynamicbox.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.dbox.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=240.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+input=/dev/input/event0
+gbar_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[dynamicbox],[shortcut],[badge]
+check_lcd=false
diff --git a/data/x11.wearable.360x480.resolution.ini b/data/x11.wearable.360x480.resolution.ini
new file mode 100644 (file)
index 0000000..fea1ffa
--- /dev/null
@@ -0,0 +1,14 @@
+1x1=170x170
+2x1=0x0
+2x2=360x480
+4x1=0x0
+4x2=0x0
+4x3=0x0
+4x4=0x0
+4x5=0x0
+4x6=0x0
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=360x480
+base=360x480
index 260dadb..6119d57 100644 (file)
@@ -16,7 +16,7 @@ slave_relaunch_count=3
 max_log_line=1000
 max_log_file=3
 sqilte_flush_max=1048576
-#db_path=/opt/dbspace/.livebox.db
+#db_path=/opt/dbspace/.dynamicbox.db
 #share_path=/opt/usr/share/live_magazine/
 log_path=/tmp/.dbox.service
 #always_path=/opt/usr/share/live_magazine/always
@@ -31,7 +31,10 @@ overwrite_content=false
 com_core_thread=true
 use_xmonitor=false
 #input=/dev/input/event2
-pd_request_timeout=5.0
+gbar_request_timeout=5.0
 premultiplied=0
 #emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
-services=[livebox],[shortcut],[badge]
+services=[dynamicbox],[shortcut],[badge]
+#auto_align=true
+#use_event_time=true
+check_lcd=false
index b9e7561..5b6923e 100644 (file)
@@ -1,4 +1,4 @@
-1x1=320x320
+1x1=170x170
 2x1=0x0
 2x2=320x320
 4x1=0x0
index e3aa982..ff5cf1d 100644 (file)
@@ -18,12 +18,7 @@ struct buffer_info;
 struct inst_info;
 struct buffer;
 
-enum buffer_type { /*!< Must have to be sync with libprovider, liblivebox-viewer, liblivebox-edje */
-       BUFFER_TYPE_FILE,
-       BUFFER_TYPE_SHM,
-       BUFFER_TYPE_PIXMAP,
-       BUFFER_TYPE_ERROR
-};
+#include <dynamicbox_buffer.h>
 
 /*!
  * \brief
@@ -33,7 +28,7 @@ enum buffer_type { /*!< Must have to be sync with libprovider, liblivebox-viewer
  * \param[in] pixel_size
  * \return buffer_info
  */
-extern struct buffer_info *buffer_handler_create(struct inst_info *inst, enum buffer_type type, int w, int h, int pixel_size);
+extern struct buffer_info *buffer_handler_create(struct inst_info *inst, enum dynamicbox_fb_type type, int w, int h, int pixel_size);
 
 /*!
  * \brief
@@ -90,9 +85,9 @@ extern const char *buffer_handler_id(const struct buffer_info *info);
 
 /*!
  * \param[in] info
- * \return buffer_type
+ * \return dynamicbox_fb_type
  */
-extern enum buffer_type buffer_handler_type(const struct buffer_info *info);
+extern enum dynamicbox_fb_type buffer_handler_type(const struct buffer_info *info);
 
 /*!
  * \brief This API is not supported for Pixmap.
@@ -140,6 +135,27 @@ extern int buffer_handler_pixmap_release_buffer(void *canvas);
 
 /*!
  * \brief
+ * \param[in] info
+ * \return int
+ */
+extern int buffer_handler_stride(struct buffer_info *info);
+
+/*!
+ * \brief
+ * \param[in] info
+ * \return int
+ */
+extern int buffer_handler_pixels(struct buffer_info *info);
+
+/*!
+ * \brief
+ * \param[in] info
+ * \return int
+ */
+extern int buffer_handler_auto_align(void);
+
+/*!
+ * \brief
  * \return int
  */
 extern int buffer_handler_init(void);
@@ -228,14 +244,14 @@ extern struct inst_info *buffer_handler_instance(struct buffer_info *info);
  * \remarks
  * \param[in] type
  * \param[in] resource
- * \return struct buffer *
+ * \return dynamicbox_fb_t 
  * \retval NULL
  * \retval address
  * \pre
  * \post
  * \sa
  */
-extern struct buffer *buffer_handler_raw_open(enum buffer_type type, void *resource);
+extern dynamicbox_fb_t buffer_handler_raw_open(enum dynamicbox_fb_type type, void *resource);
 
 /*!
  * \brief
@@ -248,7 +264,7 @@ extern struct buffer *buffer_handler_raw_open(enum buffer_type type, void *resou
  * \post
  * \sa
  */
-extern int buffer_handler_raw_close(struct buffer *buffer);
+extern int buffer_handler_raw_close(dynamicbox_fb_t buffer);
 
 /*!
  * \brief
@@ -261,7 +277,7 @@ extern int buffer_handler_raw_close(struct buffer *buffer);
  * \post
  * \sa
  */
-extern void *buffer_handler_raw_data(struct buffer *buffer);
+extern void *buffer_handler_raw_data(dynamicbox_fb_t buffer);
 
 /*!
  * \brief
@@ -274,7 +290,7 @@ extern void *buffer_handler_raw_data(struct buffer *buffer);
  * \post
  * \sa
  */
-extern int buffer_handler_raw_size(struct buffer *buffer);
+extern int buffer_handler_raw_size(dynamicbox_fb_t buffer);
 
 /*!
  * \brief
index fa88612..b844659 100644 (file)
@@ -31,7 +31,7 @@ struct packet;
  * \note
  * Create & Destroy
  */
-extern struct client_node *client_create(pid_t pid, int handle);
+extern struct client_node *client_create(pid_t pid, int handle, const char *direct_addr);
 #define client_destroy(client) client_unref(client)
 
 /*!
@@ -102,4 +102,6 @@ extern int client_browse_list(const char *cluster, const char *category, int (*c
 extern int client_nr_of_subscriber(const char *cluster, const char *category);
 
 extern int client_broadcast(struct inst_info *inst, struct packet *packet);
+
+extern const char *client_direct_addr(const struct client_node *client);
 /* End of a file */
index aab11d1..a4d0603 100644 (file)
  */
 
 struct conf {
-       int width;
-       int height;
-
-       int base_width;
-       int base_height;
-       double minimum_period;
-
-       struct {
-               char *script;
-               char *abi;
-               char *pd_group;
-               double period;
-               int pixels;
-       } default_conf;
-
-       struct {
-               char *name;
-               char *secured;
-               char *abi;
-       } launch_key;
-
-       double default_packet_time;
-
-       char *empty_content;
-       char *empty_title;
-
-       char *default_content;
-       char *default_title;
-
-       unsigned long minimum_space;
-
-       char *replace_tag;
-
-       double slave_ttl;
-       double slave_activate_time;
-       double slave_relaunch_time;
-       int slave_relaunch_count;
-
-       int max_log_line;
-       int max_log_file;
-
-       unsigned long sqlite_flush_max;
-
-       struct {
-               char *conf;
-               char *image;
-               char *script;
-               char *root;
-               char *script_port;
-               char *slave_log;
-               char *reader;
-               char *always;
-               char *db;
-               char *input;
-       } path;
-
-       int max_size_type;
-
-       int slave_max_load;
-
-       double ping_time;
-
-       char *vconf_sys_cluster;
-       int max_pended_ctx_events;
-
-       int use_sw_backend;
-       char *provider_method;
        int debug_mode;
-       int overwrite_content;
-       int com_core_thread;
-       int use_xmonitor;
-       int premultiplied;
-
-       double scale_width_factor;
-       double scale_height_factor;
-
-       double pd_request_timeout;
-
-       char *emergency_disk;
-       char *services;
+       int slave_max_load;
 };
 
 extern struct conf g_conf;
 
-extern int conf_loader(void);
-extern void conf_update_size(void);
-extern void conf_reset(void);
-extern void conf_init(void);
-
-#define BASE_W                 g_conf.base_width
-#define BASE_H                 g_conf.base_height
-
-#define CR 13
-#define LF 10
-
-#define EMERGENCY_DISK         g_conf.emergency_disk
-#define SCALE_WIDTH_FACTOR     g_conf.scale_width_factor
-#define SCALE_HEIGHT_FACTOR    g_conf.scale_height_factor
-
-#define USE_SW_BACKEND         g_conf.use_sw_backend
-#define PROVIDER_METHOD                g_conf.provider_method
-#define DEBUG_MODE             g_conf.debug_mode
-#define OVERWRITE_CONTENT      g_conf.overwrite_content
-#define COM_CORE_THREAD                g_conf.com_core_thread
-
-#define MINIMUM_PERIOD         g_conf.minimum_period
-
-#define DEFAULT_SCRIPT         g_conf.default_conf.script
-#define DEFAULT_ABI            g_conf.default_conf.abi
-#define DEFAULT_GROUP          g_conf.default_conf.pd_group
-#define DEFAULT_PERIOD         g_conf.default_conf.period
-#define DEFAULT_PIXELS         g_conf.default_conf.pixels
-#define PRIORITY_NO_CHANGE     -1.0f
-
-#define BUNDLE_SLAVE_NAME      g_conf.launch_key.name
-#define BUNDLE_SLAVE_SECURED   g_conf.launch_key.secured
-#define BUNDLE_SLAVE_ABI       g_conf.launch_key.abi
-#define PACKET_TIME            g_conf.default_packet_time
-#define CONTENT_NO_CHANGE      g_conf.empty_content
-#define TITLE_NO_CHANGE                g_conf.empty_title
-#define DEFAULT_TITLE          g_conf.default_title
-#define DEFAULT_CONTENT                g_conf.default_content
-#define MINIMUM_SPACE          g_conf.minimum_space
-
-#define IMAGE_PATH             g_conf.path.image
-#define SCRIPT_PATH            g_conf.path.script
-#define SCRIPT_PORT_PATH       g_conf.path.script_port
-#define CONF_PATH              g_conf.path.conf
-#define ROOT_PATH              g_conf.path.root
-#define SLAVE_LOG_PATH         g_conf.path.slave_log
-#define READER_PATH            g_conf.path.reader
-#define ALWAYS_PATH            g_conf.path.always
-#define INPUT_PATH             g_conf.path.input
-
-#define REPLACE_TAG_APPID      g_conf.replace_tag
-#define SLAVE_TTL              g_conf.slave_ttl
-#define SLAVE_ACTIVATE_TIME    g_conf.slave_activate_time
-#define SLAVE_RELAUNCH_TIME    g_conf.slave_relaunch_time
-#define SLAVE_RELAUNCH_COUNT   g_conf.slave_relaunch_count
-
-#define MAX_LOG_LINE           g_conf.max_log_line
-#define MAX_LOG_FILE           g_conf.max_log_file
-
-#define SQLITE_FLUSH_MAX       g_conf.sqlite_flush_max
-#define DBFILE                 g_conf.path.db
-
-#define PD_REQUEST_TIMEOUT     g_conf.pd_request_timeout
-
-#define SLAVE_MAX_LOAD         g_conf.slave_max_load
-#define DEFAULT_PING_TIME      g_conf.ping_time
-#define PREMULTIPLIED_COLOR    g_conf.premultiplied
-#define SERVICES               g_conf.services
-
-#define SERVICE_LIVEBOX                "[livebox]"
-#define SERVICE_NOTIFICATION   "[notification]"
-#define SERVICE_BADGE          "[badge]"
-#define SERVICE_SHORTCUT       "[shortcut]"
-#define SERVICE_UTILITY                "[utility]"
-#define SERVICE_FILE           "[file]"
-
-#define PAUSED_FILE            "/tmp/.live.paused"
-
-#define MAX_ABI                256
-#define MAX_PKGNAME    512
-#define DELAY_TIME     0.0000001f
-#define DEFAULT_CLUSTER        "user,created"
-#define MINIMUM_REACTIVATION_TIME      10
+#define DELAY_TIME 0.0000001f
+#define HAPI __attribute__((visibility("hidden")))
 
 #if !defined(VCONFKEY_MASTER_STARTED)
 #define VCONFKEY_MASTER_STARTED        "memory/data-provider-master/started"
@@ -191,11 +32,7 @@ extern void conf_init(void);
 #define VCONFKEY_MASTER_RESTART_COUNT  "memory/private/data-provider-master/restart_count"
 #endif
 
-#define USE_XMONITOR           g_conf.use_xmonitor
-
-#define HAPI __attribute__((visibility("hidden")))
-/*!
- * EAPI is defined from eina.h
- */
+#define CR 13
+#define LF 10
 
 /* End of a file */
index cc4911f..ac1a079 100644 (file)
@@ -67,4 +67,6 @@ extern FILE *__file_log_fp;
 #define PERF_MARK(tag)
 #endif
 
+#define HAPI __attribute__((visibility("hidden")))
+
 /* End of a file */
index 800b071..9413040 100644 (file)
@@ -29,11 +29,10 @@ struct event_data {
                int minor;
        } width;
        int distance;   /* Hovering */
-#if defined(_USE_ECORE_TIME_GET)
+       int orientation;
+       int pressure;
+       int updated; /* Timestamp is updated */
        double tv;
-#else
-       struct timeval tv;
-#endif
 };
 
 enum event_state {
@@ -49,5 +48,6 @@ extern int event_fini(void);
 extern int event_activate(int x, int y, int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data);
 extern int event_deactivate(int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data);
 extern int event_is_activated(void);
+extern int event_reset_cbdata(int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data, void *new_data);
 
 /* End of a file */
index 04dfddd..8cda595 100644 (file)
@@ -36,8 +36,8 @@ extern const char *group_cluster_name_by_category(struct category *category);
 extern int group_add_package(struct category *category, const char *pkgname);
 extern int group_del_package(struct category *category, const char *pkgname);
 
-extern int group_add_livebox(const char *group, const char *pkgname);
-extern int group_del_livebox(const char *pkgname);
+extern int group_add_dynamicbox(const char *group, const char *pkgname);
+extern int group_del_dynamicbox(const char *pkgname);
 
 extern int group_init(void);
 extern int group_fini(void);
index a61c32c..781b7a8 100644 (file)
@@ -26,7 +26,7 @@
  * After master successfully allocate heap for an instance,
  * It will send a load request to a specified slave
  * (The slave will be specified when a package informaion is
- * prepared via configuration file of each livebox packages.)
+ * prepared via configuration file of each dynamicbox packages.)
  * We defined this as "REQUEST_TO_ACTIVATE" state.
  *
  * After the slave create a new instance, it will sends back
  * Sometimes, slaves can meet some unexpected problems then
  * it will tries to clear all problems and tries to keep them in safe env.
  * To do this, master or slave can be terminated.
- * In this case, the master has to find the fault module(crashed livebox)
+ * In this case, the master has to find the fault module(crashed dynamicbox)
  * and prevent it from loading at the slave.
- * And it will send requests for re-creating all other normal liveboxes.
+ * And it will send requests for re-creating all other normal dynamicboxes.
  * We defined this as "REQUEST_TO_REACTIVATE".
  *
  * After slave is launched again(recovered from fault situation), it will
  * receives "re-create" event from the master, then it will create all
- * instances of requested liveboxes.
+ * instances of requested dynamicboxes.
  *
  * When the master receives "created" event from the slaves,
  * It will change the instance's state to "ACTIVATED"
  * But now, the master will not send "created" event to the clients.
  *
- * Because the clients don't want to know the re-created liveboxes.
- * They just want to know about fault liveboxes to display deactivated
+ * Because the clients don't want to know the re-created dynamicboxes.
+ * They just want to know about fault dynamicboxes to display deactivated
  * message.
  *
  * Sometimes the master can send requests to the slave to unload instances.
@@ -80,7 +80,7 @@
  * It will change the state of an master to "DESTROYED"
  *
  * There is one more event to change the state of an instance to "DESTROYED".
- * In case of system created livebox, it could be destroyed itself.
+ * In case of system created dynamicbox, it could be destroyed itself.
  * So the slave will send "deleted" event to the master directly.
  * Even if the master doesn't requests to delete it.
  *
@@ -94,16 +94,6 @@ enum instance_event {
        INSTNACE_EVENT_UNKNOWN
 };
 
-enum instance_destroy_type {
-       INSTANCE_DESTROY_DEFAULT = 0x00,
-       INSTANCE_DESTROY_UPGRADE = 0x01,
-       INSTANCE_DESTROY_UNINSTALL = 0x02,
-       INSTANCE_DESTROY_TERMINATE = 0x03,
-       INSTANCE_DESTROY_FAULT = 0x04,
-       INSTANCE_DESTROY_TEMPORARY = 0x05,
-       INSTANCE_DESTROY_UNKNOWN = 0x06
-};
-
 enum instance_state {
        INST_INIT = 0x0, /*!< Only keeps in the master */
 
@@ -119,17 +109,17 @@ enum instance_state {
        INST_REQUEST_TO_DESTROY /*!< Sent a request to a slave, when the master receives deleted event, the master will delete this */
 };
 
-enum livebox_visible_state { /*!< Must be sync'd with livebox-viewer */
-       LB_SHOW = 0x00, /*!< Livebox is showed. Default state */
-       LB_HIDE = 0x01, /*!< Livebox is hide, with no update event, but keep update timer */
+enum dynamicbox_visible_state { /*!< Must be sync'd with dynamicbox-viewer */
+       DBOX_SHOW = 0x00, /*!< Dynamicbox is showed. Default state */
+       DBOX_HIDE = 0x01, /*!< Dynamicbox is hide, with no update event, but keep update timer */
 
-       LB_HIDE_WITH_PAUSE = 0x02, /*!< Livebix is hide, it needs to be paused (with freezed update timer) */
+       DBOX_HIDE_WITH_PAUSE = 0x02, /*!< Dynamicbox is hide, it needs to be paused (with freezed update timer) */
 
-       LB_VISIBLE_ERROR = 0xFFFFFFFF /* To enlarge the size of this enumeration type */
+       DBOX_VISIBLE_ERROR = 0xFFFFFFFF /* To enlarge the size of this enumeration type */
 };
 
-#define IS_PD  1
-#define IS_LB  0
+#define IS_GBAR 1
+#define IS_DBOX 0
 
 struct inst_info;
 struct pkg_info;
@@ -137,8 +127,8 @@ struct script_handle;
 struct client_node;
 
 extern struct inst_info *instance_create(struct client_node *client, double timestamp, const char *pkgname, const char *content, const char *cluster, const char *category, double period, int width, int height);
-extern int instance_destroy(struct inst_info *inst, enum instance_destroy_type type);
-extern int instance_reload(struct inst_info *inst, enum instance_destroy_type type);
+extern int instance_destroy(struct inst_info *inst, dynamicbox_destroy_type_e type);
+extern int instance_reload(struct inst_info *inst, dynamicbox_destroy_type_e type);
 
 extern struct inst_info * instance_ref(struct inst_info *inst);
 extern struct inst_info * instance_unref(struct inst_info *inst);
@@ -152,9 +142,9 @@ extern int instance_activate(struct inst_info *inst);
 extern int instance_recover_state(struct inst_info *inst);
 extern int instance_need_slave(struct inst_info *inst);
 
-extern void instance_set_lb_info(struct inst_info *inst, double priority, const char *content, const char *title);
-extern void instance_set_lb_size(struct inst_info *inst, int w, int h);
-extern void instance_set_pd_size(struct inst_info *inst, int w, int h);
+extern void instance_set_dbox_info(struct inst_info *inst, double priority, const char *content, const char *title);
+extern void instance_set_dbox_size(struct inst_info *inst, int w, int h);
+extern void instance_set_gbar_size(struct inst_info *inst, int w, int h);
 extern void instance_set_alt_info(struct inst_info *inst, const char *icon, const char *name);
 
 extern int instance_set_pinup(struct inst_info *inst, int pinup);
@@ -165,8 +155,8 @@ extern int instance_clicked(struct inst_info *inst, const char *event, double ti
 extern int instance_text_signal_emit(struct inst_info *inst, const char *emission, const char *source, double sx, double sy, double ex, double ey);
 extern int instance_signal_emit(struct inst_info *inst, const char *emission, const char *source, double sx, double sy, double ex, double ey, double x, double y, int down);
 extern int instance_change_group(struct inst_info *inst, const char *cluster, const char *category);
-extern int instance_set_visible_state(struct inst_info *inst, enum livebox_visible_state state);
-extern enum livebox_visible_state instance_visible_state(struct inst_info *inst);
+extern int instance_set_visible_state(struct inst_info *inst, enum dynamicbox_visible_state state);
+extern enum dynamicbox_visible_state instance_visible_state(struct inst_info *inst);
 extern int instance_set_update_mode(struct inst_info *inst, int active_update);
 extern int instance_active_update(struct inst_info *inst);
 
@@ -176,10 +166,12 @@ extern int instance_active_update(struct inst_info *inst);
  */
 extern const double const instance_timestamp(const struct inst_info *inst);
 extern struct pkg_info * const instance_package(const struct inst_info *inst);
-extern struct script_info * const instance_lb_script(const struct inst_info *inst);
-extern struct script_info * const instance_pd_script(const struct inst_info *inst);
-extern struct buffer_info * const instance_pd_buffer(const struct inst_info *inst);
-extern struct buffer_info * const instance_lb_buffer(const struct inst_info *inst);
+extern struct script_info * const instance_dbox_script(const struct inst_info *inst);
+extern struct script_info * const instance_gbar_script(const struct inst_info *inst);
+extern struct buffer_info * const instance_gbar_buffer(const struct inst_info *inst);
+extern struct buffer_info * const instance_gbar_extra_buffer(const struct inst_info *inst, int idx);
+extern struct buffer_info * const instance_dbox_buffer(const struct inst_info *inst);
+extern struct buffer_info * const instance_dbox_extra_buffer(const struct inst_info *inst, int idx);
 extern const char * const instance_id(const struct inst_info *inst);
 extern const char * const instance_content(const struct inst_info *inst);
 extern const char * const instance_category(const struct inst_info *inst);
@@ -190,10 +182,10 @@ extern const int const instance_priority(const struct inst_info *inst);
 extern const struct client_node * const instance_client(const struct inst_info *inst);
 extern const double const instance_period(const struct inst_info *inst);
 extern const int const instance_timeout(const struct inst_info *inst);
-extern const int const instance_lb_width(const struct inst_info *inst);
-extern const int const instance_lb_height(const struct inst_info *inst);
-extern const int const instance_pd_width(const struct inst_info *inst);
-extern const int const instance_pd_height(const struct inst_info *inst);
+extern const int const instance_dbox_width(const struct inst_info *inst);
+extern const int const instance_dbox_height(const struct inst_info *inst);
+extern const int const instance_gbar_width(const struct inst_info *inst);
+extern const int const instance_gbar_height(const struct inst_info *inst);
 extern const enum instance_state const instance_state(const struct inst_info *inst);
 
 /*!
@@ -202,43 +194,53 @@ extern const enum instance_state const instance_state(const struct inst_info *in
 extern int instance_unicast_created_event(struct inst_info *inst, struct client_node *client);
 extern int instance_unicast_deleted_event(struct inst_info *inst, struct client_node *client, int reason);
 
-extern int instance_create_lb_buffer(struct inst_info *inst, int pixels);
-extern int instance_create_pd_buffer(struct inst_info *inst, int pixels);
+extern int instance_create_dbox_buffer(struct inst_info *inst, int pixels);
+extern int instance_create_dbox_extra_buffer(struct inst_info *inst, int pixels, int idx);
+extern int instance_create_gbar_buffer(struct inst_info *inst, int pixels);
+extern int instance_create_gbar_extra_buffer(struct inst_info *inst, int pixels, int idx);
 
-extern void instance_slave_set_pd_pos(struct inst_info *inst, double x, double y);
-extern void instance_slave_get_pd_pos(struct inst_info *inst, double *x, double *y);
+extern void instance_slave_set_gbar_pos(struct inst_info *inst, double x, double y);
+extern void instance_slave_get_gbar_pos(struct inst_info *inst, double *x, double *y);
 
-extern int instance_slave_open_pd(struct inst_info *inst, struct client_node *client);
-extern int instance_slave_close_pd(struct inst_info *inst, struct client_node *client, int reason);
+extern int instance_slave_open_gbar(struct inst_info *inst, struct client_node *client);
+extern int instance_slave_close_gbar(struct inst_info *inst, struct client_node *client, int reason);
 
 extern int instance_freeze_updator(struct inst_info *inst);
 extern int instance_thaw_updator(struct inst_info *inst);
 
 extern int instance_send_access_event(struct inst_info *inst, int status);
 
-extern int instance_lb_update_begin(struct inst_info *inst, double priority, const char *content, const char *title);
-extern int instance_lb_update_end(struct inst_info *inst);
+extern int instance_dbox_update_begin(struct inst_info *inst, double priority, const char *content, const char *title);
+extern int instance_dbox_update_end(struct inst_info *inst);
 
-extern int instance_pd_update_begin(struct inst_info *inst);
-extern int instance_pd_update_end(struct inst_info *inst);
+extern int instance_gbar_update_begin(struct inst_info *inst);
+extern int instance_gbar_update_end(struct inst_info *inst);
 
-extern void instance_pd_updated(const char *pkgname, const char *id, const char *descfile);
-extern void instance_lb_updated_by_instance(struct inst_info *inst, const char *safe_file);
-extern void instance_pd_updated_by_instance(struct inst_info *inst, const char *descfile);
+extern void instance_gbar_updated(const char *pkgname, const char *id, const char *descfile, int x, int y, int w, int h);
+extern void instance_dbox_updated_by_instance(struct inst_info *inst, const char *safe_file, int x, int y, int w, int h);
+extern void instance_gbar_updated_by_instance(struct inst_info *inst, const char *descfile, int x, int y, int w, int h);
+extern void instance_extra_updated_by_instance(struct inst_info *inst, int is_gbar, int idx, int x, int y, int w, int h);
+extern void instance_extra_info_updated_by_instance(struct inst_info *inst);
 
 /*!
  * \note
- * if the status is LB_STATUS_ERROR_FAULT (slave is faulted)
- * even though the PD is not created, this will forcely send the PD_DESTROYED event to the client.
+ * if the status is DBOX_STATUS_ERROR_FAULT (slave is faulted)
+ * even though the GBAR is not created, this will forcely send the GBAR_DESTROYED event to the client.
  */
-extern int instance_client_pd_destroyed(struct inst_info *inst, int status);
-extern int instance_client_pd_created(struct inst_info *inst, int status);
+extern int instance_client_gbar_destroyed(struct inst_info *inst, int status);
+extern int instance_client_gbar_created(struct inst_info *inst, int status);
+
+extern int instance_client_gbar_extra_buffer_created(struct inst_info *inst, int idx);
+extern int instance_client_gbar_extra_buffer_destroyed(struct inst_info *inst, int idx);
+
+extern int instance_client_dbox_extra_buffer_created(struct inst_info *inst, int idx);
+extern int instance_client_dbox_extra_buffer_destroyed(struct inst_info *inst, int idx);
 
 extern int instance_send_access_status(struct inst_info *inst, int status);
 extern int instance_send_key_status(struct inst_info *inst, int status);
 extern int instance_forward_packet(struct inst_info *inst, struct packet *packet);
 
-extern struct client_node *instance_pd_owner(struct inst_info *inst);
+extern struct client_node *instance_gbar_owner(struct inst_info *inst);
 
 /*!
  * Multiple viewer
@@ -253,6 +255,7 @@ extern int instance_fini(void);
 
 extern int instance_event_callback_add(struct inst_info *inst, enum instance_event type, int (*event_cb)(struct inst_info *inst, void *data), void *data);
 extern int instance_event_callback_del(struct inst_info *inst, enum instance_event type, int (*event_cb)(struct inst_info *inst, void *data), void *data);
+extern int instance_event_callback_is_added(struct inst_info *inst, enum instance_event type, int (*event_cb)(struct inst_info *inst, void *data), void *data);
 
 /*!
  */
index c3d83b4..5647d52 100644 (file)
@@ -17,9 +17,9 @@
 extern int io_init(void);
 extern int io_fini(void);
 extern int io_load_package_db(struct pkg_info *info);
-extern char *io_livebox_pkgname(const char *pkgname);
-extern int io_update_livebox_package(const char *pkgname, int (*cb)(const char *pkgid, const char *lbid, int prime, void *data), void *data);
-extern int io_crawling_liveboxes(int (*cb)(const char *pkgid, const char *lbid, int prime, void *data), void *data);
+extern char *io_dynamicbox_pkgname(const char *pkgname);
+extern int io_update_dynamicbox_package(const char *pkgname, int (*cb)(const char *pkgid, const char *lbid, int prime, void *data), void *data);
+extern int io_crawling_dynamicboxes(int (*cb)(const char *pkgid, const char *lbid, int prime, void *data), void *data);
 extern int io_is_exists(const char *lbid);
 
 /* End of a file */
index a46b9f5..3046725 100644 (file)
  * limitations under the License.
  */
 
-#ifndef __LIVEBOX_ERRNO_H
-#define __LIVEBOX_ERRNO_H
+#ifndef __DYNAMICBOX_ERRNO_H
+#define __DYNAMICBOX_ERRNO_H
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-/*!
- * \addtogroup CAPI_LIVEBOX_SERVICE_MODULE
- * \{
+/**
+ * @addtogroup CAPI_DYNAMICBOX_SERVICE_MODULE
+ * @{
  */
 
-/*!
- * \brief
- * Definitions for the result status of livebox operation.
+/**
+ * @brief
+ * Definitions for the result status of dynamicbox operation.
  */
-enum livebox_status {
-       LB_STATUS_SUCCESS = 0x00000000, /*!< Operation is successfully completed */
-       LB_STATUS_ERROR = 0x80000000, /*!< This will be OR'd with other specific error value */
-       LB_STATUS_ERROR_INVALID = LB_STATUS_ERROR | 0x0001, /*!< Invalid request */
-       LB_STATUS_ERROR_FAULT = LB_STATUS_ERROR | 0x0002, /*!< Fault - Unable to recover from the error */
-       LB_STATUS_ERROR_MEMORY = LB_STATUS_ERROR | 0x0004, /*!< Memory is not enough to do this operation */
-       LB_STATUS_ERROR_EXIST = LB_STATUS_ERROR | 0x0008, /*!< Already exists */
-       LB_STATUS_ERROR_BUSY = LB_STATUS_ERROR | 0x0010, /*!< Busy so the operation is not started(accepted), try again */
-       LB_STATUS_ERROR_PERMISSION = LB_STATUS_ERROR | 0x0020, /*!< Permission error */
-       LB_STATUS_ERROR_ALREADY = LB_STATUS_ERROR | 0x0040, /*!< Operation is already started */
-       LB_STATUS_ERROR_CANCEL = LB_STATUS_ERROR | 0x0080, /*!< Operation is canceled */
-       LB_STATUS_ERROR_IO = LB_STATUS_ERROR | 0x0100, /*!< I/O Error */
-       LB_STATUS_ERROR_NOT_EXIST = LB_STATUS_ERROR | 0x0200, /*!< Not exists */
-       LB_STATUS_ERROR_TIMEOUT = LB_STATUS_ERROR | 0x0400, /*!< Timeout */
-       LB_STATUS_ERROR_NOT_IMPLEMENTED = LB_STATUS_ERROR | 0x0800, /*!< Operation is not implemented */
-       LB_STATUS_ERROR_NO_SPACE = LB_STATUS_ERROR | 0x1000, /*!< No space to operate */
-       LB_STATUS_ERROR_DISABLED = LB_STATUS_ERROR | 0x2000 /*!< Disabled */
+enum dynamicbox_status {
+       DBOX_STATUS_ERROR_NONE = 0x00000000, /**< Operation is successfully completed */
+       DBOX_STATUS_ERROR = 0x80000000, /**< This will be OR'd with other specific error value */
+       DBOX_STATUS_ERROR_INVALID_PARAMETER = DBOX_STATUS_ERROR | 0x0001, /**< Invalid request */
+       DBOX_STATUS_ERROR_FAULT = DBOX_STATUS_ERROR | 0x0002, /**< Fault - Unable to recover from the error */
+       DBOX_STATUS_ERROR_OUT_OF_MEMORY = DBOX_STATUS_ERROR | 0x0004, /**< Memory is not enough to do this operation */
+       DBOX_STATUS_ERROR_EXIST = DBOX_STATUS_ERROR | 0x0008, /**< Already exists */
+       DBOX_STATUS_ERROR_BUSY = DBOX_STATUS_ERROR | 0x0010, /**< Busy so the operation is not started(accepted), try again */
+       DBOX_STATUS_ERROR_PERMISSION_DENIED = DBOX_STATUS_ERROR | 0x0020, /**< Permission error */
+       DBOX_STATUS_ERROR_ALREADY = DBOX_STATUS_ERROR | 0x0040, /**< Operation is already started */
+       DBOX_STATUS_ERROR_CANCEL = DBOX_STATUS_ERROR | 0x0080, /**< Operation is canceled */
+       DBOX_STATUS_ERROR_IO_ERROR = DBOX_STATUS_ERROR | 0x0100, /**< I/O Error */
+       DBOX_STATUS_ERROR_NOT_EXIST = DBOX_STATUS_ERROR | 0x0200, /**< Not exists */
+       DBOX_STATUS_ERROR_TIMEOUT = DBOX_STATUS_ERROR | 0x0400, /**< Timeout */
+       DBOX_STATUS_ERROR_NOT_IMPLEMENTED = DBOX_STATUS_ERROR | 0x0800, /**< Operation is not implemented */
+       DBOX_STATUS_ERROR_NO_SPACE = DBOX_STATUS_ERROR | 0x1000, /**< No space to operate */
+       DBOX_STATUS_ERROR_DISABLED = DBOX_STATUS_ERROR | 0x2000 /**< Disabled */
 };
 
+
 /*!
  * \brief Check whether given code value indicates error or not.
  * \param[in] s
  * \return 1 or 0
  */
-#define LB_STATUS_IS_ERROR(s)  (!!((s) & LB_STATUS_ERROR))
+#define DBOX_STATUS_IS_ERROR(s)        (!!((s) & DBOX_STATUS_ERROR))
 
 /*!
  * \}
index dd5d3f6..492739f 100644 (file)
  * limitations under the License.
  */
 
-enum lb_type {
-       LB_TYPE_NONE = 0x0,
-       LB_TYPE_SCRIPT,
-       LB_TYPE_FILE,
-       LB_TYPE_TEXT,
-       LB_TYPE_BUFFER
-};
-
-enum pd_type {
-       PD_TYPE_NONE = 0x0,
-       PD_TYPE_SCRIPT,
-       PD_TYPE_TEXT,
-       PD_TYPE_BUFFER
-};
-
 enum alter_type {
        ALTER_CREATE,
        ALTER_DESTROY
@@ -45,8 +30,8 @@ struct slave_node;
  */
 extern struct pkg_info *package_create(const char *pkgid, const char *lbid);
 extern int package_destroy(struct pkg_info *info);
-extern char *package_lb_pkgname(const char *pkgname);
-extern int package_is_lb_pkgname(const char *pkgname);
+extern char *package_dbox_pkgname(const char *pkgname);
+extern int package_is_dbox_pkgname(const char *pkgname);
 extern struct pkg_info *package_find(const char *pkgname);
 extern const char *package_find_by_secured_slave(struct slave_node *slave);
 extern struct inst_info *package_find_instance_by_id(const char *pkgname, const char *id);
@@ -66,15 +51,15 @@ extern const double const package_period(const struct pkg_info *info);
 extern const int const package_secured(const struct pkg_info *info);
 extern const char * const package_script(const struct pkg_info *info);
 extern const char * const package_abi(const struct pkg_info *info);
-extern const char * const package_lb_path(const struct pkg_info *info);
-extern const char * const package_lb_group(const struct pkg_info *info);
-extern const char * const package_pd_path(const struct pkg_info *info);
-extern const char * const package_pd_group(const struct pkg_info *info);
+extern const char * const package_dbox_path(const struct pkg_info *info);
+extern const char * const package_dbox_group(const struct pkg_info *info);
+extern const char * const package_gbar_path(const struct pkg_info *info);
+extern const char * const package_gbar_group(const struct pkg_info *info);
 extern const int const package_pinup(const struct pkg_info *info);
 extern const char * const package_auto_launch(const struct pkg_info *info);
 extern const unsigned int const package_size_list(const struct pkg_info *info);
-extern const int const package_pd_width(const struct pkg_info *info);
-extern const int const package_pd_height(const struct pkg_info *info);
+extern const int const package_gbar_width(const struct pkg_info *info);
+extern const int const package_gbar_height(const struct pkg_info *info);
 extern const char * const package_name(const struct pkg_info *info);
 extern const char * const package_libexec(struct pkg_info *info);
 extern int package_network(struct pkg_info *info);
@@ -84,19 +69,19 @@ extern int package_set_libexec(struct pkg_info *info, const char *libexec);
 extern void package_set_pinup(struct pkg_info *info, int pinup);
 extern void package_set_auto_launch(struct pkg_info *info, const char *auto_launch);
 extern void package_set_size_list(struct pkg_info *info, unsigned int size_list);
-extern void package_set_lb_type(struct pkg_info *info, enum lb_type type);
-extern void package_set_pd_type(struct pkg_info *info, enum pd_type type);
-extern int package_set_lb_group(struct pkg_info *info, const char *group);
-extern int package_set_lb_path(struct pkg_info *info, const char *path);
-extern int package_set_pd_group(struct pkg_info *info, const char *group);
-extern int package_set_pd_path(struct pkg_info *info, const char *path);
+extern void package_set_dbox_type(struct pkg_info *info, enum dynamicbox_dbox_type type);
+extern void package_set_gbar_type(struct pkg_info *info, enum dynamicbox_gbar_type type);
+extern int package_set_dbox_group(struct pkg_info *info, const char *group);
+extern int package_set_dbox_path(struct pkg_info *info, const char *path);
+extern int package_set_gbar_group(struct pkg_info *info, const char *group);
+extern int package_set_gbar_path(struct pkg_info *info, const char *path);
 extern int package_set_script(struct pkg_info *info, const char *script);
 extern void package_set_secured(struct pkg_info *info, int secured);
 extern void package_set_period(struct pkg_info *info, double period);
 extern void package_set_timeout(struct pkg_info *info, int timeout);
 extern void package_set_network(struct pkg_info *info, int network);
-extern void package_set_pd_height(struct pkg_info *info, int height);
-extern void package_set_pd_width(struct pkg_info *info, int width);
+extern void package_set_gbar_height(struct pkg_info *info, int height);
+extern void package_set_gbar_width(struct pkg_info *info, int width);
 extern int package_set_abi(struct pkg_info *info, const char *abi);
 extern void package_add_ctx_info(struct pkg_info *pkginfo, struct context_info *info);
 extern void package_del_ctx_info(struct pkg_info *pkginfo, struct context_info *info);
@@ -109,8 +94,8 @@ extern struct pkg_info * const package_ref(struct pkg_info *info);
 extern struct pkg_info * const package_unref(struct pkg_info *info);
 extern const int const package_refcnt(const struct pkg_info *info);
 
-extern const enum pd_type const package_pd_type(const struct pkg_info *info);
-extern const enum lb_type const package_lb_type(const struct pkg_info *info);
+extern const enum dynamicbox_gbar_type const package_gbar_type(const struct pkg_info *info);
+extern const enum dynamicbox_dbox_type const package_dbox_type(const struct pkg_info *info);
 
 extern int package_add_instance(struct pkg_info *info, struct inst_info *inst);
 extern int package_del_instance(struct pkg_info *info, struct inst_info *inst);
index 16e297a..71349e5 100644 (file)
@@ -23,22 +23,22 @@ extern int parser_network(struct parser *handle);
 extern int parser_timeout(struct parser *handle);
 extern const char *parser_auto_launch(struct parser *handle);
 extern unsigned int parser_size(struct parser *handle);
-extern void parser_get_pdsize(struct parser *handle, unsigned int *width, unsigned int *height);
+extern void parser_get_gbar_size(struct parser *handle, unsigned int *width, unsigned int *height);
 extern const char *parser_group_str(struct parser *handle);
 extern int parser_secured(struct parser *handle);
 extern int parser_pinup(struct parser *handler);
 
-extern const char *parser_lb_path(struct parser *handle);
-extern const char *parser_lb_group(struct parser *handle);
-extern const char *parser_pd_path(struct parser *handle);
-extern const char *parser_pd_group(struct parser *handle);
+extern const char *parser_dbox_path(struct parser *handle);
+extern const char *parser_dbox_group(struct parser *handle);
+extern const char *parser_gbar_path(struct parser *handle);
+extern const char *parser_gbar_group(struct parser *handle);
 
 extern const char *parser_abi(struct parser *handle);
 
-extern int parser_text_pd(struct parser *handle);
-extern int parser_text_lb(struct parser *handle);
-extern int parser_buffer_lb(struct parser *handle);
-extern int parser_buffer_pd(struct parser *handle);
+extern int parser_text_gbar(struct parser *handle);
+extern int parser_text_dbox(struct parser *handle);
+extern int parser_buffer_dbox(struct parser *handle);
+extern int parser_buffer_gbar(struct parser *handle);
 
 extern const char *parser_script(struct parser *handle);
 
index 6d0700f..d2138a5 100644 (file)
@@ -18,4 +18,14 @@ extern int setting_is_lcd_off(void);
 extern int setting_init(void);
 extern int setting_fini(void);
 
+enum oom_event_type {
+    OOM_TYPE_NORMAL = 0x00,
+    OOM_TYPE_LOW = 0x01,
+    OOM_ERROR = 0xFF
+};
+
+extern int setting_add_oom_event_callback(int (*handler)(enum oom_event_type type, void *data), void *data);
+extern int setting_del_oom_event_callback(int (*handler)(enum oom_event_type type, void *data), void *data);
+extern enum oom_event_type setting_oom_level(void);
+
 /* End of a file */
index 7f477f3..3b65f12 100644 (file)
@@ -169,7 +169,7 @@ extern int slave_set_pid(struct slave_node *slave, pid_t pid);
 extern void slave_load_package(struct slave_node *slave);
 extern void slave_unload_package(struct slave_node *slave);
 extern int const slave_loaded_package(struct slave_node *slave);
-extern struct slave_node *slave_find_available(const char *abi, int secured, int network);
+extern struct slave_node *slave_find_available(const char *slave_pkgname, const char *abi, int secured, int network);
 
 extern double const slave_ttl(const struct slave_node *slave);
 
@@ -212,4 +212,9 @@ extern int slave_activate_all(void);
 extern void slave_set_control_option(struct slave_node *slave, int ctrl);
 extern int slave_control_option(struct slave_node *slave);
 
+extern char *slave_package_name(const char *abi, const char *lbid);
+
+extern int slave_priority(struct slave_node *slave);
+extern int slave_set_priority(struct slave_node *slave, int priority);
+
 /* End of a file */
index 4f32a76..56348f1 100644 (file)
@@ -17,7 +17,6 @@
 extern unsigned long util_string_hash(const char *str);
 extern double util_timestamp(void);
 extern int util_check_ext(const char *filename, const char *check_ptr);
-extern int util_validate_livebox_package(const char *pkgname);
 extern int util_unlink(const char *filename);
 extern int util_unlink_files(const char *folder);
 extern char *util_slavename(void);
index 5efa5e7..e0992e3 100644 (file)
                <filesystem path="/usr/share/data-provider-master" label="data-provider-master::data" />
                <filesystem path="/usr/share/data-provider-master/abi.ini" label="data-provider-master::data" />
 
-               <!-- livebox-service is able to access the resolution.ini file -->
+               <!-- dynamicbox_service is able to access the resolution.ini file -->
                <filesystem path="/usr/share/data-provider-master/resolution.ini" label="_" />
+               <filesystem path="/usr/share/data-provider-master/320x480/resolution.ini" label="_" />
+               <filesystem path="/usr/share/data-provider-master/800x480/resolution.ini" label="_" />
+               <filesystem path="/usr/share/data-provider-master/360x480/resolution.ini" label="_" />
+               <filesystem path="/usr/share/data-provider-master/720x1280/resolution.ini" label="_" />
+               <filesystem path="/usr/share/data-provider-master/320x320/resolution.ini" label="_" />
 
                <!-- Slave provider and the master provider are able to access the conf.ini file -->
                <filesystem path="/usr/share/data-provider-master/conf.ini" label="data-provider-master::data" />
+               <filesystem path="/usr/share/data-provider-master/320x480/conf.ini" label="data-provider-master::data" />
+               <filesystem path="/usr/share/data-provider-master/800x480/conf.ini" label="data-provider-master::data" />
+               <filesystem path="/usr/share/data-provider-master/360x480/conf.ini" label="data-provider-master::data" />
+               <filesystem path="/usr/share/data-provider-master/720x1280/conf.ini" label="data-provider-master::data" />
+               <filesystem path="/usr/share/data-provider-master/320x320/conf.ini" label="data-provider-master::data" />
 
                <!-- Shared data folder -->
                <filesystem path="/opt/usr/share/live_magazine" label="data-provider-master::share" type="transmutable" />
                <filesystem path="/opt/usr/share/live_magazine/always" label="data-provider-master::share" type="transmutable" />
 
                <!-- Database -->
-               <filesystem path="/opt/dbspace/.livebox.db" label="data-provider-master::db" />
-               <filesystem path="/opt/dbspace/.livebox.db-journal" label="data-provider-master::db" />
+               <filesystem path="/opt/dbspace/.dynamicbox.db" label="data-provider-master::db" />
+               <filesystem path="/opt/dbspace/.dynamicbox.db-journal" label="data-provider-master::db" />
 
                <filesystem path="/usr/lib/systemd/system/data-provider-master.service" label="_" />
                <filesystem path="/usr/lib/systemd/system/multi-user.target.wants/data-provider-master.service" label="_" />
 
                <!-- Package manager plugin -->
-               <filesystem path="/usr/etc/package-manager/parserlib/liblivebox.so" label="_" />
+               <filesystem path="/usr/etc/package-manager/parserlib/libdynamicbox.so" label="_" />
 
                <!-- Logdump script -->
-               <filesystem path="/opt/etc/dump.d/module.d/dump_livebox.sh" label="_" exec_label="_" />
+               <filesystem path="/opt/etc/dump.d/module.d/dump_dynamicbox.sh" label="_" exec_label="_" />
        </assign>
 </manifest>
index ad79dc6..ec21600 100755 (executable)
@@ -1,15 +1,14 @@
 %bcond_with wayland
 
 Name: data-provider-master
-Summary: Master service provider for liveboxes
-Version: 0.43.2
+Summary: Master service provider for dynamicboxes
+Version: 1.0.0
 Release: 1
-Group: HomeTF/Livebox
+Group: HomeTF/DynamicBox
 License: Flora
 Source0: %{name}-%{version}.tar.gz
 Source1001: %{name}.manifest
 BuildRequires: cmake, gettext-tools, smack, coreutils
-BuildRequires: pkgconfig(ail)
 BuildRequires: pkgconfig(dlog)
 BuildRequires: pkgconfig(aul)
 BuildRequires: pkgconfig(vconf)
@@ -39,9 +38,11 @@ BuildRequires: pkgconfig(eina)
 BuildRequires: pkgconfig(com-core)
 BuildRequires: pkgconfig(libxml-2.0)
 BuildRequires: pkgconfig(pkgmgr)
+BuildRequires: pkgconfig(pkgmgr-info)
 
+# This will not be works, I know. But...
 %if "%{sec_product_feature_livebox}" != "0"
-BuildRequires: pkgconfig(livebox-service)
+BuildRequires: pkgconfig(dynamicbox_service)
 %endif
 
 BuildRequires: pkgconfig(notification)
@@ -50,13 +51,13 @@ BuildRequires: pkgconfig(badge)
 BuildRequires: pkgconfig(badge-service)
 BuildRequires: pkgconfig(shortcut)
 BuildRequires: pkgconfig(security-server)
-BuildRequires: pkgconfig(libsystemd-daemon)
+BuildRequires: sec-product-features
 Requires(post): sys-assert
 Requires(post): dbus
 
 %description
-Manage the 2nd stage livebox service provider and communicate with the viewer application.
-Keep trace on the life-cycle of the livebox and status of the service providers, viewer applications.
+Manage the 2nd stage dynamicbox service provider and communicate with the viewer application.
+Keep trace on the life-cycle of the dynamicbox and status of the service providers, viewer applications.
 
 %prep
 %setup -q
@@ -97,6 +98,18 @@ export MOBILE=On
 export WEARABLE=Off
 %endif
 
+%if "%{sec_product_feature_display_resolution}" == "360x480"
+export LIVEBOX_SHM="${LIVEBOX_SHM}.360x480"
+%endif
+
+%if "%{sec_product_feature_display_resolution}" == "320x480"
+export LIVEBOX_SHM="${LIVEBOX_SHM}.320x480"
+%endif
+
+%if "%{sec_product_feature_display_resolution}" == "480x800"
+export LIVEBOX_SHM="${LIVEBOX_SHM}.480x800"
+%endif
+
 %if "%{sec_product_feature_livebox}" == "0"
 export LIVEBOX=Off
 %else
@@ -111,14 +124,8 @@ CFLAGS="${CFLAGS} -Wall -Winline -Werror" LDFLAGS="${LDFLAGS}" make %{?jobs:-j%j
 rm -rf %{buildroot}
 %make_install
 mkdir -p %{buildroot}/%{_datarootdir}/license
-%if "%{_repository}" == "wearable"
 mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants
 ln -sf ../data-provider-master.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/data-provider-master.service
-%else
-mkdir -p %{buildroot}/%{_libdir}/systemd/user/tizen-middleware.target.wants
-ln -sf %{_libdir}/systemd/user/data-provider-master.service %{buildroot}/%{_libdir}/systemd/user/tizen-middleware.target.wants/data-provider-master.service
-%endif
-
 %if "%{sec_product_feature_livebox}" == "0"
 # Nothing provides
 %else
@@ -128,20 +135,20 @@ mkdir -p %{buildroot}/opt/usr/share/live_magazine/reader
 mkdir -p %{buildroot}/opt/usr/share/live_magazine/always
 mkdir -p %{buildroot}/opt/usr/devel/usr/bin
 mkdir -p %{buildroot}/opt/dbspace
-touch %{buildroot}/opt/dbspace/.livebox.db
-touch %{buildroot}/opt/dbspace/.livebox.db-journal
-if [ ! -s %{buildroot}/opt/dbspace/.livebox.db ]; then
-echo "LiveBox DB file is not exists, initiate it"
-sqlite3 %{buildroot}/opt/dbspace/.livebox.db <<EOF
+touch %{buildroot}/opt/dbspace/.dynamicbox.db
+touch %{buildroot}/opt/dbspace/.dynamicbox.db-journal
+if [ ! -s %{buildroot}/opt/dbspace/.dynamicbox.db ]; then
+echo "DynamicBox DB file is not exists, initiate it"
+sqlite3 %{buildroot}/opt/dbspace/.dynamicbox.db <<EOF
 CREATE TABLE version ( version INTEGER );
 CREATE TABLE box_size ( pkgid TEXT NOT NULL, size_type INTEGER, preview TEXT, touch_effect INTEGER, need_frame INTEGER, mouse_event INTEGER, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
-CREATE TABLE client (pkgid TEXT PRIMARY KEY NOT NULL, icon TEXT, name TEXT, auto_launch TEXT, pd_size TEXT, content TEXT, nodisplay INTEGER, setup TEXT, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
+CREATE TABLE client (pkgid TEXT PRIMARY KEY NOT NULL, icon TEXT, name TEXT, auto_launch TEXT, gbar_size TEXT, content TEXT, nodisplay INTEGER, setup TEXT, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
 CREATE TABLE groupinfo ( id INTEGER PRIMARY KEY AUTOINCREMENT, cluster TEXT NOT NULL, category TEXT NOT NULL, pkgid TEXT NOT NULL, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
 CREATE TABLE groupmap (option_id INTEGER PRIMARY KEY AUTOINCREMENT, id INTEGER, pkgid TEXT NOT NULL, ctx_item TEXT NOT NULL, FOREIGN KEY(id) REFERENCES groupinfo(id), FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
 CREATE TABLE i18n ( pkgid TEXT NOT NULL, lang TEXT COLLATE NOCASE, name TEXT, icon TEXT, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
 CREATE TABLE option ( pkgid TEXT NOT NULL, option_id INTEGER, key TEXT NOT NULL, value TEXT NOT NULL, FOREIGN KEY(option_id) REFERENCES groupmap(option_id), FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
 CREATE TABLE pkgmap ( pkgid TEXT PRIMARY KEY NOT NULL, appid TEXT, uiapp TEXT, prime INTEGER, category TEXT DEFAULT 'http://tizen.org/category/default' );
-CREATE TABLE provider ( pkgid TEXT PRIMARY KEY NOT NULL, network INTEGER, abi TEXT, secured INTEGER, box_type INTEGER, box_src TEXT, box_group TEXT, pd_type INTEGER, pd_src TEXT, pd_group TEXT, libexec TEXT, timeout INTEGER, period TEXT, script TEXT, pinup INTEGER, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
+CREATE TABLE provider ( pkgid TEXT PRIMARY KEY NOT NULL, network INTEGER, abi TEXT, secured INTEGER, box_type INTEGER, box_src TEXT, box_group TEXT, gbar_type INTEGER, gbar_src TEXT, gbar_group TEXT, libexec TEXT, timeout INTEGER, period TEXT, script TEXT, pinup INTEGER, count INTEGER, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
 EOF
 fi
 %endif
@@ -164,10 +171,10 @@ chown 5000:5000 /opt/usr/share/live_magazine/reader
 chmod 750 /opt/usr/share/live_magazine/reader
 chown 5000:5000 /opt/usr/share/live_magazine/always
 chmod 750 /opt/usr/share/live_magazine/always
-chown 0:5000 /opt/dbspace/.livebox.db
-chmod 640 /opt/dbspace/.livebox.db
-chown 0:5000 /opt/dbspace/.livebox.db-journal
-chmod 640 /opt/dbspace/.livebox.db-journal
+chown 0:5000 /opt/dbspace/.dynamicbox.db
+chmod 640 /opt/dbspace/.dynamicbox.db
+chown 0:5000 /opt/dbspace/.dynamicbox.db-journal
+chmod 640 /opt/dbspace/.dynamicbox.db-journal
 %endif
 vconftool set -t bool "memory/data-provider-master/started" 0 -i -u 5000 -f -s system::vconf_system
 vconftool set -t int "memory/private/data-provider-master/restart_count" 0 -i -u 5000 -f -s data-provider-master
@@ -179,27 +186,21 @@ echo "%{_sysconfdir}/init.d/data-provider-master start"
 %manifest %{name}.manifest
 %defattr(-,root,root,-)
 %{_bindir}/data-provider-master
-%if "%{_repository}" == "wearable"
 %{_libdir}/systemd/system/multi-user.target.wants/data-provider-master.service
 %{_libdir}/systemd/system/data-provider-master.service
-/opt/etc/dump.d/module.d/dump_livebox.sh
-%else
-%{_libdir}/systemd/user/data-provider-master.service
-%{_libdir}/systemd/user/tizen-middleware.target.wants/data-provider-master.service
-/opt/etc/smack/accesses.d
-%endif
 %{_datarootdir}/license/*
-%if "%{sec_product_feature_livebox}" == "0"
-# Nothing provides
-%else
 %if 0%{?tizen_build_binary_release_type_eng}
 /opt/usr/devel/usr/bin/*
 %endif
+%if "%{sec_product_feature_livebox}" == "0"
+# Nothing provides
+%else
 %{_prefix}/etc/package-manager/parserlib/*
 %{_datarootdir}/data-provider-master/*
+/opt/etc/dump.d/module.d/dump_dynamicbox.sh
 /opt/usr/share/live_magazine/*
-/opt/dbspace/.livebox.db
-/opt/dbspace/.livebox.db-journal
+/opt/dbspace/.dynamicbox.db
+/opt/dbspace/.dynamicbox.db-journal
 %endif
 
 # End of a file
similarity index 83%
rename from pkgmgr_livebox/CMakeLists.txt
rename to pkgmgr_dynamicbox/CMakeLists.txt
index c20b5c1..06ad219 100644 (file)
@@ -1,6 +1,6 @@
-PROJECT(livebox C)
+PROJECT(dynamicbox C)
 
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/pkgmgr_livebox/include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/pkgmgr_dynamicbox/include)
 
 INCLUDE(FindPkgConfig)
 pkg_check_modules(bin_pkgs REQUIRED
@@ -8,7 +8,7 @@ pkg_check_modules(bin_pkgs REQUIRED
        sqlite3
        libxml-2.0
        db-util
-       livebox-service
+       dynamicbox_service
 )
 
 FOREACH(flag ${bin_pkgs_CFLAGS})
diff --git a/pkgmgr_dynamicbox/dynamicbox.xml b/pkgmgr_dynamicbox/dynamicbox.xml
new file mode 100644 (file)
index 0000000..7e274b5
--- /dev/null
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<manifest xmlns="http://tizen.org/ns/packages" package="com.samsung.nicesj" version="1.0" install-location="auto">
+
+<dynamicbox appid="com.samsung.nicesj.dynamicbox" primary="true" secured="false" network="false" abi="c" timeout="20" period="10.0" libexec="/usr/apps/com.samsung.myapp/libexec/liblive-com.samsung.nicesj.so" pinup="false" script="edje" nodisplay="false">
+       <label>My Dynamic Box</label>
+       <icon>/usr/share/icons/small/com.samsung.live-nicesj.png</icon>
+       <label xml:lang="en_US">Sample</label>
+       <label xml:lang="ko_KR">Hangul</label>
+       <content>Content information</content>  <!-- This string will be passed to the dynamicbox_create -->
+       <category name="http://tizen.org/dynamicbox/default"></category>        <!-- Used for categorizing a package -->
+
+       <launch>com.samsung.nicesj</launch> <!-- Launch this app from homescreen directly -->
+
+       <setup>com.samsung.nicesj</setup> <!-- If the box needs to be setting up before adding it to the homscreen, this app will be launched -->
+
+       <box type="image" mouse_event="false" count="0">
+               <!-- 1x1 should be exists, mandatory size -->
+               <size touch_effect="true" preview="ABSPATH" mouse_event="false">1x1</size>
+
+               <size touch_effect="true" preview="ABSPATH" mouse_event="false">2x1</size>
+               <size touch_effect="true" need_frame="true" mouse_event="false">2x2</size>
+               <size>4x1</size>
+               <size need_frame="true">4x2</size>
+               <size touch_effect="false" need_frame="true" mouse_event="false">4x3</size>
+               <size touch_effect="false" mouse_event="false">4x4</size>
+
+               <!-- Only for the Easy home -->
+               <size>21x21</size>
+               <size preview="ABSPATH">23x21</size>
+               <size>23x23</size>
+
+               <!-- Only supported for special Dynamic Box - inhouse / commercialization target only -->
+               <size>0x0</size>
+               <script src="/opt/usr/apps/com.samsung.myapp/res/script/my.edj" group="my_group" />
+       </box>
+
+       <glancebar type="script">
+               <size>720x100</size>
+               <script src="/opt/usr/apps/com.samsung.myapp/res/script/mypd.edj" group="group_string" />
+       </glancebar>
+
+       <group>
+               <cluster name="cluster1">
+                       <category name="category1" context="APP_USED_FREQUENTLY">
+                               <option key="time_span" value="value" />
+                               <option key="result_size" value="value" />
+                       </category>
+                       <category name="category2" context="APP_USED_FREQUENTLY_THISTIME">
+                               <option key="time_span" value="value" />
+                               <option key="result_size" value="value" />
+                               <option key="time_interval" value="value" />
+                       </category>
+               </cluster>
+               <cluster name="cluster2">
+                       <category name="category1" context="CONTACT_COMMUNICATED_FREQUENTLY">
+                               <option key="data_provider" value="com.samsung.contact" />
+                               <option key="time_span" value="value" />
+                               <option key="result_size" value="size" />
+                       </category>
+                       <category name="category2" context="CONTACT_COMMUNICATED_FREQUENTLY_THISTIME">
+                               <option key="data_provider" value="com.samsung.contact" />
+                               <option key="time_span" value="value" />
+                               <option key="result_size" value="value" />
+                               <option key="time_interval" value="value" />
+                       </category>
+                       <category name="category3" context="CONTACT_COMMUNICATED_ATLEASTONCE">
+                               <option key="data_provider" value="value" />
+                               <option key="time_span" value="value" />
+                               <option key="result_size" value="value" />
+                       </category>
+               </cluster>
+               <cluster name="noctx_cluster">
+                       <category name="noctx_category" />
+               </cluster>
+               <!--
+                    KEYWORD_SEARCHED_FREQUENTLY(DATA_PROVIDER, TIME_SPAN, RESULT_SIZE)
+                    MUSIC_PLAYED_FREQUENTLY(DATA_PROVIDER, TIME_SPAN, RESULT_SIZE)
+               -->
+       </group>
+</dynamicbox>
+</manifest>
diff --git a/pkgmgr_dynamicbox/dynamicbox.xsd b/pkgmgr_dynamicbox/dynamicbox.xsd
new file mode 100644 (file)
index 0000000..cc58e22
--- /dev/null
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://tizen.org/ns/packages" xmlns:packages="http://tizen.org/ns/packages">
+
+    <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>
+
+    <xs:element name="dynamicbox">
+       <xs:complexType>
+           <xs:sequence>
+               <xs:element name="label">
+                   <xs:complexType mixed="true">
+                       <xs:attribute ref="xml:lang"/>
+                   </xs:complexType>
+               </xs:element>
+               <xs:element name="icon">
+                   <xs:complexType mixed="true">
+                       <xs:attribute ref="xml:lang"/>
+                   </xs:complexType>
+               </xs:element>
+               <xs:element name="content"/>
+               <xs:element name="launch"/>
+               <xs:element name="setup"/>
+               <xs:element name="category">
+                   <xs:complexType>
+                     <xs:sequence>
+                       <xs:choice maxOccurs="unbounded">
+                         <xs:any minOccurs="0" processContents="lax"/>
+                       </xs:choice>
+                     </xs:sequence>
+                     <xs:anyAttribute processContents="lax"/>
+                   </xs:complexType>
+               </xs:element>
+               <xs:element nmae="glancebar">
+                   <xs:complexType>
+                       <xs:sequence>
+                           <xs:choice maxOccurs="unbounded" minOccurs="0">
+                               <xs:element name="size"/>
+                               <xs:element name="script">
+                                   <xs:complexType>
+                                       <xs:attribute name="src" type="xs:string"/>
+                                       <xs:attribute name="group" type="xs:string"/>
+                                   </xs:complexType>
+                               </xs:element>
+                           </xs:choice>
+                       </xs:sequence>
+                   </xs:complexType>
+               </xs:element>
+               <xs:element name="box">
+                   <xs:complexType>
+                       <xs:sequence>
+                           <xs:choice maxOccurs="unbounded" minOccurs="0">
+                               <xs:element name="size">
+                                   <xs:complexType>
+                                       <xs:attribute name="touch_effect" type="xs:boolean"/>
+                                       <xs:attribute name="mouse_event" type="xs:boolean"/>
+                                       <xs:attribute name="need_frame" type="xs:boolean"/>
+                                       <xs:attribute name="preview" type="xs:string"/>
+                                   </xs:complexType>
+                               </xs:element>
+
+                               <xs:element name="script">
+                                   <xs:complexType>
+                                       <xs:attribute name="src" type="xs:string"/>
+                                       <xs:attribute name="group" type="xs:string"/>
+                                   </xs:complexType>
+                               </xs:element>
+                           </xs:choice>
+                       </xs:sequence>
+                       <xs:attribute name="type" type="xs:string"/>
+                       <xs:attribute name="mouse_event" type="xs:boolean"/>
+                       <xs:attribute name="count" type="xs:decimal"/>
+                   </xs:complexType>
+               </xs:element>
+           </xs:sequence>
+           <xs:attribute name="appid" use="required" type="xs:string"/>
+           <xs:attribute name="primary" use="required" type="xs:boolean"/>
+           <xs:attribute name="secured" type="xs:boolean"/>
+           <xs:attribute name="network" use="required" type="xs:boolean"/>
+           <xs:attribute name="abi" type="xs:string"/>
+           <xs:attribute name="timeout" use="required" type="xs:string"/>
+           <xs:attribute name="period" use="required" type="xs:string"/>
+           <xs:attribute name="libexec" type="xs:string"/>
+           <xs:attribute name="pinup" type="xs:string"/>
+           <xs:attribute name="script" type="xs:string"/>
+           <xs:attribute name="nodisplay" type="xs:boolean"/>
+       </xs:complexType>
+    </xs:element>
+
+</xs:schema>
similarity index 77%
rename from pkgmgr_livebox/src/service_register.c
rename to pkgmgr_dynamicbox/src/service_register.c
index 17e7726..ebb0613 100644 (file)
@@ -28,7 +28,7 @@
 #include <libxml/tree.h>
 #include <dlog.h>
 
-#include <livebox-service.h>
+#include <dynamicbox_service.h>
 
 #include "dlist.h"
 
@@ -38,7 +38,7 @@
 #define ErrPrintWithConsole(format, arg...)    do { fprintf(stderr, "[%s/%s:%d] " format, basename(__FILE__), __func__, __LINE__, ##arg); SECURE_LOGE("[\e[32m%s/%s\e[0m:%d] " format, basename(__FILE__), __func__, __LINE__, ##arg); } while (0)
 #endif
 
-#define CUR_VER 3
+#define CUR_VER 4
 #define DEFAULT_CATEGORY       "http://tizen.org/category/default"
 
 /*!
  *
  *
  * provider
- * +-------+---------+-----+---------+----------+---------+-----------+---------+--------+----------+---------+---------+--------+--------+-------+
- * | pkgid | network | abi | secured | box_type | box_src | box_group | pd_type | pd_src | pd_group | libexec | timeout | period | script | pinup |
- * +-------+---------+-----+---------+----------+---------+-----------+---------+--------+----------+---------+---------+--------+--------+-------+
- * |   -   |    -    |  -  |    -    |     -    |    -    |     -     |    -    |    -   |     -    |     -   |    -    |    -   |    -   |   -   |
- * +-------+---------+-----+---------+----------+---------+-----------+---------+--------+----------+---------+---------+--------+--------+-------+
- * CREATE TABLE provider ( pkgid TEXT PRIMARY KEY NOT NULL, network INTEGER, abi TEXT, secured INTEGER, box_type INTEGER, box_src TEXT, box_group TEXT, pd_type TEXT, pd_src TEXT, pd_group TEXT, libexec TEXT, timeout INTEGER, period TEXT, script TEXT, pinup INTEGER, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid))
+ * +-------+---------+-----+---------+----------+---------+-----------+---------+--------+----------+---------+---------+--------+--------+-------+-----------------------+
+ * | pkgid | network | abi | secured | box_type | box_src | box_group | gbar_type | gbar_src | gbar_group | libexec | timeout | period | script | pinup | count(from ver 4) |
+ * +-------+---------+-----+---------+----------+---------+-----------+---------+--------+----------+---------+---------+--------+--------+-------+-----------------------+
+ * |   -   |    -    |  -  |    -    |     -    |    -    |     -     |    -    |    -   |     -    |     -   |    -    |    -   |    -   |   -   |           -           |
+ * +-------+---------+-----+---------+----------+---------+-----------+---------+--------+----------+---------+---------+--------+--------+-------+-----------------------+
+ * CREATE TABLE provider ( pkgid TEXT PRIMARY KEY NOT NULL, network INTEGER, abi TEXT, secured INTEGER, box_type INTEGER, box_src TEXT, box_group TEXT, gbar_type TEXT, gbar_src TEXT, gbar_group TEXT, libexec TEXT, timeout INTEGER, period TEXT, script TEXT, pinup INTEGER, count INTEGER, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid))
  *
  * = box_type = { text | buffer | script | image }
- * = pd_type = { text | buffer | script }
+ * = gbar_type = { text | buffer | script }
  * = network = { 1 | 0 }
  * = secured = { 1 | 0 }
  *
  *
  * client
  * +-------+------+---------+-------------+---------+---------+-----------+-------+
- * | pkgid | Icon |  Name   | auto_launch | pd_size | content | nodisplay | setup |
+ * | pkgid | Icon |  Name   | auto_launch | gbar_size | content | nodisplay | setup |
  * +-------+------+---------+-------------+---------+---------+-----------+-------+
  * |   -   |   -  |    -    |      -      |    -    |    -    |     -     |   -   |
  * +-------+------+---------+-------------+---------+---------+-----------+-------+
- * CREATE TABLE client ( pkgid TEXT PRIMARY KEY NOT NULL, icon TEXT, name TEXT, auto_launch TEXT, pd_size TEXT, content TEXT, nodisplay INTEGER, setup TEXT, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) )
+ * CREATE TABLE client ( pkgid TEXT PRIMARY KEY NOT NULL, icon TEXT, name TEXT, auto_launch TEXT, gbar_size TEXT, content TEXT, nodisplay INTEGER, setup TEXT, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) )
  *
  * = auto_launch = UI-APPID
- * = pd_size = WIDTHxHEIGHT
+ * = gbar_size = WIDTHxHEIGHT
  *
  *
  * i18n
 #undef LOG_TAG
 #endif
 
-#define LOG_TAG "PKGMGR_LIVEBOX"
+#define LOG_TAG "PKGMGR_DYNAMICBOX"
 
 int errno;
 
@@ -148,22 +148,7 @@ struct i18n {
        xmlChar *icon;
 };
 
-enum lb_type {
-       LB_TYPE_NONE = 0x0,
-       LB_TYPE_SCRIPT,
-       LB_TYPE_FILE,
-       LB_TYPE_TEXT,
-       LB_TYPE_BUFFER,
-};
-
-enum pd_type {
-       PD_TYPE_NONE = 0x0,
-       PD_TYPE_SCRIPT,
-       PD_TYPE_TEXT,
-       PD_TYPE_BUFFER,
-};
-
-struct livebox {
+struct dynamicbox {
        xmlChar *pkgid;
        int secured;
        int network;
@@ -181,27 +166,28 @@ struct livebox {
        xmlChar *category; /* Category of this box */
 
        int pinup; /* Is this support the pinup feature? */
-       int primary; /* Is this primary livebox? */
+       int primary; /* Is this primary dynamicbox? */
        int nodisplay;
+       int count; /* Max count of instances */
 
-       int default_mouse_event; /* Mouse event processing option for livebox */
+       int default_mouse_event; /* Mouse event processing option for dynamicbox */
        int default_touch_effect;
        int default_need_frame;
 
-       enum lb_type lb_type;
-       xmlChar *lb_src;
-       xmlChar *lb_group;
+       enum dynamicbox_dbox_type dbox_type;
+       xmlChar *dbox_src;
+       xmlChar *dbox_group;
        int size_list; /* 1x1, 2x1, 2x2, 4x1, 4x2, 4x3, 4x4 */
 
-       xmlChar *preview[NR_OF_SIZE_LIST];
-       int touch_effect[NR_OF_SIZE_LIST]; /* Touch effect of a livebox */
-       int need_frame[NR_OF_SIZE_LIST]; /* Box needs frame which should be cared by viewer */
-       int mouse_event[NR_OF_SIZE_LIST];
+       xmlChar *preview[DBOX_NR_OF_SIZE_LIST];
+       int touch_effect[DBOX_NR_OF_SIZE_LIST]; /* Touch effect of a dynamicbox */
+       int need_frame[DBOX_NR_OF_SIZE_LIST]; /* Box needs frame which should be cared by viewer */
+       int mouse_event[DBOX_NR_OF_SIZE_LIST];
 
-       enum pd_type pd_type;
-       xmlChar *pd_src;
-       xmlChar *pd_group;
-       xmlChar *pd_size; /* Default PD size */
+       enum dynamicbox_gbar_type gbar_type;
+       xmlChar *gbar_src;
+       xmlChar *gbar_group;
+       xmlChar *gbar_size; /* Default PD size */
 
        struct dlist *i18n_list;
        struct dlist *group_list;
@@ -223,7 +209,7 @@ static struct {
        const char *dbfile;
        sqlite3 *handle;
 } s_info = {
-       .dbfile = "/opt/dbspace/.livebox.db",
+       .dbfile = "/opt/dbspace/.dynamicbox.db",
        .handle = NULL,
 };
 
@@ -422,6 +408,33 @@ static void upgrade_pkgmap_for_category(void)
 
 /*!
  * \note
+ * From version 3 to 4
+ * "provider" table should have "count" column.
+ * "count" will be used for limiting creatable count of instances for each dynamicbox.
+ * Every dynamicbox developer should describe their max count of creatable instances.
+ */
+static void upgrade_to_version_4(void)
+{
+       char *err;
+       static const char *ddl;
+
+       /*
+        * Step 1
+        * Create a new column for count to provider table.
+        */
+       ddl = "ALTER TABLE provider ADD COLUMN count INTEGER DEFAULT 0";
+       if (sqlite3_exec(s_info.handle, ddl, NULL, NULL, &err) != SQLITE_OK) {
+               ErrPrint("Failed to execute the DDL (%s)\n", err);
+               return;
+       }
+
+       if (sqlite3_changes(s_info.handle) == 0) {
+               ErrPrint("No changes to DB\n");
+       }
+}
+
+/*!
+ * \note
  * From version 2 to 3
  * mouse_event is deleted from client table
  * mouse_event is added to box_size table
@@ -550,6 +563,8 @@ static void do_upgrade_db_schema(void)
                upgrade_pkgmap_for_category();
        case 2:
                upgrade_to_version_3();
+       case 3:
+               upgrade_to_version_4();
        default:
                /* Need to update version */
                DbgPrint("Old version: %d\n", version);
@@ -681,8 +696,9 @@ static inline int db_create_provider(void)
        ddl = "CREATE TABLE provider (" \
                "pkgid TEXT PRIMARY KEY NOT NULL, network INTEGER, " \
                "abi TEXT, secured INTEGER, box_type INTEGER, " \
-               "box_src TEXT, box_group TEXT, pd_type INTEGER, " \
-               "pd_src TEXT, pd_group TEXT, libexec TEXT, timeout INTEGER, period TEXT, script TEXT, pinup INTEGER, "\
+               "box_src TEXT, box_group TEXT, gbar_type INTEGER, " \
+               "gbar_src TEXT, gbar_group TEXT, libexec TEXT, timeout INTEGER, period TEXT, script TEXT, pinup INTEGER, "\
+               "count INTEGER, "\
                "FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE)";
 
        if (sqlite3_exec(s_info.handle, ddl, NULL, NULL, &err) != SQLITE_OK) {
@@ -729,20 +745,20 @@ out:
        sqlite3_finalize(stmt);
        return ret;
 }
-static int db_insert_provider(struct livebox *livebox)
+static int db_insert_provider(struct dynamicbox *dynamicbox)
 {
        static const char *dml;
        int ret;
        sqlite3_stmt *stmt;
-       char *abi = (char *)livebox->abi;
-       char *box_src = (char *)livebox->lb_src;
-       char *box_group = (char *)livebox->lb_group;
-       char *pd_src = (char *)livebox->pd_src;
-       char *pd_group = (char *)livebox->pd_group;
-       char *libexec = (char *)livebox->libexec;
-       char *timeout = (char *)livebox->timeout;
-       char *period = (char *)livebox->period;
-       char *script = (char *)livebox->script;
+       char *abi = (char *)dynamicbox->abi;
+       char *box_src = (char *)dynamicbox->dbox_src;
+       char *box_group = (char *)dynamicbox->dbox_group;
+       char *gbar_src = (char *)dynamicbox->gbar_src;
+       char *gbar_group = (char *)dynamicbox->gbar_group;
+       char *libexec = (char *)dynamicbox->libexec;
+       char *timeout = (char *)dynamicbox->timeout;
+       char *period = (char *)dynamicbox->period;
+       char *script = (char *)dynamicbox->script;
 
        if (!abi) {
                abi = "c";
@@ -760,21 +776,21 @@ static int db_insert_provider(struct livebox *livebox)
                script = "edje";
        }
 
-       dml = "INSERT INTO provider ( pkgid, network, abi, secured, box_type, box_src, box_group, pd_type, pd_src, pd_group, libexec, timeout, period, script, pinup ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+       dml = "INSERT INTO provider ( pkgid, network, abi, secured, box_type, box_src, box_group, gbar_type, gbar_src, gbar_group, libexec, timeout, period, script, pinup, count ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
        ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL);
        if (ret != SQLITE_OK) {
                ErrPrintWithConsole("Error: %s\n", sqlite3_errmsg(s_info.handle));
                return -EIO;
        }
 
-       ret = sqlite3_bind_text(stmt, 1, (char *)livebox->pkgid, -1, SQLITE_TRANSIENT);
+       ret = sqlite3_bind_text(stmt, 1, (char *)dynamicbox->pkgid, -1, SQLITE_TRANSIENT);
        if (ret != SQLITE_OK) {
                ErrPrintWithConsole("Error: %s\n", sqlite3_errmsg(s_info.handle));
                ret = -EIO;
                goto out;
        }
 
-       ret = sqlite3_bind_int(stmt, 2, livebox->network);
+       ret = sqlite3_bind_int(stmt, 2, dynamicbox->network);
        if (ret != SQLITE_OK) {
                ErrPrintWithConsole("Error: %s\n", sqlite3_errmsg(s_info.handle));
                ret = -EIO;
@@ -787,14 +803,14 @@ static int db_insert_provider(struct livebox *livebox)
                ret = -EIO;
                goto out;
        }
-       ret = sqlite3_bind_int(stmt, 4, livebox->secured);
+       ret = sqlite3_bind_int(stmt, 4, dynamicbox->secured);
        if (ret != SQLITE_OK) {
                ErrPrintWithConsole("Error: %s\n", sqlite3_errmsg(s_info.handle));
                ret = -EIO;
                goto out;
        }
 
-       ret = sqlite3_bind_int(stmt, 5, livebox->lb_type);
+       ret = sqlite3_bind_int(stmt, 5, dynamicbox->dbox_type);
        if (ret != SQLITE_OK) {
                ErrPrintWithConsole("Error: %s\n", sqlite3_errmsg(s_info.handle));
                ret = -EIO;
@@ -815,21 +831,21 @@ static int db_insert_provider(struct livebox *livebox)
                goto out;
        }
 
-       ret = sqlite3_bind_int(stmt, 8, livebox->pd_type);
+       ret = sqlite3_bind_int(stmt, 8, dynamicbox->gbar_type);
        if (ret != SQLITE_OK) {
                ErrPrintWithConsole("Error: %s\n", sqlite3_errmsg(s_info.handle));
                ret = -EIO;
                goto out;
        }
 
-       ret = sqlite3_bind_text(stmt, 9, pd_src, -1, SQLITE_TRANSIENT);
+       ret = sqlite3_bind_text(stmt, 9, gbar_src, -1, SQLITE_TRANSIENT);
        if (ret != SQLITE_OK) {
                ErrPrintWithConsole("Error: %s\n", sqlite3_errmsg(s_info.handle));
                ret = -EIO;
                goto out;
        }
 
-       ret = sqlite3_bind_text(stmt, 10, pd_group, -1, SQLITE_TRANSIENT);
+       ret = sqlite3_bind_text(stmt, 10, gbar_group, -1, SQLITE_TRANSIENT);
        if (ret != SQLITE_OK) {
                ErrPrintWithConsole("Error: %s\n", sqlite3_errmsg(s_info.handle));
                ret = -EIO;
@@ -864,7 +880,14 @@ static int db_insert_provider(struct livebox *livebox)
                goto out;
        }
 
-       ret = sqlite3_bind_int(stmt, 15, livebox->pinup);
+       ret = sqlite3_bind_int(stmt, 15, dynamicbox->pinup);
+       if (ret != SQLITE_OK) {
+               ErrPrintWithConsole("Error: %s\n", sqlite3_errmsg(s_info.handle));
+               ret = -EIO;
+               goto out;
+       }
+
+       ret = sqlite3_bind_int(stmt, 16, dynamicbox->count);
        if (ret != SQLITE_OK) {
                ErrPrintWithConsole("Error: %s\n", sqlite3_errmsg(s_info.handle));
                ret = -EIO;
@@ -891,7 +914,7 @@ static inline int db_create_client(void)
 
        ddl = "CREATE TABLE client (" \
                "pkgid TEXT PRIMARY KEY NOT NULL, icon TEXT, name TEXT, " \
-               "auto_launch TEXT, pd_size TEXT, content TEXT, nodisplay INTEGER, setup TEXT, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE)";
+               "auto_launch TEXT, gbar_size TEXT, content TEXT, nodisplay INTEGER, setup TEXT, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE)";
        if (sqlite3_exec(s_info.handle, ddl, NULL, NULL, &err) != SQLITE_OK) {
                ErrPrint("Failed to execute the DDL (%s)\n", err);
                return -EIO;
@@ -904,69 +927,69 @@ static inline int db_create_client(void)
        return 0;
 }
 
-static inline int db_insert_client(struct livebox *livebox)
+static inline int db_insert_client(struct dynamicbox *dynamicbox)
 {
        static const char *dml;
        int ret;
        sqlite3_stmt *stmt;
 
-       dml = "INSERT INTO client ( pkgid, icon, name, auto_launch, pd_size, content, nodisplay, setup ) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
+       dml = "INSERT INTO client ( pkgid, icon, name, auto_launch, gbar_size, content, nodisplay, setup ) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
        ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL);
        if (ret != SQLITE_OK) {
                ErrPrintWithConsole("Error: %s\n", sqlite3_errmsg(s_info.handle));
                return -EIO;
        }
 
-       ret = sqlite3_bind_text(stmt, 1, (char *)livebox->pkgid, -1, SQLITE_TRANSIENT);
+       ret = sqlite3_bind_text(stmt, 1, (char *)dynamicbox->pkgid, -1, SQLITE_TRANSIENT);
        if (ret != SQLITE_OK) {
                ErrPrintWithConsole("Error: %s\n", sqlite3_errmsg(s_info.handle));
                ret = -EIO;
                goto out;
        }
 
-       ret = sqlite3_bind_text(stmt, 2, (char *)livebox->icon, -1, SQLITE_TRANSIENT);
+       ret = sqlite3_bind_text(stmt, 2, (char *)dynamicbox->icon, -1, SQLITE_TRANSIENT);
        if (ret != SQLITE_OK) {
                ErrPrintWithConsole("Error: %s\n", sqlite3_errmsg(s_info.handle));
                ret = -EIO;
                goto out;
        }
 
-       ret = sqlite3_bind_text(stmt, 3, (char *)livebox->name, -1, SQLITE_TRANSIENT);
+       ret = sqlite3_bind_text(stmt, 3, (char *)dynamicbox->name, -1, SQLITE_TRANSIENT);
        if (ret != SQLITE_OK) {
                ErrPrintWithConsole("Error: %s\n", sqlite3_errmsg(s_info.handle));
                ret = -EIO;
                goto out;
        }
 
-       ret = sqlite3_bind_text(stmt, 4, (char *)livebox->auto_launch, -1, SQLITE_TRANSIENT);
+       ret = sqlite3_bind_text(stmt, 4, (char *)dynamicbox->auto_launch, -1, SQLITE_TRANSIENT);
        if (ret != SQLITE_OK) {
                ErrPrintWithConsole("Error: %s\n", sqlite3_errmsg(s_info.handle));
                ret = -EIO;
                goto out;
        }
 
-       ret = sqlite3_bind_text(stmt, 5, (char *)livebox->pd_size, -1, SQLITE_TRANSIENT);
+       ret = sqlite3_bind_text(stmt, 5, (char *)dynamicbox->gbar_size, -1, SQLITE_TRANSIENT);
        if (ret != SQLITE_OK) {
                ErrPrintWithConsole("Error: %s\n", sqlite3_errmsg(s_info.handle));
                ret = -EIO;
                goto out;
        }
 
-       ret = sqlite3_bind_text(stmt, 6, (char *)livebox->content, -1, SQLITE_TRANSIENT);
+       ret = sqlite3_bind_text(stmt, 6, (char *)dynamicbox->content, -1, SQLITE_TRANSIENT);
        if (ret != SQLITE_OK) {
                ErrPrintWithConsole("Error: %s\n", sqlite3_errmsg(s_info.handle));
                ret = -EIO;
                goto out;
        }
 
-       ret = sqlite3_bind_int(stmt, 7, livebox->nodisplay);
+       ret = sqlite3_bind_int(stmt, 7, dynamicbox->nodisplay);
        if (ret != SQLITE_OK) {
                ErrPrintWithConsole("Error: %s\n", sqlite3_errmsg(s_info.handle));
                ret = -EIO;
                goto out;
        }
 
-       ret = sqlite3_bind_text(stmt, 8, (char *)livebox->setup, -1, SQLITE_TRANSIENT);
+       ret = sqlite3_bind_text(stmt, 8, (char *)dynamicbox->setup, -1, SQLITE_TRANSIENT);
        if (ret != SQLITE_OK) {
                ErrPrintWithConsole("Error: %s\n", sqlite3_errmsg(s_info.handle));
                ret = -EIO;
@@ -1769,7 +1792,7 @@ static inline int validate_pkgid(const char *appid, const char *pkgid)
        return 1 || !strncmp(appid, pkgid, strlen(appid));
 }
 
-static int livebox_destroy(struct livebox *livebox)
+static int dynamicbox_destroy(struct dynamicbox *dynamicbox)
 {
        struct dlist *l;
        struct dlist *n;
@@ -1779,46 +1802,46 @@ static int livebox_destroy(struct livebox *livebox)
        struct dlist *il;
        struct dlist *in;
 
-       xmlFree(livebox->auto_launch);
-       xmlFree(livebox->pkgid);
-       xmlFree(livebox->abi);
-       xmlFree(livebox->name);
-       xmlFree(livebox->icon);
-       xmlFree(livebox->lb_src);
-       xmlFree(livebox->lb_group);
-       xmlFree(livebox->pd_src);
-       xmlFree(livebox->pd_group);
-       xmlFree(livebox->pd_size);
-       xmlFree(livebox->libexec);
-       xmlFree(livebox->script);
-       xmlFree(livebox->period);
-       xmlFree(livebox->content);
-       xmlFree(livebox->setup);
-       xmlFree(livebox->category);
-       xmlFree(livebox->preview[0]); /* 1x1 */
-       xmlFree(livebox->preview[1]); /* 2x1 */
-       xmlFree(livebox->preview[2]); /* 2x2 */
-       xmlFree(livebox->preview[3]); /* 4x1 */
-       xmlFree(livebox->preview[4]); /* 4x2 */
-       xmlFree(livebox->preview[5]); /* 4x3 */
-       xmlFree(livebox->preview[6]); /* 4x4 */
-       xmlFree(livebox->preview[7]); /* 4x5 */
-       xmlFree(livebox->preview[8]); /* 4x6 */
-       xmlFree(livebox->preview[9]); /* easy 1x1 */
-       xmlFree(livebox->preview[10]); /* easy 3x1 */
-       xmlFree(livebox->preview[11]); /* easy 3x3 */
-       xmlFree(livebox->preview[12]); /* full */
-
-       dlist_foreach_safe(livebox->i18n_list, l, n, i18n) {
-               livebox->i18n_list = dlist_remove(livebox->i18n_list, l);
+       xmlFree(dynamicbox->auto_launch);
+       xmlFree(dynamicbox->pkgid);
+       xmlFree(dynamicbox->abi);
+       xmlFree(dynamicbox->name);
+       xmlFree(dynamicbox->icon);
+       xmlFree(dynamicbox->dbox_src);
+       xmlFree(dynamicbox->dbox_group);
+       xmlFree(dynamicbox->gbar_src);
+       xmlFree(dynamicbox->gbar_group);
+       xmlFree(dynamicbox->gbar_size);
+       xmlFree(dynamicbox->libexec);
+       xmlFree(dynamicbox->script);
+       xmlFree(dynamicbox->period);
+       xmlFree(dynamicbox->content);
+       xmlFree(dynamicbox->setup);
+       xmlFree(dynamicbox->category);
+       xmlFree(dynamicbox->preview[0]); /* 1x1 */
+       xmlFree(dynamicbox->preview[1]); /* 2x1 */
+       xmlFree(dynamicbox->preview[2]); /* 2x2 */
+       xmlFree(dynamicbox->preview[3]); /* 4x1 */
+       xmlFree(dynamicbox->preview[4]); /* 4x2 */
+       xmlFree(dynamicbox->preview[5]); /* 4x3 */
+       xmlFree(dynamicbox->preview[6]); /* 4x4 */
+       xmlFree(dynamicbox->preview[7]); /* 4x5 */
+       xmlFree(dynamicbox->preview[8]); /* 4x6 */
+       xmlFree(dynamicbox->preview[9]); /* easy 1x1 */
+       xmlFree(dynamicbox->preview[10]); /* easy 3x1 */
+       xmlFree(dynamicbox->preview[11]); /* easy 3x3 */
+       xmlFree(dynamicbox->preview[12]); /* full */
+
+       dlist_foreach_safe(dynamicbox->i18n_list, l, n, i18n) {
+               dynamicbox->i18n_list = dlist_remove(dynamicbox->i18n_list, l);
                xmlFree(i18n->name);
                xmlFree(i18n->icon);
                xmlFree(i18n->lang);
                free(i18n);
        }
 
-       dlist_foreach_safe(livebox->group_list, l, n, group) {
-               livebox->group_list = dlist_remove(livebox->group_list, l);
+       dlist_foreach_safe(dynamicbox->group_list, l, n, group) {
+               dynamicbox->group_list = dlist_remove(dynamicbox->group_list, l);
                DbgPrint("Release %s/%s\n", group->cluster, group->category);
 
                if (group->ctx_item) {
@@ -1837,11 +1860,11 @@ static int livebox_destroy(struct livebox *livebox)
                free(group);
        }
 
-       free(livebox);
+       free(dynamicbox);
        return 0;
 }
 
-static inline void update_i18n_name(struct livebox *livebox, xmlNodePtr node)
+static inline void update_i18n_name(struct dynamicbox *dynamicbox, xmlNodePtr node)
 {
        struct i18n *i18n;
        struct dlist *l;
@@ -1856,16 +1879,16 @@ static inline void update_i18n_name(struct livebox *livebox, xmlNodePtr node)
 
        lang = xmlNodeGetLang(node);
        if (!lang) {
-               if (livebox->name) {
-                       DbgPrint("Override default name: %s\n", livebox->name);
-                       xmlFree(livebox->name);
+               if (dynamicbox->name) {
+                       DbgPrint("Override default name: %s\n", dynamicbox->name);
+                       xmlFree(dynamicbox->name);
                }
 
-               livebox->name = name;
+               dynamicbox->name = name;
                return;
        }
 
-       dlist_foreach(livebox->i18n_list, l, i18n) {
+       dlist_foreach(dynamicbox->i18n_list, l, i18n) {
                if (!xmlStrcasecmp(i18n->lang, lang)) {
                        if (i18n->name) {
                                DbgPrint("Override name: %s\n", i18n->name);
@@ -1888,10 +1911,10 @@ static inline void update_i18n_name(struct livebox *livebox, xmlNodePtr node)
        i18n->name = name;
        i18n->lang = lang;
        DbgPrint("Label[%s] - [%s] added\n", i18n->lang, i18n->name);
-       livebox->i18n_list = dlist_append(livebox->i18n_list, i18n);
+       dynamicbox->i18n_list = dlist_append(dynamicbox->i18n_list, i18n);
 }
 
-static inline void update_i18n_icon(struct livebox *livebox, xmlNodePtr node)
+static inline void update_i18n_icon(struct dynamicbox *dynamicbox, xmlNodePtr node)
 {
        struct i18n *i18n;
        struct dlist *l;
@@ -1906,16 +1929,16 @@ static inline void update_i18n_icon(struct livebox *livebox, xmlNodePtr node)
 
        lang = xmlNodeGetLang(node);
        if (!lang) {
-               if (livebox->icon) {
-                       DbgPrint("Override default icon: %s\n", livebox->icon);
-                       xmlFree(livebox->icon);
+               if (dynamicbox->icon) {
+                       DbgPrint("Override default icon: %s\n", dynamicbox->icon);
+                       xmlFree(dynamicbox->icon);
                }
 
-               livebox->icon = icon;
+               dynamicbox->icon = icon;
                return;
        }
 
-       dlist_foreach(livebox->i18n_list, l, i18n) {
+       dlist_foreach(dynamicbox->i18n_list, l, i18n) {
                if (!xmlStrcasecmp(i18n->lang, lang)) {
                        if (i18n->icon) {
                                DbgPrint("Override icon %s for %s\n", i18n->icon, i18n->name);
@@ -1938,10 +1961,10 @@ static inline void update_i18n_icon(struct livebox *livebox, xmlNodePtr node)
        i18n->icon = icon;
        i18n->lang = lang;
        DbgPrint("Icon[%s] - [%s] added\n", i18n->lang, i18n->icon);
-       livebox->i18n_list = dlist_append(livebox->i18n_list, i18n);
+       dynamicbox->i18n_list = dlist_append(dynamicbox->i18n_list, i18n);
 }
 
-static inline void update_launch(struct livebox *livebox, xmlNodePtr node)
+static inline void update_launch(struct dynamicbox *dynamicbox, xmlNodePtr node)
 {
        xmlChar *launch;
 
@@ -1951,38 +1974,39 @@ static inline void update_launch(struct livebox *livebox, xmlNodePtr node)
                return;
        }
 
-       if (livebox->auto_launch) {
-               xmlFree(livebox->auto_launch);
+       if (dynamicbox->auto_launch) {
+               xmlFree(dynamicbox->auto_launch);
        }
 
-       livebox->auto_launch = xmlStrdup(launch);
-       if (!livebox->auto_launch) {
+       dynamicbox->auto_launch = xmlStrdup(launch);
+       if (!dynamicbox->auto_launch) {
                ErrPrint("Failed to duplicate string: %s\n", (char *)launch);
                return;
        }
 }
 
-static inline void update_category(struct livebox *livebox, xmlNodePtr node)
+static inline void update_category(struct dynamicbox *dynamicbox, xmlNodePtr node)
 {
        xmlChar *category;
-       category = xmlNodeGetContent(node);
+
+       category = xmlGetProp(node, (const xmlChar *)"name");
        if (!category) {
                DbgPrint("Has no valid category\n");
                return;
        }
 
-       if (livebox->category) {
-               xmlFree(livebox->category);
+       if (dynamicbox->category) {
+               xmlFree(dynamicbox->category);
        }
 
-       livebox->category = xmlStrdup(category);
-       if (!livebox->category) {
+       dynamicbox->category = xmlStrdup(category);
+       if (!dynamicbox->category) {
                ErrPrint("Failed to duplicate string: %s\n", (char *)category);
                return;
        }
 }
 
-static inline void update_ui_appid(struct livebox *livebox, xmlNodePtr node)
+static inline void update_ui_appid(struct dynamicbox *dynamicbox, xmlNodePtr node)
 {
        xmlChar *uiapp;
        uiapp = xmlNodeGetContent(node);
@@ -1991,18 +2015,18 @@ static inline void update_ui_appid(struct livebox *livebox, xmlNodePtr node)
                return;
        }
 
-       if (livebox->uiapp) {
-               xmlFree(livebox->uiapp);
+       if (dynamicbox->uiapp) {
+               xmlFree(dynamicbox->uiapp);
        }
 
-       livebox->uiapp = xmlStrdup(uiapp);
-       if (!livebox->uiapp) {
+       dynamicbox->uiapp = xmlStrdup(uiapp);
+       if (!dynamicbox->uiapp) {
                ErrPrint("Failed to duplicate string: %s\n", (char *)uiapp);
                return;
        }
 }
 
-static inline void update_setup(struct livebox *livebox, xmlNodePtr node)
+static inline void update_setup(struct dynamicbox *dynamicbox, xmlNodePtr node)
 {
        xmlChar *setup;
        setup = xmlNodeGetContent(node);
@@ -2011,18 +2035,18 @@ static inline void update_setup(struct livebox *livebox, xmlNodePtr node)
                return;
        }
 
-       if (livebox->setup) {
-               xmlFree(livebox->setup);
+       if (dynamicbox->setup) {
+               xmlFree(dynamicbox->setup);
        }
 
-       livebox->setup = xmlStrdup(setup);
-       if (!livebox->setup) {
+       dynamicbox->setup = xmlStrdup(setup);
+       if (!dynamicbox->setup) {
                ErrPrint("Failed to duplicate string: %s\n", (char *)setup);
                return;
        }
 }
 
-static inline void update_content(struct livebox *livebox, xmlNodePtr node)
+static inline void update_content(struct dynamicbox *dynamicbox, xmlNodePtr node)
 {
        xmlChar *content;
        content = xmlNodeGetContent(node);
@@ -2031,21 +2055,21 @@ static inline void update_content(struct livebox *livebox, xmlNodePtr node)
                return;
        }
 
-       if (livebox->content) {
-               xmlFree(livebox->content);
+       if (dynamicbox->content) {
+               xmlFree(dynamicbox->content);
        }
 
-       livebox->content = xmlStrdup(content);
-       if (!livebox->content) {
+       dynamicbox->content = xmlStrdup(content);
+       if (!dynamicbox->content) {
                ErrPrint("Failed to duplicate string: %s\n", (char *)content);
                return;
        }
 }
 
-static void update_size_info(struct livebox *livebox, int idx, xmlNodePtr node)
+static void update_size_info(struct dynamicbox *dynamicbox, int idx, xmlNodePtr node)
 {
        if (xmlHasProp(node, (const xmlChar *)"preview")) {
-               livebox->preview[idx] = xmlGetProp(node, (const xmlChar *)"preview");
+               dynamicbox->preview[idx] = xmlGetProp(node, (const xmlChar *)"preview");
        }
 
        if (xmlHasProp(node, (const xmlChar *)"need_frame")) {
@@ -2053,13 +2077,13 @@ static void update_size_info(struct livebox *livebox, int idx, xmlNodePtr node)
 
                need_frame = xmlGetProp(node, (const xmlChar *)"need_frame");
                if (need_frame) {
-                       livebox->need_frame[idx] = !xmlStrcasecmp(need_frame, (const xmlChar *)"true");
+                       dynamicbox->need_frame[idx] = !xmlStrcasecmp(need_frame, (const xmlChar *)"true");
                        xmlFree(need_frame);
                } else {
-                       livebox->need_frame[idx] = livebox->default_need_frame;
+                       dynamicbox->need_frame[idx] = dynamicbox->default_need_frame;
                }
        } else {
-               livebox->need_frame[idx] = livebox->default_need_frame;
+               dynamicbox->need_frame[idx] = dynamicbox->default_need_frame;
        }
 
        if (xmlHasProp(node, (const xmlChar *)"touch_effect")) {
@@ -2067,13 +2091,13 @@ static void update_size_info(struct livebox *livebox, int idx, xmlNodePtr node)
 
                touch_effect = xmlGetProp(node, (const xmlChar *)"touch_effect");
                if (touch_effect) {
-                       livebox->touch_effect[idx] = !xmlStrcasecmp(touch_effect, (const xmlChar *)"true");
+                       dynamicbox->touch_effect[idx] = !xmlStrcasecmp(touch_effect, (const xmlChar *)"true");
                        xmlFree(touch_effect);
                } else {
-                       livebox->touch_effect[idx] = livebox->default_touch_effect;
+                       dynamicbox->touch_effect[idx] = dynamicbox->default_touch_effect;
                }
        } else {
-               livebox->touch_effect[idx] = livebox->default_touch_effect;
+               dynamicbox->touch_effect[idx] = dynamicbox->default_touch_effect;
        }
 
        if (xmlHasProp(node, (const xmlChar *)"mouse_event")) {
@@ -2081,36 +2105,38 @@ static void update_size_info(struct livebox *livebox, int idx, xmlNodePtr node)
 
                mouse_event = xmlGetProp(node, (const xmlChar *)"mouse_event");
                if (mouse_event) {
-                       livebox->mouse_event[idx] = !xmlStrcasecmp(mouse_event, (const xmlChar *)"true");
+                       dynamicbox->mouse_event[idx] = !xmlStrcasecmp(mouse_event, (const xmlChar *)"true");
                        xmlFree(mouse_event);
                } else {
-                       livebox->mouse_event[idx] = livebox->default_mouse_event;
+                       dynamicbox->mouse_event[idx] = dynamicbox->default_mouse_event;
                }
        } else {
-               livebox->mouse_event[idx] = livebox->default_mouse_event;
+               dynamicbox->mouse_event[idx] = dynamicbox->default_mouse_event;
        }
 }
 
-static inline void update_box(struct livebox *livebox, xmlNodePtr node)
+static inline void update_box(struct dynamicbox *dynamicbox, xmlNodePtr node)
 {
        if (!xmlHasProp(node, (const xmlChar *)"type")) {
-               livebox->lb_type = LB_TYPE_FILE;
+               dynamicbox->dbox_type = DBOX_TYPE_FILE;
        } else {
                xmlChar *type;
 
                type = xmlGetProp(node, (const xmlChar *)"type");
                if (!type) {
                        ErrPrint("Type is NIL\n");
-                       livebox->lb_type = LB_TYPE_FILE;
+                       dynamicbox->dbox_type = DBOX_TYPE_FILE;
                } else {
                        if (!xmlStrcasecmp(type, (const xmlChar *)"text")) {
-                               livebox->lb_type = LB_TYPE_TEXT;
+                               dynamicbox->dbox_type = DBOX_TYPE_TEXT;
                        } else if (!xmlStrcasecmp(type, (const xmlChar *)"buffer")) {
-                               livebox->lb_type = LB_TYPE_BUFFER;
+                               dynamicbox->dbox_type = DBOX_TYPE_BUFFER;
                        } else if (!xmlStrcasecmp(type, (const xmlChar *)"script")) {
-                               livebox->lb_type = LB_TYPE_SCRIPT;
+                               dynamicbox->dbox_type = DBOX_TYPE_SCRIPT;
+                       } else if (!xmlStrcasecmp(type, (const xmlChar *)"elm")) {
+                               dynamicbox->dbox_type = DBOX_TYPE_UIFW;
                        } else { /* Default */
-                               livebox->lb_type = LB_TYPE_FILE;
+                               dynamicbox->dbox_type = DBOX_TYPE_FILE;
                        }
 
                        xmlFree(type);
@@ -2118,46 +2144,46 @@ static inline void update_box(struct livebox *livebox, xmlNodePtr node)
        }
 
        if (!xmlHasProp(node, (const xmlChar *)"mouse_event")) {
-               livebox->default_mouse_event = 0;
+               dynamicbox->default_mouse_event = 0;
        } else {
                xmlChar *mouse_event;
 
                mouse_event = xmlGetProp(node, (const xmlChar *)"mouse_event");
                if (!mouse_event) {
                        ErrPrint("mouse_event is NIL\n");
-                       livebox->default_mouse_event = 0;
+                       dynamicbox->default_mouse_event = 0;
                } else {
-                       livebox->default_mouse_event = !xmlStrcasecmp(mouse_event, (const xmlChar *)"true");
+                       dynamicbox->default_mouse_event = !xmlStrcasecmp(mouse_event, (const xmlChar *)"true");
                        xmlFree(mouse_event);
                }
        }
 
        if (!xmlHasProp(node, (const xmlChar *)"touch_effect")) {
-               livebox->default_touch_effect = 1;
+               dynamicbox->default_touch_effect = 1;
        } else {
                xmlChar *touch_effect;
 
                touch_effect = xmlGetProp(node, (const xmlChar *)"touch_effect");
                if (!touch_effect) {
                        ErrPrint("default touch_effect is NIL\n");
-                       livebox->default_touch_effect = 1;
+                       dynamicbox->default_touch_effect = 1;
                } else {
-                       livebox->default_touch_effect = !xmlStrcasecmp(touch_effect, (const xmlChar *)"true");
+                       dynamicbox->default_touch_effect = !xmlStrcasecmp(touch_effect, (const xmlChar *)"true");
                        xmlFree(touch_effect);
                }
        }
 
        if (!xmlHasProp(node, (const xmlChar *)"need_frame")) {
-               livebox->default_need_frame = 0;
+               dynamicbox->default_need_frame = 0;
        } else {
                xmlChar *need_frame;
 
                need_frame = xmlGetProp(node, (const xmlChar *)"need_frame");
                if (!need_frame) {
                        ErrPrint("default need_frame is NIL\n");
-                       livebox->default_need_frame = 0;
+                       dynamicbox->default_need_frame = 0;
                } else {
-                       livebox->default_need_frame = !xmlStrcasecmp(need_frame, (const xmlChar *)"true");
+                       dynamicbox->default_need_frame = !xmlStrcasecmp(need_frame, (const xmlChar *)"true");
                        xmlFree(need_frame);
                }
        }
@@ -2185,62 +2211,62 @@ static inline void update_box(struct livebox *livebox, xmlNodePtr node)
 
                        if (!xmlStrcasecmp(size, (const xmlChar *)"1x1")) {
                                if (is_easy) {
-                                       livebox->size_list |= LB_SIZE_TYPE_EASY_1x1;
-                                       update_size_info(livebox, 9, node);
+                                       dynamicbox->size_list |= DBOX_SIZE_TYPE_EASY_1x1;
+                                       update_size_info(dynamicbox, 9, node);
                                } else {
-                                       livebox->size_list |= LB_SIZE_TYPE_1x1;
-                                       update_size_info(livebox, 0, node);
+                                       dynamicbox->size_list |= DBOX_SIZE_TYPE_1x1;
+                                       update_size_info(dynamicbox, 0, node);
                                }
                        } else if (!xmlStrcasecmp(size, (const xmlChar *)"3x1")) {
                                if (is_easy) {
-                                       livebox->size_list |= LB_SIZE_TYPE_EASY_3x1;
-                                       update_size_info(livebox, 10, node);
+                                       dynamicbox->size_list |= DBOX_SIZE_TYPE_EASY_3x1;
+                                       update_size_info(dynamicbox, 10, node);
                                } else {
                                        ErrPrint("Invalid size tag (%s)\n", size);
                                }
                        } else if (!xmlStrcasecmp(size, (const xmlChar *)"3x3")) {
                                if (is_easy) {
-                                       livebox->size_list |= LB_SIZE_TYPE_EASY_3x3;
-                                       update_size_info(livebox, 11, node);
+                                       dynamicbox->size_list |= DBOX_SIZE_TYPE_EASY_3x3;
+                                       update_size_info(dynamicbox, 11, node);
                                } else {
                                        ErrPrint("Invalid size tag (%s)\n", size);
                                }
                        } else if (!xmlStrcasecmp(size, (const xmlChar *)"2x1")) {
-                               livebox->size_list |= LB_SIZE_TYPE_2x1;
-                               update_size_info(livebox, 1, node);
+                               dynamicbox->size_list |= DBOX_SIZE_TYPE_2x1;
+                               update_size_info(dynamicbox, 1, node);
                        } else if (!xmlStrcasecmp(size, (const xmlChar *)"2x2")) {
-                               livebox->size_list |= LB_SIZE_TYPE_2x2;
-                               update_size_info(livebox, 2, node);
+                               dynamicbox->size_list |= DBOX_SIZE_TYPE_2x2;
+                               update_size_info(dynamicbox, 2, node);
                        } else if (!xmlStrcasecmp(size, (const xmlChar *)"4x1")) {
-                               livebox->size_list |= LB_SIZE_TYPE_4x1;
-                               update_size_info(livebox, 3, node);
+                               dynamicbox->size_list |= DBOX_SIZE_TYPE_4x1;
+                               update_size_info(dynamicbox, 3, node);
                        } else if (!xmlStrcasecmp(size, (const xmlChar *)"4x2")) {
-                               livebox->size_list |= LB_SIZE_TYPE_4x2;
-                               update_size_info(livebox, 4, node);
+                               dynamicbox->size_list |= DBOX_SIZE_TYPE_4x2;
+                               update_size_info(dynamicbox, 4, node);
                        } else if (!xmlStrcasecmp(size, (const xmlChar *)"4x3")) {
-                               livebox->size_list |= LB_SIZE_TYPE_4x3;
-                               update_size_info(livebox, 5, node);
+                               dynamicbox->size_list |= DBOX_SIZE_TYPE_4x3;
+                               update_size_info(dynamicbox, 5, node);
                        } else if (!xmlStrcasecmp(size, (const xmlChar *)"4x4")) {
-                               livebox->size_list |= LB_SIZE_TYPE_4x4;
-                               update_size_info(livebox, 6, node);
+                               dynamicbox->size_list |= DBOX_SIZE_TYPE_4x4;
+                               update_size_info(dynamicbox, 6, node);
                        } else if (!xmlStrcasecmp(size, (const xmlChar *)"4x5")) {
-                               livebox->size_list |= LB_SIZE_TYPE_4x5;
-                               update_size_info(livebox, 7, node);
+                               dynamicbox->size_list |= DBOX_SIZE_TYPE_4x5;
+                               update_size_info(dynamicbox, 7, node);
                        } else if (!xmlStrcasecmp(size, (const xmlChar *)"4x6")) {
-                               livebox->size_list |= LB_SIZE_TYPE_4x6;
-                               update_size_info(livebox, 8, node);
+                               dynamicbox->size_list |= DBOX_SIZE_TYPE_4x6;
+                               update_size_info(dynamicbox, 8, node);
                        } else if (!xmlStrcasecmp(size, (const xmlChar *)"21x21")) {
-                               livebox->size_list |= LB_SIZE_TYPE_EASY_1x1;
-                               update_size_info(livebox, 9, node);
+                               dynamicbox->size_list |= DBOX_SIZE_TYPE_EASY_1x1;
+                               update_size_info(dynamicbox, 9, node);
                        } else if (!xmlStrcasecmp(size, (const xmlChar *)"23x21")) {
-                               livebox->size_list |= LB_SIZE_TYPE_EASY_3x1;
-                               update_size_info(livebox, 10, node);
+                               dynamicbox->size_list |= DBOX_SIZE_TYPE_EASY_3x1;
+                               update_size_info(dynamicbox, 10, node);
                        } else if (!xmlStrcasecmp(size, (const xmlChar *)"23x23")) {
-                               livebox->size_list |= LB_SIZE_TYPE_EASY_3x3;
-                               update_size_info(livebox, 11, node);
+                               dynamicbox->size_list |= DBOX_SIZE_TYPE_EASY_3x3;
+                               update_size_info(dynamicbox, 11, node);
                        } else if (!xmlStrcasecmp(size, (const xmlChar *)"0x0")) {
-                               livebox->size_list |= LB_SIZE_TYPE_0x0;
-                               update_size_info(livebox, 12, node);
+                               dynamicbox->size_list |= DBOX_SIZE_TYPE_0x0;
+                               update_size_info(dynamicbox, 12, node);
                        } else {
                                ErrPrint("Invalid size tag (%s)\n", size);
                        }
@@ -2260,12 +2286,12 @@ static inline void update_box(struct livebox *livebox, xmlNodePtr node)
                                continue;
                        }
 
-                       if (livebox->lb_src) {
-                               DbgPrint("Override lb src: %s\n", livebox->lb_src);
-                               xmlFree(livebox->lb_src);
+                       if (dynamicbox->dbox_src) {
+                               DbgPrint("Override lb src: %s\n", dynamicbox->dbox_src);
+                               xmlFree(dynamicbox->dbox_src);
                        }
 
-                       livebox->lb_src = src;
+                       dynamicbox->dbox_src = src;
 
                        if (xmlHasProp(node, (const xmlChar *)"group")) {
                                xmlChar *group;
@@ -2273,19 +2299,19 @@ static inline void update_box(struct livebox *livebox, xmlNodePtr node)
                                if (!group) {
                                        ErrPrint("Group is NIL\n");
                                } else {
-                                       if (livebox->lb_group) {
-                                               DbgPrint("Override lb group: %s\n", livebox->lb_group);
-                                               xmlFree(livebox->lb_group);
+                                       if (dynamicbox->dbox_group) {
+                                               DbgPrint("Override lb group: %s\n", dynamicbox->dbox_group);
+                                               xmlFree(dynamicbox->dbox_group);
                                        }
 
-                                       livebox->lb_group = group;
+                                       dynamicbox->dbox_group = group;
                                }
                        }
                }
        }
 }
 
-static inline void update_group(struct livebox *livebox, xmlNodePtr node)
+static inline void update_group(struct dynamicbox *dynamicbox, xmlNodePtr node)
 {
        xmlNodePtr cluster;
        xmlNodePtr category;
@@ -2351,7 +2377,7 @@ static inline void update_group(struct livebox *livebox, xmlNodePtr node)
                        }
 
                        group->category = category_name;
-                       livebox->group_list = dlist_append(livebox->group_list, group);
+                       dynamicbox->group_list = dlist_append(dynamicbox->group_list, group);
 
                        if (!xmlHasProp(category, (const xmlChar *)"context")) {
                                DbgPrint("%s, %s has no ctx info\n", group->cluster, group->category);
@@ -2415,10 +2441,10 @@ static inline void update_group(struct livebox *livebox, xmlNodePtr node)
        }
 }
 
-static inline void update_pd(struct livebox *livebox, xmlNodePtr node)
+static inline void update_pd(struct dynamicbox *dynamicbox, xmlNodePtr node)
 {
        if (!xmlHasProp(node, (const xmlChar *)"type")) {
-               livebox->pd_type = PD_TYPE_SCRIPT;
+               dynamicbox->gbar_type = GBAR_TYPE_SCRIPT;
        } else {
                xmlChar *type;
 
@@ -2429,11 +2455,13 @@ static inline void update_pd(struct livebox *livebox, xmlNodePtr node)
                }
 
                if (!xmlStrcasecmp(type, (const xmlChar *)"text")) {
-                       livebox->pd_type = PD_TYPE_TEXT;
+                       dynamicbox->gbar_type = GBAR_TYPE_TEXT;
                } else if (!xmlStrcasecmp(type, (const xmlChar *)"buffer")) {
-                       livebox->pd_type = PD_TYPE_BUFFER;
+                       dynamicbox->gbar_type = GBAR_TYPE_BUFFER;
+               } else if (!xmlStrcasecmp(type, (const xmlChar *)"elm")) {
+                       dynamicbox->gbar_type = GBAR_TYPE_UIFW;
                } else {
-                       livebox->pd_type = PD_TYPE_SCRIPT;
+                       dynamicbox->gbar_type = GBAR_TYPE_SCRIPT;
                }
 
                xmlFree(type);
@@ -2449,11 +2477,11 @@ static inline void update_pd(struct livebox *livebox, xmlNodePtr node)
                                continue;
                        }
 
-                       if (livebox->pd_size) {
-                               DbgPrint("Override pd size: %s\n", livebox->pd_size);
-                               xmlFree(livebox->pd_size);
+                       if (dynamicbox->gbar_size) {
+                               DbgPrint("Override pd size: %s\n", dynamicbox->gbar_size);
+                               xmlFree(dynamicbox->gbar_size);
                        }
-                       livebox->pd_size = size;
+                       dynamicbox->gbar_size = size;
                } else if (!xmlStrcasecmp(node->name, (const xmlChar *)"script")) {
                        xmlChar *src;
 
@@ -2468,12 +2496,12 @@ static inline void update_pd(struct livebox *livebox, xmlNodePtr node)
                                continue;
                        }
 
-                       if (livebox->pd_src) {
-                               DbgPrint("Overide PD src: %s\n", livebox->pd_src);
-                               xmlFree(livebox->pd_src);
+                       if (dynamicbox->gbar_src) {
+                               DbgPrint("Overide PD src: %s\n", dynamicbox->gbar_src);
+                               xmlFree(dynamicbox->gbar_src);
                        }
 
-                       livebox->pd_src = src;
+                       dynamicbox->gbar_src = src;
 
                        if (xmlHasProp(node, (const xmlChar *)"group")) {
                                xmlChar *group;
@@ -2481,19 +2509,19 @@ static inline void update_pd(struct livebox *livebox, xmlNodePtr node)
                                if (!group) {
                                        ErrPrint("Group is NIL\n");
                                } else {
-                                       if (livebox->pd_group) {
-                                               DbgPrint("Override PD group : %s\n", livebox->pd_group);
-                                               xmlFree(livebox->pd_group);
+                                       if (dynamicbox->gbar_group) {
+                                               DbgPrint("Override PD group : %s\n", dynamicbox->gbar_group);
+                                               xmlFree(dynamicbox->gbar_group);
                                        }
 
-                                       livebox->pd_group = group;
+                                       dynamicbox->gbar_group = group;
                                }
                        }
                }
        }
 }
 
-static int db_insert_livebox(struct livebox *livebox, const char *appid)
+static int db_insert_dynamicbox(struct dynamicbox *dynamicbox, const char *appid)
 {
        struct dlist *l;
        struct dlist *il;
@@ -2504,126 +2532,126 @@ static int db_insert_livebox(struct livebox *livebox, const char *appid)
        struct option *option;
 
        begin_transaction();
-       ret = db_insert_pkgmap(appid, (char *)livebox->pkgid, (char *)livebox->uiapp, livebox->primary, (char *)livebox->category);
+       ret = db_insert_pkgmap(appid, (char *)dynamicbox->pkgid, (char *)dynamicbox->uiapp, dynamicbox->primary, (char *)dynamicbox->category);
        if (ret < 0) {
                goto errout;
        }
 
-       ret = db_insert_provider(livebox);
+       ret = db_insert_provider(dynamicbox);
        if (ret < 0) {
                goto errout;
        }
 
-       ret = db_insert_client(livebox);
+       ret = db_insert_client(dynamicbox);
        if (ret < 0) {
                goto errout;
        }
 
-       dlist_foreach(livebox->i18n_list, l, i18n) {
-               ret = db_insert_i18n((char *)livebox->pkgid, (char *)i18n->lang, (char *)i18n->name, (char *)i18n->icon);
+       dlist_foreach(dynamicbox->i18n_list, l, i18n) {
+               ret = db_insert_i18n((char *)dynamicbox->pkgid, (char *)i18n->lang, (char *)i18n->name, (char *)i18n->icon);
                if (ret < 0) {
                        goto errout;
                }
        }
 
-       if (livebox->size_list & LB_SIZE_TYPE_1x1) {
-               ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_1x1, (char *)livebox->preview[0], livebox->touch_effect[0], livebox->need_frame[0], livebox->mouse_event[0]);
+       if (dynamicbox->size_list & DBOX_SIZE_TYPE_1x1) {
+               ret = db_insert_box_size((char *)dynamicbox->pkgid, DBOX_SIZE_TYPE_1x1, (char *)dynamicbox->preview[0], dynamicbox->touch_effect[0], dynamicbox->need_frame[0], dynamicbox->mouse_event[0]);
                if (ret < 0) {
                        goto errout;
                }
        }
 
-       if (livebox->size_list & LB_SIZE_TYPE_2x1) {
-               ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_2x1, (char *)livebox->preview[1], livebox->touch_effect[1], livebox->need_frame[1], livebox->mouse_event[1]);
+       if (dynamicbox->size_list & DBOX_SIZE_TYPE_2x1) {
+               ret = db_insert_box_size((char *)dynamicbox->pkgid, DBOX_SIZE_TYPE_2x1, (char *)dynamicbox->preview[1], dynamicbox->touch_effect[1], dynamicbox->need_frame[1], dynamicbox->mouse_event[1]);
                if (ret < 0) {
                        goto errout;
                }
        }
 
-       if (livebox->size_list & LB_SIZE_TYPE_2x2) {
-               ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_2x2, (char *)livebox->preview[2], livebox->touch_effect[2], livebox->need_frame[2], livebox->mouse_event[2]);
+       if (dynamicbox->size_list & DBOX_SIZE_TYPE_2x2) {
+               ret = db_insert_box_size((char *)dynamicbox->pkgid, DBOX_SIZE_TYPE_2x2, (char *)dynamicbox->preview[2], dynamicbox->touch_effect[2], dynamicbox->need_frame[2], dynamicbox->mouse_event[2]);
                if (ret < 0) {
                        goto errout;
                }
        }
 
-       if (livebox->size_list & LB_SIZE_TYPE_4x1) {
-               ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_4x1, (char *)livebox->preview[3], livebox->touch_effect[3], livebox->need_frame[3], livebox->mouse_event[3]);
+       if (dynamicbox->size_list & DBOX_SIZE_TYPE_4x1) {
+               ret = db_insert_box_size((char *)dynamicbox->pkgid, DBOX_SIZE_TYPE_4x1, (char *)dynamicbox->preview[3], dynamicbox->touch_effect[3], dynamicbox->need_frame[3], dynamicbox->mouse_event[3]);
                if (ret < 0) {
                        goto errout;
                }
        }
 
-       if (livebox->size_list & LB_SIZE_TYPE_4x2) {
-               ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_4x2, (char *)livebox->preview[4], livebox->touch_effect[4], livebox->need_frame[4], livebox->mouse_event[4]);
+       if (dynamicbox->size_list & DBOX_SIZE_TYPE_4x2) {
+               ret = db_insert_box_size((char *)dynamicbox->pkgid, DBOX_SIZE_TYPE_4x2, (char *)dynamicbox->preview[4], dynamicbox->touch_effect[4], dynamicbox->need_frame[4], dynamicbox->mouse_event[4]);
                if (ret < 0) {
                        goto errout;
                }
        }
 
-       if (livebox->size_list & LB_SIZE_TYPE_4x3) {
-               ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_4x3, (char *)livebox->preview[5], livebox->touch_effect[5], livebox->need_frame[5], livebox->mouse_event[5]);
+       if (dynamicbox->size_list & DBOX_SIZE_TYPE_4x3) {
+               ret = db_insert_box_size((char *)dynamicbox->pkgid, DBOX_SIZE_TYPE_4x3, (char *)dynamicbox->preview[5], dynamicbox->touch_effect[5], dynamicbox->need_frame[5], dynamicbox->mouse_event[5]);
                if (ret < 0) {
                        goto errout;
                }
        }
 
-       if (livebox->size_list & LB_SIZE_TYPE_4x4) {
-               ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_4x4, (char *)livebox->preview[6], livebox->touch_effect[6], livebox->need_frame[6], livebox->mouse_event[6]);
+       if (dynamicbox->size_list & DBOX_SIZE_TYPE_4x4) {
+               ret = db_insert_box_size((char *)dynamicbox->pkgid, DBOX_SIZE_TYPE_4x4, (char *)dynamicbox->preview[6], dynamicbox->touch_effect[6], dynamicbox->need_frame[6], dynamicbox->mouse_event[6]);
                if (ret < 0) {
                        goto errout;
                }
        }
 
-       if (livebox->size_list & LB_SIZE_TYPE_4x5) {
-               ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_4x5, (char *)livebox->preview[7], livebox->touch_effect[7], livebox->need_frame[7], livebox->mouse_event[7]);
+       if (dynamicbox->size_list & DBOX_SIZE_TYPE_4x5) {
+               ret = db_insert_box_size((char *)dynamicbox->pkgid, DBOX_SIZE_TYPE_4x5, (char *)dynamicbox->preview[7], dynamicbox->touch_effect[7], dynamicbox->need_frame[7], dynamicbox->mouse_event[7]);
                if (ret < 0) {
                        goto errout;
                }
        }
 
-       if (livebox->size_list & LB_SIZE_TYPE_4x6) {
-               ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_4x6, (char *)livebox->preview[8], livebox->touch_effect[8], livebox->need_frame[8], livebox->mouse_event[8]);
+       if (dynamicbox->size_list & DBOX_SIZE_TYPE_4x6) {
+               ret = db_insert_box_size((char *)dynamicbox->pkgid, DBOX_SIZE_TYPE_4x6, (char *)dynamicbox->preview[8], dynamicbox->touch_effect[8], dynamicbox->need_frame[8], dynamicbox->mouse_event[8]);
                if (ret < 0) {
                        goto errout;
                }
        }
 
-       if (livebox->size_list & LB_SIZE_TYPE_EASY_1x1) {
-               ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_EASY_1x1, (char *)livebox->preview[9], livebox->touch_effect[9], livebox->need_frame[9], livebox->mouse_event[9]);
+       if (dynamicbox->size_list & DBOX_SIZE_TYPE_EASY_1x1) {
+               ret = db_insert_box_size((char *)dynamicbox->pkgid, DBOX_SIZE_TYPE_EASY_1x1, (char *)dynamicbox->preview[9], dynamicbox->touch_effect[9], dynamicbox->need_frame[9], dynamicbox->mouse_event[9]);
                if (ret < 0) {
                        goto errout;
                }
        }
 
-       if (livebox->size_list & LB_SIZE_TYPE_EASY_3x1) {
-               ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_EASY_3x1, (char *)livebox->preview[10], livebox->touch_effect[10], livebox->need_frame[10], livebox->mouse_event[10]);
+       if (dynamicbox->size_list & DBOX_SIZE_TYPE_EASY_3x1) {
+               ret = db_insert_box_size((char *)dynamicbox->pkgid, DBOX_SIZE_TYPE_EASY_3x1, (char *)dynamicbox->preview[10], dynamicbox->touch_effect[10], dynamicbox->need_frame[10], dynamicbox->mouse_event[10]);
                if (ret < 0) {
                        goto errout;
                }
        }
 
-       if (livebox->size_list & LB_SIZE_TYPE_EASY_3x3) {
-               ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_EASY_3x3, (char *)livebox->preview[11], livebox->touch_effect[11], livebox->need_frame[11], livebox->mouse_event[11]);
+       if (dynamicbox->size_list & DBOX_SIZE_TYPE_EASY_3x3) {
+               ret = db_insert_box_size((char *)dynamicbox->pkgid, DBOX_SIZE_TYPE_EASY_3x3, (char *)dynamicbox->preview[11], dynamicbox->touch_effect[11], dynamicbox->need_frame[11], dynamicbox->mouse_event[11]);
                if (ret < 0) {
                        goto errout;
                }
        }
 
-       if (livebox->size_list & LB_SIZE_TYPE_0x0) {
-               ret = db_insert_box_size((char *)livebox->pkgid, LB_SIZE_TYPE_0x0, (char *)livebox->preview[12], livebox->touch_effect[12], livebox->need_frame[12], livebox->mouse_event[12]);
+       if (dynamicbox->size_list & DBOX_SIZE_TYPE_0x0) {
+               ret = db_insert_box_size((char *)dynamicbox->pkgid, DBOX_SIZE_TYPE_0x0, (char *)dynamicbox->preview[12], dynamicbox->touch_effect[12], dynamicbox->need_frame[12], dynamicbox->mouse_event[12]);
                if (ret < 0) {
                        goto errout;
                }
        }
 
-       dlist_foreach(livebox->group_list, l, group) {
+       dlist_foreach(dynamicbox->group_list, l, group) {
                /* group ID "id" */
                id = db_get_group_id((char *)group->cluster, (char *)group->category);
                if (id < 0) {
                        int ret;
                        
-                       ret = db_insert_group((char *)livebox->pkgid, (char *)group->cluster, (char *)group->category);
+                       ret = db_insert_group((char *)dynamicbox->pkgid, (char *)group->cluster, (char *)group->category);
                        if (ret < 0) {
                                ErrPrint("[%s]-[%s] is not exists\n", group->cluster, group->category);
                                continue;
@@ -2642,19 +2670,19 @@ static int db_insert_livebox(struct livebox *livebox, const char *appid)
                        continue;
                }
 
-               ret = db_insert_groupmap(id, (char *)livebox->pkgid, (char *)group->ctx_item);
+               ret = db_insert_groupmap(id, (char *)dynamicbox->pkgid, (char *)group->ctx_item);
                if (ret < 0) {
                        goto errout;
                }
 
                /* REUSE "id" from here , option ID */
-               id = db_get_option_id(id, (char *)livebox->pkgid, (char *)group->ctx_item);
+               id = db_get_option_id(id, (char *)dynamicbox->pkgid, (char *)group->ctx_item);
                if (id < 0) {
                        goto errout;
                }
 
                dlist_foreach(group->option_list, il, option) {
-                       ret = db_insert_option((char *)livebox->pkgid, id, (char *)option->key, (char *)option->value);
+                       ret = db_insert_option((char *)dynamicbox->pkgid, id, (char *)option->key, (char *)option->value);
                        if (ret < 0) {
                                goto errout;
                        }
@@ -2662,19 +2690,19 @@ static int db_insert_livebox(struct livebox *livebox, const char *appid)
        }
 
        commit_transaction();
-       livebox_destroy(livebox);
+       dynamicbox_destroy(dynamicbox);
        return 0;
 
 errout:
        ErrPrint("ROLLBACK\n");
        rollback_transaction();
-       livebox_destroy(livebox);
+       dynamicbox_destroy(dynamicbox);
        return ret;
 }
 
 static int do_install(xmlNodePtr node, const char *appid)
 {
-       struct livebox *livebox;
+       struct dynamicbox *dynamicbox;
        xmlChar *pkgid;
        xmlChar *tmp;
 
@@ -2692,108 +2720,116 @@ static int do_install(xmlNodePtr node, const char *appid)
 
        DbgPrint("appid: %s\n", (char *)pkgid);
 
-       livebox = calloc(1, sizeof(*livebox));
-       if (!livebox) {
+       dynamicbox = calloc(1, sizeof(*dynamicbox));
+       if (!dynamicbox) {
                ErrPrint("Heap: %s\n", strerror(errno));
                xmlFree(pkgid);
                return -ENOMEM;
        }
 
-       livebox->pkgid = pkgid;
+       dynamicbox->pkgid = pkgid;
+
+       if (xmlHasProp(node, (const xmlChar *)"count")) {
+               tmp = xmlGetProp(node, (const xmlChar *)"count");
+               if (sscanf((const char *)tmp, "%d", &dynamicbox->count) != 1) {
+                       ErrPrint("Invalid syntax: %s\n", (const char *)tmp);
+               }
+               xmlFree(tmp);
+       }
 
        if (xmlHasProp(node, (const xmlChar *)"primary")) {
                tmp = xmlGetProp(node, (const xmlChar *)"primary");
-               livebox->primary = !xmlStrcasecmp(tmp, (const xmlChar *)"true");
+               dynamicbox->primary = !xmlStrcasecmp(tmp, (const xmlChar *)"true");
                xmlFree(tmp);
        }
 
        if (xmlHasProp(node, (const xmlChar *)"script")) {
-               livebox->script = xmlGetProp(node, (const xmlChar *)"script");
-               if (!livebox->script) {
+               dynamicbox->script = xmlGetProp(node, (const xmlChar *)"script");
+               if (!dynamicbox->script) {
                        ErrPrint("script is NIL\n");
                }
        }
 
        if (xmlHasProp(node, (const xmlChar *)"nodisplay")) {
                tmp = xmlGetProp(node, (const xmlChar *)"nodisplay");
-               livebox->nodisplay = tmp && !xmlStrcasecmp(tmp, (const xmlChar *)"true");
+               dynamicbox->nodisplay = tmp && !xmlStrcasecmp(tmp, (const xmlChar *)"true");
                xmlFree(tmp);
        }
 
        if (xmlHasProp(node, (const xmlChar *)"pinup")) {
                tmp = xmlGetProp(node, (const xmlChar *)"pinup");
-               livebox->pinup = tmp && !xmlStrcasecmp(tmp, (const xmlChar *)"true");
+               dynamicbox->pinup = tmp && !xmlStrcasecmp(tmp, (const xmlChar *)"true");
                xmlFree(tmp);
        }
 
        if (xmlHasProp(node, (const xmlChar *)"period")) {
-               livebox->period = xmlGetProp(node, (const xmlChar *)"period");
-               if (!livebox->period) {
+               dynamicbox->period = xmlGetProp(node, (const xmlChar *)"period");
+               if (!dynamicbox->period) {
                        ErrPrint("Period is NIL\n");
                }
        }
 
        if (xmlHasProp(node, (const xmlChar *)"timeout")) {
-               livebox->timeout = xmlGetProp(node, (const xmlChar *)"timeout");
-               if (!livebox->timeout) {
+               dynamicbox->timeout = xmlGetProp(node, (const xmlChar *)"timeout");
+               if (!dynamicbox->timeout) {
                        ErrPrint("Timeout is NIL\n");
                }
        }
 
        if (xmlHasProp(node, (const xmlChar *)"secured")) {
                tmp = xmlGetProp(node, (const xmlChar *)"secured");
-               livebox->secured = tmp && !xmlStrcasecmp(tmp, (const xmlChar *)"true");
+               dynamicbox->secured = tmp && !xmlStrcasecmp(tmp, (const xmlChar *)"true");
                xmlFree(tmp);
        }
 
        if (xmlHasProp(node, (const xmlChar *)"network")) {
                tmp = xmlGetProp(node, (const xmlChar *)"network");
-               livebox->network = tmp && !xmlStrcasecmp(tmp, (const xmlChar *)"true");
+               dynamicbox->network = tmp && !xmlStrcasecmp(tmp, (const xmlChar *)"true");
                xmlFree(tmp);
        }
 
        if (xmlHasProp(node, (const xmlChar *)"abi")) {
-               livebox->abi = xmlGetProp(node, (const xmlChar *)"abi");
-               if (!livebox->abi) {
+               dynamicbox->abi = xmlGetProp(node, (const xmlChar *)"abi");
+               if (!dynamicbox->abi) {
                        ErrPrint("ABI is NIL\n");
-                       livebox_destroy(livebox);
+                       dynamicbox_destroy(dynamicbox);
                        return -EFAULT;
                }
        } else {
-               livebox->abi = xmlStrdup((const xmlChar *)"c");
-               if (!livebox->abi) {
+               dynamicbox->abi = xmlStrdup((const xmlChar *)"c");
+               if (!dynamicbox->abi) {
                        ErrPrint("Heap: %s\n", strerror(errno));
-                       livebox_destroy(livebox);
+                       dynamicbox_destroy(dynamicbox);
                        return -ENOMEM;
                }
        }
 
        if (xmlHasProp(node, (const xmlChar *)"libexec")) {
-               livebox->libexec = xmlGetProp(node, (const xmlChar *)"libexec");
-               if (!livebox->libexec) {
+               dynamicbox->libexec = xmlGetProp(node, (const xmlChar *)"libexec");
+               if (!dynamicbox->libexec) {
                        ErrPrint("libexec is NIL\n");
-                       livebox_destroy(livebox);
+                       dynamicbox_destroy(dynamicbox);
                        return -EFAULT;
                }
-       } else if (!xmlStrcasecmp(livebox->abi, (const xmlChar *)"c") || !xmlStrcasecmp(livebox->abi, (const xmlChar *)"cpp")) {
+       } else if (!xmlStrcasecmp(dynamicbox->abi, (const xmlChar *)"c") || !xmlStrcasecmp(dynamicbox->abi, (const xmlChar *)"cpp")) {
                char *filename;
                int len;
 
-               len = strlen((char *)livebox->pkgid) + strlen("/libexec/liblive-.so") + 1;
+               len = strlen((char *)dynamicbox->pkgid) + strlen("/libexec/liblive-.so") + 1;
 
                filename = malloc(len);
                if (!filename) {
-                       livebox_destroy(livebox);
+                       dynamicbox_destroy(dynamicbox);
                        return -ENOMEM;
                }
 
-               snprintf(filename, len, "/libexec/liblive-%s.so", livebox->pkgid);
-               livebox->libexec = xmlStrdup((xmlChar *)filename);
+               snprintf(filename, len, "/libexec/liblive-%s.so", dynamicbox->pkgid);
+               dynamicbox->libexec = xmlStrdup((xmlChar *)filename);
                DbgPrint("Use the default libexec: %s\n", filename);
                free(filename);
 
-               if (!livebox->libexec) {
-                       livebox_destroy(livebox);
+               if (!dynamicbox->libexec) {
+                       dynamicbox_destroy(dynamicbox);
                        return -ENOMEM;
                }
        }
@@ -2805,57 +2841,57 @@ static int do_install(xmlNodePtr node, const char *appid)
 
                DbgPrint("Nodename: %s\n", node->name);
                if (!xmlStrcasecmp(node->name, (const xmlChar *)"label")) {
-                       update_i18n_name(livebox, node);
+                       update_i18n_name(dynamicbox, node);
                        continue;
                }
 
                if (!xmlStrcasecmp(node->name, (const xmlChar *)"icon")) {
-                       update_i18n_icon(livebox, node);
+                       update_i18n_icon(dynamicbox, node);
                        continue;
                }
 
                if (!xmlStrcasecmp(node->name, (const xmlChar *)"box")) {
-                       update_box(livebox, node);
+                       update_box(dynamicbox, node);
                        continue;
                }
 
-               if (!xmlStrcasecmp(node->name, (const xmlChar *)"pd")) {
-                       update_pd(livebox, node);
+               if (!xmlStrcasecmp(node->name, (const xmlChar *)"glancebar")) {
+                       update_pd(dynamicbox, node);
                        continue;
                }
 
                if (!xmlStrcasecmp(node->name, (const xmlChar *)"group")) {
-                       update_group(livebox, node);
+                       update_group(dynamicbox, node);
                        continue;
                }
 
                if (!xmlStrcasecmp(node->name, (const xmlChar *)"content")) {
-                       update_content(livebox, node);
+                       update_content(dynamicbox, node);
                        continue;
                }
 
                if (!xmlStrcasecmp(node->name, (const xmlChar *)"setup")) {
-                       update_setup(livebox, node);
+                       update_setup(dynamicbox, node);
                        continue;
                }
 
                if (!xmlStrcasecmp(node->name, (const xmlChar *)"launch")) {
-                       update_launch(livebox, node);
+                       update_launch(dynamicbox, node);
                        continue;
                }
 
                if (!xmlStrcasecmp(node->name, (const xmlChar *)"ui-appid")) {
-                       update_ui_appid(livebox, node);
+                       update_ui_appid(dynamicbox, node);
                        continue;
                }
 
                if (!xmlStrcasecmp(node->name, (const xmlChar *)"category")) {
-                       update_category(livebox, node);
+                       update_category(dynamicbox, node);
                        continue;
                }
        }
 
-       return db_insert_livebox(livebox, appid);
+       return db_insert_dynamicbox(dynamicbox, appid);
 }
 
 static inline int do_uninstall(xmlNodePtr node, const char *appid)
@@ -3072,7 +3108,7 @@ int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr docPtr, const char *appid)
 
        for (node = node->children; node; node = node->next) {
                DbgPrint("node->name: %s\n", node->name);
-               if (!xmlStrcasecmp(node->name, (const xmlChar *)"livebox")) {
+               if (!xmlStrcasecmp(node->name, (const xmlChar *)"dynamicbox")) {
                        ret = do_install(node, appid);
                        if (ret < 0) {
                                DbgPrint("Returns: %d\n", ret);
@@ -3134,7 +3170,7 @@ int PKGMGR_PARSER_PLUGIN_UPGRADE(xmlDocPtr docPtr, const char *appid)
        }
 
        for (node = node->children; node; node = node->next) {
-               if (!xmlStrcasecmp(node->name, (const xmlChar *)"livebox")) {
+               if (!xmlStrcasecmp(node->name, (const xmlChar *)"dynamicbox")) {
                        ret = do_install(node, appid);
                        if (ret < 0) {
                                DbgPrint("Returns: %d\n", ret);
diff --git a/pkgmgr_livebox/livebox.xml b/pkgmgr_livebox/livebox.xml
deleted file mode 100644 (file)
index e14cdea..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.nicesj" version="1.0" install-location="auto">
-
-<livebox appid="org.tizen.nicesj.livebox" primary="true" secured="false" network="false" abi="c" timeout="20" period="10.0" libexec="/usr/apps/org.tizen.myapp/libexec/liblive-org.tizen.nicesj.so" pinup="false" script="edje" nodisplay="false">
-       <label>My livebox</label>
-       <icon>/usr/share/icons/small/org.tizen.live-nicesj.png</icon>
-       <label xml:lang="en_US">Sample</label>
-       <label xml:lang="ko_KR">Hangul</label>
-       <content>Content information</content>
-
-       <launch>org.tizen.nicesj</launch>
-
-       <setup>org.tizen.nicesj</setup>
-
-       <box type="image" mouse_event="false">
-               <size touch_effect="true" preview="ABSPATH">1x1</size>
-               <size touch_effect="true" preview="ABSPATH">2x1</size>
-               <size touch_effect="true" need_frame="true">2x2</size>
-               <size>4x1</size>
-               <size need_frame="true">4x2</size>
-               <size touch_effect="false" need_frame="true">4x3</size>
-               <size touch_effect="false">4x4</size>
-
-               <!-- Easy home -->
-               <size>21x21</size>
-               <size preview="ABSPATH">23x21</size>
-               <size>23x23</size>
-
-               <!-- Only supported for special livebox - inhouse / commercialization target only -->
-               <size>0x0</size>
-               <script src="/opt/usr/apps/org.tizen.myapp/res/script/my.edj" group="my_group" />
-       </box>
-
-       <pd type="script">
-               <size>720x100</size>
-               <script src="/opt/usr/apps/org.tizen.myapp/res/script/mypd.edj" group="group_string" />
-       </pd>
-
-       <group>
-               <cluster name="cluster1">
-                       <category name="category1" context="APP_USED_FREQUENTLY">
-                               <option key="time_span" value="value" />
-                               <option key="result_size" value="value" />
-                       </category>
-                       <category name="category2" context="APP_USED_FREQUENTLY_THISTIME">
-                               <option key="time_span" value="value" />
-                               <option key="result_size" value="value" />
-                               <option key="time_interval" value="value" />
-                       </category>
-               </cluster>
-               <cluster name="cluster2">
-                       <category name="category1" context="CONTACT_COMMUNICATED_FREQUENTLY">
-                               <option key="data_provider" value="org.tizen.contact" />
-                               <option key="time_span" value="value" />
-                               <option key="result_size" value="size" />
-                       </category>
-                       <category name="category2" context="CONTACT_COMMUNICATED_FREQUENTLY_THISTIME">
-                               <option key="data_provider" value="org.tizen.contact" />
-                               <option key="time_span" value="value" />
-                               <option key="result_size" value="value" />
-                               <option key="time_interval" value="value" />
-                       </category>
-                       <category name="category3" context="CONTACT_COMMUNICATED_ATLEASTONCE">
-                               <option key="data_provider" value="value" />
-                               <option key="time_span" value="value" />
-                               <option key="result_size" value="value" />
-                       </category>
-               </cluster>
-               <cluster name="noctx_cluster">
-                       <category name="noctx_category" />
-               </cluster>
-               <!--
-                    KEYWORD_SEARCHED_FREQUENTLY(DATA_PROVIDER, TIME_SPAN, RESULT_SIZE)
-                    MUSIC_PLAYED_FREQUENTLY(DATA_PROVIDER, TIME_SPAN, RESULT_SIZE)
-               -->
-       </group>
-</livebox>
-</manifest>
index ec7f868..9eda604 100644 (file)
@@ -4,6 +4,6 @@
 #      DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/master.edc
 #)
 #ADD_DEPENDENCIES(${PROJECT_NAME} master.edj)
-#INSTALL(FILES master.edj DESTINATION "/opt/apps/org.tizen.${PROJECT_NAME}/res/edje")
+#INSTALL(FILES master.edj DESTINATION "/opt/apps/com.samsung.${PROJECT_NAME}/res/edje")
 
 # End of a file
index edbfa21..80abcd2 100644 (file)
--- a/src/abi.c
+++ b/src/abi.c
@@ -20,7 +20,7 @@
 
 #include <Eina.h>
 #include <dlog.h>
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
 
 #include "util.h"
 #include "debug.h"
 int errno;
 
 struct item {
-       char *abi;
-       char *pkgname; /*!< Slave package name */
+    char *abi;
+    char *pkgname; /*!< Slave package name */
 };
 
 static struct {
-       Eina_List *list;
+    Eina_List *list;
 } s_abi = {
-       .list = NULL,
+    .list = NULL,
 };
 
 HAPI int abi_add_entry(const char *abi, const char *pkgname)
 {
-       struct item *item;
-
-       item = malloc(sizeof(*item));
-       if (!item) {
-               ErrPrint("Failed to add a new entry for abi[%s - %s]\n", abi, pkgname);
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       item->abi = strdup(abi);
-       if (!item->abi) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(item);
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       item->pkgname = strdup(pkgname);
-       if (!item->pkgname) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(item->abi);
-               DbgFree(item);
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       s_abi.list = eina_list_append(s_abi.list, item);
-       return LB_STATUS_SUCCESS;
+    struct item *item;
+
+    item = malloc(sizeof(*item));
+    if (!item) {
+       ErrPrint("Failed to add a new entry for abi[%s - %s]\n", abi, pkgname);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    item->abi = strdup(abi);
+    if (!item->abi) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(item);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    item->pkgname = strdup(pkgname);
+    if (!item->pkgname) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(item->abi);
+       DbgFree(item);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    s_abi.list = eina_list_append(s_abi.list, item);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int abi_update_entry(const char *abi, const char *pkgname)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct item *item;
-       char *_pkgname;
-
-       _pkgname = strdup(pkgname);
-       if (!_pkgname) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
+    Eina_List *l;
+    Eina_List *n;
+    struct item *item;
+    char *_pkgname;
+
+    _pkgname = strdup(pkgname);
+    if (!_pkgname) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    EINA_LIST_FOREACH_SAFE(s_abi.list, l, n, item) {
+       if (!strcasecmp(item->abi, abi)) {
+           DbgFree(item->pkgname);
+           item->pkgname = _pkgname;
+           return 0;
        }
+    }
 
-       EINA_LIST_FOREACH_SAFE(s_abi.list, l, n, item) {
-               if (!strcasecmp(item->abi, abi)) {
-                       DbgFree(item->pkgname);
-                       item->pkgname = _pkgname;
-                       return 0;
-               }
-       }
-
-       DbgFree(_pkgname);
-       return LB_STATUS_ERROR_NOT_EXIST;
+    DbgFree(_pkgname);
+    return DBOX_STATUS_ERROR_NOT_EXIST;
 }
 
 HAPI int abi_del_entry(const char *abi)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct item *item;
-
-       EINA_LIST_FOREACH_SAFE(s_abi.list, l, n, item) {
-               if (!strcasecmp(item->abi, abi)) {
-                       s_abi.list = eina_list_remove(s_abi.list, item);
-                       DbgFree(item->abi);
-                       DbgFree(item->pkgname);
-                       DbgFree(item);
-                       return LB_STATUS_SUCCESS;
-               }
+    Eina_List *l;
+    Eina_List *n;
+    struct item *item;
+
+    EINA_LIST_FOREACH_SAFE(s_abi.list, l, n, item) {
+       if (!strcasecmp(item->abi, abi)) {
+           s_abi.list = eina_list_remove(s_abi.list, item);
+           DbgFree(item->abi);
+           DbgFree(item->pkgname);
+           DbgFree(item);
+           return DBOX_STATUS_ERROR_NONE;
        }
+    }
 
-       return LB_STATUS_ERROR_NOT_EXIST;
+    return DBOX_STATUS_ERROR_NOT_EXIST;
 }
 
 HAPI void abi_del_all(void)
 {
-       struct item *item;
+    struct item *item;
 
-       EINA_LIST_FREE(s_abi.list, item) {
-               DbgFree(item->abi);
-               DbgFree(item->pkgname);
-               DbgFree(item);
-       }
+    EINA_LIST_FREE(s_abi.list, item) {
+       DbgFree(item->abi);
+       DbgFree(item->pkgname);
+       DbgFree(item);
+    }
 }
 
 HAPI const char *abi_find_slave(const char *abi)
 {
-       Eina_List *l;
-       struct item *item;
+    Eina_List *l;
+    struct item *item;
 
-       EINA_LIST_FOREACH(s_abi.list, l, item) {
-               if (!strcasecmp(item->abi, abi)) {
-                       return item->pkgname;
-               }
+    EINA_LIST_FOREACH(s_abi.list, l, item) {
+       if (!strcasecmp(item->abi, abi)) {
+           return item->pkgname;
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
 HAPI const char *abi_find_by_pkgname(const char *pkgname)
 {
-       Eina_List *l;
-       struct item *item;
+    Eina_List *l;
+    struct item *item;
 
-       EINA_LIST_FOREACH(s_abi.list, l, item) {
-               if (!strcmp(item->pkgname, pkgname)) {
-                       return item->abi;
-               }
+    EINA_LIST_FOREACH(s_abi.list, l, item) {
+       if (!strcmp(item->pkgname, pkgname)) {
+           return item->abi;
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
 /* End of a file */
index 2b1dc0b..d8d4e8b 100644 (file)
@@ -20,7 +20,7 @@
 
 #include <dlog.h>
 #if defined(HAVE_LIVEBOX)
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
 #else
 #include "lite-errno.h"
 #endif
 #include "conf.h"
 
 static struct info {
-       Eina_List *context_list;
-       struct service_context *svc_ctx;
+    Eina_List *context_list;
+    struct service_context *svc_ctx;
 } s_info = {
-       .context_list = NULL, /*!< \WARN: This is only used for SERVICE THREAD */
-       .svc_ctx = NULL, /*!< \WARN: This is only used for MAIN THREAD */
+    .context_list = NULL, /*!< \WARN: This is only used for SERVICE THREAD */
+    .svc_ctx = NULL, /*!< \WARN: This is only used for MAIN THREAD */
 };
 
 #define ENABLE_BS_ACCESS_CONTROL 1
 
 struct context {
-       struct tcb *tcb;
-       double seq;
+    struct tcb *tcb;
+    double seq;
 };
 
 struct badge_service {
-       const char *cmd;
-       void (*handler)(struct tcb *tcb, struct packet *packet, void *data);
-       const char *rule;
-       const char *access;
+    const char *cmd;
+    void (*handler)(struct tcb *tcb, struct packet *packet, void *data);
+    const char *rule;
+    const char *access;
 };
 
 /*!
@@ -65,31 +65,31 @@ struct badge_service {
  */
 static int _is_valid_permission(int fd, struct badge_service *service)
 {
-       int ret;
+    int ret;
 
-       if (service->rule != NULL && service->access != NULL) {
-               ret = security_server_check_privilege_by_sockfd(fd, service->rule, service->access);
-               if (ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) {
-                       ErrPrint("SMACK:Access denied\n");
-                       return 0;
-               }
+    if (service->rule != NULL && service->access != NULL) {
+       ret = security_server_check_privilege_by_sockfd(fd, service->rule, service->access);
+       if (ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) {
+           ErrPrint("SMACK:Access denied\n");
+           return 0;
        }
+    }
 
-       return 1;
+    return 1;
 }
 
 static int _is_manager_permission(int fd)
 {
-       int ret;
+    int ret;
 
-       ret = security_server_check_privilege_by_sockfd(fd,
-                       "data-provider-master::badge.manager", "w");
-       if (ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) {
-               ErrPrint("SMACK:not a manager\n");
-               return 0;
-       }
+    ret = security_server_check_privilege_by_sockfd(fd,
+           "data-provider-master::badge.manager", "w");
+    if (ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) {
+       ErrPrint("SMACK:not a manager\n");
+       return 0;
+    }
 
-       return 1;
+    return 1;
 }
 
 /*!
@@ -97,14 +97,14 @@ static int _is_manager_permission(int fd)
  */
 static inline char *get_string(char *string)
 {
-       if (string == NULL) {
-               return NULL;
-       }
-       if (string[0] == '\0') {
-               return NULL;
-       }
-
-       return string;
+    if (string == NULL) {
+       return NULL;
+    }
+    if (string[0] == '\0') {
+       return NULL;
+    }
+
+    return string;
 }
 
 /*!
@@ -112,322 +112,322 @@ static inline char *get_string(char *string)
  */
 static void _handler_insert_badge(struct tcb *tcb, struct packet *packet, void *data)
 {
-       int ret = 0, ret_p = 0;
-       struct packet *packet_reply = NULL;
-       struct packet *packet_service = NULL;
-       char *pkgname = NULL;
-       char *writable_pkg = NULL;
-       char *caller = NULL;
-
-       if (packet_get(packet, "sss", &pkgname, &writable_pkg, &caller) == 3) {
-               pkgname = get_string(pkgname);
-               writable_pkg = get_string(writable_pkg);
-               caller = get_string(caller);
-
-               if (pkgname != NULL && writable_pkg != NULL && caller != NULL) {
-                       ret = badge_db_insert(pkgname, writable_pkg, caller);
-               } else {
-                       ret = BADGE_ERROR_INVALID_DATA;
-               }
+    int ret = 0, ret_p = 0;
+    struct packet *packet_reply = NULL;
+    struct packet *packet_service = NULL;
+    char *pkgname = NULL;
+    char *writable_pkg = NULL;
+    char *caller = NULL;
+
+    if (packet_get(packet, "sss", &pkgname, &writable_pkg, &caller) == 3) {
+       pkgname = get_string(pkgname);
+       writable_pkg = get_string(writable_pkg);
+       caller = get_string(caller);
+
+       if (pkgname != NULL && writable_pkg != NULL && caller != NULL) {
+           ret = badge_db_insert(pkgname, writable_pkg, caller);
+       } else {
+           ret = BADGE_ERROR_INVALID_PARAMETER;
+       }
 
-               packet_reply = packet_create_reply(packet, "i", ret);
-               if (packet_reply) {
-                       if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
-                               ErrPrint("Failed to send a reply packet:%d", ret_p);
-                       }
-                       packet_destroy(packet_reply);
-               } else {
-                       ErrPrint("Failed to create a reply packet");
-               }
+       packet_reply = packet_create_reply(packet, "i", ret);
+       if (packet_reply) {
+           if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
+               ErrPrint("Failed to send a reply packet:%d", ret_p);
+           }
+           packet_destroy(packet_reply);
+       } else {
+           ErrPrint("Failed to create a reply packet");
+       }
 
-               if (ret == BADGE_ERROR_NONE) {
-                       packet_service = packet_create("insert_badge", "is", ret, pkgname);
-                       if (packet_service != NULL) {
-                               if ((ret_p = service_common_multicast_packet(tcb, packet_service, TCB_CLIENT_TYPE_SERVICE)) < 0) {
-                                       ErrPrint("Failed to send a muticast packet:%d", ret_p);
-                               }
-                               packet_destroy(packet_service);
-                       } else {
-                               ErrPrint("Failed to create a multicast packet");
-                       }
-               } else {
-                       ErrPrint("Failed to insert a badge:%d", ret);
+       if (ret == BADGE_ERROR_NONE) {
+           packet_service = packet_create("insert_badge", "is", ret, pkgname);
+           if (packet_service != NULL) {
+               if ((ret_p = service_common_multicast_packet(tcb, packet_service, TCB_CLIENT_TYPE_SERVICE)) < 0) {
+                   ErrPrint("Failed to send a muticast packet:%d", ret_p);
                }
+               packet_destroy(packet_service);
+           } else {
+               ErrPrint("Failed to create a multicast packet");
+           }
        } else {
-               ErrPrint("Failed to get data from the packet");
+           ErrPrint("Failed to insert a badge:%d", ret);
        }
+    } else {
+       ErrPrint("Failed to get data from the packet");
+    }
 }
 
 static void _handler_delete_badge(struct tcb *tcb, struct packet *packet, void *data)
 {
-       int ret = 0, ret_p = 0;
-       struct packet *packet_reply = NULL;
-       struct packet *packet_service = NULL;
-       char *pkgname = NULL;
-       char *caller = NULL;
-
-       if (packet_get(packet, "ss", &pkgname, &caller) == 2) {
-               pkgname = get_string(pkgname);
-               caller = get_string(caller);
-
-               if (pkgname != NULL && caller != NULL) {
-                       if (_is_manager_permission(tcb_fd(tcb)) == 1) {
-                               ret = badge_db_delete(pkgname, pkgname);
-                       } else {
-                               ret = badge_db_delete(pkgname, caller);
-                       }
-               } else {
-                       ret = BADGE_ERROR_INVALID_DATA;
-               }
+    int ret = 0, ret_p = 0;
+    struct packet *packet_reply = NULL;
+    struct packet *packet_service = NULL;
+    char *pkgname = NULL;
+    char *caller = NULL;
+
+    if (packet_get(packet, "ss", &pkgname, &caller) == 2) {
+       pkgname = get_string(pkgname);
+       caller = get_string(caller);
+
+       if (pkgname != NULL && caller != NULL) {
+           if (_is_manager_permission(tcb_fd(tcb)) == 1) {
+               ret = badge_db_delete(pkgname, pkgname);
+           } else {
+               ret = badge_db_delete(pkgname, caller);
+           }
+       } else {
+           ret = BADGE_ERROR_INVALID_PARAMETER;
+       }
 
-               packet_reply = packet_create_reply(packet, "i", ret);
-               if (packet_reply) {
-                       if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
-                               ErrPrint("Failed to send a reply packet:%d", ret_p);
-                       }
-                       packet_destroy(packet_reply);
-               } else {
-                       ErrPrint("Failed to create a reply packet");
-               }
+       packet_reply = packet_create_reply(packet, "i", ret);
+       if (packet_reply) {
+           if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
+               ErrPrint("Failed to send a reply packet:%d", ret_p);
+           }
+           packet_destroy(packet_reply);
+       } else {
+           ErrPrint("Failed to create a reply packet");
+       }
 
-               if (ret == BADGE_ERROR_NONE) {
-                       packet_service = packet_create("delete_badge", "is", ret, pkgname);
-                       if (packet_service != NULL) {
-                               if ((ret_p = service_common_multicast_packet(tcb, packet_service, TCB_CLIENT_TYPE_SERVICE)) < 0) {
-                                       ErrPrint("Failed to send a muticast packet:%d", ret_p);
-                               }
-                               packet_destroy(packet_service);
-                       } else {
-                               ErrPrint("Failed to create a multicast packet");
-                       }
-               } else {
-                       ErrPrint("Failed to delete a badge:%d", ret);
+       if (ret == BADGE_ERROR_NONE) {
+           packet_service = packet_create("delete_badge", "is", ret, pkgname);
+           if (packet_service != NULL) {
+               if ((ret_p = service_common_multicast_packet(tcb, packet_service, TCB_CLIENT_TYPE_SERVICE)) < 0) {
+                   ErrPrint("Failed to send a muticast packet:%d", ret_p);
                }
+               packet_destroy(packet_service);
+           } else {
+               ErrPrint("Failed to create a multicast packet");
+           }
        } else {
-               ErrPrint("Failed to get data from the packet");
+           ErrPrint("Failed to delete a badge:%d", ret);
        }
+    } else {
+       ErrPrint("Failed to get data from the packet");
+    }
 }
 
 static void _handler_set_badge_count(struct tcb *tcb, struct packet *packet, void *data)
 {
-       int ret = 0, ret_p = 0;
-       struct packet *packet_reply = NULL;
-       struct packet *packet_service = NULL;
-       char *pkgname = NULL;
-       char *caller = NULL;
-       int count = 0;
-
-       if (packet_get(packet, "ssi", &pkgname, &caller, &count) == 3) {
-               pkgname = get_string(pkgname);
-               caller = get_string(caller);
-
-               if (pkgname != NULL && caller != NULL) {
-                       ret = badge_db_set_count(pkgname, caller, count);
-               } else {
-                       ret = BADGE_ERROR_INVALID_DATA;
-               }
+    int ret = 0, ret_p = 0;
+    struct packet *packet_reply = NULL;
+    struct packet *packet_service = NULL;
+    char *pkgname = NULL;
+    char *caller = NULL;
+    int count = 0;
+
+    if (packet_get(packet, "ssi", &pkgname, &caller, &count) == 3) {
+       pkgname = get_string(pkgname);
+       caller = get_string(caller);
+
+       if (pkgname != NULL && caller != NULL) {
+           ret = badge_db_set_count(pkgname, caller, count);
+       } else {
+           ret = BADGE_ERROR_INVALID_PARAMETER;
+       }
 
-               packet_reply = packet_create_reply(packet, "i", ret);
-               if (packet_reply) {
-                       if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
-                               ErrPrint("Failed to send a reply packet:%d", ret_p);
-                       }
-                       packet_destroy(packet_reply);
-               } else {
-                       ErrPrint("Failed to create a reply packet");
-               }
+       packet_reply = packet_create_reply(packet, "i", ret);
+       if (packet_reply) {
+           if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
+               ErrPrint("Failed to send a reply packet:%d", ret_p);
+           }
+           packet_destroy(packet_reply);
+       } else {
+           ErrPrint("Failed to create a reply packet");
+       }
 
-               if (ret == BADGE_ERROR_NONE) {
-                       packet_service = packet_create("set_badge_count", "isi", ret, pkgname, count);
-                       if (packet_service != NULL) {
-                               if ((ret_p = service_common_multicast_packet(tcb, packet_service, TCB_CLIENT_TYPE_SERVICE)) < 0) {
-                                       ErrPrint("Failed to send a muticast packet:%d", ret_p);
-                               }
-                               packet_destroy(packet_service);
-                       } else {
-                               ErrPrint("Failed to create a multicast packet");
-                       }
-               } else {
-                       ErrPrint("Failed to set count of badge:%d", ret);
+       if (ret == BADGE_ERROR_NONE) {
+           packet_service = packet_create("set_badge_count", "isi", ret, pkgname, count);
+           if (packet_service != NULL) {
+               if ((ret_p = service_common_multicast_packet(tcb, packet_service, TCB_CLIENT_TYPE_SERVICE)) < 0) {
+                   ErrPrint("Failed to send a muticast packet:%d", ret_p);
                }
+               packet_destroy(packet_service);
+           } else {
+               ErrPrint("Failed to create a multicast packet");
+           }
        } else {
-               ErrPrint("Failed to get data from the packet");
+           ErrPrint("Failed to set count of badge:%d", ret);
        }
+    } else {
+       ErrPrint("Failed to get data from the packet");
+    }
 }
 
 static void _handler_set_display_option(struct tcb *tcb, struct packet *packet, void *data)
 {
-       int ret = 0, ret_p = 0;
-       struct packet *packet_reply = NULL;
-       struct packet *packet_service = NULL;
-       char *pkgname = NULL;
-       char *caller = NULL;
-       int is_display = 0;
-
-       if (packet_get(packet, "ssi", &pkgname, &caller, &is_display) == 3) {
-               pkgname = get_string(pkgname);
-               caller = get_string(caller);
-
-               if (pkgname != NULL && caller != NULL) {
-                       ret = badge_db_set_display_option(pkgname, caller, is_display);
-               } else {
-                       ret = BADGE_ERROR_INVALID_DATA;
-               }
+    int ret = 0, ret_p = 0;
+    struct packet *packet_reply = NULL;
+    struct packet *packet_service = NULL;
+    char *pkgname = NULL;
+    char *caller = NULL;
+    int is_display = 0;
+
+    if (packet_get(packet, "ssi", &pkgname, &caller, &is_display) == 3) {
+       pkgname = get_string(pkgname);
+       caller = get_string(caller);
+
+       if (pkgname != NULL && caller != NULL) {
+           ret = badge_db_set_display_option(pkgname, caller, is_display);
+       } else {
+           ret = BADGE_ERROR_INVALID_PARAMETER;
+       }
 
-               packet_reply = packet_create_reply(packet, "i", ret);
-               if (packet_reply) {
-                       if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
-                               ErrPrint("Failed to send a reply packet:%d", ret_p);
-                       }
-                       packet_destroy(packet_reply);
-               } else {
-                       ErrPrint("Failed to create a reply packet");
-               }
+       packet_reply = packet_create_reply(packet, "i", ret);
+       if (packet_reply) {
+           if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
+               ErrPrint("Failed to send a reply packet:%d", ret_p);
+           }
+           packet_destroy(packet_reply);
+       } else {
+           ErrPrint("Failed to create a reply packet");
+       }
 
-               if (ret == BADGE_ERROR_NONE) {
-                       packet_service = packet_create("set_disp_option", "isi", ret, pkgname, is_display);
-                       if (packet_service != NULL) {
-                               if ((ret_p = service_common_multicast_packet(tcb, packet_service, TCB_CLIENT_TYPE_SERVICE)) < 0) {
-                                       ErrPrint("Failed to send a muticast packet:%d", ret_p);
-                               }
-                               packet_destroy(packet_service);
-                       } else {
-                               ErrPrint("Failed to create a multicast packet");
-                       }
-               } else {
-                       ErrPrint("Failed to set display option of badge:%d", ret);
+       if (ret == BADGE_ERROR_NONE) {
+           packet_service = packet_create("set_disp_option", "isi", ret, pkgname, is_display);
+           if (packet_service != NULL) {
+               if ((ret_p = service_common_multicast_packet(tcb, packet_service, TCB_CLIENT_TYPE_SERVICE)) < 0) {
+                   ErrPrint("Failed to send a muticast packet:%d", ret_p);
                }
+               packet_destroy(packet_service);
+           } else {
+               ErrPrint("Failed to create a multicast packet");
+           }
        } else {
-               ErrPrint("Failed to get data from the packet");
+           ErrPrint("Failed to set display option of badge:%d", ret);
        }
+    } else {
+       ErrPrint("Failed to get data from the packet");
+    }
 }
 
 static void _handler_set_setting_property(struct tcb *tcb, struct packet *packet, void *data)
 {
-       int ret = 0, ret_p = 0;
-       int is_display = 0;
-       struct packet *packet_reply = NULL;
-       struct packet *packet_service = NULL;
-       char *pkgname = NULL;
-       char *property = NULL;
-       char *value = NULL;
-
-       if (packet_get(packet, "sss", &pkgname, &property, &value) == 3) {
-               pkgname = get_string(pkgname);
-               property = get_string(property);
-               value = get_string(value);
-
-               if (pkgname != NULL && property != NULL && value != NULL) {
-                       ret = badge_setting_db_set(pkgname, property, value);
-               } else {
-                       ret = BADGE_ERROR_INVALID_DATA;
-               }
+    int ret = 0, ret_p = 0;
+    int is_display = 0;
+    struct packet *packet_reply = NULL;
+    struct packet *packet_service = NULL;
+    char *pkgname = NULL;
+    char *property = NULL;
+    char *value = NULL;
+
+    if (packet_get(packet, "sss", &pkgname, &property, &value) == 3) {
+       pkgname = get_string(pkgname);
+       property = get_string(property);
+       value = get_string(value);
+
+       if (pkgname != NULL && property != NULL && value != NULL) {
+           ret = badge_setting_db_set(pkgname, property, value);
+       } else {
+           ret = BADGE_ERROR_INVALID_PARAMETER;
+       }
 
-               packet_reply = packet_create_reply(packet, "ii", ret, ret);
-               if (packet_reply) {
-                       if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
-                               ErrPrint("failed to send reply packet:%d\n", ret_p);
-                       }
-                       packet_destroy(packet_reply);
+       packet_reply = packet_create_reply(packet, "ii", ret, ret);
+       if (packet_reply) {
+           if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
+               ErrPrint("failed to send reply packet:%d\n", ret_p);
+           }
+           packet_destroy(packet_reply);
+       } else {
+           ErrPrint("failed to create a reply packet\n");
+       }
+
+       if (ret == BADGE_ERROR_NONE) {
+           if (strcmp(property, "OPT_BADGE") == 0) {
+               if (strcmp(value, "ON") == 0) {
+                   is_display = 1;
                } else {
-                       ErrPrint("failed to create a reply packet\n");
+                   is_display = 0;
                }
 
-               if (ret == BADGE_ERROR_NONE) {
-                       if (strcmp(property, "OPT_BADGE") == 0) {
-                               if (strcmp(value, "ON") == 0) {
-                                       is_display = 1;
-                               } else {
-                                       is_display = 0;
-                               }
-
-                               packet_service = packet_create("set_disp_option", "isi", ret, pkgname, is_display);
-                               if (packet_service != NULL) {
-                                       if ((ret_p = service_common_multicast_packet(tcb, packet_service, TCB_CLIENT_TYPE_SERVICE)) < 0) {
-                                               ErrPrint("Failed to send a muticast packet:%d", ret_p);
-                                       }
-                                       packet_destroy(packet_service);
-                               } else {
-                                       ErrPrint("Failed to create a multicast packet");
-                               }
-                       }
+               packet_service = packet_create("set_disp_option", "isi", ret, pkgname, is_display);
+               if (packet_service != NULL) {
+                   if ((ret_p = service_common_multicast_packet(tcb, packet_service, TCB_CLIENT_TYPE_SERVICE)) < 0) {
+                       ErrPrint("Failed to send a muticast packet:%d", ret_p);
+                   }
+                   packet_destroy(packet_service);
                } else {
-                       ErrPrint("failed to set noti property:%d\n", ret);
+                   ErrPrint("Failed to create a multicast packet");
                }
+           }
        } else {
-               ErrPrint("Failed to get data from the packet");
+           ErrPrint("failed to set noti property:%d\n", ret);
        }
+    } else {
+       ErrPrint("Failed to get data from the packet");
+    }
 }
 
 static void _handler_get_setting_property(struct tcb *tcb, struct packet *packet, void *data)
 {
-       int ret = 0, ret_p = 0;
-       struct packet *packet_reply = NULL;
-       char *pkgname = NULL;
-       char *property = NULL;
-       char *value = NULL;
-
-       if (packet_get(packet, "sss", &pkgname, &property) == 2) {
-               pkgname = get_string(pkgname);
-               property = get_string(property);
-
-               if (pkgname != NULL && property != NULL) {
-                       ret = badge_setting_db_get(pkgname, property, &value);
-               } else {
-                       ret = BADGE_ERROR_INVALID_DATA;
-               }
+    int ret = 0, ret_p = 0;
+    struct packet *packet_reply = NULL;
+    char *pkgname = NULL;
+    char *property = NULL;
+    char *value = NULL;
+
+    if (packet_get(packet, "sss", &pkgname, &property) == 2) {
+       pkgname = get_string(pkgname);
+       property = get_string(property);
+
+       if (pkgname != NULL && property != NULL) {
+           ret = badge_setting_db_get(pkgname, property, &value);
+       } else {
+           ret = BADGE_ERROR_INVALID_PARAMETER;
+       }
 
-               packet_reply = packet_create_reply(packet, "is", ret, value);
-               if (packet_reply) {
-                       if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
-                               ErrPrint("failed to send reply packet:%d\n", ret_p);
-                       }
-                       packet_destroy(packet_reply);
-               } else {
-                       ErrPrint("failed to create a reply packet\n");
-               }
+       packet_reply = packet_create_reply(packet, "is", ret, value);
+       if (packet_reply) {
+           if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
+               ErrPrint("failed to send reply packet:%d\n", ret_p);
+           }
+           packet_destroy(packet_reply);
+       } else {
+           ErrPrint("failed to create a reply packet\n");
+       }
 
-               if (value != NULL) {
-                       DbgFree(value);
-               }
+       if (value != NULL) {
+           DbgFree(value);
        }
+    }
 }
 
 static void _handler_service_register(struct tcb *tcb, struct packet *packet, void *data)
 {
-       int ret = 0;
-       struct packet *packet_reply;
-
-       ret = tcb_client_type_set(tcb, TCB_CLIENT_TYPE_SERVICE);
-       if (ret < 0) {
-               ErrPrint("Failed to set the type of client:%d", ret);
-       }
-
-       packet_reply = packet_create_reply(packet, "i", ret);
-       if (packet_reply) {
-               if ((ret = service_common_unicast_packet(tcb, packet_reply)) < 0) {
-                       ErrPrint("Failed to send a reply packet:%d", ret);
-               }
-               packet_destroy(packet_reply);
-       } else {
-               ErrPrint("Failed to create a reply packet");
+    int ret = 0;
+    struct packet *packet_reply;
+
+    ret = tcb_client_type_set(tcb, TCB_CLIENT_TYPE_SERVICE);
+    if (ret < 0) {
+       ErrPrint("Failed to set the type of client:%d", ret);
+    }
+
+    packet_reply = packet_create_reply(packet, "i", ret);
+    if (packet_reply) {
+       if ((ret = service_common_unicast_packet(tcb, packet_reply)) < 0) {
+           ErrPrint("Failed to send a reply packet:%d", ret);
        }
+       packet_destroy(packet_reply);
+    } else {
+       ErrPrint("Failed to create a reply packet");
+    }
 }
 
 static void _handler_access_control_error(struct tcb *tcb, struct packet *packet)
 {
-       int ret_p = 0;
-       struct packet *packet_reply = NULL;
+    int ret_p = 0;
+    struct packet *packet_reply = NULL;
 
-       packet_reply = packet_create_reply(packet, "i", BADGE_ERROR_PERMISSION_DENIED);
-       if (packet_reply) {
-               if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
-                       ErrPrint("Failed to send a reply packet:%d", ret_p);
-               }
-               packet_destroy(packet_reply);
-       } else {
-               ErrPrint("Failed to create a reply packet");
+    packet_reply = packet_create_reply(packet, "i", BADGE_ERROR_PERMISSION_DENIED);
+    if (packet_reply) {
+       if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
+           ErrPrint("Failed to send a reply packet:%d", ret_p);
        }
+       packet_destroy(packet_reply);
+    } else {
+       ErrPrint("Failed to create a reply packet");
+    }
 }
 
 /*!
@@ -435,107 +435,107 @@ static void _handler_access_control_error(struct tcb *tcb, struct packet *packet
  */
 static int service_thread_main(struct tcb *tcb, struct packet *packet, void *data)
 {
-       int i = 0;
-       const char *command;
-       static struct badge_service service_req_table[] = {
-               {
-                       .cmd = "insert_badge",
-                       .handler = _handler_insert_badge,
-                       .rule = "data-provider-master::badge.client",
-                       .access = "w",
-               },
-               {
-                       .cmd = "delete_badge",
-                       .handler = _handler_delete_badge,
-                       .rule = "data-provider-master::badge.client",
-                       .access = "w",
-               },
-               {
-                       .cmd = "set_badge_count",
-                       .handler = _handler_set_badge_count,
-                       .rule = "data-provider-master::badge.client",
-                       .access = "w",
-               },
-               {
-                       .cmd = "set_disp_option",
-                       .handler = _handler_set_display_option,
-                       .rule = "data-provider-master::badge.client",
-                       .access = "w",
-               },
-               {
-                       .cmd = "set_noti_property",
-                       .handler = _handler_set_setting_property,
-                       .rule = "data-provider-master::badge.client",
-                       .access = "w",
-               },
-               {
-                       .cmd = "get_noti_property",
-                       .handler = _handler_get_setting_property,
-                       .rule = "data-provider-master::badge.client",
-                       .access = "r",
-               },
-               {
-                       .cmd = "service_register",
-                       .handler = _handler_service_register,
-                       .rule = NULL,
-                       .access = NULL,
-               },
-               {
-                       .cmd = NULL,
-                       .handler = NULL,
-                       .rule = NULL,
-                       .access = NULL,
-               },
-       };
-
-       if (!packet) {
-               DbgPrint("TCB: %p is terminated (NIL packet)\n", tcb);
-               return 0;
-       }
+    int i = 0;
+    const char *command;
+    static struct badge_service service_req_table[] = {
+       {
+           .cmd = "insert_badge",
+           .handler = _handler_insert_badge,
+           .rule = "data-provider-master::badge.client",
+           .access = "w",
+       },
+       {
+           .cmd = "delete_badge",
+           .handler = _handler_delete_badge,
+           .rule = "data-provider-master::badge.client",
+           .access = "w",
+       },
+       {
+           .cmd = "set_badge_count",
+           .handler = _handler_set_badge_count,
+           .rule = "data-provider-master::badge.client",
+           .access = "w",
+       },
+       {
+           .cmd = "set_disp_option",
+           .handler = _handler_set_display_option,
+           .rule = "data-provider-master::badge.client",
+           .access = "w",
+       },
+       {
+           .cmd = "set_noti_property",
+           .handler = _handler_set_setting_property,
+           .rule = "data-provider-master::badge.client",
+           .access = "w",
+       },
+       {
+           .cmd = "get_noti_property",
+           .handler = _handler_get_setting_property,
+           .rule = "data-provider-master::badge.client",
+           .access = "r",
+       },
+       {
+           .cmd = "service_register",
+           .handler = _handler_service_register,
+           .rule = NULL,
+           .access = NULL,
+       },
+       {
+           .cmd = NULL,
+           .handler = NULL,
+           .rule = NULL,
+           .access = NULL,
+       },
+    };
+
+    if (!packet) {
+       DbgPrint("TCB: %p is terminated (NIL packet)\n", tcb);
+       return 0;
+    }
 
-       command = packet_command(packet);
-       if (!command) {
-               ErrPrint("Invalid command\n");
-               return -EINVAL;
-       }
-       DbgPrint("Command: [%s], Packet type[%d]\n", command, packet_type(packet));
+    command = packet_command(packet);
+    if (!command) {
+       ErrPrint("Invalid command\n");
+       return -EINVAL;
+    }
+    DbgPrint("Command: [%s], Packet type[%d]\n", command, packet_type(packet));
 
-       switch (packet_type(packet)) {
+    switch (packet_type(packet)) {
        case PACKET_REQ:
-               /* Need to send reply packet */
-               for (i = 0; service_req_table[i].cmd; i++) {
-                       if (strcmp(service_req_table[i].cmd, command)) {
-                               continue;
-                       }
+           /* Need to send reply packet */
+           for (i = 0; service_req_table[i].cmd; i++) {
+               if (strcmp(service_req_table[i].cmd, command)) {
+                   continue;
+               }
 
 #if ENABLE_BS_ACCESS_CONTROL
-                       if (_is_valid_permission(tcb_fd(tcb), &(service_req_table[i])) == 1) {
-                               service_req_table[i].handler(tcb, packet, data);
-                       } else {
-                               _handler_access_control_error(tcb, packet);
-                       }
+               if (_is_valid_permission(tcb_fd(tcb), &(service_req_table[i])) == 1) {
+                   service_req_table[i].handler(tcb, packet, data);
+               } else {
+                   _handler_access_control_error(tcb, packet);
+               }
 #else
-                       _is_valid_permission(tcb_fd(tcb), &(service_req_table[i]));
-                       service_req_table[i].handler(tcb, packet, data);
+               _is_valid_permission(tcb_fd(tcb), &(service_req_table[i]));
+               service_req_table[i].handler(tcb, packet, data);
 #endif
-                       break;
-               }
-
                break;
+           }
+
+           break;
        case PACKET_REQ_NOACK:
-               break;
+           break;
        case PACKET_ACK:
-               break;
+           break;
        default:
-               ErrPrint("Packet type is not valid[%s]\n", command);
-               return -EINVAL;
-       }
-
-       /*!
-        * return value has no meanning,
-        * it will be printed by dlogutil.
-        */
-       return 0;
+           ErrPrint("Packet type is not valid[%s]\n", command);
+           return -EINVAL;
+    }
+
+    /*!
+     * return value has no meanning,
+     * it will be printed by dlogutil.
+     */
+    return 0;
 }
 
 
@@ -545,49 +545,49 @@ static int service_thread_main(struct tcb *tcb, struct packet *packet, void *dat
  */
 HAPI int badge_service_init(void)
 {
-       if (s_info.svc_ctx) {
-               ErrPrint("Already initialized\n");
-               return LB_STATUS_ERROR_ALREADY;
-       }
-
-       s_info.svc_ctx = service_common_create(BADGE_SOCKET, service_thread_main, NULL);
-       if (!s_info.svc_ctx) {
-               ErrPrint("Unable to activate service thread\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       if (smack_fsetlabel(service_common_fd(s_info.svc_ctx), BADGE_SMACK_LABEL, SMACK_LABEL_IPOUT) != 0) {
-               if (errno != EOPNOTSUPP) {
-                       ErrPrint("Unable to set SMACK label(%d)\n", errno);
-                       service_common_destroy(s_info.svc_ctx);
-                       s_info.svc_ctx = NULL;
-                       return LB_STATUS_ERROR_FAULT;
-               }
+    if (s_info.svc_ctx) {
+       ErrPrint("Already initialized\n");
+       return DBOX_STATUS_ERROR_ALREADY;
+    }
+
+    s_info.svc_ctx = service_common_create(BADGE_SOCKET, service_thread_main, NULL);
+    if (!s_info.svc_ctx) {
+       ErrPrint("Unable to activate service thread\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    if (smack_fsetlabel(service_common_fd(s_info.svc_ctx), BADGE_SMACK_LABEL, SMACK_LABEL_IPOUT) != 0) {
+       if (errno != EOPNOTSUPP) {
+           ErrPrint("Unable to set SMACK label(%d)\n", errno);
+           service_common_destroy(s_info.svc_ctx);
+           s_info.svc_ctx = NULL;
+           return DBOX_STATUS_ERROR_FAULT;
        }
-
-       if (smack_fsetlabel(service_common_fd(s_info.svc_ctx), BADGE_SMACK_LABEL, SMACK_LABEL_IPIN) != 0) {
-               if (errno != EOPNOTSUPP) {
-                       ErrPrint("Unable to set SMACK label(%d)\n", errno);
-                       service_common_destroy(s_info.svc_ctx);
-                       s_info.svc_ctx = NULL;
-                       return LB_STATUS_ERROR_FAULT;
-               }
+    }
+
+    if (smack_fsetlabel(service_common_fd(s_info.svc_ctx), BADGE_SMACK_LABEL, SMACK_LABEL_IPIN) != 0) {
+       if (errno != EOPNOTSUPP) {
+           ErrPrint("Unable to set SMACK label(%d)\n", errno);
+           service_common_destroy(s_info.svc_ctx);
+           s_info.svc_ctx = NULL;
+           return DBOX_STATUS_ERROR_FAULT;
        }
+    }
 
-       DbgPrint("Successfully initiated\n");
-       return LB_STATUS_SUCCESS;
+    DbgPrint("Successfully initiated\n");
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int badge_service_fini(void)
 {
-       if (!s_info.svc_ctx) {
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       service_common_destroy(s_info.svc_ctx);
-       s_info.svc_ctx = NULL;
-       DbgPrint("Successfully finalized\n");
-       return LB_STATUS_SUCCESS;
+    if (!s_info.svc_ctx) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    service_common_destroy(s_info.svc_ctx);
+    s_info.svc_ctx = NULL;
+    DbgPrint("Successfully finalized\n");
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 /* End of a file */
index c27eecf..b118ca3 100644 (file)
 
 #include <dlog.h>
 #include <packet.h>
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
+#include <dynamicbox_buffer.h>
+#include <dynamicbox_service.h>
+#include <dynamicbox_conf.h>
 
 #include "debug.h"
 #include "conf.h"
 #include "buffer_handler.h"
 #include "script_handler.h" // Reverse dependency. must has to be broken
 
-struct buffer {
-       enum {
-               CREATED = 0x00beef00,
-               DESTROYED = 0x00dead00
-       } state;
-       enum buffer_type type;
-       int refcnt;
-       void *info;
-       char data[];
-};
-
 /*!
  * \brief Allocate this in the buffer->data.
  */
 struct gem_data {
-       DRI2Buffer *dri2_buffer;
-       unsigned int attachments[1];
-       tbm_bo pixmap_bo;
-       int count;
-       int buf_count;
-       int w;
-       int h;
-       int depth;
-       Pixmap pixmap;
-       void *data; /* Gem layer */
-       int refcnt;
-
-       void *compensate_data; /* Check the pitch value, copy this to data */
+    DRI2Buffer *dri2_buffer;
+    unsigned int attachments[1];
+    tbm_bo pixmap_bo;
+    int count;
+    int buf_count;
+    int w;
+    int h;
+    int depth;
+    Pixmap pixmap;
+    void *data; /* Gem layer */
+    int refcnt;
+
+    void *compensate_data; /* Check the pitch value, copy this to data */
 };
 
 struct buffer_info
 {
-       void *buffer;
-       char *id;
-       char *lock;
-       int lock_fd;
+    void *buffer;
+    char *id;
+    dynamicbox_lock_info_t lock_info;
 
-       enum buffer_type type;
+    enum dynamicbox_fb_type type;
 
-       int w;
-       int h;
-       int pixel_size;
-       int is_loaded;
+    int w;
+    int h;
+    int pixel_size;
+    int is_loaded;
 
-       struct inst_info *inst;
-       void *data;
+    struct inst_info *inst;
+    void *data;
 };
 
 static struct {
-       tbm_bufmgr slp_bufmgr;
-       int evt_base;
-       int err_base;
-       int fd;
-       Eina_List *pixmap_list;
+    tbm_bufmgr slp_bufmgr;
+    int evt_base;
+    int err_base;
+    int fd;
+    Eina_List *pixmap_list;
 } s_info = {
-       .slp_bufmgr = NULL,
-       .evt_base = 0,
-       .err_base = 0,
-       .fd = -1,
-       .pixmap_list = NULL,
+    .slp_bufmgr = NULL,
+    .evt_base = 0,
+    .err_base = 0,
+    .fd = -1,
+    .pixmap_list = NULL,
 };
 
-static int destroy_lock_file(struct buffer_info *info)
+static inline dynamicbox_fb_t create_pixmap(struct buffer_info *info)
 {
-       if (!info->inst) {
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       if (!info->lock) {
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       if (close(info->lock_fd) < 0) {
-               ErrPrint("close: %s\n", strerror(errno));
-       }
-       info->lock_fd = -1;
-
-       if (unlink(info->lock) < 0) {
-               ErrPrint("unlink: %s\n", strerror(errno));
-       }
-
-       DbgFree(info->lock);
-       info->lock = NULL;
-       return LB_STATUS_SUCCESS;
-}
-
-static int create_lock_file(struct buffer_info *info)
-{
-       const char *id;
-       int len;
-       char *file;
-       char target[3] = "pd";
-
-       if (!info->inst) {
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       id = instance_id(info->inst);
-       if (!id) {
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       len = strlen(id);
-       file = malloc(len + 20);
-       if (!file) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    struct gem_data *gem;
+    dynamicbox_fb_t buffer;
+    Display *disp;
+    Window parent;
+    XGCValues gcv;
+    GC gc;
+
+    disp = ecore_x_display_get();
+    if (!disp) {
+       return NULL;
+    }
 
-       if (script_handler_buffer_info(instance_pd_script(info->inst)) != info && instance_pd_buffer(info->inst) != info) {
-               target[0] = 'l';
-               target[1] = 'b';
-               /* target[2] = '\0'; // We already have this ;) */
-       }
+    parent = DefaultRootWindow(disp);
 
-       snprintf(file, len + 20, "%s.%s.lck", util_uri_to_path(id), target);
-       info->lock_fd = open(file, O_WRONLY|O_CREAT, 0644);
-       if (info->lock_fd < 0) {
-               ErrPrint("open: %s\n", strerror(errno));
-               DbgFree(file);
-               return LB_STATUS_ERROR_IO;
-       }
+    buffer = calloc(1, sizeof(*buffer) + sizeof(*gem));
+    if (!buffer) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
+
+    gem = (struct gem_data *)buffer->data;
+
+    buffer->type = DBOX_FB_TYPE_PIXMAP;
+    buffer->refcnt = 1;
+    buffer->state = DBOX_FB_STATE_CREATED;
+
+    gem->attachments[0] = DRI2BufferFrontLeft;
+    gem->count = 1;
+    gem->w = info->w; /*!< This can be changed by DRI2GetBuffers */
+    gem->h = info->h; /*!< This can be changed by DRI2GetBuffers */
+    gem->depth = info->pixel_size;
+    /*!
+     * \NOTE
+     * Use the 24 Bits
+     * 32 Bits is not supported for video playing.
+     * But for the transparent background, use the 32 bits, and give up video.
+     */
+    gem->pixmap = XCreatePixmap(disp, parent, info->w, info->h, (info->pixel_size << 3));
+    if (gem->pixmap == (Pixmap)0) {
+       ErrPrint("Failed to create a pixmap\n");
+       DbgFree(buffer);
+       return NULL;
+    }
+
+    /*!
+     * \note
+     * Clear pixmap
+     */
+    memset(&gcv, 0, sizeof(gcv));
+    gc = XCreateGC(disp, gem->pixmap, GCForeground, &gcv);
+    if (gc) {
+       XFillRectangle(disp, gem->pixmap, gc, 0, 0, info->w, info->h);
+       XSync(disp, False);
+       XFreeGC(disp, gc);
+    } else {
+       XSync(disp, False);
+       ErrPrint("Unable to clear the pixmap\n");
+    }
 
-       info->lock = file;
-       return LB_STATUS_SUCCESS;
+    return buffer;
 }
 
-static int do_buffer_lock(struct buffer_info *buffer)
+static inline int create_gem(dynamicbox_fb_t buffer)
 {
-       struct flock flock;
-       int ret;
+    struct gem_data *gem;
+    Display *disp;
 
-       if (buffer->lock_fd < 0) {
-               return LB_STATUS_SUCCESS;
-       }
+    disp = ecore_x_display_get();
+    if (!disp) {
+       ErrPrint("Failed to get display\n");
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
 
-       flock.l_type = F_WRLCK;
-       flock.l_whence = SEEK_SET;
-       flock.l_start = 0;
-       flock.l_len = 0;
-       flock.l_pid = getpid();
-
-       do {
-               ret = fcntl(buffer->lock_fd, F_SETLKW, &flock);
-               if (ret < 0) {
-                       ret = errno;
-                       ErrPrint("fcntl: %s\n", strerror(errno));
-               }
-       } while (ret == EINTR);
+    gem = (struct gem_data *)buffer->data;
 
-       return LB_STATUS_SUCCESS;
+    if (s_info.fd < 0) {
+       gem->data = calloc(1, gem->w * gem->h * gem->depth);
+       if (!gem->data) {
+           ErrPrint("Heap: %s\n", strerror(errno));
+           return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+       }
+
+       ErrPrint("DRI2(gem) is not supported - Fallback to the S/W Backend\n");
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    DRI2CreateDrawable(disp, gem->pixmap);
+
+    gem->dri2_buffer = DRI2GetBuffers(disp, gem->pixmap,
+           &gem->w, &gem->h, gem->attachments, gem->count, &gem->buf_count);
+    if (!gem->dri2_buffer || !gem->dri2_buffer->name) {
+       ErrPrint("Failed to get a gem buffer\n");
+       DRI2DestroyDrawable(disp, gem->pixmap);
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+    /*!
+     * \How can I destroy this?
+     */
+    gem->pixmap_bo = tbm_bo_import(s_info.slp_bufmgr, gem->dri2_buffer->name);
+    if (!gem->pixmap_bo) {
+       ErrPrint("Failed to import BO\n");
+       DRI2DestroyDrawable(disp, gem->pixmap);
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    if (DYNAMICBOX_CONF_AUTO_ALIGN && gem->dri2_buffer->pitch != gem->w * gem->depth) {
+       gem->compensate_data = calloc(1, gem->w * gem->h * gem->depth);
+       if (!gem->compensate_data) {
+           ErrPrint("Failed to allocate heap\n");
+       }
+    }
+
+    DbgPrint("dri2_buffer: %p, name: %p, %dx%d, pitch: %d, buf_count: %d, depth: %d, compensate: %p (%d)\n",
+           gem->dri2_buffer, gem->dri2_buffer->name, gem->w, gem->h,
+           gem->dri2_buffer->pitch, gem->buf_count, gem->depth, gem->compensate_data, DYNAMICBOX_CONF_AUTO_ALIGN);
+
+    return DBOX_STATUS_ERROR_NONE;
 }
 
-static int do_buffer_unlock(struct buffer_info *buffer)
+static inline void *acquire_gem(dynamicbox_fb_t buffer)
 {
-       struct flock flock;
-       int ret;
+    struct gem_data *gem;
 
-       if (buffer->lock_fd < 0) {
-               return LB_STATUS_SUCCESS;
-       }
-
-       flock.l_type = F_UNLCK;
-       flock.l_whence = SEEK_SET;
-       flock.l_start = 0;
-       flock.l_len = 0;
-       flock.l_pid = getpid();
-
-       do {
-               ret = fcntl(buffer->lock_fd, F_SETLKW, &flock);
-               if (ret < 0) {
-                       ret = errno;
-                       ErrPrint("fcntl: %s\n", strerror(errno));
-               }
-       } while (ret == EINTR);
-
-       return LB_STATUS_SUCCESS;
-}
-
-static inline struct buffer *create_pixmap(struct buffer_info *info)
-{
-       struct gem_data *gem;
-       struct buffer *buffer;
-       Display *disp;
-       Window parent;
-       XGCValues gcv;
-       GC gc;
+    if (!buffer) {
+       return NULL;
+    }
 
-       disp = ecore_x_display_get();
-       if (!disp) {
-               return NULL;
+    gem = (struct gem_data *)buffer->data;
+    if (s_info.fd < 0) {
+       ErrPrint("GEM is not supported - Use the fake gem buffer\n");
+    } else {
+       if (!gem->pixmap_bo) {
+           ErrPrint("GEM is not created\n");
+           return NULL;
        }
 
-       parent = DefaultRootWindow(disp);
+       if (!gem->data) {
+           tbm_bo_handle handle;
 
-       buffer = calloc(1, sizeof(*buffer) + sizeof(*gem));
-       if (!buffer) {
-               ErrPrint("Heap: %s\n", strerror(errno));
+           if (gem->refcnt) {
+               ErrPrint("Already acquired. but the buffer is not valid\n");
                return NULL;
-       }
+           }
 
-       gem = (struct gem_data *)buffer->data;
-
-       buffer->type = BUFFER_TYPE_PIXMAP;
-       buffer->refcnt = 1;
-       buffer->state = CREATED;
-
-       gem->attachments[0] = DRI2BufferFrontLeft;
-       gem->count = 1;
-       gem->w = info->w; /*!< This can be changed by DRI2GetBuffers */
-       gem->h = info->h; /*!< This can be changed by DRI2GetBuffers */
-       gem->depth = info->pixel_size;
-       /*!
-        * \NOTE
-        * Use the 24 Bits
-        * 32 Bits is not supported for video playing.
-        * But for the transparent background, use the 32 bits, and give up video.
-        */
-       gem->pixmap = XCreatePixmap(disp, parent, info->w, info->h, (info->pixel_size << 3));
-       if (gem->pixmap == (Pixmap)0) {
-               ErrPrint("Failed to create a pixmap\n");
-               DbgFree(buffer);
-               return NULL;
+           handle = tbm_bo_map(gem->pixmap_bo, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE);
+           gem->data = handle.ptr;
        }
+    }
 
-       /*!
-        * \note
-        * Clear pixmap
-        */
-       memset(&gcv, 0, sizeof(gcv));
-       gc = XCreateGC(disp, gem->pixmap, GCForeground, &gcv);
-       if (gc) {
-               XFillRectangle(disp, gem->pixmap, gc, 0, 0, info->w, info->h);
-               XSync(disp, False);
-               XFreeGC(disp, gc);
-       } else {
-               XSync(disp, False);
-               ErrPrint("Unable to clear the pixmap\n");
-       }
+    gem->refcnt++;
 
-       return buffer;
+    /*!
+     * \note
+     * If there is a compensate canvas buffer,
+     * use it
+     */
+    return gem->compensate_data ? gem->compensate_data : gem->data;
 }
 
-static inline int create_gem(struct buffer *buffer)
+static inline void release_gem(dynamicbox_fb_t buffer)
 {
-       struct gem_data *gem;
-       Display *disp;
+    struct gem_data *gem;
 
-       disp = ecore_x_display_get();
-       if (!disp) {
-               ErrPrint("Failed to get display\n");
-               return LB_STATUS_ERROR_IO;
-       }
+    gem = (struct gem_data *)buffer->data;
+    if (s_info.fd >= 0 && !gem->pixmap_bo) {
+       ErrPrint("GEM is not created\n");
+       return;
+    }
 
-       gem = (struct gem_data *)buffer->data;
-
-       if (s_info.fd < 0) {
-               gem->data = calloc(1, gem->w * gem->h * gem->depth);
-               if (!gem->data) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       return LB_STATUS_ERROR_MEMORY;
-               }
-
-               ErrPrint("DRI2(gem) is not supported - Fallback to the S/W Backend\n");
-               return LB_STATUS_SUCCESS;
+    if (!gem->data) {
+       if (gem->refcnt > 0) {
+           ErrPrint("Reference count is not valid %d\n", gem->refcnt);
+           gem->refcnt = 0;
        }
+       return;
+    }
 
-       DRI2CreateDrawable(disp, gem->pixmap);
-
-       gem->dri2_buffer = DRI2GetBuffers(disp, gem->pixmap,
-                                       &gem->w, &gem->h, gem->attachments, gem->count, &gem->buf_count);
-       if (!gem->dri2_buffer || !gem->dri2_buffer->name) {
-               ErrPrint("Failed to get a gem buffer\n");
-               DRI2DestroyDrawable(disp, gem->pixmap);
-               return LB_STATUS_ERROR_FAULT;
-       }
-       /*!
-        * \How can I destroy this?
-        */
-       gem->pixmap_bo = tbm_bo_import(s_info.slp_bufmgr, gem->dri2_buffer->name);
-       if (!gem->pixmap_bo) {
-               ErrPrint("Failed to import BO\n");
-               DRI2DestroyDrawable(disp, gem->pixmap);
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       if (gem->dri2_buffer->pitch != gem->w * gem->depth) {
-               gem->compensate_data = calloc(1, gem->w * gem->h * gem->depth);
-               if (!gem->compensate_data) {
-                       ErrPrint("Failed to allocate heap\n");
-               }
-       }
-
-       DbgPrint("dri2_buffer: %p, name: %p, %dx%d, pitch: %d, buf_count: %d, depth: %d, compensate: %p\n",
-                               gem->dri2_buffer, gem->dri2_buffer->name, gem->w, gem->h,
-                               gem->dri2_buffer->pitch, gem->buf_count, gem->depth, gem->compensate_data);
-
-       return LB_STATUS_SUCCESS;
-}
-
-static inline void *acquire_gem(struct buffer *buffer)
-{
-       struct gem_data *gem;
-
-       if (!buffer) {
-               return NULL;
-       }
-
-       gem = (struct gem_data *)buffer->data;
+    gem->refcnt--;
+    if (gem->refcnt == 0) {
        if (s_info.fd < 0) {
-               ErrPrint("GEM is not supported - Use the fake gem buffer\n");
+           DbgPrint("S/W Gem buffer has no reference\n");
        } else {
-               if (!gem->pixmap_bo) {
-                       ErrPrint("GEM is not created\n");
-                       return NULL;
+           /*!
+            * \note
+            * Update the gem buffer using compensate data buffer if it is exists
+            */
+           if (gem->compensate_data) {
+               register int x;
+               register int y;
+               int *gem_pixel;
+               int *pixel;
+               int gap;
+
+               pixel = gem->compensate_data;
+               gem_pixel = gem->data;
+               gap = gem->dri2_buffer->pitch - (gem->w * gem->depth);
+
+               for (y = 0; y < gem->h; y++) {
+                   for (x = 0; x < gem->w; x++) {
+                       *gem_pixel++ = *pixel++;
+                   }
+
+                   gem_pixel = (int *)(((char *)gem_pixel) + gap);
                }
+           }
 
-               if (!gem->data) {
-                       tbm_bo_handle handle;
+           if (gem->pixmap_bo) {
+               tbm_bo_unmap(gem->pixmap_bo);
+           }
 
-                       if (gem->refcnt) {
-                               ErrPrint("Already acquired. but the buffer is not valid\n");
-                               return NULL;
-                       }
-
-                       handle = tbm_bo_map(gem->pixmap_bo, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE);
-                       gem->data = handle.ptr;
-               }
+           gem->data = NULL;
        }
-
-       gem->refcnt++;
-
-       /*!
-        * \note
-        * If there is a compensate canvas buffer,
-        * use it
-        */
-       return gem->compensate_data ? gem->compensate_data : gem->data;
+    } else if (gem->refcnt < 0) {
+       ErrPrint("Invalid refcnt: %d (reset)\n", gem->refcnt);
+       gem->refcnt = 0;
+    }
 }
 
-static inline void release_gem(struct buffer *buffer)
+static inline int destroy_pixmap(dynamicbox_fb_t buffer)
 {
-       struct gem_data *gem;
+    struct gem_data *gem;
 
-       gem = (struct gem_data *)buffer->data;
-       if (s_info.fd >= 0 && !gem->pixmap_bo) {
-               ErrPrint("GEM is not created\n");
-               return;
-       }
+    gem = (struct gem_data *)buffer->data;
 
-       if (!gem->data) {
-               if (gem->refcnt > 0) {
-                       ErrPrint("Reference count is not valid %d\n", gem->refcnt);
-                       gem->refcnt = 0;
-               }
-               return;
-       }
-
-       gem->refcnt--;
-       if (gem->refcnt == 0) {
-               if (s_info.fd < 0) {
-                       DbgPrint("S/W Gem buffer has no reference\n");
-               } else {
-                       /*!
-                        * \note
-                        * Update the gem buffer using compensate data buffer if it is exists
-                        */
-                       if (gem->compensate_data) {
-                               register int x;
-                               register int y;
-                               int *gem_pixel;
-                               int *pixel;
-                               int gap;
-
-                               pixel = gem->compensate_data;
-                               gem_pixel = gem->data;
-                               gap = gem->dri2_buffer->pitch - (gem->w * gem->depth);
-
-                               for (y = 0; y < gem->h; y++) {
-                                       for (x = 0; x < gem->w; x++) {
-                                               *gem_pixel++ = *pixel++;
-                                       }
-
-                                       gem_pixel = (int *)(((char *)gem_pixel) + gap);
-                               }
-                       }
-
-                       if (gem->pixmap_bo) {
-                               tbm_bo_unmap(gem->pixmap_bo);
-                       }
+    if (gem->pixmap) {
+       Display *disp;
 
-                       gem->data = NULL;
-               }
-       } else if (gem->refcnt < 0) {
-               ErrPrint("Invalid refcnt: %d (reset)\n", gem->refcnt);
-               gem->refcnt = 0;
+       disp = ecore_x_display_get();
+       if (!disp) {
+           return DBOX_STATUS_ERROR_IO_ERROR;
        }
-}
-
-static inline int destroy_pixmap(struct buffer *buffer)
-{
-       struct gem_data *gem;
 
-       gem = (struct gem_data *)buffer->data;
+       DbgPrint("pixmap %lu\n", gem->pixmap);
+       XFreePixmap(disp, gem->pixmap);
+    }
 
-       if (gem->pixmap) {
-               Display *disp;
-
-               disp = ecore_x_display_get();
-               if (!disp) {
-                       return LB_STATUS_ERROR_IO;
-               }
-
-               DbgPrint("pixmap %lu\n", gem->pixmap);
-               XFreePixmap(disp, gem->pixmap);
-       }
-
-       buffer->state = DESTROYED;
-       DbgFree(buffer);
-       return LB_STATUS_SUCCESS;
+    buffer->state = DBOX_FB_STATE_DESTROYED;
+    DbgFree(buffer);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
-static inline int destroy_gem(struct buffer *buffer)
+static inline int destroy_gem(dynamicbox_fb_t buffer)
 {
-       struct gem_data *gem;
+    struct gem_data *gem;
 
-       if (!buffer) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!buffer) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       /*!
-        * Forcely release the acquire_buffer.
-        */
-       gem = (struct gem_data *)buffer->data;
-       if (!gem) {
-               return LB_STATUS_ERROR_FAULT;
-       }
+    /*!
+     * Forcely release the acquire_buffer.
+     */
+    gem = (struct gem_data *)buffer->data;
+    if (!gem) {
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       if (s_info.fd >= 0) {
-               if (gem->compensate_data) {
-                       DbgPrint("Release compensate buffer %p\n", gem->compensate_data);
-                       DbgFree(gem->compensate_data);
-                       gem->compensate_data = NULL;
-               }
+    if (s_info.fd >= 0) {
+       if (gem->compensate_data) {
+           DbgPrint("Release compensate buffer %p\n", gem->compensate_data);
+           DbgFree(gem->compensate_data);
+           gem->compensate_data = NULL;
+       }
 
-               if (gem->pixmap_bo) {
-                       DbgPrint("unref pixmap bo\n");
-                       tbm_bo_unref(gem->pixmap_bo);
-                       gem->pixmap_bo = NULL;
+       if (gem->pixmap_bo) {
+           DbgPrint("unref pixmap bo\n");
+           tbm_bo_unref(gem->pixmap_bo);
+           gem->pixmap_bo = NULL;
 
-                       DRI2DestroyDrawable(ecore_x_display_get(), gem->pixmap);
-               }
-       } else if (gem->data) {
-               DbgPrint("Release fake gem buffer\n");
-               DbgFree(gem->data);
-               gem->data = NULL;
+           DRI2DestroyDrawable(ecore_x_display_get(), gem->pixmap);
        }
+    } else if (gem->data) {
+       DbgPrint("Release fake gem buffer\n");
+       DbgFree(gem->data);
+       gem->data = NULL;
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static inline int load_file_buffer(struct buffer_info *info)
 {
-       struct buffer *buffer;
-       double timestamp;
-       int size;
-       char *new_id;
-       int len;
-
-       len = strlen(IMAGE_PATH) + 40;
-       new_id = malloc(len);
-       if (!new_id) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       timestamp = util_timestamp();
-       snprintf(new_id, len, SCHEMA_FILE "%s%lf", IMAGE_PATH, timestamp);
-
-       size = sizeof(*buffer) + info->w * info->h * info->pixel_size;
-       if (!size) {
-               ErrPrint("Canvas buffer size is ZERO\n");
-               DbgFree(new_id);
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       buffer = calloc(1, size);
-       if (!buffer) {
-               ErrPrint("Failed to allocate buffer\n");
-               DbgFree(new_id);
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       buffer->type = BUFFER_TYPE_FILE;
-       buffer->refcnt = 0;
-       buffer->state = CREATED;
-       buffer->info = info;
-
-       DbgFree(info->id);
-       info->id = new_id;
-       info->buffer = buffer;
-       info->is_loaded = 1;
-
-       DbgPrint("FILE type %d created\n", size);
-       return LB_STATUS_SUCCESS;
+    dynamicbox_fb_t buffer;
+    double timestamp;
+    int size;
+    char *new_id;
+    int len;
+
+    len = strlen(DYNAMICBOX_CONF_IMAGE_PATH) + 40;
+    new_id = malloc(len);
+    if (!new_id) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    timestamp = util_timestamp();
+    snprintf(new_id, len, SCHEMA_FILE "%s%lf", DYNAMICBOX_CONF_IMAGE_PATH, timestamp);
+
+    size = sizeof(*buffer) + info->w * info->h * info->pixel_size;
+    if (!size) {
+       ErrPrint("Canvas buffer size is ZERO\n");
+       DbgFree(new_id);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    buffer = calloc(1, size);
+    if (!buffer) {
+       ErrPrint("Failed to allocate buffer\n");
+       DbgFree(new_id);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    buffer->type = DBOX_FB_TYPE_FILE;
+    buffer->refcnt = 0;
+    buffer->state = DBOX_FB_STATE_CREATED;
+    buffer->info = info;
+
+    DbgFree(info->id);
+    info->id = new_id;
+    info->buffer = buffer;
+    info->is_loaded = 1;
+
+    DbgPrint("FILE type %d created\n", size);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static inline int load_shm_buffer(struct buffer_info *info)
 {
-       int id;
-       int size;
-       struct buffer *buffer; /* Just for getting a size */
-       char *new_id;
-       int len;
+    int id;
+    int size;
+    dynamicbox_fb_t buffer; /* Just for getting a size */
+    char *new_id;
+    int len;
+
+    size = info->w * info->h * info->pixel_size;
+    if (!size) {
+       ErrPrint("Invalid buffer size\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    id = shmget(IPC_PRIVATE, size + sizeof(*buffer), IPC_CREAT | 0666);
+    if (id < 0) {
+       ErrPrint("shmget: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    buffer = shmat(id, NULL, 0);
+    if (buffer == (void *)-1) {
+       ErrPrint("%s shmat: %s\n", info->id, strerror(errno));
 
-       size = info->w * info->h * info->pixel_size;
-       if (!size) {
-               ErrPrint("Invalid buffer size\n");
-               return LB_STATUS_ERROR_INVALID;
+       if (shmctl(id, IPC_RMID, 0) < 0) {
+           ErrPrint("%s shmctl: %s\n", info->id, strerror(errno));
        }
 
-       id = shmget(IPC_PRIVATE, size + sizeof(*buffer), IPC_CREAT | 0666);
-       if (id < 0) {
-               ErrPrint("shmget: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_FAULT;
-       }
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       buffer = shmat(id, NULL, 0);
-       if (buffer == (void *)-1) {
-               ErrPrint("%s shmat: %s\n", info->id, strerror(errno));
+    buffer->type = DBOX_FB_TYPE_SHM;
+    buffer->refcnt = id;
+    buffer->state = DBOX_FB_STATE_CREATED; /*!< Needless */
+    buffer->info = (void *)size; /*!< Use this field to indicates the size of SHM */
 
-               if (shmctl(id, IPC_RMID, 0) < 0) {
-                       ErrPrint("%s shmctl: %s\n", info->id, strerror(errno));
-               }
+    len = strlen(SCHEMA_SHM) + 30; /* strlen("shm://") + 30 */
 
-               return LB_STATUS_ERROR_FAULT;
+    new_id = malloc(len);
+    if (!new_id) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       if (shmdt(buffer) < 0) {
+           ErrPrint("shmdt: %s\n", strerror(errno));
        }
 
-       buffer->type = BUFFER_TYPE_SHM;
-       buffer->refcnt = id;
-       buffer->state = CREATED; /*!< Needless */
-       buffer->info = (void *)size; /*!< Use this field to indicates the size of SHM */
-
-       len = strlen(SCHEMA_SHM) + 30; /* strlen("shm://") + 30 */
-
-       new_id = malloc(len);
-       if (!new_id) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               if (shmdt(buffer) < 0) {
-                       ErrPrint("shmdt: %s\n", strerror(errno));
-               }
-
-               if (shmctl(id, IPC_RMID, 0) < 0) {
-                       ErrPrint("shmctl: %s\n", strerror(errno));
-               }
-
-               return LB_STATUS_ERROR_MEMORY;
+       if (shmctl(id, IPC_RMID, 0) < 0) {
+           ErrPrint("shmctl: %s\n", strerror(errno));
        }
 
-       snprintf(new_id, len, SCHEMA_SHM "%d", id);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       DbgFree(info->id);
-       info->id = new_id;
-       info->buffer = buffer;
-       info->is_loaded = 1;
-       return LB_STATUS_SUCCESS;
+    snprintf(new_id, len, SCHEMA_SHM "%d", id);
+
+    DbgFree(info->id);
+    info->id = new_id;
+    info->buffer = buffer;
+    info->is_loaded = 1;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static inline int load_pixmap_buffer(struct buffer_info *info)
 {
-       struct buffer *buffer;
-       struct gem_data *gem;
-       char *new_id;
-       int len;
-
-       /*!
-        * \NOTE
-        * Before call the buffer_handler_pixmap_ref function,
-        * You should make sure that the is_loaded value is toggled (1)
-        * Or the buffer_handler_pixmap_ref function will return NULL
-        */
-       info->is_loaded = 1;
-
-       if (info->buffer) {
-               DbgPrint("Buffer is already exists, but override it with new one\n");
-       }
-
-       buffer = buffer_handler_pixmap_ref(info);
-       if (!buffer) {
-               DbgPrint("Failed to make a reference of a pixmap\n");
-               info->is_loaded = 0;
-               return LB_STATUS_ERROR_FAULT;
-       }
+    dynamicbox_fb_t buffer;
+    struct gem_data *gem;
+    char *new_id;
+    int len;
+
+    /*!
+     * \NOTE
+     * Before call the buffer_handler_pixmap_ref function,
+     * You should make sure that the is_loaded value is toggled (1)
+     * Or the buffer_handler_pixmap_ref function will return NULL
+     */
+    info->is_loaded = 1;
+
+    if (info->buffer) {
+       DbgPrint("Buffer is already exists, but override it with new one\n");
+    }
+
+    buffer = buffer_handler_pixmap_ref(info);
+    if (!buffer) {
+       DbgPrint("Failed to make a reference of a pixmap\n");
+       info->is_loaded = 0;
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       len = strlen(SCHEMA_PIXMAP) + 30; /* strlen("pixmap://") + 30 */
-       new_id = malloc(len);
-       if (!new_id) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               info->is_loaded = 0;
-               buffer_handler_pixmap_unref(buffer);
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    len = strlen(SCHEMA_PIXMAP) + 30; /* strlen("pixmap://") + 30 */
+    new_id = malloc(len);
+    if (!new_id) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       info->is_loaded = 0;
+       buffer_handler_pixmap_unref(buffer);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       DbgFree(info->id);
-       info->id = new_id;
+    DbgFree(info->id);
+    info->id = new_id;
 
-       gem = (struct gem_data *)buffer->data;
+    gem = (struct gem_data *)buffer->data;
 
-       snprintf(info->id, len, SCHEMA_PIXMAP "%d:%d", (int)gem->pixmap, info->pixel_size);
-       DbgPrint("Loaded pixmap(info->id): %s\n", info->id);
-       return LB_STATUS_SUCCESS;
+    snprintf(info->id, len, SCHEMA_PIXMAP "%d:%d", (int)gem->pixmap, info->pixel_size);
+    DbgPrint("Loaded pixmap(info->id): %s\n", info->id);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 EAPI int buffer_handler_load(struct buffer_info *info)
 {
-       int ret;
-
-       if (!info) {
-               ErrPrint("buffer handler is nil\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       if (info->is_loaded) {
-               DbgPrint("Buffer is already loaded\n");
-               return LB_STATUS_SUCCESS;
-       }
-
-       switch (info->type) {
-       case BUFFER_TYPE_FILE:
-               ret = load_file_buffer(info);
-               (void)create_lock_file(info);
-               break;
-       case BUFFER_TYPE_SHM:
-               ret = load_shm_buffer(info);
-               (void)create_lock_file(info);
-               break;
-       case BUFFER_TYPE_PIXMAP:
-               ret = load_pixmap_buffer(info);
-               break;
+    int ret;
+    dynamicbox_target_type_e type = DBOX_TYPE_GBAR;
+
+    if (!info) {
+       ErrPrint("buffer handler is nil\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    if (info->is_loaded) {
+       DbgPrint("Buffer is already loaded\n");
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    switch (info->type) {
+       case DBOX_FB_TYPE_FILE:
+           ret = load_file_buffer(info);
+
+           if (script_handler_buffer_info(instance_gbar_script(info->inst)) != info && instance_gbar_buffer(info->inst) != info) {
+               type = DBOX_TYPE_DBOX;
+           }
+           info->lock_info = dynamicbox_service_create_lock(instance_id(info->inst), type, DBOX_LOCK_WRITE);
+           break;
+       case DBOX_FB_TYPE_SHM:
+           ret = load_shm_buffer(info);
+
+           if (script_handler_buffer_info(instance_gbar_script(info->inst)) != info && instance_gbar_buffer(info->inst) != info) {
+               type = DBOX_TYPE_DBOX;
+           }
+           info->lock_info = dynamicbox_service_create_lock(instance_id(info->inst), type, DBOX_LOCK_WRITE);
+           break;
+       case DBOX_FB_TYPE_PIXMAP:
+           ret = load_pixmap_buffer(info);
+           break;
        default:
-               ErrPrint("Invalid buffer\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               break;
-       }
+           ErrPrint("Invalid buffer\n");
+           ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+           break;
+    }
 
-       return ret;
+    return ret;
 }
 
 static inline int unload_file_buffer(struct buffer_info *info)
 {
-       const char *path;
-       char *new_id;
-
-       new_id = strdup(SCHEMA_FILE "/tmp/.live.undefined");
-       if (!new_id) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       DbgFree(info->buffer);
-       info->buffer = NULL;
-
-       path = util_uri_to_path(info->id);
-       if (path && unlink(path) < 0) {
-               ErrPrint("unlink: %s\n", strerror(errno));
-       }
-
-       DbgFree(info->id);
-       info->id = new_id;
-       return LB_STATUS_SUCCESS;
+    const char *path;
+    char *new_id;
+
+    new_id = strdup(SCHEMA_FILE "/tmp/.live.undefined");
+    if (!new_id) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    DbgFree(info->buffer);
+    info->buffer = NULL;
+
+    path = util_uri_to_path(info->id);
+    if (path && unlink(path) < 0) {
+       ErrPrint("unlink: %s\n", strerror(errno));
+    }
+
+    DbgFree(info->id);
+    info->id = new_id;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static inline int unload_shm_buffer(struct buffer_info *info)
 {
-       int id;
-       char *new_id;
-
-       new_id = strdup(SCHEMA_SHM "-1");
-       if (!new_id) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       if (sscanf(info->id, SCHEMA_SHM "%d", &id) != 1) {
-               ErrPrint("%s Invalid ID\n", info->id);
-               DbgFree(new_id);
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       if (id < 0) {
-               ErrPrint("(%s) Invalid id: %d\n", info->id, id);
-               DbgFree(new_id);
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       if (shmdt(info->buffer) < 0) {
-               ErrPrint("Detach shm: %s\n", strerror(errno));
-       }
-
-       if (shmctl(id, IPC_RMID, 0) < 0) {
-               ErrPrint("Remove shm: %s\n", strerror(errno));
-       }
-
-       info->buffer = NULL;
-
-       DbgFree(info->id);
-       info->id = new_id;
-       return LB_STATUS_SUCCESS;
+    int id;
+    char *new_id;
+
+    new_id = strdup(SCHEMA_SHM "-1");
+    if (!new_id) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    if (sscanf(info->id, SCHEMA_SHM "%d", &id) != 1) {
+       ErrPrint("%s Invalid ID\n", info->id);
+       DbgFree(new_id);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    if (id < 0) {
+       ErrPrint("(%s) Invalid id: %d\n", info->id, id);
+       DbgFree(new_id);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    if (shmdt(info->buffer) < 0) {
+       ErrPrint("Detach shm: %s\n", strerror(errno));
+    }
+
+    if (shmctl(id, IPC_RMID, 0) < 0) {
+       ErrPrint("Remove shm: %s\n", strerror(errno));
+    }
+
+    info->buffer = NULL;
+
+    DbgFree(info->id);
+    info->id = new_id;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static inline int unload_pixmap_buffer(struct buffer_info *info)
 {
-       int id;
-       char *new_id;
-       int pixels;
-
-       new_id = strdup(SCHEMA_PIXMAP "0:0");
-       if (!new_id) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       if (sscanf(info->id, SCHEMA_PIXMAP "%d:%d", &id, &pixels) != 2) {
-               ErrPrint("Invalid ID (%s)\n", info->id);
-               DbgFree(new_id);
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       if (id == 0) {
-               ErrPrint("(%s) Invalid id: %d\n", info->id, id);
-               DbgFree(new_id);
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       /*!
-        * Decrease the reference counter.
-        */
-       buffer_handler_pixmap_unref(info->buffer);
-
-       /*!
-        * \note
-        * Just clear the info->buffer.
-        * It will be reallocated again.
-        */
-       info->buffer = NULL;
-
-       DbgFree(info->id);
-       info->id = new_id;
-       return LB_STATUS_SUCCESS;
+    int id;
+    char *new_id;
+    int pixels;
+
+    new_id = strdup(SCHEMA_PIXMAP "0:0");
+    if (!new_id) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    if (sscanf(info->id, SCHEMA_PIXMAP "%d:%d", &id, &pixels) != 2) {
+       ErrPrint("Invalid ID (%s)\n", info->id);
+       DbgFree(new_id);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    if (id == 0) {
+       ErrPrint("(%s) Invalid id: %d\n", info->id, id);
+       DbgFree(new_id);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    /*!
+     * Decrease the reference counter.
+     */
+    buffer_handler_pixmap_unref(info->buffer);
+
+    /*!
+     * \note
+     * Just clear the info->buffer.
+     * It will be reallocated again.
+     */
+    info->buffer = NULL;
+
+    DbgFree(info->id);
+    info->id = new_id;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 EAPI int buffer_handler_unload(struct buffer_info *info)
 {
-       int ret;
-
-       if (!info) {
-               ErrPrint("buffer handler is NIL\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       if (!info->is_loaded) {
-               ErrPrint("Buffer is not loaded\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       switch (info->type) {
-       case BUFFER_TYPE_FILE:
-               (void)destroy_lock_file(info);
-               ret = unload_file_buffer(info);
-               break;
-       case BUFFER_TYPE_SHM:
-               (void)destroy_lock_file(info);
-               ret = unload_shm_buffer(info);
-               break;
-       case BUFFER_TYPE_PIXMAP:
-               ret = unload_pixmap_buffer(info);
-               break;
+    int ret;
+
+    if (!info) {
+       ErrPrint("buffer handler is NIL\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    if (!info->is_loaded) {
+       ErrPrint("Buffer is not loaded\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    switch (info->type) {
+       case DBOX_FB_TYPE_FILE:
+           dynamicbox_service_destroy_lock(info->lock_info);
+           info->lock_info = NULL;
+           ret = unload_file_buffer(info);
+           break;
+       case DBOX_FB_TYPE_SHM:
+           dynamicbox_service_destroy_lock(info->lock_info);
+           info->lock_info = NULL;
+           ret = unload_shm_buffer(info);
+           break;
+       case DBOX_FB_TYPE_PIXMAP:
+           ret = unload_pixmap_buffer(info);
+           break;
        default:
-               ErrPrint("Invalid buffer\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               break;
-       }
+           ErrPrint("Invalid buffer\n");
+           ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+           break;
+    }
 
-       if (ret == 0) {
-               info->is_loaded = 0;
-       }
+    if (ret == 0) {
+       info->is_loaded = 0;
+    }
 
-       return ret;
+    return ret;
 }
 
 EAPI const char *buffer_handler_id(const struct buffer_info *info)
 {
-       return info ? info->id : "";
+    return info ? info->id : "";
 }
 
-EAPI enum buffer_type buffer_handler_type(const struct buffer_info *info)
+EAPI enum dynamicbox_fb_type buffer_handler_type(const struct buffer_info *info)
 {
-       return info ? info->type : BUFFER_TYPE_ERROR;
+    return info ? info->type : DBOX_FB_TYPE_ERROR;
 }
 
 EAPI void *buffer_handler_fb(struct buffer_info *info)
 {
-       struct buffer *buffer;
+    dynamicbox_fb_t buffer;
 
-       if (!info) {
-               return NULL;
-       }
+    if (!info) {
+       return NULL;
+    }
 
-       buffer = info->buffer;
+    buffer = info->buffer;
 
-       if (info->type == BUFFER_TYPE_PIXMAP) {
-               void *canvas;
-               int ret;
+    if (info->type == DBOX_FB_TYPE_PIXMAP) {
+       void *canvas;
+       int ret;
 
-               /*!
-                * \note
-                * For getting the buffer address of gem.
-                */
-               canvas = buffer_handler_pixmap_acquire_buffer(info);
-               ret = buffer_handler_pixmap_release_buffer(canvas);
-               if (ret < 0) {
-                       ErrPrint("Failed to release buffer: %d\n", ret);
-               }
-               return canvas;
+       /*!
+        * \note
+        * For getting the buffer address of gem.
+        */
+       canvas = buffer_handler_pixmap_acquire_buffer(info);
+       ret = buffer_handler_pixmap_release_buffer(canvas);
+       if (ret < 0) {
+           ErrPrint("Failed to release buffer: %d\n", ret);
        }
+       return canvas;
+    }
 
-       return buffer->data;
+    return buffer->data;
 }
 
 EAPI int buffer_handler_pixmap(const struct buffer_info *info)
 {
-       struct buffer *buf;
-       struct gem_data *gem;
+    dynamicbox_fb_t buf;
+    struct gem_data *gem;
 
-       if (!info) {
-               ErrPrint("Inavlid buffer handler\n");
-               return 0;
-       }
+    if (!info) {
+       ErrPrint("Inavlid buffer handler\n");
+       return 0;
+    }
 
-       if (info->type != BUFFER_TYPE_PIXMAP) {
-               ErrPrint("Invalid buffer type\n");
-               return 0;
-       }
+    if (info->type != DBOX_FB_TYPE_PIXMAP) {
+       ErrPrint("Invalid buffer type\n");
+       return 0;
+    }
 
-       buf = (struct buffer *)info->buffer;
-       if (!buf) {
-               ErrPrint("Invalid buffer data\n");
-               return 0;
-       }
+    buf = (dynamicbox_fb_t)info->buffer;
+    if (!buf) {
+       ErrPrint("Invalid buffer data\n");
+       return 0;
+    }
 
-       gem = (struct gem_data *)buf->data;
-       return gem->pixmap;
+    gem = (struct gem_data *)buf->data;
+    return gem->pixmap;
 }
 
 EAPI void *buffer_handler_pixmap_acquire_buffer(struct buffer_info *info)
 {
-       struct buffer *buffer;
+    dynamicbox_fb_t buffer;
 
-       if (!info || !info->is_loaded) {
-               ErrPrint("Buffer is not loaded\n");
-               return NULL;
-       }
+    if (!info || !info->is_loaded) {
+       ErrPrint("Buffer is not loaded\n");
+       return NULL;
+    }
 
-       buffer = buffer_handler_pixmap_ref(info);
-       if (!buffer) {
-               return NULL;
-       }
+    buffer = buffer_handler_pixmap_ref(info);
+    if (!buffer) {
+       return NULL;
+    }
 
-       return acquire_gem(buffer);
+    return acquire_gem(buffer);
 }
 
 EAPI void *buffer_handler_pixmap_buffer(struct buffer_info *info)
 {
-       struct buffer *buffer;
-       struct gem_data *gem;
-
-       if (!info) {
-               return NULL;
-       }
+    dynamicbox_fb_t buffer;
+    struct gem_data *gem;
 
-       if (!info->is_loaded) {
-               ErrPrint("Buffer is not loaded\n");
-               return NULL;
-       }
+    if (!info) {
+       return NULL;
+    }
 
-       buffer = info->buffer;
-       if (!buffer) {
-               return NULL;
-       }
+    if (!info->is_loaded) {
+       ErrPrint("Buffer is not loaded\n");
+       return NULL;
+    }
 
-       gem = (struct gem_data *)buffer->data;
-       return gem->compensate_data ? gem->compensate_data : gem->data;
+    buffer = info->buffer;
+    if (!buffer) {
+       return NULL;
+    }
+
+    gem = (struct gem_data *)buffer->data;
+    return gem->compensate_data ? gem->compensate_data : gem->data;
 }
 
-/*!
- * \return "buffer" object (Not the buffer_info)
+/**
+ * @return "buffer" object (Not the buffer_info)
  */
 EAPI void *buffer_handler_pixmap_ref(struct buffer_info *info)
 {
-       struct buffer *buffer;
+    dynamicbox_fb_t buffer;
 
-       if (!info->is_loaded) {
-               ErrPrint("Buffer is not loaded\n");
-               return NULL;
-       }
+    if (!info->is_loaded) {
+       ErrPrint("Buffer is not loaded\n");
+       return NULL;
+    }
 
-       if (info->type != BUFFER_TYPE_PIXMAP) {
-               ErrPrint("Buffer type is not matched\n");
-               return NULL;
-       }
+    if (info->type != DBOX_FB_TYPE_PIXMAP) {
+       ErrPrint("Buffer type is not matched\n");
+       return NULL;
+    }
+
+    buffer = info->buffer;
+    if (!buffer) {
+       int need_gem = 1;
 
-       buffer = info->buffer;
+       buffer = create_pixmap(info);
        if (!buffer) {
-               int need_gem = 1;
+           ErrPrint("Failed to create a pixmap\n");
+           return NULL;
+       }
 
-               buffer = create_pixmap(info);
-               if (!buffer) {
-                       ErrPrint("Failed to create a pixmap\n");
-                       return NULL;
-               }
+       info->buffer = buffer;
 
-               info->buffer = buffer;
-
-               if (info->inst) {
-                       struct pkg_info *pkg;
-
-                       if (instance_lb_buffer(info->inst) == info) {
-                               pkg = instance_package(info->inst);
-                               if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-                                       need_gem = 0;
-                               }
-                       } else if (instance_pd_buffer(info->inst) == info) {
-                               pkg = instance_package(info->inst);
-                               if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-                                       need_gem = 0;
-                               }
-                       }
-               }
+       if (info->inst) {
+           struct pkg_info *pkg;
+
+           pkg = instance_package(info->inst);
 
-               if (need_gem) {
-                       create_gem(buffer);
+           if (instance_dbox_buffer(info->inst) == info) {
+               if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+                   need_gem = 0;
                }
+           } else if (instance_gbar_buffer(info->inst) == info) {
+               if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+                   need_gem = 0;
+               }
+           } else {
+               int idx;
+
+               for (idx = 0; idx < DYNAMICBOX_CONF_EXTRA_BUFFER_COUNT; idx++) {
+                   if (instance_dbox_extra_buffer(info->inst, idx) == info) {
+                       if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+                           need_gem = 0;
+                           break;
+                       }
+                   }
 
-       } else if (buffer->state != CREATED || buffer->type != BUFFER_TYPE_PIXMAP) {
-               ErrPrint("Invalid buffer\n");
-               return NULL;
-       } else if (buffer->refcnt > 0) {
-               buffer->refcnt++;
-               return buffer;
+                   if (instance_gbar_extra_buffer(info->inst, idx) == info) {
+                       if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+                           need_gem = 0;
+                           break;
+                       }
+                   }
+               }
+           }
        }
 
-       s_info.pixmap_list = eina_list_append(s_info.pixmap_list, buffer);
+       if (need_gem) {
+           if (create_gem(buffer) < 0) {
+               /* okay, something goes wrong */
+           }
+       }
+    } else if (buffer->state != DBOX_FB_STATE_CREATED || buffer->type != DBOX_FB_TYPE_PIXMAP) {
+       ErrPrint("Invalid buffer\n");
+       return NULL;
+    } else if (buffer->refcnt > 0) {
+       buffer->refcnt++;
        return buffer;
+    }
+
+    s_info.pixmap_list = eina_list_append(s_info.pixmap_list, buffer);
+    return buffer;
 }
 
 /*!
@@ -1014,64 +918,64 @@ EAPI void *buffer_handler_pixmap_ref(struct buffer_info *info)
  */
 EAPI void *buffer_handler_pixmap_find(int pixmap)
 {
-       struct buffer *buffer;
-       struct gem_data *gem;
-       Eina_List *l;
-       Eina_List *n;
+    dynamicbox_fb_t buffer;
+    struct gem_data *gem;
+    Eina_List *l;
+    Eina_List *n;
 
-       if (pixmap == 0) {
-               return NULL;
-       }
+    if (pixmap == 0) {
+       return NULL;
+    }
 
-       EINA_LIST_FOREACH_SAFE(s_info.pixmap_list, l, n, buffer) {
-               if (!buffer || buffer->state != CREATED || buffer->type != BUFFER_TYPE_PIXMAP) {
-                       s_info.pixmap_list = eina_list_remove(s_info.pixmap_list, buffer);
-                       DbgPrint("Invalid buffer (List Removed: %p)\n", buffer);
-                       continue;
-               }
+    EINA_LIST_FOREACH_SAFE(s_info.pixmap_list, l, n, buffer) {
+       if (!buffer || buffer->state != DBOX_FB_STATE_CREATED || buffer->type != DBOX_FB_TYPE_PIXMAP) {
+           s_info.pixmap_list = eina_list_remove(s_info.pixmap_list, buffer);
+           DbgPrint("Invalid buffer (List Removed: %p)\n", buffer);
+           continue;
+       }
 
-               gem = (struct gem_data *)buffer->data;
-               if (gem->pixmap == pixmap) {
-                       return buffer;
-               }
+       gem = (struct gem_data *)buffer->data;
+       if (gem->pixmap == pixmap) {
+           return buffer;
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
 EAPI int buffer_handler_pixmap_release_buffer(void *canvas)
 {
-       struct buffer *buffer;
-       struct gem_data *gem;
-       Eina_List *l;
-       Eina_List *n;
-       void *_ptr;
-
-       if (!canvas) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    dynamicbox_fb_t buffer;
+    struct gem_data *gem;
+    Eina_List *l;
+    Eina_List *n;
+    void *_ptr;
 
-       EINA_LIST_FOREACH_SAFE(s_info.pixmap_list, l, n, buffer) {
-               if (!buffer || buffer->state != CREATED || buffer->type != BUFFER_TYPE_PIXMAP) {
-                       s_info.pixmap_list = eina_list_remove(s_info.pixmap_list, buffer);
-                       continue;
-               }
+    if (!canvas) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-               gem = (struct gem_data *)buffer->data;
-               _ptr = gem->compensate_data ? gem->compensate_data : gem->data;
+    EINA_LIST_FOREACH_SAFE(s_info.pixmap_list, l, n, buffer) {
+       if (!buffer || buffer->state != DBOX_FB_STATE_CREATED || buffer->type != DBOX_FB_TYPE_PIXMAP) {
+           s_info.pixmap_list = eina_list_remove(s_info.pixmap_list, buffer);
+           continue;
+       }
 
-               if (!_ptr) {
-                       continue;
-               }
+       gem = (struct gem_data *)buffer->data;
+       _ptr = gem->compensate_data ? gem->compensate_data : gem->data;
 
-               if (_ptr == canvas) {
-                       release_gem(buffer);
-                       buffer_handler_pixmap_unref(buffer);
-                       return LB_STATUS_SUCCESS;
-               }
+       if (!_ptr) {
+           continue;
        }
 
-       return LB_STATUS_ERROR_NOT_EXIST;
+       if (_ptr == canvas) {
+           release_gem(buffer);
+           buffer_handler_pixmap_unref(buffer);
+           return DBOX_STATUS_ERROR_NONE;
+       }
+    }
+
+    return DBOX_STATUS_ERROR_NOT_EXIST;
 }
 
 /*!
@@ -1082,570 +986,643 @@ EAPI int buffer_handler_pixmap_release_buffer(void *canvas)
  */
 EAPI int buffer_handler_pixmap_unref(void *buffer_ptr)
 {
-       struct buffer *buffer = buffer_ptr;
-       struct buffer_info *info;
+    dynamicbox_fb_t buffer = buffer_ptr;
+    struct buffer_info *info;
 
-       buffer->refcnt--;
-       if (buffer->refcnt > 0) {
-               return LB_STATUS_SUCCESS; /* Return NULL means, gem buffer still in use */
-       }
+    buffer->refcnt--;
+    if (buffer->refcnt > 0) {
+       return DBOX_STATUS_ERROR_NONE; /* Return NULL means, gem buffer still in use */
+    }
 
-       s_info.pixmap_list = eina_list_remove(s_info.pixmap_list, buffer);
+    s_info.pixmap_list = eina_list_remove(s_info.pixmap_list, buffer);
 
-       info = buffer->info;
+    info = buffer->info;
 
-       if (destroy_gem(buffer) < 0) {
-               ErrPrint("Failed to destroy gem buffer\n");
-       }
+    if (destroy_gem(buffer) < 0) {
+       ErrPrint("Failed to destroy gem buffer\n");
+    }
 
-       if (destroy_pixmap(buffer) < 0) {
-               ErrPrint("Failed to destroy pixmap\n");
-       }
+    if (destroy_pixmap(buffer) < 0) {
+       ErrPrint("Failed to destroy pixmap\n");
+    }
 
-       if (info && info->buffer == buffer) {
-               info->buffer = NULL;
-       }
+    if (info && info->buffer == buffer) {
+       info->buffer = NULL;
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 EAPI int buffer_handler_is_loaded(const struct buffer_info *info)
 {
-       return info ? info->is_loaded : 0;
+    return info ? info->is_loaded : 0;
 }
 
 EAPI void buffer_handler_update_size(struct buffer_info *info, int w, int h)
 {
-       if (!info) {
-               return;
-       }
+    if (!info) {
+       return;
+    }
 
-       info->w = w;
-       info->h = h;
+    info->w = w;
+    info->h = h;
 }
 
 EAPI int buffer_handler_resize(struct buffer_info *info, int w, int h)
 {
-       int ret;
+    int ret;
 
-       if (!info) {
-               ErrPrint("Invalid handler\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!info) {
+       ErrPrint("Invalid handler\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (info->w == w && info->h == h) {
-               DbgPrint("No changes\n");
-               return LB_STATUS_SUCCESS;
-       }
+    if (info->w == w && info->h == h) {
+       DbgPrint("No changes\n");
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
-       buffer_handler_update_size(info, w, h);
+    buffer_handler_update_size(info, w, h);
 
-       if (!info->is_loaded) {
-               DbgPrint("Buffer size is updated[%dx%d]\n", w, h);
-               return LB_STATUS_SUCCESS;
-       }
+    if (!info->is_loaded) {
+       DbgPrint("Buffer size is updated[%dx%d]\n", w, h);
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
-       ret = buffer_handler_unload(info);
-       if (ret < 0) {
-               ErrPrint("Unload: %d\n", ret);
-       }
+    ret = buffer_handler_unload(info);
+    if (ret < 0) {
+       ErrPrint("Unload: %d\n", ret);
+    }
 
-       ret = buffer_handler_load(info);
-       if (ret < 0) {
-               ErrPrint("Load: %d\n", ret);
-       }
+    ret = buffer_handler_load(info);
+    if (ret < 0) {
+       ErrPrint("Load: %d\n", ret);
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 EAPI int buffer_handler_get_size(struct buffer_info *info, int *w, int *h)
 {
-       if (!info) {
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       if (w) {
-               *w = info->w;
-       }
-       if (h) {
-               *h = info->h;
-       }
-
-       return LB_STATUS_SUCCESS;
+    if (!info) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    if (w) {
+       *w = info->w;
+    }
+    if (h) {
+       *h = info->h;
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 EAPI struct inst_info *buffer_handler_instance(struct buffer_info *info)
 {
-       return info->inst;
+    return info->inst;
 }
 
 /*!
  * \note
  * Only for used S/W Backend
  */
-static inline int sync_for_pixmap(struct buffer *buffer)
+static inline int sync_for_pixmap(dynamicbox_fb_t buffer)
 {
-       XShmSegmentInfo si;
-       XImage *xim;
-       GC gc;
-       Display *disp;
-       struct gem_data *gem;
-       Screen *screen;
-       Visual *visual;
-
-       if (buffer->state != CREATED) {
-               ErrPrint("Invalid state of a FB\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       if (buffer->type != BUFFER_TYPE_PIXMAP) {
-               ErrPrint("Invalid buffer\n");
-               return LB_STATUS_SUCCESS;
-       }
-
-       disp = ecore_x_display_get();
-       if (!disp) {
-               ErrPrint("Failed to get a display\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       gem = (struct gem_data *)buffer->data;
-       if (gem->w == 0 || gem->h == 0) {
-               DbgPrint("Nothing can be sync\n");
-               return LB_STATUS_SUCCESS;
-       }
-
-       si.shmid = shmget(IPC_PRIVATE, gem->w * gem->h * gem->depth, IPC_CREAT | 0666);
-       if (si.shmid < 0) {
-               ErrPrint("shmget: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       si.readOnly = False;
-       si.shmaddr = shmat(si.shmid, NULL, 0);
-       if (si.shmaddr == (void *)-1) {
-               if (shmctl(si.shmid, IPC_RMID, 0) < 0) {
-                       ErrPrint("shmctl: %s\n", strerror(errno));
-               }
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       screen = DefaultScreenOfDisplay(disp);
-       visual = DefaultVisualOfScreen(screen);
-       /*!
-        * \NOTE
-        * XCreatePixmap can only uses 24 bits depth only.
-        */
-       xim = XShmCreateImage(disp, visual, (gem->depth << 3), ZPixmap, NULL, &si, gem->w, gem->h);
-       if (xim == NULL) {
-               if (shmdt(si.shmaddr) < 0) {
-                       ErrPrint("shmdt: %s\n", strerror(errno));
-               }
-
-               if (shmctl(si.shmid, IPC_RMID, 0) < 0) {
-                       ErrPrint("shmctl: %s\n", strerror(errno));
-               }
-               return LB_STATUS_ERROR_FAULT;
+    XShmSegmentInfo si;
+    XImage *xim;
+    GC gc;
+    Display *disp;
+    struct gem_data *gem;
+    Screen *screen;
+    Visual *visual;
+
+    if (buffer->state != DBOX_FB_STATE_CREATED) {
+       ErrPrint("Invalid state of a FB\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    if (buffer->type != DBOX_FB_TYPE_PIXMAP) {
+       ErrPrint("Invalid buffer\n");
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    disp = ecore_x_display_get();
+    if (!disp) {
+       ErrPrint("Failed to get a display\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    gem = (struct gem_data *)buffer->data;
+    if (gem->w == 0 || gem->h == 0) {
+       DbgPrint("Nothing can be sync\n");
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    si.shmid = shmget(IPC_PRIVATE, gem->w * gem->h * gem->depth, IPC_CREAT | 0666);
+    if (si.shmid < 0) {
+       ErrPrint("shmget: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    si.readOnly = False;
+    si.shmaddr = shmat(si.shmid, NULL, 0);
+    if (si.shmaddr == (void *)-1) {
+       if (shmctl(si.shmid, IPC_RMID, 0) < 0) {
+           ErrPrint("shmctl: %s\n", strerror(errno));
+       }
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    screen = DefaultScreenOfDisplay(disp);
+    visual = DefaultVisualOfScreen(screen);
+    /*!
+     * \NOTE
+     * XCreatePixmap can only uses 24 bits depth only.
+     */
+    xim = XShmCreateImage(disp, visual, (gem->depth << 3), ZPixmap, NULL, &si, gem->w, gem->h);
+    if (xim == NULL) {
+       if (shmdt(si.shmaddr) < 0) {
+           ErrPrint("shmdt: %s\n", strerror(errno));
        }
 
-       xim->data = si.shmaddr;
-       XShmAttach(disp, &si);
-       XSync(disp, False);
-
-       gc = XCreateGC(disp, gem->pixmap, 0, NULL);
-       if (!gc) {
-               XShmDetach(disp, &si);
-               XDestroyImage(xim);
-
-               if (shmdt(si.shmaddr) < 0) {
-                       ErrPrint("shmdt: %s\n", strerror(errno));
-               }
-
-               if (shmctl(si.shmid, IPC_RMID, 0) < 0) {
-                       ErrPrint("shmctl: %s\n", strerror(errno));
-               }
-
-               return LB_STATUS_ERROR_FAULT;
+       if (shmctl(si.shmid, IPC_RMID, 0) < 0) {
+           ErrPrint("shmctl: %s\n", strerror(errno));
        }
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       memcpy(xim->data, gem->data, gem->w * gem->h * gem->depth);
-
-       /*!
-        * \note Do not send the event.
-        *       Instead of X event, master will send the updated event to the viewer
-        */
-       XShmPutImage(disp, gem->pixmap, gc, xim, 0, 0, 0, 0, gem->w, gem->h, False);
-       XSync(disp, False);
+    xim->data = si.shmaddr;
+    XShmAttach(disp, &si);
+    XSync(disp, False);
 
-       XFreeGC(disp, gc);
+    gc = XCreateGC(disp, gem->pixmap, 0, NULL);
+    if (!gc) {
        XShmDetach(disp, &si);
        XDestroyImage(xim);
 
        if (shmdt(si.shmaddr) < 0) {
-               ErrPrint("shmdt: %s\n", strerror(errno));
+           ErrPrint("shmdt: %s\n", strerror(errno));
        }
 
        if (shmctl(si.shmid, IPC_RMID, 0) < 0) {
-               ErrPrint("shmctl: %s\n", strerror(errno));
+           ErrPrint("shmctl: %s\n", strerror(errno));
        }
 
-       return LB_STATUS_SUCCESS;
-}
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-EAPI void buffer_handler_flush(struct buffer_info *info)
-{
-       int fd;
-       int size;
-       struct buffer *buffer;
+    memcpy(xim->data, gem->data, gem->w * gem->h * gem->depth);
 
-       if (!info || !info->buffer) {
-               return;
-       }
+    /*!
+     * \note Do not send the event.
+     *       Instead of X event, master will send the updated event to the viewer
+     */
+    XShmPutImage(disp, gem->pixmap, gc, xim, 0, 0, 0, 0, gem->w, gem->h, False);
+    XSync(disp, False);
 
-       buffer = info->buffer;
-
-       if (buffer->type == BUFFER_TYPE_PIXMAP) {
-               if (s_info.fd > 0) {
-                       //return;
-                       //PERF_INIT();
-                       //PERF_BEGIN();
-                       XRectangle rect;
-                       XserverRegion region;
-
-                       rect.x = 0;
-                       rect.y = 0;
-                       rect.width = info->w;
-                       rect.height = info->h;
-
-                       region = XFixesCreateRegion(ecore_x_display_get(), &rect, 1);
-                       XDamageAdd(ecore_x_display_get(), buffer_handler_pixmap(info), region);
-                       XFixesDestroyRegion(ecore_x_display_get(), region);
-                       XFlush(ecore_x_display_get());
-                       //PERF_MARK("XFlush");
-               } else {
-                       if (sync_for_pixmap(buffer) < 0) {
-                               ErrPrint("Failed to sync via S/W Backend\n");
-                       }
-               }
-       } else if (buffer->type == BUFFER_TYPE_FILE) {
-               fd = open(util_uri_to_path(info->id), O_WRONLY | O_CREAT, 0644);
-               if (fd < 0) {
-                       ErrPrint("%s open falied: %s\n", util_uri_to_path(info->id), strerror(errno));
-                       return;
-               }
+    XFreeGC(disp, gc);
+    XShmDetach(disp, &si);
+    XDestroyImage(xim);
 
-               size = info->w * info->h * info->pixel_size;
-               do_buffer_lock(info);
-               if (write(fd, info->buffer, size) != size) {
-                       ErrPrint("Write is not completed: %s\n", strerror(errno));
-               }
-               do_buffer_unlock(info);
+    if (shmdt(si.shmaddr) < 0) {
+       ErrPrint("shmdt: %s\n", strerror(errno));
+    }
 
-               if (close(fd) < 0) {
-                       ErrPrint("close: %s\n", strerror(errno));
-               }
-       } else {
-               DbgPrint("Flush nothing\n");
-       }
+    if (shmctl(si.shmid, IPC_RMID, 0) < 0) {
+       ErrPrint("shmctl: %s\n", strerror(errno));
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
 }
 
-HAPI int buffer_handler_init(void)
+EAPI void buffer_handler_flush(struct buffer_info *info)
 {
-       int dri2Major, dri2Minor;
-       char *driverName, *deviceName;
-       drm_magic_t magic;
-
-       if (!DRI2QueryExtension(ecore_x_display_get(), &s_info.evt_base, &s_info.err_base)) {
-               ErrPrint("DRI2 is not supported\n");
-               return LB_STATUS_SUCCESS;
+    int fd;
+    int size;
+    dynamicbox_fb_t buffer;
+
+    if (!info || !info->buffer) {
+       return;
+    }
+
+    buffer = info->buffer;
+
+    if (buffer->type == DBOX_FB_TYPE_PIXMAP) {
+       if (s_info.fd > 0) {
+           //return;
+           //PERF_INIT();
+           //PERF_BEGIN();
+           XRectangle rect;
+           XserverRegion region;
+
+           rect.x = 0;
+           rect.y = 0;
+           rect.width = info->w;
+           rect.height = info->h;
+
+           region = XFixesCreateRegion(ecore_x_display_get(), &rect, 1);
+           XDamageAdd(ecore_x_display_get(), buffer_handler_pixmap(info), region);
+           XFixesDestroyRegion(ecore_x_display_get(), region);
+           XFlush(ecore_x_display_get());
+           //PERF_MARK("XFlush");
+       } else {
+           if (sync_for_pixmap(buffer) < 0) {
+               ErrPrint("Failed to sync via S/W Backend\n");
+           }
        }
-
-       if (!DRI2QueryVersion(ecore_x_display_get(), &dri2Major, &dri2Minor)) {
-               ErrPrint("DRI2 is not supported\n");
-               s_info.evt_base = 0;
-               s_info.err_base = 0;
-               return LB_STATUS_SUCCESS;
+    } else if (buffer->type == DBOX_FB_TYPE_FILE) {
+       fd = open(util_uri_to_path(info->id), O_WRONLY | O_CREAT, 0644);
+       if (fd < 0) {
+           ErrPrint("%s open falied: %s\n", util_uri_to_path(info->id), strerror(errno));
+           return;
        }
 
-       if (!DRI2Connect(ecore_x_display_get(), DefaultRootWindow(ecore_x_display_get()), &driverName, &deviceName)) {
-               ErrPrint("DRI2 is not supported\n");
-               s_info.evt_base = 0;
-               s_info.err_base = 0;
-               return LB_STATUS_SUCCESS;
+       size = info->w * info->h * info->pixel_size;
+       dynamicbox_service_acquire_lock(info->lock_info);
+       if (write(fd, info->buffer, size) != size) {
+           ErrPrint("Write is not completed: %s\n", strerror(errno));
        }
+       dynamicbox_service_release_lock(info->lock_info);
 
-       if (USE_SW_BACKEND) {
-               DbgPrint("Fallback to the S/W Backend\n");
-               s_info.evt_base = 0;
-               s_info.err_base = 0;
-               DbgFree(deviceName);
-               DbgFree(driverName);
-               return LB_STATUS_SUCCESS;
+       if (close(fd) < 0) {
+           ErrPrint("close: %s\n", strerror(errno));
        }
+    } else {
+       DbgPrint("Flush nothing\n");
+    }
+}
 
-       s_info.fd = open(deviceName, O_RDWR);
+HAPI int buffer_handler_init(void)
+{
+    int dri2Major, dri2Minor;
+    char *driverName, *deviceName;
+    drm_magic_t magic;
+
+    if (!DRI2QueryExtension(ecore_x_display_get(), &s_info.evt_base, &s_info.err_base)) {
+       ErrPrint("DRI2 is not supported\n");
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    if (!DRI2QueryVersion(ecore_x_display_get(), &dri2Major, &dri2Minor)) {
+       ErrPrint("DRI2 is not supported\n");
+       s_info.evt_base = 0;
+       s_info.err_base = 0;
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    if (!DRI2Connect(ecore_x_display_get(), DefaultRootWindow(ecore_x_display_get()), &driverName, &deviceName)) {
+       ErrPrint("DRI2 is not supported\n");
+       s_info.evt_base = 0;
+       s_info.err_base = 0;
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    if (DYNAMICBOX_CONF_USE_SW_BACKEND) {
+       DbgPrint("Fallback to the S/W Backend\n");
+       s_info.evt_base = 0;
+       s_info.err_base = 0;
        DbgFree(deviceName);
        DbgFree(driverName);
-       if (s_info.fd < 0) {
-               ErrPrint("Failed to open a drm device: (%s)\n", strerror(errno));
-               s_info.evt_base = 0;
-               s_info.err_base = 0;
-               return LB_STATUS_SUCCESS;
-       }
-
-       drmGetMagic(s_info.fd, &magic);
-       DbgPrint("DRM Magic: 0x%X\n", magic);
-       if (!DRI2Authenticate(ecore_x_display_get(), DefaultRootWindow(ecore_x_display_get()), (unsigned int)magic)) {
-               ErrPrint("Failed to do authenticate for DRI2\n");
-               if (close(s_info.fd) < 0) {
-                       ErrPrint("close: %s\n", strerror(errno));
-               }
-               s_info.fd = -1;
-               s_info.evt_base = 0;
-               s_info.err_base = 0;
-               return LB_STATUS_SUCCESS;
-       }
-
-       s_info.slp_bufmgr = tbm_bufmgr_init(s_info.fd);
-       if (!s_info.slp_bufmgr) {
-               ErrPrint("Failed to init bufmgr\n");
-               if (close(s_info.fd) < 0) {
-                       ErrPrint("close: %s\n", strerror(errno));
-               }
-               s_info.fd = -1;
-               s_info.evt_base = 0;
-               s_info.err_base = 0;
-               return LB_STATUS_SUCCESS;
-       }
-
-       return LB_STATUS_SUCCESS;
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    s_info.fd = open(deviceName, O_RDWR);
+    DbgFree(deviceName);
+    DbgFree(driverName);
+    if (s_info.fd < 0) {
+       ErrPrint("Failed to open a drm device: (%s)\n", strerror(errno));
+       s_info.evt_base = 0;
+       s_info.err_base = 0;
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    drmGetMagic(s_info.fd, &magic);
+    DbgPrint("DRM Magic: 0x%X\n", magic);
+    if (!DRI2Authenticate(ecore_x_display_get(), DefaultRootWindow(ecore_x_display_get()), (unsigned int)magic)) {
+       ErrPrint("Failed to do authenticate for DRI2\n");
+       if (close(s_info.fd) < 0) {
+           ErrPrint("close: %s\n", strerror(errno));
+       }
+       s_info.fd = -1;
+       s_info.evt_base = 0;
+       s_info.err_base = 0;
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    s_info.slp_bufmgr = tbm_bufmgr_init(s_info.fd);
+    if (!s_info.slp_bufmgr) {
+       ErrPrint("Failed to init bufmgr\n");
+       if (close(s_info.fd) < 0) {
+           ErrPrint("close: %s\n", strerror(errno));
+       }
+       s_info.fd = -1;
+       s_info.evt_base = 0;
+       s_info.err_base = 0;
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int buffer_handler_fini(void)
 {
-       if (s_info.fd >= 0) {
-               if (close(s_info.fd) < 0) {
-                       ErrPrint("close: %s\n", strerror(errno));
-               }
-               s_info.fd = -1;
+    if (s_info.fd >= 0) {
+       if (close(s_info.fd) < 0) {
+           ErrPrint("close: %s\n", strerror(errno));
        }
+       s_info.fd = -1;
+    }
 
-       if (s_info.slp_bufmgr) {
-               tbm_bufmgr_deinit(s_info.slp_bufmgr);
-               s_info.slp_bufmgr = NULL;
-       }
+    if (s_info.slp_bufmgr) {
+       tbm_bufmgr_deinit(s_info.slp_bufmgr);
+       s_info.slp_bufmgr = NULL;
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
-static inline struct buffer *raw_open_file(const char *filename)
+static inline dynamicbox_fb_t raw_open_file(const char *filename)
 {
-       struct buffer *buffer;
-       int fd;
-       off_t off;
-       int ret;
-
-       fd = open(filename, O_RDONLY);
-       if (fd < 0) {
-               ErrPrint("open: %s\n", strerror(errno));
-               return NULL;
-       }
-
-       off = lseek(fd, 0L, SEEK_END);
-       if (off == (off_t)-1) {
-               ErrPrint("lseek: %s\n", strerror(errno));
+    dynamicbox_fb_t buffer;
+    int fd;
+    off_t off;
+    int ret;
+
+    fd = open(filename, O_RDONLY);
+    if (fd < 0) {
+       ErrPrint("open: %s\n", strerror(errno));
+       return NULL;
+    }
 
-               if (close(fd) < 0) {
-                       ErrPrint("close: %s\n", strerror(errno));
-               }
+    off = lseek(fd, 0L, SEEK_END);
+    if (off == (off_t)-1) {
+       ErrPrint("lseek: %s\n", strerror(errno));
 
-               return NULL;
+       if (close(fd) < 0) {
+           ErrPrint("close: %s\n", strerror(errno));
        }
 
-       if (lseek(fd, 0L, SEEK_SET) == (off_t)-1) {
-               ErrPrint("lseek: %s\n", strerror(errno));
+       return NULL;
+    }
 
-               if (close(fd) < 0) {
-                       ErrPrint("close: %s\n", strerror(errno));
-               }
+    if (lseek(fd, 0L, SEEK_SET) == (off_t)-1) {
+       ErrPrint("lseek: %s\n", strerror(errno));
 
-               return NULL;
+       if (close(fd) < 0) {
+           ErrPrint("close: %s\n", strerror(errno));
        }
 
-       buffer = calloc(1, sizeof(*buffer) + off);
-       if (!buffer) {
-               ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
 
-               if (close(fd) < 0) {
-                       ErrPrint("close: %s\n", strerror(errno));
-               }
+    buffer = calloc(1, sizeof(*buffer) + off);
+    if (!buffer) {
+       ErrPrint("Heap: %s\n", strerror(errno));
 
-               return NULL;
+       if (close(fd) < 0) {
+           ErrPrint("close: %s\n", strerror(errno));
        }
 
-       buffer->state = CREATED;
-       buffer->type = BUFFER_TYPE_FILE;
-       buffer->refcnt = 0;
-       buffer->info = (void *)off;
-
-       ret = read(fd, buffer->data, off);
-       if (ret < 0) {
-               ErrPrint("read: %s\n", strerror(errno));
-               DbgFree(buffer);
+       return NULL;
+    }
 
-               if (close(fd) < 0) {
-                       ErrPrint("close: %s\n", strerror(errno));
-               }
+    buffer->state = DBOX_FB_STATE_CREATED;
+    buffer->type = DBOX_FB_TYPE_FILE;
+    buffer->refcnt = 0;
+    buffer->info = (void *)off;
 
-               return NULL;
-       }
+    ret = read(fd, buffer->data, off);
+    if (ret < 0) {
+       ErrPrint("read: %s\n", strerror(errno));
+       DbgFree(buffer);
 
        if (close(fd) < 0) {
-               ErrPrint("close: %s\n", strerror(errno));
+           ErrPrint("close: %s\n", strerror(errno));
        }
 
-       return buffer;
+       return NULL;
+    }
+
+    if (close(fd) < 0) {
+       ErrPrint("close: %s\n", strerror(errno));
+    }
+
+    return buffer;
 }
 
-static inline int raw_close_file(struct buffer *buffer)
+static inline int raw_close_file(dynamicbox_fb_t buffer)
 {
-       DbgFree(buffer);
-       return 0;
+    DbgFree(buffer);
+    return 0;
 }
 
-static inline struct buffer *raw_open_shm(int shm)
+static inline dynamicbox_fb_t raw_open_shm(int shm)
 {
-       struct buffer *buffer;
+    dynamicbox_fb_t buffer;
 
-       buffer = (struct buffer *)shmat(shm, NULL, SHM_RDONLY);
-       if (buffer == (struct buffer *)-1) {
-               ErrPrint("shmat: %s\n", strerror(errno));
-               return NULL;
-       }
+    buffer = (dynamicbox_fb_t)shmat(shm, NULL, SHM_RDONLY);
+    if (buffer == (dynamicbox_fb_t)-1) {
+       ErrPrint("shmat: %s\n", strerror(errno));
+       return NULL;
+    }
 
-       return buffer;
+    return buffer;
 }
 
-static inline int raw_close_shm(struct buffer *buffer)
+static inline int raw_close_shm(dynamicbox_fb_t buffer)
 {
-       int ret;
+    int ret;
 
-       ret = shmdt(buffer);
-       if (ret < 0) {
-               ErrPrint("shmdt: %s\n", strerror(errno));
-       }
+    ret = shmdt(buffer);
+    if (ret < 0) {
+       ErrPrint("shmdt: %s\n", strerror(errno));
+    }
 
-       return ret;
+    return ret;
 }
 
-static inline struct buffer *raw_open_pixmap(unsigned int pixmap)
+static inline dynamicbox_fb_t raw_open_pixmap(unsigned int pixmap)
 {
-       struct buffer *buffer;
+    dynamicbox_fb_t buffer;
 
-       buffer = calloc(1, sizeof(*buffer) + DEFAULT_PIXELS);
-       if (!buffer) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return NULL;
-       }
+    buffer = calloc(1, sizeof(*buffer) + DYNAMICBOX_CONF_DEFAULT_PIXELS);
+    if (!buffer) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
 
-       buffer->state = CREATED;
-       buffer->type = BUFFER_TYPE_PIXMAP;
+    buffer->state = DBOX_FB_STATE_CREATED;
+    buffer->type = DBOX_FB_TYPE_PIXMAP;
 
-       return buffer;
+    return buffer;
 }
 
-static inline int raw_close_pixmap(struct buffer *buffer)
+static inline int raw_close_pixmap(dynamicbox_fb_t buffer)
 {
-       DbgFree(buffer);
-       return 0;
+    DbgFree(buffer);
+    return 0;
 }
 
-EAPI void *buffer_handler_raw_data(struct buffer *buffer)
+EAPI void *buffer_handler_raw_data(dynamicbox_fb_t buffer)
 {
-       if (!buffer || buffer->state != CREATED) {
-               return NULL;
-       }
+    if (!buffer || buffer->state != DBOX_FB_STATE_CREATED) {
+       return NULL;
+    }
 
-       return buffer->data;
+    return buffer->data;
 }
 
-EAPI int buffer_handler_raw_size(struct buffer *buffer)
+EAPI int buffer_handler_raw_size(dynamicbox_fb_t buffer)
 {
-       if (!buffer || buffer->state != CREATED) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!buffer || buffer->state != DBOX_FB_STATE_CREATED) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       return (int)buffer->info;
+    return (int)buffer->info;
 }
 
-EAPI struct buffer *buffer_handler_raw_open(enum buffer_type buffer_type, void *resource)
+EAPI dynamicbox_fb_t buffer_handler_raw_open(enum dynamicbox_fb_type dynamicbox_fb_type, void *resource)
 {
-       struct buffer *handle;
+    dynamicbox_fb_t handle;
+
+    switch (dynamicbox_fb_type) {
+       case DBOX_FB_TYPE_SHM:
+           handle = raw_open_shm((int)resource);
+           break;
+       case DBOX_FB_TYPE_FILE:
+           handle = raw_open_file(resource);
+           break;
+       case DBOX_FB_TYPE_PIXMAP:
+           handle = raw_open_pixmap((unsigned int)resource);
+           break;
+       default:
+           handle = NULL;
+           break;
+    }
 
-       switch (buffer_type) {
-       case BUFFER_TYPE_SHM:
-               handle = raw_open_shm((int)resource);
-               break;
-       case BUFFER_TYPE_FILE:
-               handle = raw_open_file(resource);
-               break;
-       case BUFFER_TYPE_PIXMAP:
-               handle = raw_open_pixmap((unsigned int)resource);
-               break;
+    return handle;
+}
+
+EAPI int buffer_handler_raw_close(dynamicbox_fb_t buffer)
+{
+    int ret;
+
+    if (!buffer || buffer->state != DBOX_FB_STATE_CREATED) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    switch (buffer->type) {
+       case DBOX_FB_TYPE_SHM:
+           ret = raw_close_shm(buffer);
+           break;
+       case DBOX_FB_TYPE_FILE:
+           ret = raw_close_file(buffer);
+           break;
+       case DBOX_FB_TYPE_PIXMAP:
+           ret = raw_close_pixmap(buffer);
+           break;
        default:
-               handle = NULL;
-               break;
-       }
+           ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+           break;
+    }
 
-       return handle;
+    return ret;
 }
 
-EAPI int buffer_handler_raw_close(struct buffer *buffer)
+EAPI int buffer_handler_lock(struct buffer_info *info)
 {
-       int ret;
+    if (!info) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       switch (buffer->type) {
-       case BUFFER_TYPE_SHM:
-               ret = raw_close_shm(buffer);
-               break;
-       case BUFFER_TYPE_FILE:
-               ret = raw_close_file(buffer);
-               break;
-       case BUFFER_TYPE_PIXMAP:
-               ret = raw_close_pixmap(buffer);
-               break;
-       default:
-               ret = LB_STATUS_ERROR_INVALID;
-               break;
-       }
+    if (info->type == DBOX_FB_TYPE_PIXMAP) {
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    if (info->type == DBOX_FB_TYPE_FILE) {
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
-       return ret;
+    return dynamicbox_service_acquire_lock(info->lock_info);
 }
 
-EAPI int buffer_handler_lock(struct buffer_info *buffer)
+EAPI int buffer_handler_unlock(struct buffer_info *info)
 {
-       if (buffer->type == BUFFER_TYPE_PIXMAP) {
-               return LB_STATUS_SUCCESS;
-       }
+    if (!info) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (buffer->type == BUFFER_TYPE_FILE) {
-               return LB_STATUS_SUCCESS;
-       }
+    if (info->type == DBOX_FB_TYPE_PIXMAP) {
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
-       return do_buffer_lock(buffer);
+    if (info->type == DBOX_FB_TYPE_FILE) {
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    return dynamicbox_service_release_lock(info->lock_info);
 }
 
-EAPI int buffer_handler_unlock(struct buffer_info *buffer)
+EAPI int buffer_handler_pixels(struct buffer_info *info)
 {
-       if (buffer->type == BUFFER_TYPE_PIXMAP) {
-               return LB_STATUS_SUCCESS;
-       }
+    if (!info) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (buffer->type == BUFFER_TYPE_FILE) {
-               return LB_STATUS_SUCCESS;
-       }
+    return info->pixel_size;
+}
 
-       return do_buffer_unlock(buffer);
+EAPI int buffer_handler_auto_align(void)
+{
+    return DYNAMICBOX_CONF_AUTO_ALIGN;
+}
+
+EAPI int buffer_handler_stride(struct buffer_info *info)
+{
+    dynamicbox_fb_t buffer;
+    struct gem_data *gem;
+    int stride;
+
+    if (!info) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    switch (info->type) {
+       case DBOX_FB_TYPE_FILE:
+       case DBOX_FB_TYPE_SHM:
+           stride = info->w * info->pixel_size;
+           break;
+       case DBOX_FB_TYPE_PIXMAP:
+           buffer = info->buffer;
+           if (!buffer) {
+               stride = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+               break;
+           }
+
+           gem = (struct gem_data *)buffer->data;
+           if (!gem) {
+               stride = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+               break;
+           }
+
+           if (!gem->dri2_buffer) {
+               /*
+                * Uhm...
+                */
+               ErrPrint("dri2_buffer info is not ready yet!\n");
+               stride = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+               break;
+           }
+
+           stride = gem->dri2_buffer->pitch;
+           break;
+       default:
+           stride = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+           break;
+    }
+
+    return stride;
 }
 
 /*!
@@ -1654,112 +1631,111 @@ EAPI int buffer_handler_unlock(struct buffer_info *buffer)
  * Plugin cannot access the user data
  */
 
-HAPI int buffer_handler_set_data(struct buffer_info *buffer, void *data)
+HAPI int buffer_handler_set_data(struct buffer_info *info, void *data)
 {
-       if (!buffer) {
-               ErrPrint("Invalid handle\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!info) {
+       ErrPrint("Invalid handle\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       buffer->data = data;
-       return LB_STATUS_SUCCESS;
+    info->data = data;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
-HAPI void *buffer_handler_data(struct buffer_info *buffer)
+HAPI void *buffer_handler_data(struct buffer_info *info)
 {
-       if (!buffer) {
-               ErrPrint("Invalid handle\n");
-               return NULL;
-       }
+    if (!info) {
+       ErrPrint("Invalid handle\n");
+       return NULL;
+    }
 
-       return buffer->data;
+    return info->data;
 }
 
 HAPI int buffer_handler_destroy(struct buffer_info *info)
 {
-       Eina_List *l;
-       struct buffer *buffer;
+    Eina_List *l;
+    dynamicbox_fb_t buffer;
 
-       if (!info) {
-               DbgPrint("Buffer is not created yet. info is NIL\n");
-               return LB_STATUS_SUCCESS;
-       }
+    if (!info) {
+       DbgPrint("Buffer is not created yet. info is NIL\n");
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
-       EINA_LIST_FOREACH(s_info.pixmap_list, l, buffer) {
-               if (buffer->info == info) {
-                       buffer->info = NULL;
-               }
+    EINA_LIST_FOREACH(s_info.pixmap_list, l, buffer) {
+       if (buffer->info == info) {
+           buffer->info = NULL;
        }
+    }
 
-       buffer_handler_unload(info);
-       DbgFree(info->id);
-       DbgFree(info);
-       return LB_STATUS_SUCCESS;
+    buffer_handler_unload(info);
+    DbgFree(info->id);
+    DbgFree(info);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
-HAPI struct buffer_info *buffer_handler_create(struct inst_info *inst, enum buffer_type type, int w, int h, int pixel_size)
+HAPI struct buffer_info *buffer_handler_create(struct inst_info *inst, enum dynamicbox_fb_type type, int w, int h, int pixel_size)
 {
-       struct buffer_info *info;
-
-       info = malloc(sizeof(*info));
-       if (!info) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return NULL;
-       }
+    struct buffer_info *info;
 
-       switch (type) {
-       case BUFFER_TYPE_SHM:
-               if (pixel_size != DEFAULT_PIXELS) {
-                       DbgPrint("SHM only supportes %d bytes pixels (requested: %d)\n", DEFAULT_PIXELS, pixel_size);
-                       pixel_size = DEFAULT_PIXELS;
-               }
+    info = malloc(sizeof(*info));
+    if (!info) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
 
-               info->id = strdup(SCHEMA_SHM "-1");
-               if (!info->id) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       DbgFree(info);
-                       return NULL;
-               }
-               break;
-       case BUFFER_TYPE_FILE:
-               if (pixel_size != DEFAULT_PIXELS) {
-                       DbgPrint("FILE only supportes %d bytes pixels (requested: %d)\n", DEFAULT_PIXELS, pixel_size);
-                       pixel_size = DEFAULT_PIXELS;
-               }
+    switch (type) {
+       case DBOX_FB_TYPE_SHM:
+           if (pixel_size != DYNAMICBOX_CONF_DEFAULT_PIXELS) {
+               DbgPrint("SHM only supportes %d bytes pixels (requested: %d)\n", DYNAMICBOX_CONF_DEFAULT_PIXELS, pixel_size);
+               pixel_size = DYNAMICBOX_CONF_DEFAULT_PIXELS;
+           }
 
-               info->id = strdup(SCHEMA_FILE "/tmp/.live.undefined");
-               if (!info->id) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       DbgFree(info);
-                       return NULL;
-               }
-               break;
-       case BUFFER_TYPE_PIXMAP:
-               info->id = strdup(SCHEMA_PIXMAP "0:0");
-               if (!info->id) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       DbgFree(info);
-                       return NULL;
-               }
-               break;
-       default:
-               ErrPrint("Invalid type\n");
+           info->id = strdup(SCHEMA_SHM "-1");
+           if (!info->id) {
+               ErrPrint("Heap: %s\n", strerror(errno));
                DbgFree(info);
                return NULL;
-       }
-
-       info->lock = NULL;
-       info->lock_fd = -1;
-       info->w = w;
-       info->h = h;
-       info->pixel_size = pixel_size;
-       info->type = type;
-       info->is_loaded = 0;
-       info->inst = inst;
-       info->buffer = NULL;
-       info->data = NULL;
-
-       return info;
+           }
+           break;
+       case DBOX_FB_TYPE_FILE:
+           if (pixel_size != DYNAMICBOX_CONF_DEFAULT_PIXELS) {
+               DbgPrint("FILE only supportes %d bytes pixels (requested: %d)\n", DYNAMICBOX_CONF_DEFAULT_PIXELS, pixel_size);
+               pixel_size = DYNAMICBOX_CONF_DEFAULT_PIXELS;
+           }
+
+           info->id = strdup(SCHEMA_FILE "/tmp/.live.undefined");
+           if (!info->id) {
+               ErrPrint("Heap: %s\n", strerror(errno));
+               DbgFree(info);
+               return NULL;
+           }
+           break;
+       case DBOX_FB_TYPE_PIXMAP:
+           info->id = strdup(SCHEMA_PIXMAP "0:0");
+           if (!info->id) {
+               ErrPrint("Heap: %s\n", strerror(errno));
+               DbgFree(info);
+               return NULL;
+           }
+           break;
+       default:
+           ErrPrint("Invalid type\n");
+           DbgFree(info);
+           return NULL;
+    }
+
+    info->lock_info = NULL;
+    info->w = w;
+    info->h = h;
+    info->pixel_size = pixel_size;
+    info->type = type;
+    info->is_loaded = 0;
+    info->inst = inst;
+    info->buffer = NULL;
+    info->data = NULL;
+
+    return info;
 }
 
 /* End of a file */
index 947e1b4..1eaef62 100644 (file)
@@ -30,7 +30,7 @@
 
 #include <dlog.h>
 #include <packet.h>
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
 
 #include "debug.h"
 #include "conf.h"
 #include "script_handler.h" // Reverse dependency. must has to be broken
 
 struct buffer {
-       enum {
-               CREATED = 0x00beef00,
-               DESTROYED = 0x00dead00
-       } state;
-       enum buffer_type type;
-       int refcnt;
-       void *info;
-       char data[];
+    enum {
+       CREATED = 0x00beef00,
+       DESTROYED = 0x00dead00
+    } state;
+    enum buffer_type type;
+    int refcnt;
+    void *info;
+    char data[];
 };
 
 struct buffer_info
 {
-       void *buffer;
-       char *id;
-       char *lock;
-       int lock_fd;
+    void *buffer;
+    char *id;
+    char *lock;
+    int lock_fd;
 
-       enum buffer_type type;
+    enum buffer_type type;
 
-       int w;
-       int h;
-       int pixel_size;
-       int is_loaded;
+    int w;
+    int h;
+    int pixel_size;
+    int auto_align;
+    int is_loaded;
 
-       struct inst_info *inst;
-       void *data;
+    struct inst_info *inst;
+    void *data;
 };
 
 static int destroy_lock_file(struct buffer_info *info)
 {
-       if (!info->inst) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!info->inst) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (!info->lock) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!info->lock) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (close(info->lock_fd) < 0) {
-               ErrPrint("close: %s\n", strerror(errno));
-       }
-       info->lock_fd = -1;
+    if (close(info->lock_fd) < 0) {
+       ErrPrint("close: %s\n", strerror(errno));
+    }
+    info->lock_fd = -1;
 
-       if (unlink(info->lock) < 0) {
-               ErrPrint("unlink: %s\n", strerror(errno));
-       }
+    if (unlink(info->lock) < 0) {
+       ErrPrint("unlink: %s\n", strerror(errno));
+    }
 
-       DbgFree(info->lock);
-       info->lock = NULL;
-       return LB_STATUS_SUCCESS;
+    DbgFree(info->lock);
+    info->lock = NULL;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static int create_lock_file(struct buffer_info *info)
 {
-       const char *id;
-       int len;
-       char *file;
-       char target[3] = "pd";
-
-       if (!info->inst) {
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       id = instance_id(info->inst);
-       if (!id) {
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       len = strlen(id);
-       file = malloc(len + 20);
-       if (!file) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       if (script_handler_buffer_info(instance_pd_script(info->inst)) != info && instance_pd_buffer(info->inst) != info) {
-               target[0] = 'l';
-               target[1] = 'b';
-               /* target[2] = '\0'; // We already have this ;) */
-       }
-
-       snprintf(file, len + 20, "%s.%s.lck", util_uri_to_path(id), target);
-       info->lock_fd = open(file, O_WRONLY|O_CREAT, 0644);
-       if (info->lock_fd < 0) {
-               ErrPrint("open: %s\n", strerror(errno));
-               DbgFree(file);
-               return LB_STATUS_ERROR_IO;
-       }
-
-       info->lock = file;
-       return LB_STATUS_SUCCESS;
+    const char *id;
+    int len;
+    char *file;
+    char target[3] = "pd";
+
+    if (!info->inst) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    id = instance_id(info->inst);
+    if (!id) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    len = strlen(id);
+    file = malloc(len + 20);
+    if (!file) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    if (script_handler_buffer_info(instance_gbar_script(info->inst)) != info && instance_gbar_buffer(info->inst) != info) {
+       target[0] = 'l';
+       target[1] = 'b';
+       /* target[2] = '\0'; // We already have this ;) */
+    }
+
+    snprintf(file, len + 20, "%s.%s.lck", util_uri_to_path(id), target);
+    info->lock_fd = open(file, O_WRONLY|O_CREAT, 0644);
+    if (info->lock_fd < 0) {
+       ErrPrint("open: %s\n", strerror(errno));
+       DbgFree(file);
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
+
+    info->lock = file;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static int do_buffer_lock(struct buffer_info *buffer)
 {
-       struct flock flock;
-       int ret;
+    struct flock flock;
+    int ret;
 
-       if (buffer->lock_fd < 0) {
-               return LB_STATUS_SUCCESS;
-       }
+    if (buffer->lock_fd < 0) {
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
-       flock.l_type = F_WRLCK;
-       flock.l_whence = SEEK_SET;
-       flock.l_start = 0;
-       flock.l_len = 0;
-       flock.l_pid = getpid();
+    flock.l_type = F_WRLCK;
+    flock.l_whence = SEEK_SET;
+    flock.l_start = 0;
+    flock.l_len = 0;
+    flock.l_pid = getpid();
 
-       do {
-               ret = fcntl(buffer->lock_fd, F_SETLKW, &flock);
-               if (ret < 0) {
-                       ret = errno;
-                       ErrPrint("fcntl: %s\n", strerror(errno));
-               }
-       } while (ret == EINTR);
+    do {
+       ret = fcntl(buffer->lock_fd, F_SETLKW, &flock);
+       if (ret < 0) {
+           ret = errno;
+           ErrPrint("fcntl: %s\n", strerror(errno));
+       }
+    } while (ret == EINTR);
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static int do_buffer_unlock(struct buffer_info *buffer)
 {
-       struct flock flock;
-       int ret;
+    struct flock flock;
+    int ret;
 
-       if (buffer->lock_fd < 0) {
-               return LB_STATUS_SUCCESS;
-       }
+    if (buffer->lock_fd < 0) {
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
-       flock.l_type = F_UNLCK;
-       flock.l_whence = SEEK_SET;
-       flock.l_start = 0;
-       flock.l_len = 0;
-       flock.l_pid = getpid();
+    flock.l_type = F_UNLCK;
+    flock.l_whence = SEEK_SET;
+    flock.l_start = 0;
+    flock.l_len = 0;
+    flock.l_pid = getpid();
 
-       do {
-               ret = fcntl(buffer->lock_fd, F_SETLKW, &flock);
-               if (ret < 0) {
-                       ret = errno;
-                       ErrPrint("fcntl: %s\n", strerror(errno));
-               }
-       } while (ret == EINTR);
+    do {
+       ret = fcntl(buffer->lock_fd, F_SETLKW, &flock);
+       if (ret < 0) {
+           ret = errno;
+           ErrPrint("fcntl: %s\n", strerror(errno));
+       }
+    } while (ret == EINTR);
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static inline int load_file_buffer(struct buffer_info *info)
 {
-       struct buffer *buffer;
-       double timestamp;
-       int size;
-       char *new_id;
-       int len;
-
-       len = strlen(IMAGE_PATH) + 40;
-       new_id = malloc(len);
-       if (!new_id) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       timestamp = util_timestamp();
-       snprintf(new_id, len, SCHEMA_FILE "%s%lf", IMAGE_PATH, timestamp);
-
-       size = sizeof(*buffer) + info->w * info->h * info->pixel_size;
-       if (!size) {
-               ErrPrint("Canvas buffer size is ZERO\n");
-               DbgFree(new_id);
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       buffer = calloc(1, size);
-       if (!buffer) {
-               ErrPrint("Failed to allocate buffer\n");
-               DbgFree(new_id);
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       buffer->type = BUFFER_TYPE_FILE;
-       buffer->refcnt = 0;
-       buffer->state = CREATED;
-       buffer->info = info;
-
-       DbgFree(info->id);
-       info->id = new_id;
-       info->buffer = buffer;
-       info->is_loaded = 1;
-
-       DbgPrint("FILE type %d created\n", size);
-       return LB_STATUS_SUCCESS;
+    struct buffer *buffer;
+    double timestamp;
+    int size;
+    char *new_id;
+    int len;
+
+    len = strlen(IMAGE_PATH) + 40;
+    new_id = malloc(len);
+    if (!new_id) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    timestamp = util_timestamp();
+    snprintf(new_id, len, SCHEMA_FILE "%s%lf", IMAGE_PATH, timestamp);
+
+    size = sizeof(*buffer) + info->w * info->h * info->pixel_size;
+    if (!size) {
+       ErrPrint("Canvas buffer size is ZERO\n");
+       DbgFree(new_id);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    buffer = calloc(1, size);
+    if (!buffer) {
+       ErrPrint("Failed to allocate buffer\n");
+       DbgFree(new_id);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    buffer->type = BUFFER_TYPE_FILE;
+    buffer->refcnt = 0;
+    buffer->state = CREATED;
+    buffer->info = info;
+
+    DbgFree(info->id);
+    info->id = new_id;
+    info->buffer = buffer;
+    info->is_loaded = 1;
+
+    DbgPrint("FILE type %d created\n", size);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static inline int load_shm_buffer(struct buffer_info *info)
 {
-       int id;
-       int size;
-       struct buffer *buffer; /* Just for getting a size */
-       char *new_id;
-       int len;
-
-       size = info->w * info->h * info->pixel_size;
-       if (!size) {
-               ErrPrint("Invalid buffer size\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    int id;
+    int size;
+    struct buffer *buffer; /* Just for getting a size */
+    char *new_id;
+    int len;
 
-       id = shmget(IPC_PRIVATE, size + sizeof(*buffer), IPC_CREAT | 0666);
-       if (id < 0) {
-               ErrPrint("shmget: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_FAULT;
-       }
+    size = info->w * info->h * info->pixel_size;
+    if (!size) {
+       ErrPrint("Invalid buffer size\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       buffer = shmat(id, NULL, 0);
-       if (buffer == (void *)-1) {
-               ErrPrint("%s shmat: %s\n", info->id, strerror(errno));
+    id = shmget(IPC_PRIVATE, size + sizeof(*buffer), IPC_CREAT | 0666);
+    if (id < 0) {
+       ErrPrint("shmget: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-               if (shmctl(id, IPC_RMID, 0) < 0) {
-                       ErrPrint("%s shmctl: %s\n", info->id, strerror(errno));
-               }
+    buffer = shmat(id, NULL, 0);
+    if (buffer == (void *)-1) {
+       ErrPrint("%s shmat: %s\n", info->id, strerror(errno));
 
-               return LB_STATUS_ERROR_FAULT;
+       if (shmctl(id, IPC_RMID, 0) < 0) {
+           ErrPrint("%s shmctl: %s\n", info->id, strerror(errno));
        }
 
-       buffer->type = BUFFER_TYPE_SHM;
-       buffer->refcnt = id;
-       buffer->state = CREATED; /*!< Needless */
-       buffer->info = (void *)size; /*!< Use this field to indicates the size of SHM */
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       len = strlen(SCHEMA_SHM) + 30; /* strlen("shm://") + 30 */
+    buffer->type = BUFFER_TYPE_SHM;
+    buffer->refcnt = id;
+    buffer->state = CREATED; /*!< Needless */
+    buffer->info = (void *)size; /*!< Use this field to indicates the size of SHM */
 
-       new_id = malloc(len);
-       if (!new_id) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               if (shmdt(buffer) < 0) {
-                       ErrPrint("shmdt: %s\n", strerror(errno));
-               }
+    len = strlen(SCHEMA_SHM) + 30; /* strlen("shm://") + 30 */
 
-               if (shmctl(id, IPC_RMID, 0) < 0) {
-                       ErrPrint("shmctl: %s\n", strerror(errno));
-               }
+    new_id = malloc(len);
+    if (!new_id) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       if (shmdt(buffer) < 0) {
+           ErrPrint("shmdt: %s\n", strerror(errno));
+       }
 
-               return LB_STATUS_ERROR_MEMORY;
+       if (shmctl(id, IPC_RMID, 0) < 0) {
+           ErrPrint("shmctl: %s\n", strerror(errno));
        }
 
-       snprintf(new_id, len, SCHEMA_SHM "%d", id);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    snprintf(new_id, len, SCHEMA_SHM "%d", id);
 
-       DbgFree(info->id);
-       info->id = new_id;
-       info->buffer = buffer;
-       info->is_loaded = 1;
-       return LB_STATUS_SUCCESS;
+    DbgFree(info->id);
+    info->id = new_id;
+    info->buffer = buffer;
+    info->is_loaded = 1;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 EAPI int buffer_handler_load(struct buffer_info *info)
 {
-       int ret;
+    int ret;
 
-       if (!info) {
-               ErrPrint("buffer handler is nil\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!info) {
+       ErrPrint("buffer handler is nil\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (info->is_loaded) {
-               DbgPrint("Buffer is already loaded\n");
-               return LB_STATUS_SUCCESS;
-       }
+    if (info->is_loaded) {
+       DbgPrint("Buffer is already loaded\n");
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
-       switch (info->type) {
+    switch (info->type) {
        case BUFFER_TYPE_FILE:
-               ret = load_file_buffer(info);
-               (void)create_lock_file(info);
-               break;
+           ret = load_file_buffer(info);
+           (void)create_lock_file(info);
+           break;
        case BUFFER_TYPE_SHM:
-               ret = load_shm_buffer(info);
-               (void)create_lock_file(info);
-               break;
+           ret = load_shm_buffer(info);
+           (void)create_lock_file(info);
+           break;
        case BUFFER_TYPE_PIXMAP:
        default:
-               ErrPrint("Invalid buffer\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               break;
-       }
+           ErrPrint("Invalid buffer\n");
+           ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+           break;
+    }
 
-       return ret;
+    return ret;
 }
 
 static inline int unload_file_buffer(struct buffer_info *info)
 {
-       const char *path;
-       char *new_id;
+    const char *path;
+    char *new_id;
 
-       new_id = strdup(SCHEMA_FILE "/tmp/.live.undefined");
-       if (!new_id) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    new_id = strdup(SCHEMA_FILE "/tmp/.live.undefined");
+    if (!new_id) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       DbgFree(info->buffer);
-       info->buffer = NULL;
+    DbgFree(info->buffer);
+    info->buffer = NULL;
 
-       path = util_uri_to_path(info->id);
-       if (path && unlink(path) < 0) {
-               ErrPrint("unlink: %s\n", strerror(errno));
-       }
+    path = util_uri_to_path(info->id);
+    if (path && unlink(path) < 0) {
+       ErrPrint("unlink: %s\n", strerror(errno));
+    }
 
-       DbgFree(info->id);
-       info->id = new_id;
-       return LB_STATUS_SUCCESS;
+    DbgFree(info->id);
+    info->id = new_id;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static inline int unload_shm_buffer(struct buffer_info *info)
 {
-       int id;
-       char *new_id;
+    int id;
+    char *new_id;
 
-       new_id = strdup(SCHEMA_SHM "-1");
-       if (!new_id) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    new_id = strdup(SCHEMA_SHM "-1");
+    if (!new_id) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       if (sscanf(info->id, SCHEMA_SHM "%d", &id) != 1) {
-               ErrPrint("%s Invalid ID\n", info->id);
-               DbgFree(new_id);
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (sscanf(info->id, SCHEMA_SHM "%d", &id) != 1) {
+       ErrPrint("%s Invalid ID\n", info->id);
+       DbgFree(new_id);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (id < 0) {
-               ErrPrint("(%s) Invalid id: %d\n", info->id, id);
-               DbgFree(new_id);
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (id < 0) {
+       ErrPrint("(%s) Invalid id: %d\n", info->id, id);
+       DbgFree(new_id);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (shmdt(info->buffer) < 0) {
-               ErrPrint("Detach shm: %s\n", strerror(errno));
-       }
+    if (shmdt(info->buffer) < 0) {
+       ErrPrint("Detach shm: %s\n", strerror(errno));
+    }
 
-       if (shmctl(id, IPC_RMID, 0) < 0) {
-               ErrPrint("Remove shm: %s\n", strerror(errno));
-       }
+    if (shmctl(id, IPC_RMID, 0) < 0) {
+       ErrPrint("Remove shm: %s\n", strerror(errno));
+    }
 
-       info->buffer = NULL;
+    info->buffer = NULL;
 
-       DbgFree(info->id);
-       info->id = new_id;
-       return LB_STATUS_SUCCESS;
+    DbgFree(info->id);
+    info->id = new_id;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 EAPI int buffer_handler_unload(struct buffer_info *info)
 {
-       int ret;
+    int ret;
 
-       if (!info) {
-               ErrPrint("buffer handler is NIL\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!info) {
+       ErrPrint("buffer handler is NIL\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (!info->is_loaded) {
-               ErrPrint("Buffer is not loaded\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!info->is_loaded) {
+       ErrPrint("Buffer is not loaded\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       switch (info->type) {
+    switch (info->type) {
        case BUFFER_TYPE_FILE:
-               (void)destroy_lock_file(info);
-               ret = unload_file_buffer(info);
-               break;
+           (void)destroy_lock_file(info);
+           ret = unload_file_buffer(info);
+           break;
        case BUFFER_TYPE_SHM:
-               (void)destroy_lock_file(info);
-               ret = unload_shm_buffer(info);
-               break;
+           (void)destroy_lock_file(info);
+           ret = unload_shm_buffer(info);
+           break;
        case BUFFER_TYPE_PIXMAP:
        default:
-               ErrPrint("Invalid buffer\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               break;
-       }
+           ErrPrint("Invalid buffer\n");
+           ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+           break;
+    }
 
-       if (ret == 0) {
-               info->is_loaded = 0;
-       }
+    if (ret == 0) {
+       info->is_loaded = 0;
+    }
 
-       return ret;
+    return ret;
 }
 
 EAPI const char *buffer_handler_id(const struct buffer_info *info)
 {
-       return info ? info->id : "";
+    return info ? info->id : "";
 }
 
 EAPI enum buffer_type buffer_handler_type(const struct buffer_info *info)
 {
-       return info ? info->type : BUFFER_TYPE_ERROR;
+    return info ? info->type : BUFFER_TYPE_ERROR;
 }
 
 EAPI void *buffer_handler_fb(struct buffer_info *info)
 {
-       struct buffer *buffer;
+    struct buffer *buffer;
 
-       if (!info) {
-               return NULL;
-       }
+    if (!info) {
+       return NULL;
+    }
 
-       buffer = info->buffer;
+    buffer = info->buffer;
 
-       if (info->type == BUFFER_TYPE_PIXMAP) {
-               return NULL;
-       }
+    if (info->type == BUFFER_TYPE_PIXMAP) {
+       return NULL;
+    }
 
-       return buffer->data;
+    return buffer->data;
 }
 
 EAPI int buffer_handler_pixmap(const struct buffer_info *info)
 {
-       return 0;
+    return 0;
 }
 
 EAPI void *buffer_handler_pixmap_acquire_buffer(struct buffer_info *info)
 {
-       return NULL;
+    return NULL;
 }
 
 EAPI void *buffer_handler_pixmap_buffer(struct buffer_info *info)
 {
-       return NULL;
+    return NULL;
 }
 
 /*!
@@ -474,7 +475,7 @@ EAPI void *buffer_handler_pixmap_buffer(struct buffer_info *info)
  */
 EAPI void *buffer_handler_pixmap_ref(struct buffer_info *info)
 {
-       return NULL;
+    return NULL;
 }
 
 /*!
@@ -482,12 +483,12 @@ EAPI void *buffer_handler_pixmap_ref(struct buffer_info *info)
  */
 EAPI void *buffer_handler_pixmap_find(int pixmap)
 {
-       return NULL;
+    return NULL;
 }
 
 EAPI int buffer_handler_pixmap_release_buffer(void *canvas)
 {
-       return LB_STATUS_ERROR_NOT_EXIST;
+    return DBOX_STATUS_ERROR_NOT_EXIST;
 }
 
 /*!
@@ -498,323 +499,323 @@ EAPI int buffer_handler_pixmap_release_buffer(void *canvas)
  */
 EAPI int buffer_handler_pixmap_unref(void *buffer_ptr)
 {
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 EAPI int buffer_handler_is_loaded(const struct buffer_info *info)
 {
-       return info ? info->is_loaded : 0;
+    return info ? info->is_loaded : 0;
 }
 
 EAPI void buffer_handler_update_size(struct buffer_info *info, int w, int h)
 {
-       if (!info) {
-               return;
-       }
+    if (!info) {
+       return;
+    }
 
-       info->w = w;
-       info->h = h;
+    info->w = w;
+    info->h = h;
 }
 
 EAPI int buffer_handler_resize(struct buffer_info *info, int w, int h)
 {
-       int ret;
+    int ret;
 
-       if (!info) {
-               ErrPrint("Invalid handler\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!info) {
+       ErrPrint("Invalid handler\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (info->w == w && info->h == h) {
-               DbgPrint("No changes\n");
-               return LB_STATUS_SUCCESS;
-       }
+    if (info->w == w && info->h == h) {
+       DbgPrint("No changes\n");
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
-       buffer_handler_update_size(info, w, h);
+    buffer_handler_update_size(info, w, h);
 
-       if (!info->is_loaded) {
-               DbgPrint("Buffer size is updated[%dx%d]\n", w, h);
-               return LB_STATUS_SUCCESS;
-       }
+    if (!info->is_loaded) {
+       DbgPrint("Buffer size is updated[%dx%d]\n", w, h);
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
-       ret = buffer_handler_unload(info);
-       if (ret < 0) {
-               ErrPrint("Unload: %d\n", ret);
-       }
+    ret = buffer_handler_unload(info);
+    if (ret < 0) {
+       ErrPrint("Unload: %d\n", ret);
+    }
 
-       ret = buffer_handler_load(info);
-       if (ret < 0) {
-               ErrPrint("Load: %d\n", ret);
-       }
+    ret = buffer_handler_load(info);
+    if (ret < 0) {
+       ErrPrint("Load: %d\n", ret);
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 EAPI int buffer_handler_get_size(struct buffer_info *info, int *w, int *h)
 {
-       if (!info) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!info) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (w) {
-               *w = info->w;
-       }
-       if (h) {
-               *h = info->h;
-       }
+    if (w) {
+       *w = info->w;
+    }
+    if (h) {
+       *h = info->h;
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 EAPI struct inst_info *buffer_handler_instance(struct buffer_info *info)
 {
-       return info->inst;
+    return info->inst;
 }
 
 EAPI void buffer_handler_flush(struct buffer_info *info)
 {
-       int fd;
-       int size;
-       struct buffer *buffer;
+    int fd;
+    int size;
+    struct buffer *buffer;
+
+    if (!info || !info->buffer) {
+       return;
+    }
+
+    buffer = info->buffer;
+
+    if (buffer->type == BUFFER_TYPE_PIXMAP) {
+       /*!
+        * \note
+        * Not supported for wayland or this should be ported correctly
+        */
+    } else if (buffer->type == BUFFER_TYPE_FILE) {
+       fd = open(util_uri_to_path(info->id), O_WRONLY | O_CREAT, 0644);
+       if (fd < 0) {
+           ErrPrint("%s open falied: %s\n", util_uri_to_path(info->id), strerror(errno));
+           return;
+       }
 
-       if (!info || !info->buffer) {
-               return;
+       size = info->w * info->h * info->pixel_size;
+       do_buffer_lock(info);
+       if (write(fd, info->buffer, size) != size) {
+           ErrPrint("Write is not completed: %s\n", strerror(errno));
        }
+       do_buffer_unlock(info);
 
-       buffer = info->buffer;
-
-       if (buffer->type == BUFFER_TYPE_PIXMAP) {
-               /*!
-                * \note
-                * Not supported for wayland or this should be ported correctly
-                */
-       } else if (buffer->type == BUFFER_TYPE_FILE) {
-               fd = open(util_uri_to_path(info->id), O_WRONLY | O_CREAT, 0644);
-               if (fd < 0) {
-                       ErrPrint("%s open falied: %s\n", util_uri_to_path(info->id), strerror(errno));
-                       return;
-               }
-
-               size = info->w * info->h * info->pixel_size;
-               do_buffer_lock(info);
-               if (write(fd, info->buffer, size) != size) {
-                       ErrPrint("Write is not completed: %s\n", strerror(errno));
-               }
-               do_buffer_unlock(info);
-
-               if (close(fd) < 0) {
-                       ErrPrint("close: %s\n", strerror(errno));
-               }
-       } else {
-               DbgPrint("Flush nothing\n");
+       if (close(fd) < 0) {
+           ErrPrint("close: %s\n", strerror(errno));
        }
+    } else {
+       DbgPrint("Flush nothing\n");
+    }
 }
 
 HAPI int buffer_handler_init(void)
 {
-       /*!
-        * \TODO
-        * Implement this for wayland
-        */
-       if (USE_SW_BACKEND) {
-               DbgPrint("Fallback to the S/W Backend\n");
-               return LB_STATUS_SUCCESS;
-       }
+    /*!
+     * \TODO
+     * Implement this for wayland
+     */
+    if (USE_SW_BACKEND) {
+       DbgPrint("Fallback to the S/W Backend\n");
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int buffer_handler_fini(void)
 {
-       /*!
-        * \TODO
-        * Implement this for wayland
-        */
-       return LB_STATUS_SUCCESS;
+    /*!
+     * \TODO
+     * Implement this for wayland
+     */
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static inline struct buffer *raw_open_file(const char *filename)
 {
-       struct buffer *buffer;
-       int fd;
-       off_t off;
-       int ret;
-
-       fd = open(filename, O_RDONLY);
-       if (fd < 0) {
-               ErrPrint("open: %s\n", strerror(errno));
-               return NULL;
-       }
+    struct buffer *buffer;
+    int fd;
+    off_t off;
+    int ret;
 
-       off = lseek(fd, 0L, SEEK_END);
-       if (off == (off_t)-1) {
-               ErrPrint("lseek: %s\n", strerror(errno));
+    fd = open(filename, O_RDONLY);
+    if (fd < 0) {
+       ErrPrint("open: %s\n", strerror(errno));
+       return NULL;
+    }
 
-               if (close(fd) < 0) {
-                       ErrPrint("close: %s\n", strerror(errno));
-               }
+    off = lseek(fd, 0L, SEEK_END);
+    if (off == (off_t)-1) {
+       ErrPrint("lseek: %s\n", strerror(errno));
 
-               return NULL;
+       if (close(fd) < 0) {
+           ErrPrint("close: %s\n", strerror(errno));
        }
 
-       if (lseek(fd, 0L, SEEK_SET) == (off_t)-1) {
-               ErrPrint("lseek: %s\n", strerror(errno));
+       return NULL;
+    }
 
-               if (close(fd) < 0) {
-                       ErrPrint("close: %s\n", strerror(errno));
-               }
+    if (lseek(fd, 0L, SEEK_SET) == (off_t)-1) {
+       ErrPrint("lseek: %s\n", strerror(errno));
 
-               return NULL;
+       if (close(fd) < 0) {
+           ErrPrint("close: %s\n", strerror(errno));
        }
 
-       buffer = calloc(1, sizeof(*buffer) + off);
-       if (!buffer) {
-               ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
 
-               if (close(fd) < 0) {
-                       ErrPrint("close: %s\n", strerror(errno));
-               }
+    buffer = calloc(1, sizeof(*buffer) + off);
+    if (!buffer) {
+       ErrPrint("Heap: %s\n", strerror(errno));
 
-               return NULL;
+       if (close(fd) < 0) {
+           ErrPrint("close: %s\n", strerror(errno));
        }
 
-       buffer->state = CREATED;
-       buffer->type = BUFFER_TYPE_FILE;
-       buffer->refcnt = 0;
-       buffer->info = (void *)off;
-
-       ret = read(fd, buffer->data, off);
-       if (ret < 0) {
-               ErrPrint("read: %s\n", strerror(errno));
-               DbgFree(buffer);
+       return NULL;
+    }
 
-               if (close(fd) < 0) {
-                       ErrPrint("close: %s\n", strerror(errno));
-               }
+    buffer->state = CREATED;
+    buffer->type = BUFFER_TYPE_FILE;
+    buffer->refcnt = 0;
+    buffer->info = (void *)off;
 
-               return NULL;
-       }
+    ret = read(fd, buffer->data, off);
+    if (ret < 0) {
+       ErrPrint("read: %s\n", strerror(errno));
+       DbgFree(buffer);
 
        if (close(fd) < 0) {
-               ErrPrint("close: %s\n", strerror(errno));
+           ErrPrint("close: %s\n", strerror(errno));
        }
 
-       return buffer;
+       return NULL;
+    }
+
+    if (close(fd) < 0) {
+       ErrPrint("close: %s\n", strerror(errno));
+    }
+
+    return buffer;
 }
 
 static inline int raw_close_file(struct buffer *buffer)
 {
-       DbgFree(buffer);
-       return 0;
+    DbgFree(buffer);
+    return 0;
 }
 
 static inline struct buffer *raw_open_shm(int shm)
 {
-       struct buffer *buffer;
+    struct buffer *buffer;
 
-       buffer = (struct buffer *)shmat(shm, NULL, SHM_RDONLY);
-       if (buffer == (struct buffer *)-1) {
-               ErrPrint("shmat: %s\n", strerror(errno));
-               return NULL;
-       }
+    buffer = (struct buffer *)shmat(shm, NULL, SHM_RDONLY);
+    if (buffer == (struct buffer *)-1) {
+       ErrPrint("shmat: %s\n", strerror(errno));
+       return NULL;
+    }
 
-       return buffer;
+    return buffer;
 }
 
 static inline int raw_close_shm(struct buffer *buffer)
 {
-       int ret;
+    int ret;
 
-       ret = shmdt(buffer);
-       if (ret < 0) {
-               ErrPrint("shmdt: %s\n", strerror(errno));
-       }
+    ret = shmdt(buffer);
+    if (ret < 0) {
+       ErrPrint("shmdt: %s\n", strerror(errno));
+    }
 
-       return ret;
+    return ret;
 }
 
 EAPI void *buffer_handler_raw_data(struct buffer *buffer)
 {
-       if (!buffer || buffer->state != CREATED) {
-               return NULL;
-       }
+    if (!buffer || buffer->state != CREATED) {
+       return NULL;
+    }
 
-       return buffer->data;
+    return buffer->data;
 }
 
 EAPI int buffer_handler_raw_size(struct buffer *buffer)
 {
-       if (!buffer || buffer->state != CREATED) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!buffer || buffer->state != CREATED) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       return (int)buffer->info;
+    return (int)buffer->info;
 }
 
 EAPI struct buffer *buffer_handler_raw_open(enum buffer_type buffer_type, void *resource)
 {
-       struct buffer *handle;
+    struct buffer *handle;
 
-       switch (buffer_type) {
+    switch (buffer_type) {
        case BUFFER_TYPE_SHM:
-               handle = raw_open_shm((int)resource);
-               break;
+           handle = raw_open_shm((int)resource);
+           break;
        case BUFFER_TYPE_FILE:
-               handle = raw_open_file(resource);
-               break;
+           handle = raw_open_file(resource);
+           break;
        case BUFFER_TYPE_PIXMAP:
        default:
-               handle = NULL;
-               break;
-       }
+           handle = NULL;
+           break;
+    }
 
-       return handle;
+    return handle;
 }
 
 EAPI int buffer_handler_raw_close(struct buffer *buffer)
 {
-       int ret;
+    int ret;
 
-       switch (buffer->type) {
+    switch (buffer->type) {
        case BUFFER_TYPE_SHM:
-               ret = raw_close_shm(buffer);
-               break;
+           ret = raw_close_shm(buffer);
+           break;
        case BUFFER_TYPE_FILE:
-               ret = raw_close_file(buffer);
-               break;
+           ret = raw_close_file(buffer);
+           break;
        case BUFFER_TYPE_PIXMAP:
        default:
-               ret = LB_STATUS_ERROR_INVALID;
-               break;
-       }
+           ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+           break;
+    }
 
-       return ret;
+    return ret;
 }
 
 EAPI int buffer_handler_lock(struct buffer_info *buffer)
 {
-       if (buffer->type == BUFFER_TYPE_PIXMAP) {
-               return LB_STATUS_SUCCESS;
-       }
+    if (buffer->type == BUFFER_TYPE_PIXMAP) {
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
-       if (buffer->type == BUFFER_TYPE_FILE) {
-               return LB_STATUS_SUCCESS;
-       }
+    if (buffer->type == BUFFER_TYPE_FILE) {
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
-       return do_buffer_lock(buffer);
+    return do_buffer_lock(buffer);
 }
 
 EAPI int buffer_handler_unlock(struct buffer_info *buffer)
 {
-       if (buffer->type == BUFFER_TYPE_PIXMAP) {
-               return LB_STATUS_SUCCESS;
-       }
+    if (buffer->type == BUFFER_TYPE_PIXMAP) {
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
-       if (buffer->type == BUFFER_TYPE_FILE) {
-               return LB_STATUS_SUCCESS;
-       }
+    if (buffer->type == BUFFER_TYPE_FILE) {
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
-       return do_buffer_unlock(buffer);
+    return do_buffer_unlock(buffer);
 }
 
 /*!
@@ -825,97 +826,98 @@ EAPI int buffer_handler_unlock(struct buffer_info *buffer)
 
 HAPI int buffer_handler_set_data(struct buffer_info *buffer, void *data)
 {
-       if (!buffer) {
-               ErrPrint("Invalid handle\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!buffer) {
+       ErrPrint("Invalid handle\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       buffer->data = data;
-       return LB_STATUS_SUCCESS;
+    buffer->data = data;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI void *buffer_handler_data(struct buffer_info *buffer)
 {
-       if (!buffer) {
-               ErrPrint("Invalid handle\n");
-               return NULL;
-       }
+    if (!buffer) {
+       ErrPrint("Invalid handle\n");
+       return NULL;
+    }
 
-       return buffer->data;
+    return buffer->data;
 }
 
 HAPI int buffer_handler_destroy(struct buffer_info *info)
 {
-       Eina_List *l;
-       struct buffer *buffer;
+    Eina_List *l;
+    struct buffer *buffer;
 
-       if (!info) {
-               DbgPrint("Buffer is not created yet. info is NIL\n");
-               return LB_STATUS_SUCCESS;
-       }
+    if (!info) {
+       DbgPrint("Buffer is not created yet. info is NIL\n");
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
-       buffer_handler_unload(info);
-       DbgFree(info->id);
-       DbgFree(info);
-       return LB_STATUS_SUCCESS;
+    buffer_handler_unload(info);
+    DbgFree(info->id);
+    DbgFree(info);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
-HAPI struct buffer_info *buffer_handler_create(struct inst_info *inst, enum buffer_type type, int w, int h, int pixel_size)
+HAPI struct buffer_info *buffer_handler_create(struct inst_info *inst, enum buffer_type type, int w, int h, int pixel_size, int auto_align)
 {
-       struct buffer_info *info;
+    struct buffer_info *info;
 
-       info = malloc(sizeof(*info));
-       if (!info) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return NULL;
-       }
+    info = malloc(sizeof(*info));
+    if (!info) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
 
-       switch (type) {
+    switch (type) {
        case BUFFER_TYPE_SHM:
-               if (pixel_size != DEFAULT_PIXELS) {
-                       DbgPrint("SHM only supportes %d bytes pixels (requested: %d)\n", DEFAULT_PIXELS, pixel_size);
-                       pixel_size = DEFAULT_PIXELS;
-               }
-
-               info->id = strdup(SCHEMA_SHM "-1");
-               if (!info->id) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       DbgFree(info);
-                       return NULL;
-               }
-               break;
-       case BUFFER_TYPE_FILE:
-               if (pixel_size != DEFAULT_PIXELS) {
-                       DbgPrint("FILE only supportes %d bytes pixels (requested: %d)\n", DEFAULT_PIXELS, pixel_size);
-                       pixel_size = DEFAULT_PIXELS;
-               }
-
-               info->id = strdup(SCHEMA_FILE "/tmp/.live.undefined");
-               if (!info->id) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       DbgFree(info);
-                       return NULL;
-               }
-               break;
-       case BUFFER_TYPE_PIXMAP:
-       default:
-               ErrPrint("Invalid type\n");
+           if (pixel_size != DEFAULT_PIXELS) {
+               DbgPrint("SHM only supportes %d bytes pixels (requested: %d)\n", DEFAULT_PIXELS, pixel_size);
+               pixel_size = DEFAULT_PIXELS;
+           }
+
+           info->id = strdup(SCHEMA_SHM "-1");
+           if (!info->id) {
+               ErrPrint("Heap: %s\n", strerror(errno));
                DbgFree(info);
                return NULL;
-       }
-
-       info->lock = NULL;
-       info->lock_fd = -1;
-       info->w = w;
-       info->h = h;
-       info->pixel_size = pixel_size;
-       info->type = type;
-       info->is_loaded = 0;
-       info->inst = inst;
-       info->buffer = NULL;
-       info->data = NULL;
+           }
+           break;
+       case BUFFER_TYPE_FILE:
+           if (pixel_size != DEFAULT_PIXELS) {
+               DbgPrint("FILE only supportes %d bytes pixels (requested: %d)\n", DEFAULT_PIXELS, pixel_size);
+               pixel_size = DEFAULT_PIXELS;
+           }
 
-       return info;
+           info->id = strdup(SCHEMA_FILE "/tmp/.live.undefined");
+           if (!info->id) {
+               ErrPrint("Heap: %s\n", strerror(errno));
+               DbgFree(info);
+               return NULL;
+           }
+           break;
+       case BUFFER_TYPE_PIXMAP:
+       default:
+           ErrPrint("Invalid type\n");
+           DbgFree(info);
+           return NULL;
+    }
+
+    info->lock = NULL;
+    info->lock_fd = -1;
+    info->w = w;
+    info->h = h;
+    info->pixel_size = pixel_size;
+    info->type = type;
+    info->is_loaded = 0;
+    info->inst = inst;
+    info->buffer = NULL;
+    info->data = NULL;
+    info->auto_align = auto_align;
+
+    return info;
 }
 
 /* End of a file */
index d01dc2a..fa6b2fb 100644 (file)
 
 #include <stdio.h>
 #include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/smack.h>
 
 #include <Eina.h>
 #include <Ecore.h>
 
 #include <dlog.h>
 #include <packet.h>
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
+#include <dynamicbox_service.h>
 
 #include "client_life.h"
 #include "instance.h"
 int errno;
 
 static struct {
-       Eina_List *client_list;
-       int nr_of_paused_clients;
+    Eina_List *client_list;
+    int nr_of_paused_clients;
 
-       enum global_event_process {
-               GLOBAL_EVENT_PROCESS_IDLE = 0x00,
-               GLOBAL_EVENT_PROCESS_CREATE = 0x01,
-               GLOBAL_EVENT_PROCESS_DESTROY = 0x02
-       } in_event_process;
+    enum global_event_process {
+       GLOBAL_EVENT_PROCESS_IDLE = 0x00,
+       GLOBAL_EVENT_PROCESS_CREATE = 0x01,
+       GLOBAL_EVENT_PROCESS_DESTROY = 0x02
+    } in_event_process;
 
-       Eina_List *create_event_list;
-       Eina_List *destroy_event_list;
+    Eina_List *create_event_list;
+    Eina_List *destroy_event_list;
 
 } s_info = {
-       .client_list = NULL,
-       .nr_of_paused_clients = 0,
-       .in_event_process = GLOBAL_EVENT_PROCESS_IDLE,
-       .create_event_list = NULL,
-       .destroy_event_list = NULL,
+    .client_list = NULL,
+    .nr_of_paused_clients = 0,
+    .in_event_process = GLOBAL_EVENT_PROCESS_IDLE,
+    .create_event_list = NULL,
+    .destroy_event_list = NULL,
 };
 
 struct subscribe_item {
-       char *cluster;
-       char *category;
+    char *cluster;
+    char *category;
 };
 
 struct global_event_item {
-       void *cbdata;
-       int (*cb)(struct client_node *client, void *data);
-       int deleted;
+    void *cbdata;
+    int (*cb)(struct client_node *client, void *data);
+    int deleted;
 };
 
 struct event_item {
-       void *data;
-       int (*cb)(struct client_node *, void *);
-       int deleted;
+    void *data;
+    int (*cb)(struct client_node *, void *);
+    int deleted;
 };
 
 struct data_item {
-       char *tag;
-       void *data;
+    char *tag;
+    void *data;
 };
 
 struct client_node {
-       pid_t pid;
-       int refcnt;
+    pid_t pid;
+    int refcnt;
 
-       int paused;
+    int paused;
 
-       enum client_event_process {
-               CLIENT_EVENT_PROCESS_IDLE = 0x00,
-               CLIENT_EVENT_PROCESS_DEACTIVATE = 0x01,
-               CLIENT_EVENT_PROCESS_ACTIVATE = 0x02
-       } in_event_process;
-       Eina_List *event_deactivate_list;
-       Eina_List *event_activate_list;
+    enum client_event_process {
+       CLIENT_EVENT_PROCESS_IDLE = 0x00,
+       CLIENT_EVENT_PROCESS_DEACTIVATE = 0x01,
+       CLIENT_EVENT_PROCESS_ACTIVATE = 0x02
+    } in_event_process;
+    Eina_List *event_deactivate_list;
+    Eina_List *event_activate_list;
 
-       Eina_List *data_list;
-       Eina_List *subscribe_list;
+    Eina_List *data_list;
+    Eina_List *subscribe_list;
 
-       int faulted;
+    int faulted;
+    char *direct_addr;
 };
 
 static inline void invoke_global_destroyed_cb(struct client_node *client)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct global_event_item *item;
+    Eina_List *l;
+    Eina_List *n;
+    struct global_event_item *item;
 
-       s_info.in_event_process |= GLOBAL_EVENT_PROCESS_DESTROY;
-       EINA_LIST_FOREACH_SAFE(s_info.destroy_event_list, l, n, item) {
-               /*!
-                * The first,
-                * item->deleted will be checked, so if it is deleted, remove item from the list
-                * The second, if the first routine takes false path,
-                * item->cb will be called, if it returns negative value, remove item from the list
-                * The third, if the second routine takes false path,
-                * Check the item->deleted again, so if it is turnned on, remove item from the list
-                */
-               if (item->deleted || item->cb(client, item->cbdata) < 0 || item->deleted) {
-                       s_info.destroy_event_list = eina_list_remove(s_info.destroy_event_list, item);
-                       DbgFree(item);
-               }
+    s_info.in_event_process |= GLOBAL_EVENT_PROCESS_DESTROY;
+    EINA_LIST_FOREACH_SAFE(s_info.destroy_event_list, l, n, item) {
+       /*!
+        * The first,
+        * item->deleted will be checked, so if it is deleted, remove item from the list
+        * The second, if the first routine takes false path,
+        * item->cb will be called, if it returns negative value, remove item from the list
+        * The third, if the second routine takes false path,
+        * Check the item->deleted again, so if it is turnned on, remove item from the list
+        */
+       if (item->deleted || item->cb(client, item->cbdata) < 0 || item->deleted) {
+           s_info.destroy_event_list = eina_list_remove(s_info.destroy_event_list, item);
+           DbgFree(item);
        }
-       s_info.in_event_process &= ~GLOBAL_EVENT_PROCESS_DESTROY;
+    }
+    s_info.in_event_process &= ~GLOBAL_EVENT_PROCESS_DESTROY;
 }
 
 static inline void invoke_global_created_cb(struct client_node *client)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct global_event_item *item;
+    Eina_List *l;
+    Eina_List *n;
+    struct global_event_item *item;
 
-       s_info.in_event_process |= GLOBAL_EVENT_PROCESS_CREATE;
-       EINA_LIST_FOREACH_SAFE(s_info.create_event_list, l, n, item) {
-               /*!
-                * The first,
-                * item->deleted will be checked, so if it is deleted, remove item from the list
-                * The second, if the first routine takes false path,
-                * item->cb will be called, if it returns negative value, remove item from the list
-                * The third, if the second routine takes false path,
-                * Check the item->deleted again, so if it is turnned on, remove item from the list
-                */
-
-               if (item->deleted || item->cb(client, item->cbdata) < 0 || item->deleted) {
-                       s_info.create_event_list = eina_list_remove(s_info.create_event_list, item);
-                       DbgFree(item);
-               }
+    s_info.in_event_process |= GLOBAL_EVENT_PROCESS_CREATE;
+    EINA_LIST_FOREACH_SAFE(s_info.create_event_list, l, n, item) {
+       /*!
+        * The first,
+        * item->deleted will be checked, so if it is deleted, remove item from the list
+        * The second, if the first routine takes false path,
+        * item->cb will be called, if it returns negative value, remove item from the list
+        * The third, if the second routine takes false path,
+        * Check the item->deleted again, so if it is turnned on, remove item from the list
+        */
+
+       if (item->deleted || item->cb(client, item->cbdata) < 0 || item->deleted) {
+           s_info.create_event_list = eina_list_remove(s_info.create_event_list, item);
+           DbgFree(item);
        }
-       s_info.in_event_process &= ~GLOBAL_EVENT_PROCESS_CREATE;
+    }
+    s_info.in_event_process &= ~GLOBAL_EVENT_PROCESS_CREATE;
 }
 
 static inline void invoke_deactivated_cb(struct client_node *client)
 {
-       struct event_item *item;
-       Eina_List *l;
-       Eina_List *n;
+    struct event_item *item;
+    Eina_List *l;
+    Eina_List *n;
 
-       client->in_event_process |= CLIENT_EVENT_PROCESS_DEACTIVATE;
-       EINA_LIST_FOREACH_SAFE(client->event_deactivate_list, l, n, item) {
-               /*!
-                * The first,
-                * item->deleted will be checked, so if it is deleted, remove item from the list
-                * The second, if the first routine takes false path,
-                * item->cb will be called, if it returns negative value, remove item from the list
-                * The third, if the second routine takes false path,
-                * Check the item->deleted again, so if it is turnned on, remove item from the list
-                */
-
-               if (item->deleted || item->cb(client, item->data) < 0 || item->deleted) {
-                       client->event_deactivate_list = eina_list_remove(client->event_deactivate_list, item);
-                       DbgFree(item);
-               }
+    client->in_event_process |= CLIENT_EVENT_PROCESS_DEACTIVATE;
+    EINA_LIST_FOREACH_SAFE(client->event_deactivate_list, l, n, item) {
+       /*!
+        * The first,
+        * item->deleted will be checked, so if it is deleted, remove item from the list
+        * The second, if the first routine takes false path,
+        * item->cb will be called, if it returns negative value, remove item from the list
+        * The third, if the second routine takes false path,
+        * Check the item->deleted again, so if it is turnned on, remove item from the list
+        */
+
+       if (item->deleted || item->cb(client, item->data) < 0 || item->deleted) {
+           client->event_deactivate_list = eina_list_remove(client->event_deactivate_list, item);
+           DbgFree(item);
        }
-       client->in_event_process &= ~CLIENT_EVENT_PROCESS_DEACTIVATE;
+    }
+    client->in_event_process &= ~CLIENT_EVENT_PROCESS_DEACTIVATE;
 }
 
 static inline void invoke_activated_cb(struct client_node *client)
 {
-       struct event_item *item;
-       Eina_List *l;
-       Eina_List *n;
+    struct event_item *item;
+    Eina_List *l;
+    Eina_List *n;
 
-       client->in_event_process |= CLIENT_EVENT_PROCESS_ACTIVATE;
-       EINA_LIST_FOREACH_SAFE(client->event_activate_list, l, n, item) {
-               /*!
-                * The first,
-                * item->deleted will be checked, so if it is deleted, remove item from the list
-                * The second, if the first routine takes false path,
-                * item->cb will be called, if it returns negative value, remove item from the list
-                * The third, if the second routine takes false path,
-                * Check the item->deleted again, so if it is turnned on, remove item from the list
-                */
-
-               if (item->deleted || item->cb(client, item->data) < 0 || item->deleted) {
-                       client->event_activate_list = eina_list_remove(client->event_activate_list, item);
-                       DbgFree(item);
-               }
+    client->in_event_process |= CLIENT_EVENT_PROCESS_ACTIVATE;
+    EINA_LIST_FOREACH_SAFE(client->event_activate_list, l, n, item) {
+       /*!
+        * The first,
+        * item->deleted will be checked, so if it is deleted, remove item from the list
+        * The second, if the first routine takes false path,
+        * item->cb will be called, if it returns negative value, remove item from the list
+        * The third, if the second routine takes false path,
+        * Check the item->deleted again, so if it is turnned on, remove item from the list
+        */
+
+       if (item->deleted || item->cb(client, item->data) < 0 || item->deleted) {
+           client->event_activate_list = eina_list_remove(client->event_activate_list, item);
+           DbgFree(item);
        }
-       client->in_event_process &= ~CLIENT_EVENT_PROCESS_ACTIVATE;
+    }
+    client->in_event_process &= ~CLIENT_EVENT_PROCESS_ACTIVATE;
 }
 
 static inline void destroy_client_data(struct client_node *client)
 {
-       struct event_item *event;
-       struct data_item *data;
-       struct subscribe_item *item;
-       Ecore_Timer *timer;
+    struct event_item *event;
+    struct data_item *data;
+    struct subscribe_item *item;
+    Ecore_Timer *timer;
 
-       timer = client_del_data(client, "create,timer");
-       if (timer) {
-               ecore_timer_del(timer);
-       }
+    timer = client_del_data(client, "create,timer");
+    if (timer) {
+       ecore_timer_del(timer);
+    }
 
-       DbgPrint("Destroy client: %p\n", client);
+    DbgPrint("Destroy client: %p\n", client);
 
-       invoke_global_destroyed_cb(client);
-       client_rpc_fini(client); /*!< Finalize the RPC after invoke destroy callbacks */
+    invoke_global_destroyed_cb(client);
+    client_rpc_fini(client); /*!< Finalize the RPC after invoke destroy callbacks */
 
-       EINA_LIST_FREE(client->data_list, data) {
-               DbgPrint("Tag is not cleared (%s)\n", data->tag);
-               DbgFree(data->tag);
-               DbgFree(data);
-       }
+    EINA_LIST_FREE(client->data_list, data) {
+       DbgPrint("Tag is not cleared (%s)\n", data->tag);
+       DbgFree(data->tag);
+       DbgFree(data);
+    }
 
-       EINA_LIST_FREE(client->event_deactivate_list, event) {
-               DbgFree(event);
-       }
+    EINA_LIST_FREE(client->event_deactivate_list, event) {
+       DbgFree(event);
+    }
 
-       EINA_LIST_FREE(client->subscribe_list, item) {
-               DbgFree(item->cluster);
-               DbgFree(item->category);
-               DbgFree(item);
-       }
+    EINA_LIST_FREE(client->subscribe_list, item) {
+       DbgFree(item->cluster);
+       DbgFree(item->category);
+       DbgFree(item);
+    }
 
-       if (client->paused) {
-               s_info.nr_of_paused_clients--;
-       }
+    if (client->paused) {
+       s_info.nr_of_paused_clients--;
+    }
 
-       s_info.client_list = eina_list_remove(s_info.client_list, client);
-       DbgFree(client);
+    if (client->direct_addr) {
+       (void)unlink(client->direct_addr);
+       DbgFree(client->direct_addr);
+    }
 
-       /*!
-        * \note
-        * If there is any changes of clients,
-        * We should check the pause/resume states again.
-        */
-       xmonitor_handle_state_changes();
+    s_info.client_list = eina_list_remove(s_info.client_list, client);
+    DbgFree(client);
+
+    /*!
+     * \note
+     * If there is any changes of clients,
+     * We should check the pause/resume states again.
+     */
+    xmonitor_handle_state_changes();
 }
 
-static inline struct client_node *create_client_data(pid_t pid)
+static inline struct client_node *create_client_data(pid_t pid, const char *direct_addr)
 {
-       struct client_node *client;
+    struct client_node *client;
 
-       client = calloc(1, sizeof(*client));
-       if (!client) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return NULL;
-       }
+    client = calloc(1, sizeof(*client));
+    if (!client) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
 
-       client->pid = pid;
-       client->refcnt = 1;
+    client->pid = pid;
+    client->refcnt = 1;
 
-       s_info.client_list = eina_list_append(s_info.client_list, client);
+    if (direct_addr && direct_addr[0]) {
+       client->direct_addr = strdup(direct_addr);
+       if (!client->direct_addr) {
+           ErrPrint("Failed to allocate direct_addr (%s)\n", direct_addr);
+       }
+    }
 
-       /*!
-        * \note
-        * Right after create a client ADT,
-        * We assume that the client is paused.
-        */
-       client_paused(client);
-       xmonitor_handle_state_changes();
-       return client;
+    s_info.client_list = eina_list_append(s_info.client_list, client);
+
+    /*!
+     * \note
+     * Right after create a client ADT,
+     * We assume that the client is paused.
+     */
+    client_paused(client);
+    xmonitor_handle_state_changes();
+    return client;
 }
 
 static Eina_Bool created_cb(void *data)
 {
-       (void)client_del_data(data, "create,timer");
+    (void)client_del_data(data, "create,timer");
 
-       invoke_global_created_cb(data);
-       invoke_activated_cb(data);
-       /*!
-        * \note
-        * Client PAUSE/RESUME event must has to be sent after created event.
-        */
-       xmonitor_update_state(client_pid(data));
+    invoke_global_created_cb(data);
+    invoke_activated_cb(data);
+    /*!
+     * \note
+     * Client PAUSE/RESUME event must has to be sent after created event.
+     */
+    xmonitor_update_state(client_pid(data));
 
-       (void)client_unref(data);
-       return ECORE_CALLBACK_CANCEL;
+    (void)client_unref(data);
+    return ECORE_CALLBACK_CANCEL;
 }
 
 /*!
@@ -293,578 +312,583 @@ static Eina_Bool created_cb(void *data)
  * So we just create its ADT in this function.
  * And invoke the global created event & activated event callbacks
  */
-HAPI struct client_node *client_create(pid_t pid, int handle)
+HAPI struct client_node *client_create(pid_t pid, int handle, const char *direct_addr)
 {
-       struct client_node *client;
-       int ret;
+    struct client_node *client;
+    int ret;
 
-       client = client_find_by_rpc_handle(handle);
-       if (client) {
-               ErrPrint("Client %d(%d) is already exists\n", pid, handle);
-               return client;
-       }
+    client = client_find_by_rpc_handle(handle);
+    if (client) {
+       ErrPrint("Client %d(%d) is already exists\n", pid, handle);
+       return client;
+    }
 
-       client = create_client_data(pid);
-       if (!client) {
-               ErrPrint("Failed to create a new client (%d)\n", pid);
-               return NULL;
+    client = create_client_data(pid, direct_addr);
+    if (!client) {
+       ErrPrint("Failed to create a new client (%d)\n", pid);
+       return NULL;
+    }
+
+    ret = client_rpc_init(client, handle);
+    if (ret < 0) {
+       client = client_unref(client);
+       ErrPrint("Failed to initialize the RPC for %d, Destroy client data %p(has to be 0x0)\n", pid, client);
+    } else {
+       Ecore_Timer *create_timer;
+       /*!
+        * \note
+        * To save the time to send reply packet to the client.
+        */
+       create_timer = ecore_timer_add(DELAY_TIME, created_cb, client_ref(client));
+       if (create_timer == NULL) {
+           ErrPrint("Failed to add a timer for client created event\n");
+           client = client_unref(client); /* Decrease refcnt for argument */
+           client = client_unref(client); /* Destroy client object */
+           return NULL;
        }
 
-       ret = client_rpc_init(client, handle);
-       if (ret < 0) {
-               client = client_unref(client);
-               ErrPrint("Failed to initialize the RPC for %d, Destroy client data %p(has to be 0x0)\n", pid, client);
-       } else {
-               Ecore_Timer *create_timer;
-               /*!
-                * \note
-                * To save the time to send reply packet to the client.
-                */
-               create_timer = ecore_timer_add(DELAY_TIME, created_cb, client_ref(client));
-               if (create_timer == NULL) {
-                       ErrPrint("Failed to add a timer for client created event\n");
-                       client = client_unref(client); /* Decrease refcnt for argument */
-                       client = client_unref(client); /* Destroy client object */
-                       return NULL;
-               }
-
-               ret = client_set_data(client, "create,timer", create_timer);
-               DbgPrint("Set data: %d\n", ret);
-       }
+       ret = client_set_data(client, "create,timer", create_timer);
+       DbgPrint("Set data: %d\n", ret);
+    }
 
-       return client;
+    return client;
 }
 
 HAPI struct client_node *client_ref(struct client_node *client)
 {
-       if (!client) {
-               return NULL;
-       }
+    if (!client) {
+       return NULL;
+    }
 
-       client->refcnt++;
-       return client;
+    client->refcnt++;
+    return client;
 }
 
 HAPI struct client_node *client_unref(struct client_node *client)
 {
-       if (!client) {
-               return NULL;
-       }
+    if (!client) {
+       return NULL;
+    }
 
-       if (client->refcnt == 0) {
-               ErrPrint("Client refcnt is not managed correctly\n");
-               return NULL;
-       }
+    if (client->refcnt == 0) {
+       ErrPrint("Client refcnt is not managed correctly\n");
+       return NULL;
+    }
 
-       client->refcnt--;
-       if (client->refcnt == 0) {
-               destroy_client_data(client);
-               client = NULL;
-       }
+    client->refcnt--;
+    if (client->refcnt == 0) {
+       destroy_client_data(client);
+       client = NULL;
+    }
 
-       return client;
+    return client;
 }
 
 HAPI const int const client_refcnt(const struct client_node *client)
 {
-       return client->refcnt;
+    return client->refcnt;
 }
 
 HAPI const pid_t const client_pid(const struct client_node *client)
 {
-       return client ? client->pid : (pid_t)-1;
+    return client ? client->pid : (pid_t)-1;
 }
 
 HAPI struct client_node *client_find_by_pid(pid_t pid)
 {
-       Eina_List *l;
-       struct client_node *client;
+    Eina_List *l;
+    struct client_node *client;
 
-       EINA_LIST_FOREACH(s_info.client_list, l, client) {
-               if (client->pid == pid) {
-                       return client;
-               }
+    EINA_LIST_FOREACH(s_info.client_list, l, client) {
+       if (client->pid == pid) {
+           return client;
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
 HAPI struct client_node *client_find_by_rpc_handle(int handle)
 {
-       Eina_List *l;
-       struct client_node *client;
+    Eina_List *l;
+    struct client_node *client;
 
-       if (handle <= 0) {
-               ErrPrint("Invalid handle %d\n", handle);
-               return NULL;
-       }
+    if (handle <= 0) {
+       ErrPrint("Invalid handle %d\n", handle);
+       return NULL;
+    }
 
-       EINA_LIST_FOREACH(s_info.client_list, l, client) {
-               if (client_rpc_handle(client) == handle) {
-                       return client;
-               }
+    EINA_LIST_FOREACH(s_info.client_list, l, client) {
+       if (client_rpc_handle(client) == handle) {
+           return client;
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
 HAPI const int const client_count_paused(void)
 {
-       return s_info.nr_of_paused_clients;
+    return s_info.nr_of_paused_clients;
 }
 
 HAPI int client_is_all_paused(void)
 {
-       DbgPrint("%d, %d\n", eina_list_count(s_info.client_list), s_info.nr_of_paused_clients);
-       return eina_list_count(s_info.client_list) == s_info.nr_of_paused_clients;
+    DbgPrint("%d, %d\n", eina_list_count(s_info.client_list), s_info.nr_of_paused_clients);
+    return eina_list_count(s_info.client_list) == s_info.nr_of_paused_clients;
 }
 
 HAPI int client_count(void)
 {
-       return eina_list_count(s_info.client_list);
+    return eina_list_count(s_info.client_list);
 }
 
 HAPI struct client_node *client_deactivated_by_fault(struct client_node *client)
 {
-       if (!client || client->faulted) {
-               return client;
-       }
+    if (!client || client->faulted) {
+       return client;
+    }
 
-       ErrPrint("Client[%p] is faulted(%d), pid(%d)\n", client, client->refcnt, client->pid);
-       client->faulted = 1;
-       client->pid = (pid_t)-1;
+    ErrPrint("Client[%p] is faulted(%d), pid(%d)\n", client, client->refcnt, client->pid);
+    client->faulted = 1;
+    client->pid = (pid_t)-1;
 
-       invoke_deactivated_cb(client);
-       client = client_destroy(client);
-       /*!
-        * \todo
-        * Who invokes this function has to care the reference counter of a client
-        * do I need to invoke the deactivated callback from here?
-        * client->pid = (pid_t)-1;
-        * slave_unref(client)
-        */
-       return client;
+    invoke_deactivated_cb(client);
+    client = client_destroy(client);
+    /*!
+     * \todo
+     * Who invokes this function has to care the reference counter of a client
+     * do I need to invoke the deactivated callback from here?
+     * client->pid = (pid_t)-1;
+     * slave_unref(client)
+     */
+    return client;
 }
 
 HAPI const int const client_is_faulted(const struct client_node *client)
 {
-       /*!
-        * \note
-        * If the "client" is NIL, I assume that it is fault so returns TRUE(1)
-        */
-       return client ? client->faulted : 1;
+    /*!
+     * \note
+     * If the "client" is NIL, I assume that it is fault so returns TRUE(1)
+     */
+    return client ? client->faulted : 1;
 }
 
 HAPI void client_reset_fault(struct client_node *client)
 {
-       if (client) {
-               client->faulted = 0;
-       }
+    if (client) {
+       client->faulted = 0;
+    }
 }
 
 HAPI int client_event_callback_add(struct client_node *client, enum client_event event, int (*cb)(struct client_node *, void *), void *data)
 {
-       struct event_item *item;
-
-       if (!cb) {
-               ErrPrint("Invalid callback (cb == NULL)\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       item = malloc(sizeof(*item));
-       if (!item) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       item->cb = cb;
-       item->data = data;
-       item->deleted = 0;
-
-       /*!
-        * \note
-        * Use the eina_list_prepend API.
-        * To keep the sequence of a callback invocation.
-        *
-        * Here is an example sequence.
-        *
-        * client_event_callback_add(CALLBACK_01);
-        * client_event_callback_add(CALLBACK_02);
-        * client_event_callback_add(CALLBACK_03);
-        *
-        * Then the invoke_event_callback function will call the CALLBACKS as below sequence
-        *
-        * invoke_CALLBACK_03
-        * invoke_CALLBACK_02
-        * invoke_CALLBACK_01
-        */
-
-       switch (event) {
-       case CLIENT_EVENT_DEACTIVATE:
-               client->event_deactivate_list = eina_list_prepend(client->event_deactivate_list, item);
-               break;
-       case CLIENT_EVENT_ACTIVATE:
-               client->event_activate_list = eina_list_prepend(client->event_activate_list, item);
-               break;
-       default:
-               DbgFree(item);
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       return LB_STATUS_SUCCESS;
+    struct event_item *item;
+
+    if (!cb) {
+       ErrPrint("Invalid callback (cb == NULL)\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    item = malloc(sizeof(*item));
+    if (!item) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    item->cb = cb;
+    item->data = data;
+    item->deleted = 0;
+
+    /*!
+     * \note
+     * Use the eina_list_prepend API.
+     * To keep the sequence of a callback invocation.
+     *
+     * Here is an example sequence.
+     *
+     * client_event_callback_add(CALLBACK_01);
+     * client_event_callback_add(CALLBACK_02);
+     * client_event_callback_add(CALLBACK_03);
+     *
+     * Then the invoke_event_callback function will call the CALLBACKS as below sequence
+     *
+     * invoke_CALLBACK_03
+     * invoke_CALLBACK_02
+     * invoke_CALLBACK_01
+     */
+
+    switch (event) {
+    case CLIENT_EVENT_DEACTIVATE:
+       client->event_deactivate_list = eina_list_prepend(client->event_deactivate_list, item);
+       break;
+    case CLIENT_EVENT_ACTIVATE:
+       client->event_activate_list = eina_list_prepend(client->event_activate_list, item);
+       break;
+    default:
+       DbgFree(item);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int client_event_callback_del(struct client_node *client, enum client_event event, int (*cb)(struct client_node *, void *), void *data)
 {
-       struct event_item *item;
-       Eina_List *l;
-       Eina_List *n;
+    struct event_item *item;
+    Eina_List *l;
+    Eina_List *n;
 
-       if (!cb) {
-               ErrPrint("Invalid callback (cb == NULL)\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!cb) {
+       ErrPrint("Invalid callback (cb == NULL)\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       switch (event) {
-       case CLIENT_EVENT_DEACTIVATE:
-               EINA_LIST_FOREACH_SAFE(client->event_deactivate_list, l, n, item) {
-                       if (item->cb == cb && item->data == data) {
-                               if (client->in_event_process & CLIENT_EVENT_PROCESS_DEACTIVATE) {
-                                       item->deleted = 1;
-                               } else {
-                                       client->event_deactivate_list = eina_list_remove(client->event_deactivate_list, item);
-                                       DbgFree(item);
-                               }
-                               return LB_STATUS_SUCCESS;
-                       }
-               }
-               break;
-
-       case CLIENT_EVENT_ACTIVATE:
-               EINA_LIST_FOREACH_SAFE(client->event_activate_list, l, n, item) {
-                       if (item->cb == cb && item->data == data) {
-                               if (client->in_event_process & CLIENT_EVENT_PROCESS_ACTIVATE) {
-                                       item->deleted = 1;
-                               } else {
-                                       client->event_activate_list = eina_list_remove(client->event_activate_list, item);
-                                       DbgFree(item);
-                               }
-                               return LB_STATUS_SUCCESS;
-                       }
+    switch (event) {
+    case CLIENT_EVENT_DEACTIVATE:
+       EINA_LIST_FOREACH_SAFE(client->event_deactivate_list, l, n, item) {
+           if (item->cb == cb && item->data == data) {
+               if (client->in_event_process & CLIENT_EVENT_PROCESS_DEACTIVATE) {
+                   item->deleted = 1;
+               } else {
+                   client->event_deactivate_list = eina_list_remove(client->event_deactivate_list, item);
+                   DbgFree(item);
                }
-               break;
+               return DBOX_STATUS_ERROR_NONE;
+           }
+       }
+       break;
 
-       default:
-               ErrPrint("Invalid event\n");
-               break;
+    case CLIENT_EVENT_ACTIVATE:
+       EINA_LIST_FOREACH_SAFE(client->event_activate_list, l, n, item) {
+           if (item->cb == cb && item->data == data) {
+               if (client->in_event_process & CLIENT_EVENT_PROCESS_ACTIVATE) {
+                   item->deleted = 1;
+               } else {
+                   client->event_activate_list = eina_list_remove(client->event_activate_list, item);
+                   DbgFree(item);
+               }
+               return DBOX_STATUS_ERROR_NONE;
+           }
        }
+       break;
 
-       return LB_STATUS_ERROR_NOT_EXIST;
+    default:
+       ErrPrint("Invalid event\n");
+       break;
+    }
+
+    return DBOX_STATUS_ERROR_NOT_EXIST;
 }
 
 HAPI int client_set_data(struct client_node *client, const char *tag, void *data)
 {
-       struct data_item *item;
+    struct data_item *item;
 
-       item = calloc(1, sizeof(*item));
-       if (!item) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    item = calloc(1, sizeof(*item));
+    if (!item) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       item->tag = strdup(tag);
-       if (!item->tag) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(item);
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    item->tag = strdup(tag);
+    if (!item->tag) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(item);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       item->data = data;
+    item->data = data;
 
-       client->data_list = eina_list_append(client->data_list, item);
-       return LB_STATUS_SUCCESS;
+    client->data_list = eina_list_append(client->data_list, item);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI void *client_data(struct client_node *client, const char *tag)
 {
-       Eina_List *l;
-       struct data_item *item;
+    Eina_List *l;
+    struct data_item *item;
 
-       EINA_LIST_FOREACH(client->data_list, l, item) {
-               if (!strcmp(item->tag, tag)) {
-                       return item->data;
-               }
+    EINA_LIST_FOREACH(client->data_list, l, item) {
+       if (!strcmp(item->tag, tag)) {
+           return item->data;
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
 HAPI void *client_del_data(struct client_node *client, const char *tag)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct data_item *item;
-
-       EINA_LIST_FOREACH_SAFE(client->data_list, l, n, item) {
-               if (!strcmp(item->tag, tag)) {
-                       void *data;
-                       client->data_list = eina_list_remove(client->data_list, item);
-                       data = item->data;
-                       DbgFree(item->tag);
-                       DbgFree(item);
-                       return data;
-               }
+    Eina_List *l;
+    Eina_List *n;
+    struct data_item *item;
+
+    EINA_LIST_FOREACH_SAFE(client->data_list, l, n, item) {
+       if (!strcmp(item->tag, tag)) {
+           void *data;
+           client->data_list = eina_list_remove(client->data_list, item);
+           data = item->data;
+           DbgFree(item->tag);
+           DbgFree(item);
+           return data;
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
 HAPI void client_paused(struct client_node *client)
 {
-       if (client->paused) {
-               return;
-       }
+    if (client->paused) {
+       return;
+    }
 
-       client->paused = 1;
-       s_info.nr_of_paused_clients++;
+    client->paused = 1;
+    s_info.nr_of_paused_clients++;
 }
 
 HAPI void client_resumed(struct client_node *client)
 {
-       if (client->paused == 0) {
-               return;
-       }
+    if (client->paused == 0) {
+       return;
+    }
 
-       client->paused = 0;
-       s_info.nr_of_paused_clients--;
+    client->paused = 0;
+    s_info.nr_of_paused_clients--;
 }
 
 HAPI int client_init(void)
 {
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI void client_fini(void)
 {
-       struct global_event_item *handler;
-       struct client_node *client;
-       Eina_List *l;
-       Eina_List *n;
+    struct global_event_item *handler;
+    struct client_node *client;
+    Eina_List *l;
+    Eina_List *n;
 
-       EINA_LIST_FOREACH_SAFE(s_info.client_list, l, n, client) {
-               (void)client_destroy(client);
-       }
+    EINA_LIST_FOREACH_SAFE(s_info.client_list, l, n, client) {
+       (void)client_destroy(client);
+    }
 
-       EINA_LIST_FREE(s_info.create_event_list, handler) {
-               DbgFree(handler);
-       }
+    EINA_LIST_FREE(s_info.create_event_list, handler) {
+       DbgFree(handler);
+    }
 
-       EINA_LIST_FREE(s_info.destroy_event_list, handler) {
-               DbgFree(handler);
-       }
+    EINA_LIST_FREE(s_info.destroy_event_list, handler) {
+       DbgFree(handler);
+    }
 }
 
 HAPI int client_global_event_handler_add(enum client_global_event event_type, int (*cb)(struct client_node *client, void *data), void *data)
 {
-       struct global_event_item *handler;
+    struct global_event_item *handler;
 
-       handler = malloc(sizeof(*handler));
-       if (!handler) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    handler = malloc(sizeof(*handler));
+    if (!handler) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       handler->cbdata = data;
-       handler->cb = cb;
-       handler->deleted = 0;
-
-       switch (event_type) {
-       case CLIENT_GLOBAL_EVENT_CREATE:
-               s_info.create_event_list = eina_list_prepend(s_info.create_event_list, handler);
-               break;
-       case CLIENT_GLOBAL_EVENT_DESTROY:
-               s_info.destroy_event_list = eina_list_prepend(s_info.destroy_event_list, handler);
-               break;
-       default:
-               DbgFree(handler);
-               return LB_STATUS_ERROR_INVALID;
-       }
+    handler->cbdata = data;
+    handler->cb = cb;
+    handler->deleted = 0;
+
+    switch (event_type) {
+    case CLIENT_GLOBAL_EVENT_CREATE:
+       s_info.create_event_list = eina_list_prepend(s_info.create_event_list, handler);
+       break;
+    case CLIENT_GLOBAL_EVENT_DESTROY:
+       s_info.destroy_event_list = eina_list_prepend(s_info.destroy_event_list, handler);
+       break;
+    default:
+       DbgFree(handler);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int client_global_event_handler_del(enum client_global_event event_type, int (*cb)(struct client_node *, void *), void *data)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct global_event_item *item;
-
-       switch (event_type) {
-       case CLIENT_GLOBAL_EVENT_CREATE:
-               EINA_LIST_FOREACH_SAFE(s_info.create_event_list, l, n, item) {
-                       if (item->cb == cb && item->cbdata == data) {
-                               if (s_info.in_event_process & GLOBAL_EVENT_PROCESS_CREATE) {
-                                       item->deleted = 1;
-                               } else {
-                                       s_info.create_event_list = eina_list_remove(s_info.create_event_list, item);
-                                       DbgFree(item);
-                               }
-                               return LB_STATUS_SUCCESS;
-                       }
+    Eina_List *l;
+    Eina_List *n;
+    struct global_event_item *item;
+
+    switch (event_type) {
+    case CLIENT_GLOBAL_EVENT_CREATE:
+       EINA_LIST_FOREACH_SAFE(s_info.create_event_list, l, n, item) {
+           if (item->cb == cb && item->cbdata == data) {
+               if (s_info.in_event_process & GLOBAL_EVENT_PROCESS_CREATE) {
+                   item->deleted = 1;
+               } else {
+                   s_info.create_event_list = eina_list_remove(s_info.create_event_list, item);
+                   DbgFree(item);
                }
-               break;
-       case CLIENT_GLOBAL_EVENT_DESTROY:
-               EINA_LIST_FOREACH_SAFE(s_info.destroy_event_list, l, n, item) {
-                       if (item->cb == cb && item->cbdata == data) {
-                               if (s_info.in_event_process & GLOBAL_EVENT_PROCESS_DESTROY) {
-                                       item->deleted = 1;
-                               } else {
-                                       s_info.destroy_event_list = eina_list_remove(s_info.destroy_event_list, item);
-                                       DbgFree(item);
-                               }
-                               return LB_STATUS_SUCCESS;
-                       }
+               return DBOX_STATUS_ERROR_NONE;
+           }
+       }
+       break;
+    case CLIENT_GLOBAL_EVENT_DESTROY:
+       EINA_LIST_FOREACH_SAFE(s_info.destroy_event_list, l, n, item) {
+           if (item->cb == cb && item->cbdata == data) {
+               if (s_info.in_event_process & GLOBAL_EVENT_PROCESS_DESTROY) {
+                   item->deleted = 1;
+               } else {
+                   s_info.destroy_event_list = eina_list_remove(s_info.destroy_event_list, item);
+                   DbgFree(item);
                }
-               break;
-       default:
-               break;
+               return DBOX_STATUS_ERROR_NONE;
+           }
        }
+       break;
+    default:
+       break;
+    }
 
-       return LB_STATUS_ERROR_NOT_EXIST;
+    return DBOX_STATUS_ERROR_NOT_EXIST;
 }
 
 HAPI int client_subscribe(struct client_node *client, const char *cluster, const char *category)
 {
-       struct subscribe_item *item;
+    struct subscribe_item *item;
 
-       item = malloc(sizeof(*item));
-       if (!item) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    item = malloc(sizeof(*item));
+    if (!item) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       item->cluster = strdup(cluster);
-       if (!item->cluster) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(item);
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    item->cluster = strdup(cluster);
+    if (!item->cluster) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(item);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       item->category = strdup(category);
-       if (!item->category) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(item->cluster);
-               DbgFree(item);
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    item->category = strdup(category);
+    if (!item->category) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(item->cluster);
+       DbgFree(item);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       client->subscribe_list = eina_list_append(client->subscribe_list, item);
-       return LB_STATUS_SUCCESS;
+    client->subscribe_list = eina_list_append(client->subscribe_list, item);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int client_unsubscribe(struct client_node *client, const char *cluster, const char *category)
 {
-       struct subscribe_item *item;
-       Eina_List *l;
-       Eina_List *n;
-
-       EINA_LIST_FOREACH_SAFE(client->subscribe_list, l, n, item) {
-               if (!strcasecmp(cluster, item->cluster) && !strcasecmp(category, item->category)) {
-                       client->subscribe_list = eina_list_remove(client->subscribe_list, item);
-                       DbgFree(item->cluster);
-                       DbgFree(item->category);
-                       DbgFree(item);
-                       return LB_STATUS_SUCCESS;
-               }
+    struct subscribe_item *item;
+    Eina_List *l;
+    Eina_List *n;
+
+    EINA_LIST_FOREACH_SAFE(client->subscribe_list, l, n, item) {
+       if (!strcasecmp(cluster, item->cluster) && !strcasecmp(category, item->category)) {
+           client->subscribe_list = eina_list_remove(client->subscribe_list, item);
+           DbgFree(item->cluster);
+           DbgFree(item->category);
+           DbgFree(item);
+           return DBOX_STATUS_ERROR_NONE;
        }
+    }
 
-       return LB_STATUS_ERROR_NOT_EXIST;
+    return DBOX_STATUS_ERROR_NOT_EXIST;
 }
 
 HAPI int client_is_subscribed(struct client_node *client, const char *cluster, const char *category)
 {
-       struct subscribe_item *item;
-       Eina_List *l;
+    struct subscribe_item *item;
+    Eina_List *l;
 
-       EINA_LIST_FOREACH(client->subscribe_list, l, item) {
-               if (!strcmp(item->cluster, "*")) {
-                       return 1;
-               }
+    EINA_LIST_FOREACH(client->subscribe_list, l, item) {
+       if (!strcmp(item->cluster, "*")) {
+           return 1;
+       }
 
-               if (strcasecmp(item->cluster, cluster)) {
-                       continue;
-               }
+       if (strcasecmp(item->cluster, cluster)) {
+           continue;
+       }
 
-               if (!strcmp(item->category, "*")) {
-                       return 1;
-               }
+       if (!strcmp(item->category, "*")) {
+           return 1;
+       }
 
-               if (!strcasecmp(item->category, category)) {
-                       return 1;
-               }
+       if (!strcasecmp(item->category, category)) {
+           return 1;
        }
+    }
 
-       return 0;
+    return 0;
 }
 
 HAPI int client_browse_list(const char *cluster, const char *category, int (*cb)(struct client_node *client, void *data), void *data)
 {
-       Eina_List *l;
-       struct client_node *client;
-       int cnt;
+    Eina_List *l;
+    struct client_node *client;
+    int cnt;
 
-       if (!cb || !cluster || !category) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!cb || !cluster || !category) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       cnt = 0;
-       EINA_LIST_FOREACH(s_info.client_list, l, client) {
-               if (!client_is_subscribed(client, cluster, category)) {
-                       continue;
-               }
-
-               if (cb(client, data) < 0) {
-                       return LB_STATUS_ERROR_CANCEL;
-               }
+    cnt = 0;
+    EINA_LIST_FOREACH(s_info.client_list, l, client) {
+       if (!client_is_subscribed(client, cluster, category)) {
+           continue;
+       }
 
-               cnt++;
+       if (cb(client, data) < 0) {
+           return DBOX_STATUS_ERROR_CANCEL;
        }
 
-       return cnt;
+       cnt++;
+    }
+
+    return cnt;
 }
 
 HAPI int client_nr_of_subscriber(const char *cluster, const char *category)
 {
-       Eina_List *l;
-       struct client_node *client;
-       int cnt;
+    Eina_List *l;
+    struct client_node *client;
+    int cnt;
 
-       cnt = 0;
-       EINA_LIST_FOREACH(s_info.client_list, l, client) {
-               cnt += !!client_is_subscribed(client, cluster, category);
-       }
+    cnt = 0;
+    EINA_LIST_FOREACH(s_info.client_list, l, client) {
+       cnt += !!client_is_subscribed(client, cluster, category);
+    }
 
-       return cnt;
+    return cnt;
 }
 
 HAPI int client_broadcast(struct inst_info *inst, struct packet *packet)
 {
-       Eina_List *l;
-       Eina_List *list;
-       struct client_node *client;
-
-       list = inst ? instance_client_list(inst) : s_info.client_list;
-       EINA_LIST_FOREACH(list, l, client) {
-               if (client_pid(client) == -1) {
-                       ErrPrint("Client[%p] has PID[%d]\n", client, client_pid(client));
-                       continue;
-               }
+    Eina_List *l;
+    Eina_List *list;
+    struct client_node *client;
 
-               (void)client_rpc_async_request(client, packet_ref(packet));
+    list = inst ? instance_client_list(inst) : s_info.client_list;
+    EINA_LIST_FOREACH(list, l, client) {
+       if (client_pid(client) == -1) {
+           ErrPrint("Client[%p] has PID[%d]\n", client, client_pid(client));
+           continue;
        }
 
-       packet_unref(packet);
-       return LB_STATUS_SUCCESS;
+       (void)client_rpc_async_request(client, packet_ref(packet));
+    }
+
+    packet_unref(packet);
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+HAPI const char *client_direct_addr(const struct client_node *client)
+{
+    return client ? client->direct_addr : NULL;
 }
 
 /* End of a file */
index a9b00f4..7dad2ac 100644 (file)
@@ -23,7 +23,9 @@
 #include <dlog.h>
 #include <com-core_packet.h>
 #include <packet.h>
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
+#include <dynamicbox_conf.h>
+#include <dynamicbox_service.h>
 
 #include "client_life.h"
 #include "instance.h"
  * Static component information structure.
  */
 static struct info {
-       Eina_List *command_list; /*!< Packet Q: Before sending the request, all request commands will stay here */
-       Ecore_Timer *command_consumer; /*!< This timer will consuming the command Q. sending them to the specified client */
+    Eina_List *command_list; /*!< Packet Q: Before sending the request, all request commands will stay here */
+    Ecore_Timer *command_consumer; /*!< This timer will consuming the command Q. sending them to the specified client */
 } s_info = {
-       .command_list = NULL,
-       .command_consumer = NULL,
+    .command_list = NULL,
+    .command_consumer = NULL,
 };
 
 struct client_rpc {
-       int handle; /*!< Handler for communication with client */
+    int handle; /*!< Handler for communication with client */
 };
 
 struct command {
-       struct packet *packet;
-       struct client_node *client; /*!< Target client. who should receive this command */
+    struct packet *packet;
+    struct client_node *client; /*!< Target client. who should receive this command */
 };
 
 /*!
@@ -61,223 +63,223 @@ struct command {
  */
 static inline struct command *create_command(struct client_node *client, struct packet *packet)
 {
-       struct command *command;
+    struct command *command;
 
-       command = calloc(1, sizeof(*command));
-       if (!command) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return NULL;
-       }
+    command = calloc(1, sizeof(*command));
+    if (!command) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
 
-       command->packet = packet_ref(packet);
-       command->client = client_ref(client);
+    command->packet = packet_ref(packet);
+    command->client = client_ref(client);
 
-       return command;
+    return command;
 }
 
 static inline void destroy_command(struct command *command)
 {
-       client_unref(command->client);
-       packet_unref(command->packet);
-       DbgFree(command);
+    client_unref(command->client);
+    packet_unref(command->packet);
+    DbgFree(command);
 }
 
 static inline int count_command(void)
 {
-       return eina_list_count(s_info.command_list);
+    return eina_list_count(s_info.command_list);
 }
 
 static inline struct command *pop_command(void)
 {
-       struct command *command;
+    struct command *command;
 
-       command = eina_list_nth(s_info.command_list, 0);
-       if (!command) {
-               return NULL;
-       }
+    command = eina_list_nth(s_info.command_list, 0);
+    if (!command) {
+       return NULL;
+    }
 
-       s_info.command_list = eina_list_remove(s_info.command_list, command);
-       return command;
+    s_info.command_list = eina_list_remove(s_info.command_list, command);
+    return command;
 }
 
 static Eina_Bool command_consumer_cb(void *data)
 {
-       struct command *command;
-       struct client_rpc *rpc;
-       int ret;
-
-       command = pop_command();
-       if (!command) {
-               s_info.command_consumer = NULL;
-               return ECORE_CALLBACK_CANCEL;
-       }
-
-       if (!command->client) {
-               DbgPrint("Has no client\n");
-               goto out;
-       }
-
-       if (client_is_faulted(command->client)) {
-               ErrPrint("Client[%p] is faulted, discard command\n", command->client);
-               goto out;
-       }
-
-       rpc = client_data(command->client, RPC_TAG);
-       if (!rpc) {
-               ErrPrint("Client is not activated\n");
-               goto out;
-       }
-
-       if (rpc->handle < 0) {
-               DbgPrint("RPC is not initialized\n");
-               goto out;
-       }
-
-       ret = com_core_packet_send_only(rpc->handle, command->packet);
-       if (ret < 0) {
-               ErrPrint("Failed to send packet %d\n", ret);
-       }
+    struct command *command;
+    struct client_rpc *rpc;
+    int ret;
+
+    command = pop_command();
+    if (!command) {
+       s_info.command_consumer = NULL;
+       return ECORE_CALLBACK_CANCEL;
+    }
+
+    if (!command->client) {
+       DbgPrint("Has no client\n");
+       goto out;
+    }
+
+    if (client_is_faulted(command->client)) {
+       ErrPrint("Client[%p] is faulted, discard command\n", command->client);
+       goto out;
+    }
+
+    rpc = client_data(command->client, RPC_TAG);
+    if (!rpc) {
+       ErrPrint("Client is not activated\n");
+       goto out;
+    }
+
+    if (rpc->handle < 0) {
+       DbgPrint("RPC is not initialized\n");
+       goto out;
+    }
+
+    ret = com_core_packet_send_only(rpc->handle, command->packet);
+    if (ret < 0) {
+       ErrPrint("Failed to send packet %d\n", ret);
+    }
 
 out:
-       destroy_command(command);
-       return ECORE_CALLBACK_RENEW;
+    destroy_command(command);
+    return ECORE_CALLBACK_RENEW;
 }
 
 static inline void push_command(struct command *command)
 {
-       s_info.command_list = eina_list_append(s_info.command_list, command);
+    s_info.command_list = eina_list_append(s_info.command_list, command);
 
-       if (s_info.command_consumer) {
-               return;
-       }
+    if (s_info.command_consumer) {
+       return;
+    }
 
-       s_info.command_consumer = ecore_timer_add(PACKET_TIME, command_consumer_cb, NULL);
-       if (!s_info.command_consumer) {
-               ErrPrint("Failed to add command consumer\n");
-               s_info.command_list = eina_list_remove(s_info.command_list, command);
-               destroy_command(command);
-       }
+    s_info.command_consumer = ecore_timer_add(DYNAMICBOX_CONF_PACKET_TIME, command_consumer_cb, NULL);
+    if (!s_info.command_consumer) {
+       ErrPrint("Failed to add command consumer\n");
+       s_info.command_list = eina_list_remove(s_info.command_list, command);
+       destroy_command(command);
+    }
 }
 
 HAPI int client_rpc_async_request(struct client_node *client, struct packet *packet)
 {
-       struct command *command;
-       struct client_rpc *rpc;
-
-       if (!client || !packet) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    struct command *command;
+    struct client_rpc *rpc;
 
-       if (client_is_faulted(client)) {
-               ErrPrint("Client[%p] is faulted\n", client);
-               packet_unref(packet);
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (!client || !packet) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       rpc = client_data(client, RPC_TAG);
-       if (!rpc) {
-               ErrPrint("Client[%p] is not ready for communication (%s)\n", client, packet_command(packet));
-       }
+    if (client_is_faulted(client)) {
+       ErrPrint("Client[%p] is faulted\n", client);
+       packet_unref(packet);
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       command = create_command(client, packet);
-       if (!command) {
-               packet_unref(packet);
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    rpc = client_data(client, RPC_TAG);
+    if (!rpc) {
+       ErrPrint("Client[%p] is not ready for communication (%s)\n", client, packet_command(packet));
+    }
 
-       push_command(command);
+    command = create_command(client, packet);
+    if (!command) {
        packet_unref(packet);
-       return LB_STATUS_SUCCESS;
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    push_command(command);
+    packet_unref(packet);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static int deactivated_cb(struct client_node *client, void *data)
 {
-       struct client_rpc *rpc;
-       struct command *command;
-       Eina_List *l;
-       Eina_List *n;
-
-       rpc = client_data(client, RPC_TAG);
-       if (!rpc) {
-               ErrPrint("client is not valid\n");
-               return LB_STATUS_SUCCESS;
+    struct client_rpc *rpc;
+    struct command *command;
+    Eina_List *l;
+    Eina_List *n;
+
+    rpc = client_data(client, RPC_TAG);
+    if (!rpc) {
+       ErrPrint("client is not valid\n");
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    DbgPrint("Reset handle for %d\n", client_pid(client));
+    rpc->handle = -1;
+
+    DbgPrint("Begin: Destroying command\n");
+    EINA_LIST_FOREACH_SAFE(s_info.command_list, l, n, command) {
+       if (command->client == client) {
+           s_info.command_list = eina_list_remove(s_info.command_list, command);
+           destroy_command(command);
        }
+    }
+    DbgPrint("End: Destroying command\n");
 
-       DbgPrint("Reset handle for %d\n", client_pid(client));
-       rpc->handle = -1;
-
-       DbgPrint("Begin: Destroying command\n");
-       EINA_LIST_FOREACH_SAFE(s_info.command_list, l, n, command) {
-               if (command->client == client) {
-                       s_info.command_list = eina_list_remove(s_info.command_list, command);
-                       destroy_command(command);
-               }
-       }
-       DbgPrint("End: Destroying command\n");
-
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int client_rpc_init(struct client_node *client, int handle)
 {
-       struct client_rpc *rpc;
-       int ret;
-
-       rpc = calloc(1, sizeof(*rpc));
-       if (!rpc) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       ret = client_set_data(client, RPC_TAG, rpc);
-       if (ret < 0) {
-               ErrPrint("Failed to set \"rpc\" for client\n");
-               DbgFree(rpc);
-               return ret;
-       }
+    struct client_rpc *rpc;
+    int ret;
+
+    rpc = calloc(1, sizeof(*rpc));
+    if (!rpc) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    ret = client_set_data(client, RPC_TAG, rpc);
+    if (ret < 0) {
+       ErrPrint("Failed to set \"rpc\" for client\n");
+       DbgFree(rpc);
+       return ret;
+    }
 
-       DbgPrint("CLIENT: New handle assigned for %d, %d (old: %d)\n", client_pid(client), handle, rpc->handle);
-       rpc->handle = handle;
+    DbgPrint("CLIENT: New handle assigned for %d, %d (old: %d)\n", client_pid(client), handle, rpc->handle);
+    rpc->handle = handle;
 
-       ret = client_event_callback_add(client, CLIENT_EVENT_DEACTIVATE, deactivated_cb, NULL);
-       if (ret < 0) {
-               struct client_rpc *weird;
+    ret = client_event_callback_add(client, CLIENT_EVENT_DEACTIVATE, deactivated_cb, NULL);
+    if (ret < 0) {
+       struct client_rpc *weird;
 
-               weird = client_del_data(client, RPC_TAG);
-               if (weird != rpc) {
-                       ErrPrint("What happens? (%p <> %p)\n", weird, rpc);
-               }
-               DbgFree(rpc);
+       weird = client_del_data(client, RPC_TAG);
+       if (weird != rpc) {
+           ErrPrint("What happens? (%p <> %p)\n", weird, rpc);
        }
+       DbgFree(rpc);
+    }
 
-       return ret;
+    return ret;
 }
 
 HAPI int client_rpc_fini(struct client_node *client)
 {
-       struct client_rpc *rpc;
+    struct client_rpc *rpc;
 
-       rpc = client_del_data(client, RPC_TAG);
-       if (!rpc) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    rpc = client_del_data(client, RPC_TAG);
+    if (!rpc) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       client_event_callback_del(client, CLIENT_EVENT_DEACTIVATE, deactivated_cb, NULL);
-       DbgFree(rpc);
-       return LB_STATUS_SUCCESS;
+    client_event_callback_del(client, CLIENT_EVENT_DEACTIVATE, deactivated_cb, NULL);
+    DbgFree(rpc);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int client_rpc_handle(struct client_node *client)
 {
-       struct client_rpc *rpc;
+    struct client_rpc *rpc;
 
-       rpc = client_data(client, RPC_TAG);
-       if (!rpc) {
-               DbgPrint("Client has no RPC\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    rpc = client_data(client, RPC_TAG);
+    if (!rpc) {
+       DbgPrint("Client has no RPC\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       return rpc->handle;
+    return rpc->handle;
 }
 
 /* End of a file */
index 53941ca..be0730a 100644 (file)
@@ -1,953 +1,8 @@
-/*
- * Copyright 2013  Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <dlog.h>
-#if defined(HAVE_LIVEBOX)
-#include <livebox-errno.h>
-#else
-#include "lite-errno.h"
-#endif
-#include <Eina.h>
-
 #include "conf.h"
-#include "util.h"
-#include "debug.h"
-
-static const char *CONF_DEFAULT_SERVICES = "[livebox],[shortcut],[notification],[badge],[utility],[file]";
-static const char *CONF_DEFAULT_EMERGENCY_DISK = "source=tmpfs;type=tmpfs;option=size=6M";
-static const char *CONF_DEFAULT_PATH_CONF = "/opt/usr/live/%s/etc/%s.conf";
-static const char *CONF_DEFAULT_PATH_IMAGE = "/opt/usr/share/live_magazine/";
-static const char *CONF_DEFAULT_PATH_LOG = "/opt/usr/share/live_magazine/log";
-static const char *CONF_DEFAULT_PATH_READER = "/opt/usr/share/live_magazine/reader";
-static const char *CONF_DEFAULT_PATH_ALWAYS = "/opt/usr/share/live_magazine/always";
-static const char *CONF_DEFAULT_PATH_SCRIPT = "/opt/usr/live/%s/res/script/%s.edj";
-static const char *CONF_DEFAULT_PATH_ROOT = "/opt/usr/live/";
-static const char *CONF_DEFAULT_PATH_SCRIPT_PORT = "/usr/share/data-provider-master/plugin-script/";
-static const char *CONF_DEFAULT_PATH_DB = "/opt/dbspace/.livebox.db";
-static const char *CONF_DEFAULT_PATH_INPUT = "/dev/input/event2";
-static const char *CONF_DEFAULT_SCRIPT_TYPE = "edje";
-static const char *CONF_DEFAULT_ABI = "c";
-static const char *CONF_DEFAULT_PD_GROUP = "disclosure";
-static const char *CONF_DEFAULT_LAUNCH_BUNDLE_NAME = "name";
-static const char *CONF_DEFAULT_LAUNCH_BUNDLE_SECURED = "secured";
-static const char *CONF_DEFAULT_LAUNCH_BUNDLE_ABI = "abi";
-static const char *CONF_DEFAULT_CONTENT = "default";
-static const char *CONF_DEFAULT_TITLE = "";
-static const char *CONF_DEFAULT_EMPTY_CONTENT = "";
-static const char *CONF_DEFAULT_EMPTY_TITLE = "";
-static const char *CONF_DEFAULT_REPLACE_TAG = "/APPID/";
-static const char *CONF_DEFAULT_PROVIDER_METHOD = "pixmap";
-static const int CONF_DEFAULT_WIDTH = 0;
-static const int CONF_DEFAULT_HEIGHT = 0;
-static const int CONF_DEFAULT_BASE_WIDTH = 720;
-static const int CONF_DEFAULT_BASE_HEIGHT = 1280;
-static const double CONF_DEFAULT_MINIMUM_PERIOD = 1.0f;
-static const double CONF_DEFAULT_PERIOD = -1.0f;
-static const double CONF_DEFAULT_PACKET_TIME = 0.0001f;
-static const unsigned long CONF_DEFAULT_MINIMUM_SPACE = 5242880;
-static const double CONF_DEFAULT_SLAVE_TTL = 30.0f;
-static const double CONF_DEFAULT_SLAVE_ACTIVATE_TIME = 30.0f;
-static const double CONF_DEFAULT_SLAVE_RELAUNCH_TIME = 3.0f;
-static const int CONF_DEFAULT_SLAVE_RELAUNCH_COUNT = 3;
-static const int CONF_DEFAULT_MAX_LOG_LINE = 1000;
-static const int CONF_DEFAULT_MAX_LOG_FILE = 3;
-static const int CONF_DEFAULT_SQLITE_FLUSH_MAX = 1048576;
-static const double CONF_DEFAULT_PING_TIME = 240.0f;
-static const int CONF_DEFAULT_SLAVE_MAX_LOAD = 30;
-static const int CONF_DEFAULT_USE_SW_BACKEND = 0;
-static const int CONF_DEFAULT_DEBUG_MODE = 0;
-static const int CONF_DEFAULT_OVERWRITE_CONTENT = 0;
-static const int CONF_DEFAULT_COM_CORE_THREAD = 1;
-static const int CONF_DEFAULT_USE_XMONITOR = 0;
-static const int CONF_DEFAULT_PREMULTIPLIED = 1;
-static const double CONF_DEFAULT_SCALE_WIDTH_FACTOR = 1.0f;
-static const double CONF_DEFAULT_SCALE_HEIGHT_FACTOR = 1.0f;
-static const double CONF_DEFAULT_PD_REQUEST_TIMEOUT = 5.0f;
-static const int CONF_DEFAULT_PIXELS = sizeof(int);
-
-int errno;
-
-HAPI struct conf g_conf;
-
-HAPI void conf_update_size(void)
-{
-       util_screen_size_get(&g_conf.width, &g_conf.height);
-
-       g_conf.scale_width_factor = (double)g_conf.width / (double)BASE_W;
-       g_conf.scale_height_factor = (double)g_conf.height / (double)BASE_H;
-}
-
-static void use_xmonitor(char *buffer)
-{
-       g_conf.use_xmonitor = !strcasecmp(buffer, "true");
-}
-
-static void emergency_disk_handler(char *buffer)
-{
-       g_conf.emergency_disk = strdup(buffer);
-       if (!g_conf.emergency_disk) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void services_handler(char *buffer)
-{
-       g_conf.services = strdup(buffer);
-       if (!g_conf.services) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void use_sw_backend_handler(char *buffer)
-{
-       g_conf.use_sw_backend = !strcasecmp(buffer, "true");
-}
-
-static void provider_method_handler(char *buffer)
-{
-       g_conf.provider_method = strdup(buffer);
-       if (!g_conf.provider_method) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void debug_mode_handler(char *buffer)
-{
-       g_conf.debug_mode = !strcasecmp(buffer, "true");
-}
-
-static void overwrite_content_handler(char *buffer)
-{
-       g_conf.overwrite_content = !strcasecmp(buffer, "true");
-}
-
-static void com_core_thread_handler(char *buffer)
-{
-       g_conf.com_core_thread = !strcasecmp(buffer, "true");
-}
-
-static void base_width_handler(char *buffer)
-{
-       if (sscanf(buffer, "%d", &g_conf.base_width) != 1) {
-               ErrPrint("Failed to parse the base_width\n");
-       }
-}
-
-static void base_height_handler(char *buffer)
-{
-       if (sscanf(buffer, "%d", &g_conf.base_height) != 1) {
-               ErrPrint("Failed to parse the base_height\n");
-       }
-}
-
-static void minimum_period_handler(char *buffer)
-{
-       if (sscanf(buffer, "%lf", &g_conf.minimum_period) != 1) {
-               ErrPrint("Failed to parse the minimum_period\n");
-       }
-       DbgPrint("Minimum period: %lf\n", g_conf.minimum_period);
-}
-
-static void pixels_handler(char *buffer)
-{
-       if (sscanf(buffer, "%d", &g_conf.default_conf.pixels) != 1) {
-               ErrPrint("Failed to parse the minimum_period\n");
-       }
-       DbgPrint("Default pixels: %lf\n", g_conf.default_conf.pixels);
-}
-
-static void script_handler(char *buffer)
-{
-       g_conf.default_conf.script = strdup(buffer);
-       if (!g_conf.default_conf.script) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void default_abi_handler(char *buffer)
-{
-       g_conf.default_conf.abi = strdup(buffer);
-       if (!g_conf.default_conf.abi) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void default_group_handler(char *buffer)
-{
-       g_conf.default_conf.pd_group = strdup(buffer);
-       if (!g_conf.default_conf.pd_group) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void default_period_handler(char *buffer)
-{
-       if (sscanf(buffer, "%lf", &g_conf.default_conf.period) != 1) {
-               ErrPrint("Failed to parse the default_period\n");
-       }
-       DbgPrint("Default Period: %lf\n", g_conf.default_conf.period);
-}
-
-static void default_packet_time_handler(char *buffer)
-{
-       if (sscanf(buffer, "%lf", &g_conf.default_packet_time) != 1) {
-               ErrPrint("Failed to parse the default_packet_time\n");
-       }
-       DbgPrint("Default packet time: %lf\n", g_conf.default_packet_time);
-}
-
-static void default_content_handler(char *buffer)
-{
-       g_conf.default_content = strdup(buffer);
-       if (!g_conf.default_content) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void default_title_handler(char *buffer)
-{
-       g_conf.default_title = strdup(buffer);
-       if (!g_conf.default_title) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void minimum_space_handler(char *buffer)
-{
-       if (sscanf(buffer, "%lu", &g_conf.minimum_space) != 1) {
-               ErrPrint("Failed to parse the minimum_space\n");
-       }
-}
-
-static void replace_tag_handler(char *buffer)
-{
-       g_conf.replace_tag = strdup(buffer);
-       if (!g_conf.replace_tag) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void slave_ttl_handler(char *buffer)
-{
-       if (sscanf(buffer, "%lf", &g_conf.slave_ttl) != 1) {
-               ErrPrint("Failed to parse the slave_ttl\n");
-       }
-       DbgPrint("Slave TTL: %lf\n", g_conf.slave_ttl);
-}
-
-static void slave_activate_time_handler(char *buffer)
-{
-       if (sscanf(buffer, "%lf", &g_conf.slave_activate_time) != 1) {
-               ErrPrint("Failed to parse the slave_activate_time\n");
-       }
-       DbgPrint("Slave activate time: %lf\n", g_conf.slave_activate_time);
-}
-
-static void slave_relaunch_time_handler(char *buffer)
-{
-       if (sscanf(buffer, "%lf", &g_conf.slave_relaunch_time) != 1) {
-               ErrPrint("Failed to parse the slave_activate_time\n");
-       }
-       DbgPrint("Slave relaunch time: %lf\n", g_conf.slave_relaunch_time);
-}
-
-static void slave_relaunch_count_handler(char *buffer)
-{
-       if (sscanf(buffer, "%d", &g_conf.slave_relaunch_count) != 1) {
-               ErrPrint("Failed to parse the max_log_line\n");
-       }
-}
-
-static void max_log_line_handler(char *buffer)
-{
-       if (sscanf(buffer, "%d", &g_conf.max_log_line) != 1) {
-               ErrPrint("Failed to parse the max_log_line\n");
-       }
-}
-
-static void max_log_file_handler(char *buffer)
-{
-       if (sscanf(buffer, "%d", &g_conf.max_log_file) != 1) {
-               ErrPrint("Failed to parse the max_log_file\n");
-       }
-}
-
-static void sqlite_flush_max_handler(char *buffer)
-{
-       if (sscanf(buffer, "%lu", &g_conf.sqlite_flush_max) != 1) {
-               ErrPrint("Failed to parse the sqlite_flush_max\n");
-       }
-}
-
-static void db_path_handler(char *buffer)
-{
-       g_conf.path.db = strdup(buffer);
-       if (!g_conf.path.db) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void reader_path_handler(char *buffer)
-{
-       g_conf.path.reader = strdup(buffer);
-       if (!g_conf.path.reader) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void always_path_handler(char *buffer)
-{
-       g_conf.path.always = strdup(buffer);
-       if (!g_conf.path.always) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void log_path_handler(char *buffer)
-{
-       g_conf.path.slave_log = strdup(buffer);
-       if (!g_conf.path.slave_log) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void script_port_path_handler(char *buffer)
-{
-       g_conf.path.script_port = strdup(buffer);
-       if (!g_conf.path.script_port) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void share_path_handler(char *buffer)
-{
-       g_conf.path.image = strdup(buffer);
-       if (!g_conf.path.image) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void input_path_handler(char *buffer)
-{
-       g_conf.path.input = strdup(buffer);
-       if (!g_conf.path.input) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-       }
-}
-
-static void ping_time_handler(char *buffer)
-{
-       if (sscanf(buffer, "%lf", &g_conf.ping_time) != 1) {
-               ErrPrint("Failed to parse the ping_time\n");
-       }
-       DbgPrint("Default ping time: %lf\n", g_conf.ping_time);
-}
-
-static void slave_max_loader(char *buffer)
-{
-       if (sscanf(buffer, "%d", &g_conf.slave_max_load) != 1) {
-               ErrPrint("Failed to parse the slave_max_load\n");
-       }
-}
-
-static void premultiplied_handler(char *buffer)
-{
-       if (sscanf(buffer, "%d", &g_conf.premultiplied) != 1) {
-               ErrPrint("Failed to parse the premultiplied color\n");
-       }
-
-       DbgPrint("Premultiplied: %d\n", g_conf.premultiplied);
-}
-
-static void pd_request_timeout_handler(char *buffer)
-{
-       if (sscanf(buffer, "%lf", &g_conf.pd_request_timeout) != 1) {
-               ErrPrint("Failed to parse the request_timeout\n");
-       }
-       DbgPrint("Default PD request timeout: %lf\n", g_conf.pd_request_timeout);
-}
-
-HAPI void conf_init(void)
-{
-       g_conf.width = CONF_DEFAULT_WIDTH;
-       g_conf.height = CONF_DEFAULT_HEIGHT;
-       g_conf.base_width = CONF_DEFAULT_BASE_WIDTH;
-       g_conf.base_height = CONF_DEFAULT_BASE_HEIGHT;
-       g_conf.minimum_period = CONF_DEFAULT_MINIMUM_PERIOD;
-       g_conf.default_conf.period = CONF_DEFAULT_PERIOD;
-       g_conf.default_conf.pixels = CONF_DEFAULT_PIXELS;
-       g_conf.minimum_space = CONF_DEFAULT_MINIMUM_SPACE;
-       g_conf.default_packet_time = CONF_DEFAULT_PACKET_TIME;
-       g_conf.slave_ttl = CONF_DEFAULT_SLAVE_TTL;
-       g_conf.slave_activate_time = CONF_DEFAULT_SLAVE_ACTIVATE_TIME;
-       g_conf.slave_relaunch_time = CONF_DEFAULT_SLAVE_RELAUNCH_TIME;
-       g_conf.slave_relaunch_count = CONF_DEFAULT_SLAVE_RELAUNCH_COUNT;
-       g_conf.max_log_line = CONF_DEFAULT_MAX_LOG_LINE;
-       g_conf.max_log_file = CONF_DEFAULT_MAX_LOG_FILE;
-       g_conf.sqlite_flush_max = CONF_DEFAULT_SQLITE_FLUSH_MAX;
-       g_conf.ping_time = CONF_DEFAULT_PING_TIME;
-       g_conf.slave_max_load = CONF_DEFAULT_SLAVE_MAX_LOAD;
-       g_conf.use_sw_backend = CONF_DEFAULT_USE_SW_BACKEND;
-       g_conf.debug_mode = CONF_DEFAULT_DEBUG_MODE;
-       g_conf.overwrite_content = CONF_DEFAULT_OVERWRITE_CONTENT;
-       g_conf.com_core_thread = CONF_DEFAULT_COM_CORE_THREAD;
-       g_conf.use_xmonitor = CONF_DEFAULT_USE_XMONITOR;
-       g_conf.scale_width_factor = CONF_DEFAULT_SCALE_WIDTH_FACTOR;
-       g_conf.scale_height_factor = CONF_DEFAULT_SCALE_HEIGHT_FACTOR;
-       g_conf.pd_request_timeout = CONF_DEFAULT_PD_REQUEST_TIMEOUT;
-       g_conf.premultiplied = CONF_DEFAULT_PREMULTIPLIED;
-       g_conf.default_conf.script = (char *)CONF_DEFAULT_SCRIPT_TYPE;
-       g_conf.default_conf.abi = (char *)CONF_DEFAULT_ABI;
-       g_conf.default_conf.pd_group = (char *)CONF_DEFAULT_PD_GROUP;
-       g_conf.launch_key.name = (char *)CONF_DEFAULT_LAUNCH_BUNDLE_NAME;
-       g_conf.launch_key.secured = (char *)CONF_DEFAULT_LAUNCH_BUNDLE_SECURED;
-       g_conf.launch_key.abi = (char *)CONF_DEFAULT_LAUNCH_BUNDLE_ABI;
-       g_conf.empty_content = (char *)CONF_DEFAULT_EMPTY_CONTENT;
-       g_conf.empty_title = (char *)CONF_DEFAULT_EMPTY_TITLE;
-       g_conf.default_content = (char *)CONF_DEFAULT_CONTENT;
-       g_conf.default_title = (char *)CONF_DEFAULT_TITLE;
-       g_conf.replace_tag = (char *)CONF_DEFAULT_REPLACE_TAG;
-       g_conf.path.conf = (char *)CONF_DEFAULT_PATH_CONF;
-       g_conf.path.image = (char *)CONF_DEFAULT_PATH_IMAGE;
-       g_conf.path.slave_log = (char *)CONF_DEFAULT_PATH_LOG;
-       g_conf.path.reader = (char *)CONF_DEFAULT_PATH_READER;
-       g_conf.path.always = (char *)CONF_DEFAULT_PATH_ALWAYS;
-       g_conf.path.script = (char *)CONF_DEFAULT_PATH_SCRIPT;
-       g_conf.path.root = (char *)CONF_DEFAULT_PATH_ROOT;
-       g_conf.path.script_port = (char *)CONF_DEFAULT_PATH_SCRIPT_PORT;
-       g_conf.path.db = (char *)CONF_DEFAULT_PATH_DB;
-       g_conf.path.input = (char *)CONF_DEFAULT_PATH_INPUT;
-       g_conf.provider_method = (char *)CONF_DEFAULT_PROVIDER_METHOD;
-       g_conf.emergency_disk = (char *)CONF_DEFAULT_EMERGENCY_DISK;
-       g_conf.services = (char *)CONF_DEFAULT_SERVICES;
-}
-
-HAPI int conf_loader(void)
-{
-       FILE *fp;
-       int c;
-       enum state {
-               START,
-               SPACE,
-               TOKEN,
-               VALUE,
-               ERROR,
-               COMMENT,
-               END
-       } state;
-       int ch_idx;
-       int token_idx;
-       int buffer_idx;
-       int quote;
-       int linelen;
-       char buffer[256];
-       static const struct token_parser {
-               const char *name;
-               void (*handler)(char *buffer);
-       } token_handler[] = {
-               {
-                       .name = "base_width",
-                       .handler = base_width_handler,
-               },
-               {
-                       .name = "base_height",
-                       .handler = base_height_handler,
-               },
-               {
-                       .name = "minimum_period",
-                       .handler = minimum_period_handler,
-               },
-               {
-                       .name = "script",
-                       .handler = script_handler,
-               },
-               {
-                       .name = "pixels",
-                       .handler = pixels_handler,
-               },
-               {
-                       .name = "default_abi",
-                       .handler = default_abi_handler,
-               },
-               {
-                       .name = "default_group",
-                       .handler = default_group_handler,
-               },
-               {
-                       .name = "default_period",
-                       .handler = default_period_handler,
-               },
-               {
-                       .name = "default_packet_time",
-                       .handler = default_packet_time_handler,
-               },
-               {
-                       .name = "default_content",
-                       .handler = default_content_handler,
-               },
-               {
-                       .name = "default_title",
-                       .handler = default_title_handler,
-               },
-               {
-                       .name = "minimum_space",
-                       .handler = minimum_space_handler,
-               },
-               {
-                       .name = "replace_tag",
-                       .handler = replace_tag_handler,
-               },
-               {
-                       .name = "slave_ttl",
-                       .handler = slave_ttl_handler,
-               },
-               {
-                       .name = "slave_activate_time",
-                       .handler = slave_activate_time_handler,
-               },
-               {
-                       .name = "slave_relaunch_time",
-                       .handler = slave_relaunch_time_handler,
-               },
-               {
-                       .name = "slave_relaunch_count",
-                       .handler = slave_relaunch_count_handler,
-               },
-               {
-                       .name = "max_log_line",
-                       .handler = max_log_line_handler,
-               },
-               {
-                       .name = "max_log_file",
-                       .handler = max_log_file_handler,
-               },
-               {
-                       .name = "sqilte_flush_max",
-                       .handler = sqlite_flush_max_handler,
-               },
-               {
-                       .name = "db_path",
-                       .handler = db_path_handler,
-               },
-               {
-                       .name = "log_path",
-                       .handler = log_path_handler,
-               },
-               {
-                       .name = "reader_path",
-                       .handler = reader_path_handler,
-               },
-               {
-                       .name = "always_path",
-                       .handler = always_path_handler,
-               },
-               {
-                       .name = "share_path",
-                       .handler = share_path_handler,
-               },
-               {
-                       .name = "script_port_path",
-                       .handler = script_port_path_handler,
-               },
-               {
-                       .name = "ping_interval",
-                       .handler = ping_time_handler,
-               },
-               {
-                       .name = "slave_max_load",
-                       .handler = slave_max_loader,
-               },
-               {
-                       .name = "use_sw_backend",
-                       .handler = use_sw_backend_handler,
-               },
-               {
-                       .name = "emergency_disk",
-                       .handler = emergency_disk_handler,
-               },
-               {
-                       .name = "services",
-                       .handler = services_handler,
-               },
-               {
-                       .name = "use_xmonitor",
-                       .handler = use_xmonitor,
-               },
-               {
-                       .name = "provider_method",
-                       .handler = provider_method_handler,
-               },
-               {
-                       .name = "debug_mode",
-                       .handler = debug_mode_handler,
-               },
-               {
-                       .name = "overwrite_content",
-                       .handler = overwrite_content_handler,
-               },
-               {
-                       .name = "com_core_thread",
-                       .handler = com_core_thread_handler,
-               },
-               {
-                       .name = "input",
-                       .handler = input_path_handler,
-               },
-               {
-                       .name = "pd_request_timeout",
-                       .handler = pd_request_timeout_handler,
-               },
-               {
-                       .name = "premultiplied",
-                       .handler = premultiplied_handler,
-               },
-               {
-                       .name = NULL,
-                       .handler = NULL,
-               },
-       };
-
-       fp = fopen(DEFAULT_MASTER_CONF, "rt");
-       if (!fp) {
-               ErrPrint("Error: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_IO;
-       }
-
-       state = START;
-       ch_idx = 0;
-       token_idx = -1;
-       buffer_idx = 0;
-       quote = 0;
-       linelen = 0;
-       do {
-               c = getc(fp);
-               if ((c == EOF) && (state == VALUE)) {
-                       DbgPrint("[%s:%d] VALUE state EOF\n", __func__, __LINE__);
-                       state = END;
-               }
-
-               switch (state) {
-               case COMMENT:
-                       if (c == CR || c == LF || c == EOF) {
-                               buffer[buffer_idx] = '\0';
-
-                               state = START;
-                               token_idx = -1;
-                               ch_idx = 0;
-                               buffer_idx = 0;
-                               linelen = -1; /* Will be ZERO by follwing increment code */
-                               quote = 0;
-                       } else {
-                               buffer[buffer_idx++] = c;
-                               if (buffer_idx == (sizeof(buffer) - 1)) {
-                                       buffer[buffer_idx] = '\0';
-                                       buffer_idx = 0;
-                               }
-                       }
-                       break;
-               case START:
-                       if (linelen == 0 && c == '#') {
-                               state = COMMENT;
-                       } else if (isspace(c)) {
-                               /* Ignore empty space */
-                       } else {
-                               state = TOKEN;
-                               ungetc(c, fp);
-                       }
-                       break;
-               case SPACE:
-                       if (c == '=') {
-                               state = VALUE;
-                       } else if (!isspace(c)) {
-                               state = ERROR;
-                       }
-                       break;
-               case VALUE:
-                       if (c == '"') {
-                               if (quote == 1) {
-                                       buffer[buffer_idx] = '\0';
-                                       state = END;
-                               } else if (buffer_idx != 0) {
-                                       buffer[buffer_idx++] = c;
-                                       if (buffer_idx >= sizeof(buffer)) {
-                                               state = ERROR;
-                                       }
-                               } else {
-                                       quote = 1;
-                               }
-                       } else if (isspace(c)) {
-                               if (buffer_idx == 0) {
-                                       /* Ignore */
-                               } else if (quote == 1) {
-                                       buffer[buffer_idx++] = c;
-                                       if (buffer_idx >= sizeof(buffer)) {
-                                               state = ERROR;
-                                       }
-                               } else {
-                                       buffer[buffer_idx] = '\0';
-                                       ungetc(c, fp);
-                                       state = END;
-                               }
-                       } else {
-                               buffer[buffer_idx++] = c;
-                               if (buffer_idx >= sizeof(buffer)) {
-                                       state = ERROR;
-                               }
-                       }
-                       break;
-               case TOKEN:
-                       if (c == '=') {
-                               if (token_idx < 0) {
-                                       state = ERROR;
-                               } else {
-                                       state = VALUE;
-                               }
-                       } else if (isspace(c)) {
-                               if (token_idx < 0) {
-                                       break;
-                               }
-
-                               if (token_handler[token_idx].name[ch_idx] != '\0') {
-                                       state = ERROR;
-                               } else {
-                                       state = SPACE;
-                               }
-                       } else  {
-                               if (token_idx < 0) {
-                                       /* Now start to find a token! */
-                                       token_idx = 0;
-                               }
-
-                               if (token_handler[token_idx].name[ch_idx] == c) {
-                                       ch_idx++;
-                               } else {
-                                       ungetc(c, fp);
-                                       while (ch_idx-- > 0)
-                                               ungetc(token_handler[token_idx].name[ch_idx], fp);
-
-                                       token_idx++;
-
-                                       if (token_handler[token_idx].name == NULL) {
-                                               state = ERROR;
-                                       } else {
-                                               ch_idx = 0;
-                                       }
-                               }
-                       }
-                       break;
-               case ERROR:
-                       if (c == CR || c == LF || c == EOF) {
-                               state = START;
-                               token_idx = -1;
-                               buffer_idx = 0;
-                               ch_idx = 0;
-                               linelen = -1;
-                               quote = 0;
-                       }
-                       break;
-               case END:
-                       if (c == LF || c == CR || c == EOF) {
-                               state = START;
-
-                               if (token_idx >= 0 && token_handler[token_idx].handler) {
-                                       buffer[buffer_idx] = '\0';
-                                       token_handler[token_idx].handler(buffer);
-                               }
-
-                               token_idx = -1;
-                               ch_idx = 0;
-                               buffer_idx = 0;
-                               linelen = -1;
-                               quote = 0;
-                               /* Finish */
-                       } else if (isspace(c)) {
-                               /* ignore */
-                       } else {
-                               state = ERROR;
-                       }
-                       break;
-               default:
-                       /* ?? */
-                       break;
-               }
-
-               linelen++;
-        } while (c != EOF);
-
-       if (fclose(fp) != 0) {
-               ErrPrint("fclose: %s\n", strerror(errno));
-       }
-       return LB_STATUS_SUCCESS;
-}
-
-HAPI void conf_reset(void)
-{
-       g_conf.width = CONF_DEFAULT_WIDTH;
-       g_conf.height = CONF_DEFAULT_HEIGHT;
-       g_conf.base_width = CONF_DEFAULT_BASE_WIDTH;
-       g_conf.base_height = CONF_DEFAULT_BASE_HEIGHT;
-       g_conf.minimum_period = CONF_DEFAULT_MINIMUM_PERIOD;
-       g_conf.default_conf.period = CONF_DEFAULT_PERIOD;
-       g_conf.minimum_space = CONF_DEFAULT_MINIMUM_SPACE;
-       g_conf.default_packet_time = CONF_DEFAULT_PACKET_TIME;
-       g_conf.slave_ttl = CONF_DEFAULT_SLAVE_TTL;
-       g_conf.slave_activate_time = CONF_DEFAULT_SLAVE_ACTIVATE_TIME;
-       g_conf.slave_relaunch_time = CONF_DEFAULT_SLAVE_RELAUNCH_TIME;
-       g_conf.slave_relaunch_count = CONF_DEFAULT_SLAVE_RELAUNCH_COUNT;
-       g_conf.max_log_line = CONF_DEFAULT_MAX_LOG_LINE;
-       g_conf.max_log_file = CONF_DEFAULT_MAX_LOG_FILE;
-       g_conf.sqlite_flush_max = CONF_DEFAULT_SQLITE_FLUSH_MAX;
-       g_conf.ping_time = CONF_DEFAULT_PING_TIME;
-       g_conf.slave_max_load = CONF_DEFAULT_SLAVE_MAX_LOAD;
-       g_conf.use_sw_backend = CONF_DEFAULT_USE_SW_BACKEND;
-       g_conf.debug_mode = CONF_DEFAULT_DEBUG_MODE;
-       g_conf.overwrite_content = CONF_DEFAULT_OVERWRITE_CONTENT;
-       g_conf.com_core_thread = CONF_DEFAULT_COM_CORE_THREAD;
-       g_conf.use_xmonitor = CONF_DEFAULT_USE_XMONITOR;
-       g_conf.scale_width_factor = CONF_DEFAULT_SCALE_WIDTH_FACTOR;
-       g_conf.scale_height_factor = CONF_DEFAULT_SCALE_HEIGHT_FACTOR;
-       g_conf.pd_request_timeout = CONF_DEFAULT_PD_REQUEST_TIMEOUT;
-       g_conf.premultiplied = CONF_DEFAULT_PREMULTIPLIED;
-       g_conf.default_conf.pixels = CONF_DEFAULT_PIXELS;
-
-       if (g_conf.default_conf.script != CONF_DEFAULT_SCRIPT_TYPE) {
-               DbgFree(g_conf.default_conf.script);
-               g_conf.default_conf.script = (char *)CONF_DEFAULT_SCRIPT_TYPE;
-       }
-
-       if (g_conf.default_conf.abi != CONF_DEFAULT_ABI) {
-               DbgFree(g_conf.default_conf.abi);
-               g_conf.default_conf.abi = (char *)CONF_DEFAULT_ABI;
-       }
-
-       if (g_conf.default_conf.pd_group != CONF_DEFAULT_PD_GROUP) {
-               DbgFree(g_conf.default_conf.pd_group);
-               g_conf.default_conf.pd_group = (char *)CONF_DEFAULT_PD_GROUP;
-       }
-
-       if (g_conf.launch_key.name != CONF_DEFAULT_LAUNCH_BUNDLE_NAME) {
-               DbgFree(g_conf.launch_key.name);
-               g_conf.launch_key.name = (char *)CONF_DEFAULT_LAUNCH_BUNDLE_NAME;
-       }
-
-       if (g_conf.launch_key.secured != CONF_DEFAULT_LAUNCH_BUNDLE_SECURED) {
-               DbgFree(g_conf.launch_key.secured);
-               g_conf.launch_key.secured = (char *)CONF_DEFAULT_LAUNCH_BUNDLE_SECURED;
-       }
-
-       if (g_conf.launch_key.abi != CONF_DEFAULT_LAUNCH_BUNDLE_ABI) {
-               DbgFree(g_conf.launch_key.abi);
-               g_conf.launch_key.abi = (char *)CONF_DEFAULT_LAUNCH_BUNDLE_ABI;
-       }
-
-       if (g_conf.empty_content != CONF_DEFAULT_EMPTY_CONTENT) {
-               DbgFree(g_conf.empty_content);
-               g_conf.empty_content = (char *)CONF_DEFAULT_EMPTY_CONTENT;
-       }
-
-       if (g_conf.empty_title != CONF_DEFAULT_EMPTY_TITLE) {
-               DbgFree(g_conf.empty_title);
-               g_conf.empty_title = (char *)CONF_DEFAULT_EMPTY_TITLE;
-       }
-
-       if (g_conf.default_content != CONF_DEFAULT_CONTENT) {
-               DbgFree(g_conf.default_content);
-               g_conf.default_content = (char *)CONF_DEFAULT_CONTENT;
-       }
-
-       if (g_conf.default_title != CONF_DEFAULT_TITLE) {
-               DbgFree(g_conf.default_title);
-               g_conf.default_title = (char *)CONF_DEFAULT_TITLE;
-       }
-
-       if (g_conf.replace_tag != CONF_DEFAULT_REPLACE_TAG) {
-               DbgFree(g_conf.replace_tag);
-               g_conf.replace_tag = (char *)CONF_DEFAULT_REPLACE_TAG;
-       }
-
-       if (g_conf.path.conf != CONF_DEFAULT_PATH_CONF) {
-               DbgFree(g_conf.path.conf);
-               g_conf.path.conf = (char *)CONF_DEFAULT_PATH_CONF;
-       }
-
-       if (g_conf.path.image != CONF_DEFAULT_PATH_IMAGE) {
-               DbgFree(g_conf.path.image);
-               g_conf.path.image = (char *)CONF_DEFAULT_PATH_IMAGE;
-       }
-
-       if (g_conf.path.slave_log != CONF_DEFAULT_PATH_LOG) {
-               DbgFree(g_conf.path.slave_log);
-               g_conf.path.slave_log = (char *)CONF_DEFAULT_PATH_LOG;
-       }
-
-       if (g_conf.path.reader != CONF_DEFAULT_PATH_READER) {
-               DbgFree(g_conf.path.reader);
-               g_conf.path.reader = (char *)CONF_DEFAULT_PATH_READER;
-       }
-
-       if (g_conf.path.always != CONF_DEFAULT_PATH_ALWAYS) {
-               DbgFree(g_conf.path.always);
-               g_conf.path.always = (char *)CONF_DEFAULT_PATH_ALWAYS;
-       }
-
-       if (g_conf.path.script != CONF_DEFAULT_PATH_SCRIPT) {
-               DbgFree(g_conf.path.script);
-               g_conf.path.script = (char *)CONF_DEFAULT_PATH_SCRIPT;
-       }
-
-       if (g_conf.path.root != CONF_DEFAULT_PATH_ROOT) {
-               DbgFree(g_conf.path.root);
-               g_conf.path.root = (char *)CONF_DEFAULT_PATH_ROOT;
-       }
-
-       if (g_conf.path.script_port != CONF_DEFAULT_PATH_SCRIPT_PORT) {
-               DbgFree(g_conf.path.script_port);
-               g_conf.path.script_port = (char *)CONF_DEFAULT_PATH_SCRIPT_PORT;
-       }
-
-       if (g_conf.path.db != CONF_DEFAULT_PATH_DB) {
-               DbgFree(g_conf.path.db);
-               g_conf.path.db = (char *)CONF_DEFAULT_PATH_DB;
-       }
-
-       if (g_conf.path.input != CONF_DEFAULT_PATH_INPUT) {
-               DbgFree(g_conf.path.input);
-               g_conf.path.input = (char *)CONF_DEFAULT_PATH_INPUT;
-       }
-
-       if (g_conf.provider_method != CONF_DEFAULT_PROVIDER_METHOD) {
-               DbgFree(g_conf.provider_method);
-               g_conf.provider_method = (char *)CONF_DEFAULT_PROVIDER_METHOD;
-       }
-
-       if (g_conf.emergency_disk != CONF_DEFAULT_EMERGENCY_DISK) {
-               DbgFree(g_conf.emergency_disk);
-               g_conf.emergency_disk = (char *)CONF_DEFAULT_EMERGENCY_DISK;
-       }
 
-       if (g_conf.services != CONF_DEFAULT_SERVICES) {
-               DbgFree(g_conf.services);
-               g_conf.services = (char *)CONF_DEFAULT_SERVICES;
-       }
-}
+struct conf g_conf = {
+    .debug_mode = 0,
+    .slave_max_load = -1,
+};
 
 /* End of a file */
index 6bf10d6..ceb10a3 100644 (file)
@@ -28,7 +28,8 @@
 #include <dlog.h>
 #include <Eina.h>
 #if defined(HAVE_LIVEBOX)
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
+#include <dynamicbox_conf.h>
 #else
 #include "lite-errno.h"
 #endif
 #include "critical_log.h"
 
 static struct {
-       FILE *fp;
-       int file_id;
-       int nr_of_lines;
-       char *filename;
-       pthread_mutex_t cri_lock;
+    FILE *fp;
+    int file_id;
+    int nr_of_lines;
+    char *filename;
+    pthread_mutex_t cri_lock;
 } s_info = {
-       .fp = NULL,
-       .file_id = 0,
-       .nr_of_lines = 0,
-       .filename = NULL,
-       .cri_lock = PTHREAD_MUTEX_INITIALIZER,
+    .fp = NULL,
+    .file_id = 0,
+    .nr_of_lines = 0,
+    .filename = NULL,
+    .cri_lock = PTHREAD_MUTEX_INITIALIZER,
 };
 
 
 
 static inline void rotate_log(void)
 {
-       char *filename;
-       int namelen;
+    char *filename;
+    int namelen;
 
-       if (s_info.nr_of_lines < MAX_LOG_LINE) {
-               return;
-       }
-
-       s_info.file_id = (s_info.file_id + 1) % MAX_LOG_FILE;
+    if (s_info.nr_of_lines < DYNAMICBOX_CONF_MAX_LOG_LINE) {
+       return;
+    }
 
-       namelen = strlen(s_info.filename) + strlen(SLAVE_LOG_PATH) + 30;
-       filename = malloc(namelen);
-       if (filename) {
-               snprintf(filename, namelen, "%s/%d_%s.%d", SLAVE_LOG_PATH, s_info.file_id, s_info.filename, getpid());
+    s_info.file_id = (s_info.file_id + 1) % DYNAMICBOX_CONF_MAX_LOG_FILE;
 
-               if (s_info.fp) {
-                       if (fclose(s_info.fp) != 0) {
-                               ErrPrint("fclose: %s\n", strerror(errno));
-                       }
-               }
+    namelen = strlen(s_info.filename) + strlen(DYNAMICBOX_CONF_LOG_PATH) + 30;
+    filename = malloc(namelen);
+    if (filename) {
+       snprintf(filename, namelen, "%s/%d_%s.%d", DYNAMICBOX_CONF_LOG_PATH, s_info.file_id, s_info.filename, getpid());
 
-               s_info.fp = fopen(filename, "w+");
-               if (!s_info.fp) {
-                       ErrPrint("Failed to open a file: %s\n", filename);
-               }
+       if (s_info.fp) {
+           if (fclose(s_info.fp) != 0) {
+               ErrPrint("fclose: %s\n", strerror(errno));
+           }
+       }
 
-               DbgFree(filename);
+       s_info.fp = fopen(filename, "w+");
+       if (!s_info.fp) {
+           ErrPrint("Failed to open a file: %s\n", filename);
        }
 
-       s_info.nr_of_lines = 0;
+       DbgFree(filename);
+    }
+
+    s_info.nr_of_lines = 0;
 }
 
 
 
 HAPI int critical_log(const char *func, int line, const char *fmt, ...)
 {
-       va_list ap;
-       int ret;
+    va_list ap;
+    int ret;
 
-       if (!s_info.fp) {
-               return LB_STATUS_ERROR_IO;
-       }
+    if (!s_info.fp) {
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
 
-       CRITICAL_SECTION_BEGIN(&s_info.cri_lock);
+    CRITICAL_SECTION_BEGIN(&s_info.cri_lock);
 
-       fprintf(s_info.fp, "%lf [%s:%d] ", util_timestamp(), util_basename((char *)func), line);
+    fprintf(s_info.fp, "%lf [%s:%d] ", util_timestamp(), util_basename((char *)func), line);
 
-       va_start(ap, fmt);
-       ret = vfprintf(s_info.fp, fmt, ap);
-       va_end(ap);
+    va_start(ap, fmt);
+    ret = vfprintf(s_info.fp, fmt, ap);
+    va_end(ap);
 
-       fflush(s_info.fp);
+    fflush(s_info.fp);
 
-       s_info.nr_of_lines++;
-       rotate_log();
+    s_info.nr_of_lines++;
+    rotate_log();
 
-       CRITICAL_SECTION_END(&s_info.cri_lock);
-       return ret;
+    CRITICAL_SECTION_END(&s_info.cri_lock);
+    return ret;
 }
 
 
 
 HAPI int critical_log_init(const char *name)
 {
-       int namelen;
-       char *filename;
-
-       if (s_info.fp) {
-               return LB_STATUS_SUCCESS;
-       }
-
-       s_info.filename = strdup(name);
-       if (!s_info.filename) {
-               ErrPrint("Failed to create a log file\n");
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       namelen = strlen(name) + strlen(SLAVE_LOG_PATH) + 30;
-
-       filename = malloc(namelen);
-       if (!filename) {
-               ErrPrint("Failed to create a log file\n");
-               DbgFree(s_info.filename);
-               s_info.filename = NULL;
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       snprintf(filename, namelen, "%s/%d_%s.%d", SLAVE_LOG_PATH, s_info.file_id, name, getpid());
-
-       s_info.fp = fopen(filename, "w+");
-       if (!s_info.fp) {
-               ErrPrint("Failed to open log: %s\n", strerror(errno));
-               DbgFree(s_info.filename);
-               s_info.filename = NULL;
-               DbgFree(filename);
-               return LB_STATUS_ERROR_IO;
-       }
-
+    int namelen;
+    char *filename;
+
+    if (s_info.fp) {
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    s_info.filename = strdup(name);
+    if (!s_info.filename) {
+       ErrPrint("Failed to create a log file\n");
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    namelen = strlen(name) + strlen(DYNAMICBOX_CONF_LOG_PATH) + 30;
+
+    filename = malloc(namelen);
+    if (!filename) {
+       ErrPrint("Failed to create a log file\n");
+       DbgFree(s_info.filename);
+       s_info.filename = NULL;
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    snprintf(filename, namelen, "%s/%d_%s.%d", DYNAMICBOX_CONF_LOG_PATH, s_info.file_id, name, getpid());
+
+    s_info.fp = fopen(filename, "w+");
+    if (!s_info.fp) {
+       ErrPrint("Failed to open log: %s\n", strerror(errno));
+       DbgFree(s_info.filename);
+       s_info.filename = NULL;
        DbgFree(filename);
-       return LB_STATUS_SUCCESS;
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
+
+    DbgFree(filename);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 
 
 HAPI void critical_log_fini(void)
 {
-       if (s_info.filename) {
-               DbgFree(s_info.filename);
-               s_info.filename = NULL;
-       }
-
-       if (s_info.fp) {
-               if (fclose(s_info.fp) != 0) {
-                       ErrPrint("fclose: %s\n", strerror(errno));
-               }
-               s_info.fp = NULL;
+    if (s_info.filename) {
+       DbgFree(s_info.filename);
+       s_info.filename = NULL;
+    }
+
+    if (s_info.fp) {
+       if (fclose(s_info.fp) != 0) {
+           ErrPrint("fclose: %s\n", strerror(errno));
        }
+       s_info.fp = NULL;
+    }
 }
 
 
index 313327f..c308b5b 100644 (file)
@@ -23,6 +23,7 @@
 #include <dlog.h>
 
 #include <Eina.h>
+#include <dynamicbox_service.h> /* destroy_type for instance.h */
 
 #include "slave_life.h"
 #include "client_life.h"
 
 static int evt_cb(int handle, void *data)
 {
-       struct slave_node *slave;
-       struct client_node *client;
-       struct liveinfo *liveinfo;
-
-       slave = slave_find_by_rpc_handle(handle);
-       if (slave) {
-               if (slave_pid(slave) != (pid_t)-1) {
-                       switch (slave_state(slave)) {
-                       case SLAVE_REQUEST_TO_DISCONNECT:
-                               DbgPrint("Disconnected from %d\n", slave_pid(slave));
-                       case SLAVE_REQUEST_TO_TERMINATE:
-                               slave = slave_deactivated(slave);
-                               break;
-                       default:
-                               slave = slave_deactivated_by_fault(slave);
-                               break;
-                       }
-               }
-
-               if (!slave) {
-                       DbgPrint("Slave is deleted\n");
-               }
-
-               return 0;
+    struct slave_node *slave;
+    struct client_node *client;
+    struct liveinfo *liveinfo;
+
+    slave = slave_find_by_rpc_handle(handle);
+    if (slave) {
+       if (slave_pid(slave) != (pid_t)-1) {
+           switch (slave_state(slave)) {
+               case SLAVE_REQUEST_TO_DISCONNECT:
+                   DbgPrint("Disconnected from %d\n", slave_pid(slave));
+               case SLAVE_REQUEST_TO_TERMINATE:
+                   slave = slave_deactivated(slave);
+                   break;
+               default:
+                   slave = slave_deactivated_by_fault(slave);
+                   break;
+           }
        }
 
-       client = client_find_by_rpc_handle(handle);
-       if (client) {
-               if (client_pid(client) != (pid_t)-1) {
-                       client = client_deactivated_by_fault(client);
-               }
+       if (!slave) {
+           DbgPrint("Slave is deleted\n");
+       }
 
-               if (!client) {
-                       DbgPrint("Client is deleted\n");
-               }
+       return 0;
+    }
 
-               return 0;
+    client = client_find_by_rpc_handle(handle);
+    if (client) {
+       if (client_pid(client) != (pid_t)-1) {
+           client = client_deactivated_by_fault(client);
        }
 
-       liveinfo = liveinfo_find_by_handle(handle);
-       if (liveinfo) {
-               liveinfo_destroy(liveinfo);
-               return 0;
+       if (!client) {
+           DbgPrint("Client is deleted\n");
        }
 
        return 0;
+    }
+
+    liveinfo = liveinfo_find_by_handle(handle);
+    if (liveinfo) {
+       liveinfo_destroy(liveinfo);
+       return 0;
+    }
+
+    return 0;
 }
 
 HAPI int dead_init(void)
 {
-       com_core_add_event_callback(CONNECTOR_DISCONNECTED, evt_cb, NULL);
-       return 0;
+    com_core_add_event_callback(CONNECTOR_DISCONNECTED, evt_cb, NULL);
+    return 0;
 }
 
 HAPI int dead_fini(void)
 {
-       com_core_del_event_callback(CONNECTOR_DISCONNECTED, evt_cb, NULL);
-       return 0;
+    com_core_del_event_callback(CONNECTOR_DISCONNECTED, evt_cb, NULL);
+    return 0;
 }
 
 /* End of a file */
index 0604c11..84ef0d7 100644 (file)
@@ -29,7 +29,8 @@
 #include <Eina.h>
 #include <Ecore.h>
 #include <dlog.h>
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
+#include <dynamicbox_conf.h>
 
 #include "util.h"
 #include "debug.h"
 #include "event.h"
 
 #define EVENT_CH       'e'
+#define EVENT_EXIT     'x'
 
-#if !defined(ABS_MT_TOOL_X)
-#define ABS_MT_TOOL_X           0x3c    /* Center X tool position */
-#endif
-
-#if !defined(ABS_MT_TOOL_Y)
-#define ABS_MT_TOOL_Y           0x3d    /* Center Y tool position */
-#endif
+#define PRESSURE 10
+#define DELAY_COMPENSATOR 0.1f
 
 int errno;
 
 static struct info {
-       pthread_t tid;
-       Eina_List *event_list;
-       int handle;
-       pthread_mutex_t event_list_lock;
-       int evt_pipe[PIPE_MAX];
-       int tcb_pipe[PIPE_MAX];
-       Ecore_Fd_Handler *event_handler;
-
-       struct event_data event_data;
-
-       Eina_List *event_listener_list;
-       Eina_List *reactivate_list;
+    pthread_t tid;
+    Eina_List *event_list;
+    int handle;
+    pthread_mutex_t event_list_lock;
+    int evt_pipe[PIPE_MAX];
+    int tcb_pipe[PIPE_MAX];
+    Ecore_Fd_Handler *event_handler;
+
+    struct event_data event_data;
+
+    Eina_List *event_listener_list;
+    Eina_List *reactivate_list;
+
+    int event_handler_activated;
+    int timestamp_updated;
 } s_info = {
-       .event_list = NULL,
-       .handle = -1,
-       .event_handler = NULL,
-
-       .event_data = {
-               .x = -1,
-               .y = -1,
-               .device = -1,
-               .slot = -1,
-               .keycode = 0,
-       },
-
-       .event_listener_list = NULL,
-       .reactivate_list = NULL,
+    .event_handler_activated = 0,
+    .event_list = NULL,
+    .handle = -1,
+    .event_handler = NULL,
+    .evt_pipe = { -1, -1 },
+    .tcb_pipe = { -1, -1 },
+
+    .event_data = {
+       .x = -1,
+       .y = -1,
+       .device = -1,
+       .slot = -1,
+       .keycode = 0,
+    },
+
+    .event_listener_list = NULL,
+    .reactivate_list = NULL,
+    .timestamp_updated = 0,
 };
 
 struct event_listener {
-       int (*event_cb)(enum event_state state, struct event_data *event, void *data);
-       void *cbdata;
+    int (*event_cb)(enum event_state state, struct event_data *event, void *data);
+    void *cbdata;
 
-       enum event_state state;
+    enum event_state prev_state;
+    enum event_state state;
 
-#if defined(_USE_ECORE_TIME_GET)
-       double tv;
-#else
-       struct timeval tv; /* Recording Activate / Deactivate time */
-#endif
-       int x; /* RelX */
-       int y; /* RelY */
+    double tv;
+    int x; /* RelX */
+    int y; /* RelY */
 };
 
 static int activate_thread(void);
+static int deactivate_thread(void);
+static int event_control_fini(void);
 
 HAPI int event_init(void)
 {
-       int ret;
-       ret = pthread_mutex_init(&s_info.event_list_lock, NULL);
-       if (ret != 0) {
-               ErrPrint("Mutex: %s\n", strerror(ret));
-               return LB_STATUS_ERROR_FAULT;
-       }
-       return LB_STATUS_SUCCESS;
+    int ret;
+
+    ret = pthread_mutex_init(&s_info.event_list_lock, NULL);
+    if (ret != 0) {
+       ErrPrint("Mutex: %s\n", strerror(ret));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int event_fini(void)
 {
-       int ret;
-       ret = pthread_mutex_destroy(&s_info.event_list_lock);
-       if (ret != 0) {
-               ErrPrint("Mutex destroy failed: %s\n", strerror(ret));
+    int ret;
+
+    event_control_fini();
+
+    ret = pthread_mutex_destroy(&s_info.event_list_lock);
+    if (ret != 0) {
+       ErrPrint("Mutex destroy failed: %s\n", strerror(ret));
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+/*
+ * This function can be called Event Thread.
+ */
+static int push_event_item(void)
+{
+    struct event_data *item;
+
+    if (s_info.event_data.x < 0 || s_info.event_data.y < 0) {
+       /* Waiting full event packet */
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    item = malloc(sizeof(*item));
+    if (item) {
+       char event_ch = EVENT_CH;
+
+       memcpy(item, &s_info.event_data, sizeof(*item));
+
+       CRITICAL_SECTION_BEGIN(&s_info.event_list_lock);
+       s_info.event_list = eina_list_append(s_info.event_list, item);
+       CRITICAL_SECTION_END(&s_info.event_list_lock);
+
+       if (write(s_info.evt_pipe[PIPE_WRITE], &event_ch, sizeof(event_ch)) != sizeof(event_ch)) {
+           ErrPrint("Unable to send an event: %s\n", strerror(errno));
+           return DBOX_STATUS_ERROR_IO_ERROR;
+       }
+
+       /* Take a breathe */
+       pthread_yield();
+    } else {
+       ErrPrint("Heap: %s\n", strerror(errno));
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+static double current_time_get(void)
+{
+    double ret;
+
+    if (DYNAMICBOX_CONF_USE_GETTIMEOFDAY) {
+       struct timeval tv;
+       if (gettimeofday(&tv, NULL) < 0) {
+           ErrPrint("gettimeofday: %s\n", strerror(errno));
+           ret = ecore_time_get();
+       } else {
+           ret = (double)tv.tv_sec + ((double)tv.tv_usec / 1000000.0f);
        }
-       return LB_STATUS_SUCCESS;
+    } else {
+       ret = ecore_time_get();
+    }
+
+    return ret;
+}
+
+static void update_timestamp(struct input_event *event)
+{
+    /*
+     * Input event uses timeval instead of timespec,
+     * but its value is same as MONOTIC CLOCK TIME
+     * So we should handles it properly.
+     */
+    s_info.event_data.tv = (double)event->time.tv_sec + (double)event->time.tv_usec / 1000000.0f;
+    s_info.timestamp_updated = 1;
 }
 
+static void processing_ev_abs(struct input_event *event)
+{
+    switch (event->code) {
+#if defined(ABS_X)
+    case ABS_X:
+       break;
+#endif
+#if defined(ABS_Y)
+    case ABS_Y:
+       break;
+#endif
+#if defined(ABS_Z)
+    case ABS_Z:
+       break;
+#endif
+#if defined(ABS_RX)
+    case ABS_RX:
+       break;
+#endif
+#if defined(ABS_RY)
+    case ABS_RY:
+       break;
+#endif
+#if defined(ABS_RZ)
+    case ABS_RZ:
+       break;
+#endif
+#if defined(ABS_THROTTLE)
+    case ABS_THROTTLE:
+       break;
+#endif
+#if defined(ABS_RUDDER)
+    case ABS_RUDDER:
+       break;
+#endif
+#if defined(ABS_WHEEL)
+    case ABS_WHEEL:
+       break;
+#endif
+#if defined(ABS_GAS)
+    case ABS_GAS:
+       break;
+#endif
+#if defined(ABS_BRAKE)
+    case ABS_BRAKE:
+       break;
+#endif
+#if defined(ABS_HAT0X)
+    case ABS_HAT0X:
+       break;
+#endif
+#if defined(ABS_HAT0Y)
+    case ABS_HAT0Y:
+       break;
+#endif
+#if defined(ABS_HAT1X)
+    case ABS_HAT1X:
+       break;
+#endif
+#if defined(ABS_HAT1Y)
+    case ABS_HAT1Y:
+       break;
+#endif
+#if defined(ABS_HAT2X)
+    case ABS_HAT2X:
+       break;
+#endif
+#if defined(ABS_HAT2Y)
+    case ABS_HAT2Y:
+       break;
+#endif
+#if defined(ABS_HAT3X)
+    case ABS_HAT3X:
+       break;
+#endif
+#if defined(ABS_HAT3Y)
+    case ABS_HAT3Y:
+       break;
+#endif
+#if defined(ABS_PRESSURE)
+    case ABS_PRESSURE:
+       break;
+#endif
+#if defined(ABS_TILT_X)
+    case ABS_TILT_X:
+       break;
+#endif
+#if defined(ABS_TILT_Y)
+    case ABS_TILT_Y:
+       break;
+#endif
+#if defined(ABS_TOOL_WIDTH)
+    case ABS_TOOL_WIDTH:
+       break;
+#endif
+#if defined(ABS_VOLUME)
+    case ABS_VOLUME:
+       break;
+#endif
+#if defined(ABS_MISC)
+    case ABS_MISC:
+       break;
+#endif
+#if defined(ABS_DISTANCE)
+    case ABS_DISTANCE:
+       s_info.event_data.distance = event->value;
+       break;
+#endif
+#if defined(ABS_MT_POSITION_X)
+    case ABS_MT_POSITION_X:
+       s_info.event_data.x = event->value;
+       break;
+#endif
+#if defined(ABS_MT_POSITION_Y)
+    case ABS_MT_POSITION_Y:
+       s_info.event_data.y = event->value;
+       break;
+#endif
+#if defined(ABS_MT_SLOT)
+    case ABS_MT_SLOT:
+       s_info.event_data.slot = event->value;
+       break;
+#endif
+#if defined(ABS_MT_TRACKING_ID)
+    case ABS_MT_TRACKING_ID:
+       s_info.event_data.device = event->value;
+       break;
+#endif
+#if defined(ABS_MT_TOUCH_MAJOR)
+    case ABS_MT_TOUCH_MAJOR:
+       s_info.event_data.touch.major = event->value;
+       break;
+#endif
+#if defined(ABS_MT_TOUCH_MINOR)
+    case ABS_MT_TOUCH_MINOR:
+       s_info.event_data.touch.minor = event->value;
+       break;
+#endif
+#if defined(ABS_MT_WIDTH_MAJOR)
+    case ABS_MT_WIDTH_MAJOR:
+       s_info.event_data.width.major = event->value;
+       break;
+#endif
+#if defined(ABS_MT_WIDTH_MINOR)
+    case ABS_MT_WIDTH_MINOR:
+       s_info.event_data.width.minor = event->value;
+       break;
+#endif
+#if defined(ABS_MT_ORIENTATION)
+    case ABS_MT_ORIENTATION:
+       s_info.event_data.orientation = event->value;
+       break;
+#endif
+#if defined(ABS_MT_PRESSURE)
+    case ABS_MT_PRESSURE:
+       s_info.event_data.pressure = event->value;
+       break;
+#endif
+#if defined(ABS_MT_TOOL_X)
+    case ABS_MT_TOOL_X:
+       DbgPrint("TOOL_X: %d\n", event->value);
+       break;
+#endif
+#if defined(ABS_MT_TOOL_Y)
+    case ABS_MT_TOOL_Y:
+       DbgPrint("TOOL_Y: %d\n", event->value);
+       break;
+#endif
+#if defined(ABS_MT_TOOL_TYPE)
+    case ABS_MT_TOOL_TYPE:
+       DbgPrint("TOOL_TYPE: %d\n", event->value);
+       break;
+#endif
+#if defined(ABS_MT_BLOB_ID)
+    case ABS_MT_BLOB_ID:
+       DbgPrint("BLOB_ID: %d\n", event->value);
+       break;
+#endif
+#if defined(ABS_MT_DISTANCE)
+    case ABS_MT_DISTANCE:
+       DbgPrint("DISTANCE: %d\n", event->value);
+       break;
+#endif
+#if defined(ABS_MT_ANGLE)
+    case ABS_MT_ANGLE:
+       DbgPrint("ANGLE: %d\n", event->value);
+       break;
+#endif
+#if defined(ABS_MT_PALM)
+    case ABS_MT_PALM:
+       DbgPrint("PALM: %d\n", event->value);
+       break;
+#endif
+#if defined(ABS_MT_COMPONENT)
+    case ABS_MT_COMPONENT:
+       DbgPrint("COMPONENT: %d\n", event->value);
+       break;
+#endif
+#if defined(ABS_MT_SUMSIZE)
+    case ABS_MT_SUMSIZE:
+       DbgPrint("SUMSIZE: %d\n", event->value);
+       break;
+#endif
+    default:
+       break;
+    }
+
+    return;
+}
+
+/*
+ * Called by Event Thread
+ */
 static inline int processing_input_event(struct input_event *event)
 {
-       struct event_data *item;
-
-       switch (event->type) {
-       case EV_SYN:
-               switch (event->code) {
-                       break;
-               case SYN_CONFIG:
-                       break;
-               case SYN_MT_REPORT:
-               case SYN_REPORT:
-                       if (s_info.event_data.x < 0 || s_info.event_data.y < 0) {
-                               /* Waiting full event packet */
-                               break;
-                       }
-
-                       item = malloc(sizeof(*item));
-                       if (item) {
-                               char event_ch = EVENT_CH;
-
-#if defined(_USE_ECORE_TIME_GET)
-                               s_info.event_data.tv = ecore_time_get();
-#else
-                               if (gettimeofday(&s_info.event_data.tv, NULL) < 0) {
-                                       ErrPrint("gettimeofday: %s\n", strerror(errno));
-                               }
-#endif
-
-                               memcpy(item, &s_info.event_data, sizeof(*item));
-
-                               CRITICAL_SECTION_BEGIN(&s_info.event_list_lock);
-                               s_info.event_list = eina_list_append(s_info.event_list, item);
-                               CRITICAL_SECTION_END(&s_info.event_list_lock);
-
-                               if (write(s_info.evt_pipe[PIPE_WRITE], &event_ch, sizeof(event_ch)) != sizeof(event_ch)) {
-                                       ErrPrint("Unable to send an event: %s\n", strerror(errno));
-                                       return LB_STATUS_ERROR_IO;
-                               }
-
-                               /* Take a breathe */
-                               pthread_yield();
-                       } else {
-                               ErrPrint("Heap: %s\n", strerror(errno));
-                       }
-
-                       if (s_info.event_data.device < 0) {
-                               s_info.event_data.x = -1;
-                               s_info.event_data.y = -1;
-                               s_info.event_data.slot = -1;
-                       }
-                       break;
-               /*
-               case SYN_DROPPED:
-                       DbgPrint("EV_SYN, SYN_DROPPED\n");
-                       break;
-               */
-               default:
-                       DbgPrint("EV_SYN, 0x%x\n", event->code);
-                       break;
-               }
-               break;
-       case EV_KEY:
-               DbgPrint("EV_KEY: 0x%X\n", event->value);
-               s_info.event_data.keycode = event->value;
-               break;
-       case EV_REL:
-               break;
-       case EV_ABS:
-               switch (event->code) {
-               case ABS_DISTANCE:
-                       s_info.event_data.distance = event->value;
-                       break;
-               case ABS_MT_TOOL_X:
-               case ABS_MT_TOOL_Y:
-                       break;
-               case ABS_MT_POSITION_X:
-                       s_info.event_data.x = event->value;
-                       break;
-               case ABS_MT_POSITION_Y:
-                       s_info.event_data.y = event->value;
-                       break;
-               case ABS_MT_SLOT:
-                       s_info.event_data.slot = event->value;
-                       break;
-               case ABS_MT_TRACKING_ID:
-                       s_info.event_data.device = event->value;
-                       break;
-               case ABS_MT_TOUCH_MAJOR:
-                       s_info.event_data.touch.major = event->value;
-                       break;
-               case ABS_MT_TOUCH_MINOR:
-                       s_info.event_data.touch.minor = event->value;
-                       break;
-               case ABS_MT_WIDTH_MAJOR:
-                       s_info.event_data.width.major = event->value;
-                       break;
-               case ABS_MT_WIDTH_MINOR:
-                       s_info.event_data.width.minor = event->value;
-                       break;
-               default:
-                       DbgPrint("EV_ABS, 0x%x\n", event->code);
-                       break;
-               }
-               break;
-       case EV_MSC:
-               break;
-       case EV_SW:
-               break;
-       case EV_LED:
-               break;
-       case EV_SND:
-               break;
-       case EV_REP:
-               break;
-       case EV_FF:
-               break;
-       case EV_PWR:
-               break;
-       case EV_FF_STATUS:
-               break;
+    int ret;
+
+    if (s_info.timestamp_updated == 0) {
+       update_timestamp(event);
+    }
+
+    switch (event->type) {
+    case EV_SYN:
+       switch (event->code) {
+       case SYN_CONFIG:
+           break;
+       case SYN_MT_REPORT:
+       case SYN_REPORT:
+           s_info.timestamp_updated = 0;
+           ret = push_event_item();
+           if (ret < 0) {
+               return ret;
+           }
+
+           break;
+#if defined(SYN_DROPPED)
+       case SYN_DROPPED:
+           DbgPrint("EV_SYN, SYN_DROPPED\n");
+           break;
+#endif
        default:
-               DbgPrint("0x%X, 0x%X\n", event->type, event->code);
-               break;
+           DbgPrint("EV_SYN, 0x%x\n", event->code);
+           break;
        }
-
-       return LB_STATUS_SUCCESS;
+       break;
+    case EV_KEY:
+       DbgPrint("EV_KEY: 0x%X\n", event->value);
+       s_info.event_data.keycode = event->value;
+       break;
+    case EV_REL:
+       DbgPrint("EV_REL: 0x%X\n", event->value);
+       break;
+    case EV_ABS:
+       processing_ev_abs(event);
+       break;
+    case EV_MSC:
+    case EV_SW:
+    case EV_LED:
+    case EV_SND:
+    case EV_REP:
+    case EV_FF:
+    case EV_PWR:
+    case EV_FF_STATUS:
+    default:
+       DbgPrint("0x%X, 0x%X\n", event->type, event->code);
+       break;
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static void *event_thread_main(void *data)
 {
-       fd_set set;
-       long ret = 0;
-       struct input_event input_event;
-       char *ptr = (char *)&input_event;
-       int offset = 0;
-       int readsize = 0;
-       int fd;
-
-       DbgPrint("Initiated\n");
-
-       while (1) {
-               FD_ZERO(&set);
-               FD_SET(s_info.handle, &set);
-               FD_SET(s_info.tcb_pipe[PIPE_READ], &set);
-
-               fd = s_info.handle > s_info.tcb_pipe[PIPE_READ] ? s_info.handle : s_info.tcb_pipe[PIPE_READ];
-               ret = select(fd + 1, &set, NULL, NULL, NULL);
-               if (ret < 0) {
-                       ret = -errno;
-                       if (errno == EINTR) {
-                               DbgPrint("Select receives INTR\n");
-                               continue;
-                       }
-                       ErrPrint("Error: %s\n", strerror(errno));
-                       break;
-               } else if (ret == 0) {
-                       ErrPrint("Timeout expired\n");
-                       ret = LB_STATUS_ERROR_TIMEOUT;
-                       break;
-               }
+    fd_set set;
+    long ret = 0;
+    struct input_event input_event;
+    char *ptr = (char *)&input_event;
+    int offset = 0;
+    int readsize = 0;
+    int fd;
+    char event_ch;
+
+    while (1) {
+       FD_ZERO(&set);
+       FD_SET(s_info.handle, &set);
+       FD_SET(s_info.tcb_pipe[PIPE_READ], &set);
+
+       fd = s_info.handle > s_info.tcb_pipe[PIPE_READ] ? s_info.handle : s_info.tcb_pipe[PIPE_READ];
+       ret = select(fd + 1, &set, NULL, NULL, NULL);
+       if (ret < 0) {
+           ret = -errno;
+           if (errno == EINTR) {
+               DbgPrint("Select receives INTR\n");
+               continue;
+           }
+           ErrPrint("Error: %s\n", strerror(errno));
+           break;
+       } else if (ret == 0) {
+           ErrPrint("Timeout expired\n");
+           ret = DBOX_STATUS_ERROR_TIMEOUT;
+           break;
+       }
 
-               if (FD_ISSET(s_info.handle, &set)) {
-                       readsize = read(s_info.handle, ptr + offset, sizeof(input_event) - offset);
-                       if (readsize < 0) {
-                               ErrPrint("Unable to read device: %s / fd: %d / offset: %d / size: %d - %d\n", strerror(errno), s_info.handle, offset, sizeof(input_event), readsize);
-                               ret = LB_STATUS_ERROR_FAULT;
-                               break;
-                       }
-
-                       offset += readsize;
-                       if (offset == sizeof(input_event)) {
-                               offset = 0;
-                               if (processing_input_event(&input_event) < 0) {
-                                       ret = LB_STATUS_ERROR_FAULT;
-                                       break;
-                               }
-                       }
+       if (FD_ISSET(s_info.handle, &set)) {
+           readsize = read(s_info.handle, ptr + offset, sizeof(input_event) - offset);
+           if (readsize < 0) {
+               ErrPrint("Unable to read device: %s / fd: %d / offset: %d / size: %d - %d\n", strerror(errno), s_info.handle, offset, sizeof(input_event), readsize);
+               ret = DBOX_STATUS_ERROR_FAULT;
+               break;
+           }
+
+           offset += readsize;
+           if (offset == sizeof(input_event)) {
+               offset = 0;
+               if (processing_input_event(&input_event) < 0) {
+                   ret = DBOX_STATUS_ERROR_FAULT;
+                   break;
                }
+           }
+
+           /*
+            * If there is input event,
+            * Try again to get the input event.
+            */
+       } else if (FD_ISSET(s_info.tcb_pipe[PIPE_READ], &set)) {
+           if (read(s_info.tcb_pipe[PIPE_READ], &event_ch, sizeof(event_ch)) != sizeof(event_ch)) {
+               ErrPrint("Unable to read TCB_PIPE: %s\n", strerror(errno));
+           }
+
+           ret = DBOX_STATUS_ERROR_CANCEL;
+           break;
+       }
+    }
 
-               if (FD_ISSET(s_info.tcb_pipe[PIPE_READ], &set)) {
-                       char event_ch;
+    event_ch = EVENT_EXIT;
+    if (write(s_info.evt_pipe[PIPE_WRITE], &event_ch, sizeof(event_ch)) != sizeof(event_ch)) {
+       ErrPrint("Unable to send an event: %s\n", strerror(errno));
+    }
 
-                       if (read(s_info.tcb_pipe[PIPE_READ], &event_ch, sizeof(event_ch)) != sizeof(event_ch)) {
-                               ErrPrint("Unable to read TCB_PIPE: %s\n", strerror(errno));
-                       }
+    return (void *)ret;
+}
 
-                       ret = LB_STATUS_ERROR_CANCEL;
-                       break;
-               }
+static int invoke_event_cb(struct event_listener *listener, struct event_data *item)
+{
+    struct event_data modified_item;
+
+    memcpy(&modified_item, item, sizeof(modified_item));
+
+    modified_item.x -= listener->x;
+    modified_item.y -= listener->y;
+
+    if (!DYNAMICBOX_CONF_USE_EVENT_TIME) {
+       item->tv = current_time_get();
+    }
+
+    if (listener->event_cb(listener->state, &modified_item, listener->cbdata) < 0) {
+       if (eina_list_data_find(s_info.event_listener_list, listener)) {
+           s_info.event_listener_list = eina_list_remove(s_info.event_listener_list, listener);
+           DbgFree(listener);
+           return 1;
        }
+    }
 
-       return (void *)ret;
+    return 0;
 }
 
 static inline void clear_all_listener_list(void)
 {
-       struct event_listener *listener;
-       enum event_state next_state;
-       Eina_List *l;
-       Eina_List *n;
-
-       s_info.event_handler = NULL;
-       CLOSE_PIPE(s_info.evt_pipe);
-
-       while (s_info.event_listener_list) {
-               EINA_LIST_FOREACH_SAFE(s_info.event_listener_list, l, n, listener) {
-                       switch (listener->state) {
-                       case EVENT_STATE_ACTIVATE:
-                               next_state = EVENT_STATE_ACTIVATED;
-                               break;
-                       case EVENT_STATE_ACTIVATED:
-                               next_state = EVENT_STATE_DEACTIVATE;
-                               break;
-                       case EVENT_STATE_DEACTIVATE:
-                               next_state = EVENT_STATE_DEACTIVATED;
-                               break;
-                       case EVENT_STATE_DEACTIVATED:
-                       default:
-                               s_info.event_listener_list = eina_list_remove(s_info.event_listener_list, listener);
-                               DbgFree(listener);
-                               continue;
-                       }
-
-                       if (listener->event_cb(listener->state, &s_info.event_data, listener->cbdata) < 0) {
-                               if (eina_list_data_find(s_info.event_listener_list, listener)) {
-                                       s_info.event_listener_list = eina_list_remove(s_info.event_listener_list, listener);
-                                       DbgFree(listener);
-                                       continue;
-                               }
-                       }
-
-                       listener->state = next_state;
+    struct event_listener *listener;
+    enum event_state next_state;
+    struct event_data event_data;
+    struct event_data *p_event_data;
+    Eina_List *l;
+    Eina_List *n;
+
+    DbgPrint("event listeners: %d\n", eina_list_count(s_info.event_listener_list));
+    while (s_info.event_listener_list) {
+       EINA_LIST_FOREACH_SAFE(s_info.event_listener_list, l, n, listener) {
+
+           DbgPrint("listener[%p] prev[%x] state[%x]\n", listener, listener->prev_state, listener->state);
+
+           switch (listener->state) {
+           case EVENT_STATE_ACTIVATE:
+               p_event_data = &s_info.event_data;
+               next_state = EVENT_STATE_ACTIVATED;
+               break;
+           case EVENT_STATE_ACTIVATED:
+               p_event_data = &s_info.event_data;
+               next_state = EVENT_STATE_DEACTIVATE;
+               break;
+           case EVENT_STATE_DEACTIVATE:
+               memcpy(&event_data, &s_info.event_data, sizeof(event_data));
+               p_event_data = &event_data;
+
+               if (listener->prev_state == EVENT_STATE_ACTIVATE) {
+                   /* There is no move event. we have to emulate it */
+                   DbgPrint ("Let's emulate move event (%dx%d)\n", p_event_data->x, p_event_data->y);
+                   listener->state = EVENT_STATE_ACTIVATED;
+                   next_state = EVENT_STATE_DEACTIVATE;
+               } else {
+                   next_state = EVENT_STATE_DEACTIVATED;
                }
+               break;
+           case EVENT_STATE_DEACTIVATED:
+           default:
+               s_info.event_listener_list = eina_list_remove(s_info.event_listener_list, listener);
+               DbgFree(listener);
+               continue;
+           }
+
+           if (invoke_event_cb(listener, p_event_data)) {
+               continue;
+           }
+
+           /*!
+            * Changing state of listener will affect to the event collecting thread.
+            */
+           listener->prev_state = listener->state;
+           listener->state = next_state;
        }
+    }
+}
+
+static int compare_timestamp(struct event_listener *listener, struct event_data *item)
+{
+    int ret;
+    if (listener->tv > item->tv) {
+       ret = 1;
+    } else if (listener->tv < item->tv) {
+       ret = -1;
+    } else {
+       ret = 0;
+    }
+    return ret;
 }
 
 static Eina_Bool event_read_cb(void *data, Ecore_Fd_Handler *handler)
 {
-       int fd;
-       struct event_data *item;
-       char event_ch;
-       struct event_listener *listener;
-       Eina_List *l;
-       Eina_List *n;
-       enum event_state next_state;
-       enum event_state cur_state;
-       struct event_data modified_item;
-
-       fd = ecore_main_fd_handler_fd_get(handler);
-       if (fd < 0) {
-               ErrPrint("Invalid fd\n");
-               return ECORE_CALLBACK_CANCEL;
-       }
+    int fd;
+    struct event_data *item;
+    char event_ch;
+    struct event_listener *listener;
+    Eina_List *l;
+    Eina_List *n;
+    enum event_state next_state;
+
+    fd = ecore_main_fd_handler_fd_get(handler);
+    if (fd < 0) {
+       ErrPrint("Invalid fd\n");
+       return ECORE_CALLBACK_CANCEL;
+    }
+
+    if (read(fd, &event_ch, sizeof(event_ch)) != sizeof(event_ch)) {
+       ErrPrint("Unable to read event ch: %s\n", strerror(errno));
+       return ECORE_CALLBACK_CANCEL;
+    }
+
+    if (event_ch == EVENT_EXIT) {
+       /*!
+        * If the master gets event exit from evt_pipe,
+        * The event item list should be empty.
+        */
+       if (!s_info.event_list) {
+           /* This callback must has to clear all listeners in this case */
+           ecore_main_fd_handler_del(s_info.event_handler);
+           s_info.event_handler = NULL;
+           clear_all_listener_list();
+
+           EINA_LIST_FREE(s_info.reactivate_list, listener) {
+               s_info.event_listener_list = eina_list_append(s_info.event_listener_list, listener);
+           }
+           DbgPrint("Reactivate: %p\n", s_info.event_listener_list);
+
+           if (s_info.event_listener_list) {
+               if (activate_thread() < 0) {
+                   EINA_LIST_FREE(s_info.event_listener_list, listener) {
+                       (void)listener->event_cb(EVENT_STATE_ERROR, NULL, listener->cbdata);
+                   }
+               }
+           }
 
-       if (read(fd, &event_ch, sizeof(event_ch)) != sizeof(event_ch)) {
-               ErrPrint("Unable to read event ch: %s\n", strerror(errno));
-               return ECORE_CALLBACK_CANCEL;
+           DbgPrint("Event read callback finshed (%p)\n", s_info.event_listener_list);
+           return ECORE_CALLBACK_CANCEL;
+       } else {
+           ErrPrint("Something goes wrong, the event_list is not flushed\n");
        }
+    }
 
-       CRITICAL_SECTION_BEGIN(&s_info.event_list_lock);
-       item = eina_list_nth(s_info.event_list, 0);
-       if (item) {
-               s_info.event_list = eina_list_remove(s_info.event_list, item);
-       }
-       CRITICAL_SECTION_END(&s_info.event_list_lock);
+    CRITICAL_SECTION_BEGIN(&s_info.event_list_lock);
+    item = eina_list_nth(s_info.event_list, 0);
+    if (item) {
+       s_info.event_list = eina_list_remove(s_info.event_list, item);
+    }
+    CRITICAL_SECTION_END(&s_info.event_list_lock);
 
-       if (item) {
-               EINA_LIST_FOREACH_SAFE(s_info.event_listener_list, l, n, listener) {
-                       switch (listener->state) {
-                       case EVENT_STATE_ACTIVATE:
-#if defined(_USE_ECORE_TIME_GET)
-                               if (listener->tv > item->tv) {
-                                       continue;
-                               }
-#else
-                               if (timercmp(&listener->tv, &item->tv, >)) {
-                                       /* Ignore previous events before activating this listener */
-                                       continue;
-                               }
-#endif
-
-                               next_state = EVENT_STATE_ACTIVATED;
-                               cur_state = listener->state;
-                               break;
-                       case EVENT_STATE_DEACTIVATE:
-#if defined(_USE_ECORE_TIME_GET)
-                               if (listener->tv > item->tv) {
-                                       /* Consuming all events occurred while activating this listener */
-                                       cur_state = EVENT_STATE_ACTIVATED;
-                                       next_state = EVENT_STATE_ACTIVATED;
-                                       break;
-                               }
-#else
-                               if (timercmp(&listener->tv, &item->tv, >)) {
-                                       /* Consuming all events occurred while activating this listener */
-                                       cur_state = EVENT_STATE_ACTIVATED;
-                                       next_state = EVENT_STATE_ACTIVATED;
-                                       break;
-                               }
-#endif
-
-                               cur_state = listener->state;
-                               next_state = EVENT_STATE_DEACTIVATED;
-                               break;
-                       case EVENT_STATE_ACTIVATED:
-                               cur_state = listener->state;
-                               next_state = listener->state;
-                               break;
-                       case EVENT_STATE_DEACTIVATED:
-                       default:
-                               /* Remove this from the list */
-                                       /* Check the item again. the listener can be deleted from the callback */
-                               if (eina_list_data_find(s_info.event_listener_list, listener)) {
-                                       s_info.event_listener_list = eina_list_remove(s_info.event_listener_list, listener);
-                                       DbgFree(listener);
-                               }
-
-                               continue;
-                       }
-
-                       memcpy(&modified_item, item, sizeof(modified_item));
-                       modified_item.x -= listener->x;
-                       modified_item.y -= listener->y;
-
-                       if (listener->event_cb(cur_state, &modified_item, listener->cbdata) < 0) {
-                               if (eina_list_data_find(s_info.event_listener_list, listener)) {
-                                       s_info.event_listener_list = eina_list_remove(s_info.event_listener_list, listener);
-                                       DbgFree(listener);
-                                       continue;
-                               }
-                       }
-
-                       listener->state = next_state;
+    if (!item) {
+       ErrPrint("There is no remained event\n");
+       return ECORE_CALLBACK_RENEW;
+    }
+
+    EINA_LIST_FOREACH_SAFE(s_info.event_listener_list, l, n, listener) {
+       switch (listener->state) {
+       case EVENT_STATE_ACTIVATE:
+           if (compare_timestamp(listener, item) > 0) {
+               continue;
+           }
+
+           next_state = EVENT_STATE_ACTIVATED;
+           break;
+       case EVENT_STATE_DEACTIVATE:
+           if (compare_timestamp(listener, item) < 0) {
+               /* Consuming all events occurred while activating this listener */
+               listener->prev_state = listener->state;
+               listener->state = EVENT_STATE_ACTIVATED;
+               if (invoke_event_cb(listener, item) == 1) {
+                   /* listener is deleted */
+                   continue;
                }
 
-               DbgFree(item);
-       }
+               listener->prev_state = listener->state;
+               listener->state = EVENT_STATE_DEACTIVATE;
+           }
+
+           /* Do not terminate this listener, until this mets EVENT_EXIT */
+           continue;
+       case EVENT_STATE_ACTIVATED:
+           if (compare_timestamp(listener, item) > 0) {
+               DbgPrint("Drop event\n");
+               continue;
+           }
+           next_state = listener->state;
+           break;
+       case EVENT_STATE_DEACTIVATED:
+       default:
+           /* Remove this from the list */
+           /* Check the item again. the listener can be deleted from the callback */
+           if (eina_list_data_find(s_info.event_listener_list, listener)) {
+               s_info.event_listener_list = eina_list_remove(s_info.event_listener_list, listener);
+               DbgFree(listener);
+           }
 
-       if (s_info.handle < 0 && !s_info.event_list) {
-               /* This callback must has to clear all listeners in this case */
-               clear_all_listener_list();
+           continue;
+       }
 
-               EINA_LIST_FREE(s_info.reactivate_list, listener) {
-                       s_info.event_listener_list = eina_list_append(s_info.event_listener_list, listener);
-               }
+       if (invoke_event_cb(listener, item) == 1) {
+           continue;
+       }
 
-               if (s_info.event_listener_list) {
-                       if (activate_thread() < 0) {
-                               EINA_LIST_FREE(s_info.event_listener_list, listener) {
-                                       (void)listener->event_cb(EVENT_STATE_ERROR, NULL, listener->cbdata);
-                               }
-                       }
-               }
+       listener->prev_state = listener->state;
+       listener->state = next_state;
+    }
 
-               return ECORE_CALLBACK_CANCEL;
-       }
+    DbgFree(item);
 
-       return ECORE_CALLBACK_RENEW;
+    return ECORE_CALLBACK_RENEW;
 }
 
-static int activate_thread(void)
+static int event_control_init(void)
 {
-       int status;
-
-       s_info.handle = open(INPUT_PATH, O_RDONLY);
-       if (s_info.handle < 0) {
-               ErrPrint("Unable to access the device: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_IO;
+    int status;
+
+    DbgPrint("Initializing event controller\n");
+    if (s_info.handle != -1) {
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    s_info.handle = open(DYNAMICBOX_CONF_INPUT_PATH, O_RDONLY);
+    if (s_info.handle < 0) {
+       ErrPrint("Unable to access the device: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
+
+    if (fcntl(s_info.handle, F_SETFD, FD_CLOEXEC) < 0) {
+       ErrPrint("Error: %s\n", strerror(errno));
+    }
+
+    if (fcntl(s_info.handle, F_SETFL, O_NONBLOCK) < 0) {
+       ErrPrint("Error: %s\n", strerror(errno));
+    }
+
+    status = pipe2(s_info.evt_pipe, O_CLOEXEC);
+    if (status < 0) {
+       ErrPrint("Unable to prepare evt pipe: %s\n", strerror(errno));
+       if (close(s_info.handle) < 0) {
+           ErrPrint("Failed to close handle: %s\n", strerror(errno));
        }
+       s_info.handle = -1;
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       if (fcntl(s_info.handle, F_SETFD, FD_CLOEXEC) < 0) {
-               ErrPrint("Error: %s\n", strerror(errno));
+    status = pipe2(s_info.tcb_pipe, O_CLOEXEC);
+    if (status < 0) {
+       ErrPrint("Unable to prepare tcb pipe: %s\n", strerror(errno));
+       if (close(s_info.handle) < 0) {
+           ErrPrint("Failed to close handle: %s\n", strerror(errno));
        }
+       s_info.handle = -1;
+       CLOSE_PIPE(s_info.evt_pipe);
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       if (fcntl(s_info.handle, F_SETFL, O_NONBLOCK) < 0) {
-               ErrPrint("Error: %s\n", strerror(errno));
-       }
+    return DBOX_STATUS_ERROR_NONE;
+}
 
-       status = pipe2(s_info.evt_pipe, O_CLOEXEC);
-       if (status < 0) {
-               ErrPrint("Unable to prepare evt pipe: %s\n", strerror(errno));
-               if (close(s_info.handle) < 0) {
-                       ErrPrint("Failed to close handle: %s\n", strerror(errno));
-               }
-               s_info.handle = -1;
-               return LB_STATUS_ERROR_FAULT;
+/*!
+ * This function must has to be called after event collecting thread is terminated
+ */
+static int event_control_fini(void)
+{
+    DbgPrint("Finalizing event controller\n");
+    if (s_info.handle != -1) {
+       if (close(s_info.handle) < 0) {
+           ErrPrint("Unable to release the fd: %s\n", strerror(errno));
        }
 
-       status = pipe2(s_info.tcb_pipe, O_CLOEXEC);
-       if (status < 0) {
-               ErrPrint("Unable to prepare tcb pipe: %s\n", strerror(errno));
-               if (close(s_info.handle) < 0) {
-                       ErrPrint("Failed to close handle: %s\n", strerror(errno));
-               }
-               s_info.handle = -1;
-               CLOSE_PIPE(s_info.evt_pipe);
-               return LB_STATUS_ERROR_FAULT;
+       s_info.handle = -1;
+    }
+
+    if (!eina_list_count(s_info.event_list)) {
+       if (s_info.event_handler) {
+           ecore_main_fd_handler_del(s_info.event_handler);
+           s_info.event_handler = NULL;
        }
+       clear_all_listener_list();
+    }
 
-       s_info.event_handler = ecore_main_fd_handler_add(s_info.evt_pipe[PIPE_READ], ECORE_FD_READ, event_read_cb, NULL, NULL, NULL);
-       if (!s_info.event_handler) {
-               if (close(s_info.handle) < 0) {
-                       ErrPrint("Failed to close handle: %s\n", strerror(errno));
-               }
-               s_info.handle = -1;
+    CLOSE_PIPE(s_info.tcb_pipe);
+    CLOSE_PIPE(s_info.evt_pipe);
 
-               CLOSE_PIPE(s_info.tcb_pipe);
-               CLOSE_PIPE(s_info.evt_pipe);
-               return LB_STATUS_ERROR_FAULT;
-       }
+    return DBOX_STATUS_ERROR_NONE;
+}
 
-       status = pthread_create(&s_info.tid, NULL, event_thread_main, NULL);
-       if (status != 0) {
-               ErrPrint("Failed to initiate the thread: %s\n", strerror(status));
-               ecore_main_fd_handler_del(s_info.event_handler);
-               s_info.event_handler = NULL;
+static int activate_thread(void)
+{
+    int ret;
 
-               if (close(s_info.handle) < 0) {
-                       ErrPrint("close: %s\n", strerror(errno));
-               }
-               s_info.handle = -1;
+    ret = event_control_init();
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       return ret;
+    }
+
+    if (s_info.event_handler_activated) {
+       ErrPrint("Event handler is already activated\n");
+       return DBOX_STATUS_ERROR_ALREADY;
+    }
+
+    if (s_info.event_handler) {
+       ErrPrint("Event handler is already registered\n");
+       return DBOX_STATUS_ERROR_ALREADY;
+    }
+
+    s_info.event_handler = ecore_main_fd_handler_add(s_info.evt_pipe[PIPE_READ], ECORE_FD_READ, event_read_cb, NULL, NULL, NULL);
+    if (!s_info.event_handler) {
+       ErrPrint("Failed to add monitor for EVT READ\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    ret = pthread_create(&s_info.tid, NULL, event_thread_main, NULL);
+    if (ret != 0) {
+       ErrPrint("Failed to initiate the thread: %s\n", strerror(ret));
+       ecore_main_fd_handler_del(s_info.event_handler);
+       s_info.event_handler = NULL;
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-               CLOSE_PIPE(s_info.tcb_pipe);
-               CLOSE_PIPE(s_info.evt_pipe);
-               return LB_STATUS_ERROR_FAULT;
-       }
+    DbgPrint("Event handler activated\n");
+    s_info.event_handler_activated = 1;
+    return DBOX_STATUS_ERROR_NONE;
+}
 
-       DbgPrint("Event handler activated\n");
-       return LB_STATUS_SUCCESS;
+static int deactivate_thread(void)
+{
+    int status;
+    void *ret;
+    char event_ch = EVENT_CH;
+
+    /* Terminating thread */
+    if (write(s_info.tcb_pipe[PIPE_WRITE], &event_ch, sizeof(event_ch)) != sizeof(event_ch)) {
+       ErrPrint("Unable to write tcb_pipe: %s\n", strerror(errno));
+    }
+
+    status = pthread_join(s_info.tid, &ret);
+    if (status != 0) {
+       ErrPrint("Failed to join a thread: %s\n", strerror(errno));
+    } else {
+       DbgPrint("Thread returns: %p\n", ret);
+    }
+
+    s_info.event_handler_activated = 0;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 /*!
@@ -553,124 +888,124 @@ static int activate_thread(void)
  */
 HAPI int event_activate(int x, int y, int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data)
 {
-       struct event_listener *listener;
-       int ret = LB_STATUS_SUCCESS;
-
-       listener = malloc(sizeof(*listener));
-       if (!listener) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    struct event_listener *listener;
+    int ret = DBOX_STATUS_ERROR_NONE;
+
+    listener = malloc(sizeof(*listener));
+    if (!listener) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    listener->tv = current_time_get() - DELAY_COMPENSATOR; // Let's use the previous event.
+    DbgPrint("Activated at: %lf (%dx%d)\n", listener->tv, x, y);
+
+    listener->event_cb = event_cb;
+    listener->cbdata = data;
+    listener->prev_state = EVENT_STATE_DEACTIVATED;
+    listener->state = EVENT_STATE_ACTIVATE;
+    listener->x = x;
+    listener->y = y;
+
+    if (!s_info.event_handler_activated) {
+       /*!
+        * \note
+        * We don't need to lock to access event_list here.
+        * If the _sinfo.handle is greater than 0, the event_list will not be touched.
+        * But if the s_info.handle is less than 0, it means, there is not thread,
+        * so we can access the event_list without lock.
+        */
+       if (s_info.event_list) {
+           DbgPrint("Event thread is deactivating now. activating will be delayed\n");
+           s_info.reactivate_list = eina_list_append(s_info.reactivate_list, listener);
+       } else {
+           s_info.event_listener_list = eina_list_append(s_info.event_listener_list, listener);
 
-#if defined(_USE_ECORE_TIME_GET)
-       listener->tv = ecore_time_get();
-#else
-       if (gettimeofday(&listener->tv, NULL) < 0) {
-               ErrPrint("gettimeofday: %s\n", strerror(errno));
+           if ((ret = activate_thread()) < 0) {
+               s_info.event_listener_list = eina_list_remove(s_info.event_listener_list, listener);
                DbgFree(listener);
-               return LB_STATUS_ERROR_FAULT;
+           }
        }
-#endif
+    } else {
+       s_info.event_listener_list = eina_list_append(s_info.event_listener_list, listener);
+    }
 
-       listener->event_cb = event_cb;
-       listener->cbdata = data;
-       listener->state = EVENT_STATE_ACTIVATE;
-       listener->x = x;
-       listener->y = y;
-
-       if (s_info.handle < 0) {
-               /*!
-                * \note
-                * We don't need to lock to access event_list here.
-                * If the _sinfo.handle is greater than 0, the event_list will not be touched.
-                * But if the s_info.handle is less than 0, it means, there is not thread,
-                * so we can access the event_list without lock.
-                */
-               if (s_info.event_list) {
-                       DbgPrint("Event thread is deactivating now. activating will be delayed\n");
-                       s_info.reactivate_list = eina_list_append(s_info.reactivate_list, listener);
-               } else {
-                       s_info.event_listener_list = eina_list_append(s_info.event_listener_list, listener);
-
-                       if ((ret = activate_thread()) < 0) {
-                               s_info.event_listener_list = eina_list_remove(s_info.event_listener_list, listener);
-                               DbgFree(listener);
-                       }
-               }
-       } else {
-               s_info.event_listener_list = eina_list_append(s_info.event_listener_list, listener);
-       }
-
-       return ret;
+    return ret;
 }
 
 HAPI int event_deactivate(int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data)
 {
-       int status;
-       void *ret;
-       char event_ch = EVENT_CH;
-       struct event_listener *listener = NULL;
-       Eina_List *l;
-       int keep_thread = 0;
-
-       EINA_LIST_FOREACH(s_info.event_listener_list, l, listener) {
-               if (listener->event_cb == event_cb && listener->cbdata == data) {
-                       listener->state = EVENT_STATE_DEACTIVATE;
-               }
-
-               keep_thread += (listener->state == EVENT_STATE_ACTIVATE || listener->state == EVENT_STATE_ACTIVATED);
+    struct event_listener *listener = NULL;
+    struct event_listener *item;
+    Eina_List *l;
+    int keep_thread = 0;
+
+    EINA_LIST_FOREACH(s_info.event_listener_list, l, item) {
+       if (item->event_cb == event_cb && item->cbdata == data) {
+           switch (item->state) {
+           case EVENT_STATE_ACTIVATE:
+           case EVENT_STATE_ACTIVATED:
+               item->prev_state = item->state;
+               item->state = EVENT_STATE_DEACTIVATE;
+               listener = item;
+               break;
+           default:
+               /* Item is already deactivated */
+               break;
+           }
        }
 
-       if (!listener) {
-               ErrPrint("Listener is not registered\n");
-               return LB_STATUS_ERROR_NOT_EXIST;
-       }
+       keep_thread += (item->state == EVENT_STATE_ACTIVATE || item->state == EVENT_STATE_ACTIVATED);
+    }
 
-       if (s_info.handle < 0) {
-               ErrPrint("Event handler is not actiavated\n");
-               DbgFree(listener);
-               return LB_STATUS_SUCCESS;
-       }
-
-       if (keep_thread) {
-               return LB_STATUS_SUCCESS;
-       }
+    if (!listener) {
+       ErrPrint("Listener is not registered or already deactivated\n");
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
 
-       /* Terminating thread */
-       if (write(s_info.tcb_pipe[PIPE_WRITE], &event_ch, sizeof(event_ch)) != sizeof(event_ch)) {
-               ErrPrint("Unable to write tcb_pipe: %s\n", strerror(errno));
-       }
+    if (s_info.event_handler_activated == 0) {
+       ErrPrint("Event handler is not actiavated\n");
+       s_info.event_listener_list = eina_list_remove(s_info.event_listener_list, listener);
+       DbgFree(listener);
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
-       status = pthread_join(s_info.tid, &ret);
-       if (status != 0) {
-               ErrPrint("Failed to join a thread: %s\n", strerror(errno));
-       } else {
-               DbgPrint("Thread returns: %p\n", ret);
-       }
+    if (keep_thread) {
+       DbgPrint("Keep thread\n");
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
-       if (close(s_info.handle) < 0) {
-               ErrPrint("Unable to release the fd: %s\n", strerror(errno));
-       }
+    deactivate_thread();
 
-       s_info.handle = -1;
-       DbgPrint("Event handler deactivated\n");
+    return DBOX_STATUS_ERROR_NONE;
+}
 
-       CLOSE_PIPE(s_info.tcb_pipe);
+HAPI int event_reset_cbdata(int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data, void *new_data)
+{
+    struct event_listener *item;
+    Eina_List *l;
+    int updated = 0;
+
+    EINA_LIST_FOREACH(s_info.event_listener_list, l, item) {
+       if (item->event_cb == event_cb && item->cbdata == data) {
+           item->cbdata = new_data;
+           updated++;
+       }
+    }
 
-       if (!eina_list_count(s_info.event_list)) {
-               ecore_main_fd_handler_del(s_info.event_handler);
-               clear_all_listener_list();
+    EINA_LIST_FOREACH(s_info.reactivate_list, l, item) {
+       if (item->event_cb == event_cb && item->cbdata == data) {
+           item->cbdata = new_data;
+           updated++;
        }
+    }
 
-       s_info.event_data.x = -1;
-       s_info.event_data.y = -1;
-       s_info.event_data.slot = -1;
-       return LB_STATUS_SUCCESS;
+    return updated;
 }
 
 HAPI int event_is_activated(void)
 {
-       return s_info.handle >= 0;
+    return s_info.handle >= 0;
 }
 
 /* End of a file */
index 1ec4398..1ea694a 100644 (file)
 #include <Eina.h>
 #include <packet.h>
 #include <dlog.h>
-#include <livebox-errno.h>
-#include <livebox-service.h>
+#include <dynamicbox_errno.h>
+#include <dynamicbox_service.h>
+#include <dynamicbox_conf.h>
+#include <dynamicbox_cmd_list.h>
 
 #include "util.h"
 #include "debug.h"
 #include "critical_log.h"
 
 static struct info {
-       Eina_List *call_list;
-       int fault_mark_count;
+    Eina_List *call_list;
+    int fault_mark_count;
 } s_info = {
-       .call_list = NULL,
-       .fault_mark_count = 0,
+    .call_list = NULL,
+    .fault_mark_count = 0,
 };
 
 struct fault_info {
-       struct slave_node *slave;
-       double timestamp;
-       char *pkgname;
-       char *filename;
-       char *func;
+    struct slave_node *slave;
+    double timestamp;
+    char *pkgname;
+    char *filename;
+    char *func;
 };
 
 HAPI int const fault_is_occured(void)
 {
-       return s_info.fault_mark_count;
+    return s_info.fault_mark_count;
 }
 
 static void clear_log_file(struct slave_node *slave)
 {
-       char filename[BUFSIZ];
-       int ret;
-
-       ret = snprintf(filename, sizeof(filename) - 1, "%s/slave.%d", SLAVE_LOG_PATH, slave_pid(slave));
-       if (ret == sizeof(filename) - 1) {
-               filename[sizeof(filename) - 1] = '\0';
-               ErrPrint("filename buffer is overflowed\n");
-       }
-
-       if (unlink(filename) < 0) {
-               ErrPrint("unlink: %s\n", strerror(errno));
-       }
+    char filename[BUFSIZ];
+    int ret;
+
+    ret = snprintf(filename, sizeof(filename) - 1, "%s/slave.%d", DYNAMICBOX_CONF_LOG_PATH, slave_pid(slave));
+    if (ret == sizeof(filename) - 1) {
+       filename[sizeof(filename) - 1] = '\0';
+       ErrPrint("filename buffer is overflowed\n");
+    }
+
+    if (unlink(filename) < 0) {
+       ErrPrint("unlink: %s\n", strerror(errno));
+    }
 }
 
 static char *check_log_file(struct slave_node *slave)
 {
-       char libexec[BUFSIZ];
-       char *ptr;
-       FILE *fp;
-       char filename[BUFSIZ];
-
-       snprintf(filename, sizeof(filename), "%s/slave.%d", SLAVE_LOG_PATH, slave_pid(slave));
-       fp = fopen(filename, "rt");
-       if (!fp) {
-               ErrPrint("No log file found [%s]\n", strerror(errno));
-               return NULL;
-       }
-
-       ptr = fgets(libexec, sizeof(libexec), fp);
-       if (fclose(fp) != 0) {
-               ErrPrint("fclose: %s\n", strerror(errno));
-       }
-
-       if (ptr != libexec) {
-               ErrPrint("Invalid log\n");
-               return NULL;
-       }
-
-       if (unlink(filename) < 0) {
-               ErrPrint("Failed to unlink %s\n", filename);
-       }
-
-       ptr = livebox_service_pkgname_by_libexec(libexec);
-       if (!ptr) {
-               ErrPrint("Failed to find the faulted package\n");
-       }
-
-       DbgPrint("Faulted package: %s\n", ptr);
-       return ptr;
+    char libexec[BUFSIZ];
+    char *ptr;
+    FILE *fp;
+    char filename[BUFSIZ];
+
+    snprintf(filename, sizeof(filename), "%s/slave.%d", DYNAMICBOX_CONF_LOG_PATH, slave_pid(slave));
+    fp = fopen(filename, "rt");
+    if (!fp) {
+       ErrPrint("No log file found [%s]\n", strerror(errno));
+       return NULL;
+    }
+
+    ptr = fgets(libexec, sizeof(libexec), fp);
+    if (fclose(fp) != 0) {
+       ErrPrint("fclose: %s\n", strerror(errno));
+    }
+
+    if (ptr != libexec) {
+       ErrPrint("Invalid log\n");
+       return NULL;
+    }
+
+    if (unlink(filename) < 0) {
+       ErrPrint("Failed to unlink %s\n", filename);
+    }
+
+    ptr = dynamicbox_service_dbox_id_by_libexec(libexec);
+    if (!ptr) {
+       ErrPrint("Failed to find the faulted package\n");
+    }
+
+    DbgPrint("Faulted package: %s\n", ptr);
+    return ptr;
 }
 
 HAPI void fault_unicast_info(struct client_node *client, const char *pkgname, const char *filename, const char *func)
 {
-       struct packet *packet;
+    struct packet *packet;
+    unsigned int cmd = CMD_FAULT_PACKAGE;
 
-       if (!client || !pkgname || !filename || !func) {
-               return;
-       }
+    if (!client || !pkgname || !filename || !func) {
+       return;
+    }
 
-       packet = packet_create_noack("fault_package", "sss", pkgname, filename, func);
-       if (!packet) {
-               return;
-       }
+    packet = packet_create_noack((const char *)&cmd, "sss", pkgname, filename, func);
+    if (!packet) {
+       return;
+    }
 
-       client_rpc_async_request(client, packet);
+    client_rpc_async_request(client, packet);
 }
 
 HAPI void fault_broadcast_info(const char *pkgname, const char *filename, const char *func)
 {
-       struct packet *packet;
+    struct packet *packet;
+    unsigned int cmd = CMD_FAULT_PACKAGE;
 
-       packet = packet_create_noack("fault_package", "sss", pkgname, filename, func);
-       if (!packet) {
-               ErrPrint("Failed to create a param\n");
-               return;
-       }
+    packet = packet_create_noack((const char *)&cmd, "sss", pkgname, filename, func);
+    if (!packet) {
+       ErrPrint("Failed to create a param\n");
+       return;
+    }
 
-       client_broadcast(NULL, packet);
+    client_broadcast(NULL, packet);
 }
 
 static inline void dump_fault_info(const char *name, pid_t pid, const char *pkgname, const char *filename, const char *funcname)
 {
-       CRITICAL_LOG("Slavename: %s[%d]\n"      \
-                       "Package: %s\n"         \
-                       "Filename: %s\n"        \
-                       "Funcname: %s\n", name, pid, pkgname, filename, funcname);
+    CRITICAL_LOG("Slavename: %s[%d]\n" \
+           "Package: %s\n"             \
+           "Filename: %s\n"    \
+           "Funcname: %s\n", name, pid, pkgname, filename, funcname);
 }
 
 HAPI int fault_info_set(struct slave_node *slave, const char *pkgname, const char *id, const char *func)
 {
-       struct pkg_info *pkg;
-       int ret;
-
-       pkg = package_find(pkgname);
-       if (!pkg) {
-               return LB_STATUS_ERROR_NOT_EXIST;
-       }
-
-       ret = package_set_fault_info(pkg, util_timestamp(), id, func);
-       if (ret < 0) {
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       dump_fault_info(slave_name(slave), slave_pid(slave), pkgname, id, func);
-       ErrPrint("Set fault %s(%d)\n", !ret ? "Success" : "Failed", ret);
-       fault_broadcast_info(pkgname, id, func);
-
-       /*!
-        * \note
-        * Update statistics
-        */
-       s_info.fault_mark_count++;
-       return LB_STATUS_SUCCESS;
+    struct pkg_info *pkg;
+    int ret;
+
+    pkg = package_find(pkgname);
+    if (!pkg) {
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
+
+    ret = package_set_fault_info(pkg, util_timestamp(), id, func);
+    if (ret < 0) {
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    dump_fault_info(slave_name(slave), slave_pid(slave), pkgname, id, func);
+    ErrPrint("Set fault %s(%d)\n", !ret ? "Success" : "Failed", ret);
+    fault_broadcast_info(pkgname, id, func);
+
+    /*!
+     * \note
+     * Update statistics
+     */
+    s_info.fault_mark_count++;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int fault_check_pkgs(struct slave_node *slave)
 {
-       struct fault_info *info;
-       struct pkg_info *pkg;
-       const char *pkgname;
-       Eina_List *l;
-       Eina_List *n;
-       int checked;
-
-       /*!
-        * \note
-        * First step.
-        * Check the log file
-        */
-       pkgname = (const char *)check_log_file(slave);
-       if (pkgname) {
-               pkg = package_find(pkgname);
-               if (pkg) {
-                       (void)package_set_fault_info(pkg, util_timestamp(), NULL, NULL);
-                       dump_fault_info(slave_name(slave), slave_pid(slave), pkgname, "", "");
-                       fault_broadcast_info(pkgname, "", "");
-                       DbgFree((char *)pkgname);
-
-                       s_info.fault_mark_count = 0;
-                       clear_log_file(slave);
-                       EINA_LIST_REVERSE_FOREACH_SAFE(s_info.call_list, l, n, info) {
-                               if (info->slave != slave) {
-                                       continue;
-                               }
-
-                               s_info.call_list = eina_list_remove_list(s_info.call_list, l);
-
-                               DbgFree(info->pkgname);
-                               DbgFree(info->filename);
-                               DbgFree(info->func);
-                               DbgFree(info);
-                       }
-                       return 0;
-               }
-               DbgFree((char *)pkgname);
-       }
-
-       /*!
-        * \note
-        * Second step.
-        * Is it secured slave?
-        */
-       pkgname = package_find_by_secured_slave(slave);
-       if (pkgname) {
-               pkg = package_find(pkgname);
-               if (pkg) {
-                       (void)package_set_fault_info(pkg, util_timestamp(), NULL, NULL);
-                       dump_fault_info(slave_name(slave), slave_pid(slave), pkgname, "", "");
-                       fault_broadcast_info(pkgname, "", "");
-
-                       s_info.fault_mark_count = 0;
-                       clear_log_file(slave);
-                       EINA_LIST_REVERSE_FOREACH_SAFE(s_info.call_list, l, n, info) {
-                               if (info->slave != slave) {
-                                       continue;
-                               }
-
-                               s_info.call_list = eina_list_remove_list(s_info.call_list, l);
-
-                               DbgFree(info->pkgname);
-                               DbgFree(info->filename);
-                               DbgFree(info->func);
-                               DbgFree(info);
-                       }
-                       return 0;
-               }
-       }
-
-       /*!
-        * \note
-        * At last, check the pair of function call and return mark
-        */
-       checked = 0;
-       EINA_LIST_REVERSE_FOREACH_SAFE(s_info.call_list, l, n, info) {
-               if (info->slave == slave) {
-                       const char *filename;
-                       const char *func;
-
-                       pkg = package_find(info->pkgname);
-                       if (!pkg) {
-                               ErrPrint("Failed to find a package %s\n", info->pkgname);
-                               continue;
-                       }
-
-                       filename = info->filename ? info->filename : "";
-                       func = info->func ? info->func : "";
-
-                       if (!checked) {
-                               (void)package_set_fault_info(pkg, info->timestamp, info->filename, info->func);
-                               fault_broadcast_info(info->pkgname, info->filename, info->func);
-                       } else {
-                               DbgPrint("Treated as a false log\n");
-                               dump_fault_info(
-                                       slave_name(info->slave), slave_pid(info->slave), info->pkgname, filename, func);
-                       }
-
-                       s_info.call_list = eina_list_remove_list(s_info.call_list, l);
-
-                       DbgFree(info->pkgname);
-                       DbgFree(info->filename);
-                       DbgFree(info->func);
-                       DbgFree(info);
-                       checked = 1;
+    struct fault_info *info;
+    struct pkg_info *pkg;
+    const char *pkgname;
+    Eina_List *l;
+    Eina_List *n;
+    int checked;
+
+    /*!
+     * \note
+     * First step.
+     * Check the log file
+     */
+    pkgname = (const char *)check_log_file(slave);
+    if (pkgname) {
+       pkg = package_find(pkgname);
+       if (pkg) {
+           (void)package_set_fault_info(pkg, util_timestamp(), NULL, NULL);
+           dump_fault_info(slave_name(slave), slave_pid(slave), pkgname, "", "");
+           fault_broadcast_info(pkgname, "", "");
+           DbgFree((char *)pkgname);
+
+           s_info.fault_mark_count = 0;
+           clear_log_file(slave);
+           EINA_LIST_REVERSE_FOREACH_SAFE(s_info.call_list, l, n, info) {
+               if (info->slave != slave) {
+                   continue;
                }
-       }
 
-       s_info.fault_mark_count = 0;
-       clear_log_file(slave);
-       return 0;
-}
-
-HAPI int fault_func_call(struct slave_node *slave, const char *pkgname, const char *filename, const char *func)
-{
-       struct fault_info *info;
-
-       info = malloc(sizeof(*info));
-       if (!info) {
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       info->slave = slave;
-
-       info->pkgname = strdup(pkgname);
-       if (!info->pkgname) {
-               DbgFree(info);
-               return LB_STATUS_ERROR_MEMORY;
-       }
+               s_info.call_list = eina_list_remove_list(s_info.call_list, l);
 
-       info->filename = strdup(filename);
-       if (!info->filename) {
                DbgFree(info->pkgname);
+               DbgFree(info->filename);
+               DbgFree(info->func);
                DbgFree(info);
-               return LB_STATUS_ERROR_MEMORY;
+           }
+           return 0;
        }
+       DbgFree((char *)pkgname);
+    }
+
+    /*!
+     * \note
+     * Second step.
+     * Is it secured slave?
+     */
+    pkgname = package_find_by_secured_slave(slave);
+    if (pkgname) {
+       pkg = package_find(pkgname);
+       if (pkg) {
+           (void)package_set_fault_info(pkg, util_timestamp(), NULL, NULL);
+           dump_fault_info(slave_name(slave), slave_pid(slave), pkgname, "", "");
+           fault_broadcast_info(pkgname, "", "");
+
+           s_info.fault_mark_count = 0;
+           clear_log_file(slave);
+           EINA_LIST_REVERSE_FOREACH_SAFE(s_info.call_list, l, n, info) {
+               if (info->slave != slave) {
+                   continue;
+               }
+
+               s_info.call_list = eina_list_remove_list(s_info.call_list, l);
 
-       info->func = strdup(func);
-       if (!info->func) {
-               DbgFree(info->filename);
                DbgFree(info->pkgname);
+               DbgFree(info->filename);
+               DbgFree(info->func);
                DbgFree(info);
-               return LB_STATUS_ERROR_MEMORY;
+           }
+           return 0;
        }
+    }
+
+    /*!
+     * \note
+     * At last, check the pair of function call and return mark
+     */
+    checked = 0;
+    EINA_LIST_REVERSE_FOREACH_SAFE(s_info.call_list, l, n, info) {
+       if (info->slave == slave) {
+           const char *filename;
+           const char *func;
+
+           pkg = package_find(info->pkgname);
+           if (!pkg) {
+               ErrPrint("Failed to find a package %s\n", info->pkgname);
+               continue;
+           }
+
+           filename = info->filename ? info->filename : "";
+           func = info->func ? info->func : "";
+
+           if (!checked) {
+               (void)package_set_fault_info(pkg, info->timestamp, info->filename, info->func);
+               fault_broadcast_info(info->pkgname, info->filename, info->func);
+           } else {
+               DbgPrint("Treated as a false log\n");
+               dump_fault_info(
+                       slave_name(info->slave), slave_pid(info->slave), info->pkgname, filename, func);
+           }
+
+           s_info.call_list = eina_list_remove_list(s_info.call_list, l);
+
+           DbgFree(info->pkgname);
+           DbgFree(info->filename);
+           DbgFree(info->func);
+           DbgFree(info);
+           checked = 1;
+       }
+    }
 
-       info->timestamp = util_timestamp();
-
-       s_info.call_list = eina_list_append(s_info.call_list, info);
+    s_info.fault_mark_count = 0;
+    clear_log_file(slave);
+    return 0;
+}
 
-       s_info.fault_mark_count++;
-       return LB_STATUS_SUCCESS;
+HAPI int fault_func_call(struct slave_node *slave, const char *pkgname, const char *filename, const char *func)
+{
+    struct fault_info *info;
+
+    info = malloc(sizeof(*info));
+    if (!info) {
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    info->slave = slave;
+
+    info->pkgname = strdup(pkgname);
+    if (!info->pkgname) {
+       DbgFree(info);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    info->filename = strdup(filename);
+    if (!info->filename) {
+       DbgFree(info->pkgname);
+       DbgFree(info);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    info->func = strdup(func);
+    if (!info->func) {
+       DbgFree(info->filename);
+       DbgFree(info->pkgname);
+       DbgFree(info);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    info->timestamp = util_timestamp();
+
+    s_info.call_list = eina_list_append(s_info.call_list, info);
+
+    s_info.fault_mark_count++;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int fault_func_ret(struct slave_node *slave, const char *pkgname, const char *filename, const char *func)
 {
-       struct fault_info *info;
-       Eina_List *l;
+    struct fault_info *info;
+    Eina_List *l;
 
-       EINA_LIST_FOREACH(s_info.call_list, l, info) {
-               if (info->slave != slave) {
-                       continue;
-               }
+    EINA_LIST_FOREACH(s_info.call_list, l, info) {
+       if (info->slave != slave) {
+           continue;
+       }
 
-               if (strcmp(info->pkgname, pkgname)) {
-                       continue;
-               }
+       if (strcmp(info->pkgname, pkgname)) {
+           continue;
+       }
 
-               if (strcmp(info->filename, filename)) {
-                       continue;
-               }
+       if (strcmp(info->filename, filename)) {
+           continue;
+       }
 
-               if (strcmp(info->func, func)) {
-                       continue;
-               }
+       if (strcmp(info->func, func)) {
+           continue;
+       }
 
-               s_info.call_list = eina_list_remove_list(s_info.call_list, l);
-               DbgFree(info->filename);
-               DbgFree(info->pkgname);
-               DbgFree(info->func);
-               DbgFree(info);
+       s_info.call_list = eina_list_remove_list(s_info.call_list, l);
+       DbgFree(info->filename);
+       DbgFree(info->pkgname);
+       DbgFree(info->func);
+       DbgFree(info);
 
-               s_info.fault_mark_count--;
-               return 0;
-       
+       s_info.fault_mark_count--;
+       return 0;
+    } 
 
-       return LB_STATUS_ERROR_NOT_EXIST;
+    return DBOX_STATUS_ERROR_NOT_EXIST;
 }
 
 /* End of a file */
index f473ade..8c53a02 100644 (file)
@@ -27,7 +27,7 @@
 
 #include <dlog.h>
 
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
 #include <packet.h>
 #include <com-core.h>
 
 #define PKT_CHUNKSZ    4096
 
 static struct info {
-       struct service_context *svc_ctx;
+    struct service_context *svc_ctx;
 
-       pthread_t push_thid;
+    pthread_t push_thid;
 
-       Eina_List *request_list;
-       pthread_mutex_t request_list_lock;
+    Eina_List *request_list;
+    pthread_mutex_t request_list_lock;
 
-       int request_pipe[PIPE_MAX];
+    int request_pipe[PIPE_MAX];
 } s_info = {
-       .svc_ctx = NULL,
-       .request_list = NULL,
-       .request_list_lock = PTHREAD_MUTEX_INITIALIZER,
-       .request_pipe = { 0, },
+    .svc_ctx = NULL,
+    .request_list = NULL,
+    .request_list_lock = PTHREAD_MUTEX_INITIALIZER,
+    .request_pipe = { 0, },
 };
 
 struct request_item {
-       enum {
-               REQUEST_TYPE_FILE = 0x00,
-               REQUEST_TYPE_SHM = 0x01,
-               REQUEST_TYPE_PIXMAP = 0x02,
-               REQUEST_TYPE_MAX = 0x02,
-       } type;
-       union {
-               char *filename;
-               int shm;
-               unsigned int pixmap;
-       } data;
-       struct tcb *tcb;
+    enum {
+       REQUEST_TYPE_FILE = 0x00,
+       REQUEST_TYPE_SHM = 0x01,
+       REQUEST_TYPE_PIXMAP = 0x02,
+       REQUEST_TYPE_MAX = 0x02,
+    } type;
+    union {
+       char *filename;
+       int shm;
+       unsigned int pixmap;
+    } data;
+    struct tcb *tcb;
 };
 
 typedef int (*send_data_func_t)(int fd, const struct request_item *item);
@@ -83,637 +83,637 @@ typedef int (*send_data_func_t)(int fd, const struct request_item *item);
  * This must should be shared with client.
  */
 struct burst_head {
-       off_t size;
-       int flen;
-       char fname[];
+    off_t size;
+    int flen;
+    char fname[];
 };
 
 struct burst_data {
-       int size;
-       char data[];
+    int size;
+    char data[];
 };
 
 static inline struct request_item *create_request_item(struct tcb *tcb, int type, void *data)
 {
-       struct request_item *item;
+    struct request_item *item;
 
-       item = malloc(sizeof(*item));
-       if (!item) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return NULL;
-       }
+    item = malloc(sizeof(*item));
+    if (!item) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
 
-       switch (type) {
+    switch (type) {
        case REQUEST_TYPE_FILE:
-               item->data.filename = strdup(data);
-               if (!item->data.filename) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       DbgFree(item);
-                       return NULL;
-               }
-               break;
+           item->data.filename = strdup(data);
+           if (!item->data.filename) {
+               ErrPrint("Heap: %s\n", strerror(errno));
+               DbgFree(item);
+               return NULL;
+           }
+           break;
        case REQUEST_TYPE_PIXMAP:
-               item->data.pixmap = (unsigned int)data;
-               break;
+           item->data.pixmap = (unsigned int)data;
+           break;
        case REQUEST_TYPE_SHM:
-               item->data.shm = (int)data;
-               break;
+           item->data.shm = (int)data;
+           break;
        default:
-               ErrPrint("Invalid type of request\n");
-               DbgFree(item);
-               return NULL;
-       }
-
-       item->type = type;
-       item->tcb = tcb;
-       return item;
+           ErrPrint("Invalid type of request\n");
+           DbgFree(item);
+           return NULL;
+    }
+
+    item->type = type;
+    item->tcb = tcb;
+    return item;
 }
 
 static inline int destroy_request_item(struct request_item *item)
 {
-       switch (item->type) {
+    switch (item->type) {
        case REQUEST_TYPE_FILE:
-               DbgFree(item->data.filename);
-               break;
+           DbgFree(item->data.filename);
+           break;
        case REQUEST_TYPE_SHM:
        case REQUEST_TYPE_PIXMAP:
-               break;
+           break;
        default:
-               return LB_STATUS_ERROR_INVALID;
-       }
+           return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       DbgFree(item);
-       return LB_STATUS_SUCCESS;
+    DbgFree(item);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static int request_file_handler(struct tcb *tcb, struct packet *packet, struct request_item **item)
 {
-       const char *filename;
+    const char *filename;
 
-       if (packet_get(packet, "s", &filename) != 1) {
-               ErrPrint("Invalid packet\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (packet_get(packet, "s", &filename) != 1) {
+       ErrPrint("Invalid packet\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       *item = create_request_item(tcb, REQUEST_TYPE_FILE, (void *)filename);
-       return *item ? LB_STATUS_SUCCESS : LB_STATUS_ERROR_MEMORY;
+    *item = create_request_item(tcb, REQUEST_TYPE_FILE, (void *)filename);
+    return *item ? DBOX_STATUS_ERROR_NONE : DBOX_STATUS_ERROR_OUT_OF_MEMORY;
 }
 
 static int request_pixmap_handler(struct tcb *tcb, struct packet *packet, struct request_item **item)
 {
-       unsigned int pixmap;
-
-       if (packet_get(packet, "i", &pixmap) != 1) {
-               ErrPrint("Invalid packet\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       if (pixmap == 0) {
-               ErrPrint("pixmap is not valid\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       /*!
-        * \TODO
-        * Attach to pixmap and copy its data to the client
-        */
-       *item = create_request_item(tcb, REQUEST_TYPE_PIXMAP, (void *)pixmap);
-       return *item ? LB_STATUS_SUCCESS : LB_STATUS_ERROR_MEMORY;
+    unsigned int pixmap;
+
+    if (packet_get(packet, "i", &pixmap) != 1) {
+       ErrPrint("Invalid packet\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    if (pixmap == 0) {
+       ErrPrint("pixmap is not valid\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    /*!
+     * \TODO
+     * Attach to pixmap and copy its data to the client
+     */
+    *item = create_request_item(tcb, REQUEST_TYPE_PIXMAP, (void *)pixmap);
+    return *item ? DBOX_STATUS_ERROR_NONE : DBOX_STATUS_ERROR_OUT_OF_MEMORY;
 }
 
 static int request_shm_handler(struct tcb *tcb, struct packet *packet, struct request_item **item)
 {
-       int shm;
-
-       if (packet_get(packet, "i", &shm) != 1) {
-               ErrPrint("Invalid packet\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       if (shm < 0) {
-               ErrPrint("shm is not valid: %d\n", shm);
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       /*!
-        * \TODO
-        * Attach to SHM and copy its buffer to the client
-        */
-       *item = create_request_item(tcb, REQUEST_TYPE_SHM, (void *)shm);
-       return *item ? LB_STATUS_SUCCESS : LB_STATUS_ERROR_MEMORY;
+    int shm;
+
+    if (packet_get(packet, "i", &shm) != 1) {
+       ErrPrint("Invalid packet\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    if (shm < 0) {
+       ErrPrint("shm is not valid: %d\n", shm);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    /*!
+     * \TODO
+     * Attach to SHM and copy its buffer to the client
+     */
+    *item = create_request_item(tcb, REQUEST_TYPE_SHM, (void *)shm);
+    return *item ? DBOX_STATUS_ERROR_NONE : DBOX_STATUS_ERROR_OUT_OF_MEMORY;
 }
 
 /* SERVER THREAD */
 static int service_thread_main(struct tcb *tcb, struct packet *packet, void *data)
 {
+    const char *cmd;
+    char ch = PUSH_ITEM;
+    int ret;
+    int i;
+    struct request_item *item;
+    struct packet *reply;
+    struct {
        const char *cmd;
-       char ch = PUSH_ITEM;
-       int ret;
-       int i;
-       struct request_item *item;
-       struct packet *reply;
-       struct {
-               const char *cmd;
-               int (*request_handler)(struct tcb *tcb, struct packet *packet, struct request_item **item);
-       } cmd_table[] = {
-               {
-                       .cmd = "request,file",
-                       .request_handler = request_file_handler,
-               },
-               {
-                       .cmd = "request,pixmap",
-                       .request_handler = request_pixmap_handler,
-               },
-               {
-                       .cmd = "request,shm",
-                       .request_handler = request_shm_handler,
-               },
-               {
-                       .cmd = NULL,
-                       .request_handler = NULL,
-               },
-       };
-
-       if (!packet) {
-               DbgPrint("TCB %p is disconnected\n", tcb);
-               return LB_STATUS_SUCCESS;
-       }
+       int (*request_handler)(struct tcb *tcb, struct packet *packet, struct request_item **item);
+    } cmd_table[] = {
+       {
+           .cmd = "request,file",
+           .request_handler = request_file_handler,
+       },
+       {
+           .cmd = "request,pixmap",
+           .request_handler = request_pixmap_handler,
+       },
+       {
+           .cmd = "request,shm",
+           .request_handler = request_shm_handler,
+       },
+       {
+           .cmd = NULL,
+           .request_handler = NULL,
+       },
+    };
+
+    if (!packet) {
+       DbgPrint("TCB %p is disconnected\n", tcb);
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    cmd = packet_command(packet);
+    if (!cmd) {
+       ErrPrint("Invalid packet. cmd is not valid\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    switch (packet_type(packet)) {
+       case PACKET_REQ:
+           for (i = 0; cmd_table[i].cmd; i++) {
+               /*!
+                * Protocol sequence
+                * FILE REQUEST COMMAND (Client -> Server)
+                * REPLY FOR REQUEST (Client <- Server)
+                * PUSH FILE (Client <- Server)
+                *
+                * Client & Server must has to keep this communication sequence.
+                */
+               if (strcmp(cmd, cmd_table[i].cmd)) {
+                   continue;
+               }
 
-       cmd = packet_command(packet);
-       if (!cmd) {
-               ErrPrint("Invalid packet. cmd is not valid\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+               item = NULL;
+               ret = cmd_table[i].request_handler(tcb, packet, &item);
 
-       switch (packet_type(packet)) {
-       case PACKET_REQ:
-               for (i = 0; cmd_table[i].cmd; i++) {
-                       /*!
-                        * Protocol sequence
-                        * FILE REQUEST COMMAND (Client -> Server)
-                        * REPLY FOR REQUEST (Client <- Server)
-                        * PUSH FILE (Client <- Server)
-                        *
-                        * Client & Server must has to keep this communication sequence.
-                        */
-                       if (strcmp(cmd, cmd_table[i].cmd)) {
-                               continue;
-                       }
-
-                       item = NULL;
-                       ret = cmd_table[i].request_handler(tcb, packet, &item);
-
-                       reply = packet_create_reply(packet, "i", ret);
-                       if (!reply) {
-                               ErrPrint("Failed to create a reply packet\n");
-                               break;
-                       }
-
-                       if (service_common_unicast_packet(tcb, reply) < 0) {
-                               ErrPrint("Unable to send reply packet\n");
-                       }
-
-                       packet_destroy(reply);
-
-                       /*!
-                        * \note
-                        * After send the reply packet, file push thread can sending a file
-                        */
-                       if (ret != LB_STATUS_SUCCESS || !item) {
-                               break;
-                       }
-
-                       CRITICAL_SECTION_BEGIN(&s_info.request_list_lock);
-                       s_info.request_list = eina_list_append(s_info.request_list, item);
-                       CRITICAL_SECTION_END(&s_info.request_list_lock);
-
-                       ret = write(s_info.request_pipe[PIPE_WRITE], &ch, sizeof(ch));
-                       if (ret < 0) {
-                               ErrPrint("write: %s\n", strerror(errno));
-
-                               CRITICAL_SECTION_BEGIN(&s_info.request_list_lock);
-                               s_info.request_list = eina_list_remove(s_info.request_list, item);
-                               CRITICAL_SECTION_END(&s_info.request_list_lock);
-
-                               destroy_request_item(item);
-                               /*!
-                                * \note for the client
-                                * In this case, the client can waiting files forever.
-                                * So the client must has to wait only a few seconds.
-                                * If the client could not get the any data in that time,
-                                * it should cancel the waiting.
-                                */
-                       }
+               reply = packet_create_reply(packet, "i", ret);
+               if (!reply) {
+                   ErrPrint("Failed to create a reply packet\n");
+                   break;
+               }
+
+               if (service_common_unicast_packet(tcb, reply) < 0) {
+                   ErrPrint("Unable to send reply packet\n");
+               }
+
+               packet_destroy(reply);
+
+               /*!
+                * \note
+                * After send the reply packet, file push thread can sending a file
+                */
+               if (ret != DBOX_STATUS_ERROR_NONE || !item) {
+                   break;
                }
 
-               break;
+               CRITICAL_SECTION_BEGIN(&s_info.request_list_lock);
+               s_info.request_list = eina_list_append(s_info.request_list, item);
+               CRITICAL_SECTION_END(&s_info.request_list_lock);
+
+               ret = write(s_info.request_pipe[PIPE_WRITE], &ch, sizeof(ch));
+               if (ret < 0) {
+                   ErrPrint("write: %s\n", strerror(errno));
+
+                   CRITICAL_SECTION_BEGIN(&s_info.request_list_lock);
+                   s_info.request_list = eina_list_remove(s_info.request_list, item);
+                   CRITICAL_SECTION_END(&s_info.request_list_lock);
+
+                   destroy_request_item(item);
+                   /*!
+                    * \note for the client
+                    * In this case, the client can waiting files forever.
+                    * So the client must has to wait only a few seconds.
+                    * If the client could not get the any data in that time,
+                    * it should cancel the waiting.
+                    */
+               }
+           }
+
+           break;
        case PACKET_REQ_NOACK:
        case PACKET_ACK:
-               /* File service has no this case, it is passive service type */
-               ErrPrint("Invalid packet.\n");
-               break;
+           /* File service has no this case, it is passive service type */
+           ErrPrint("Invalid packet.\n");
+           break;
        default:
-               break;
-       }
+           break;
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static int send_file(int handle, const struct request_item *item)
 {
-       struct burst_head *head;
-       struct burst_data *body;
-       int pktsz;
-       int flen;
-       off_t fsize;
-       int fd;
-       int ret = 0;
-
-       /* TODO: push a file to the client */
-       fd = open(item->data.filename, O_RDONLY);
-       if (fd < 0) {
-               ErrPrint("open: %s\n", strerror(errno));
-               return -EIO;
-       }
-
-       flen = strlen(item->data.filename);
-       if (flen == 0) {
-               ret = -EINVAL;
-               goto errout;
-       }
-
-       pktsz = sizeof(*head) + flen + 1;
-
-       head = malloc(pktsz);
-       if (!head) {
-               ErrPrint("heap: %s\n", strerror(errno));
-               ret = -ENOMEM;
-               goto errout;
-       }
-
-       fsize = lseek(fd, 0L, SEEK_END);
-       if (fsize == (off_t)-1) {
-               ErrPrint("heap: %s\n", strerror(errno));
-               DbgFree(head);
-               ret = -EIO;
-               goto errout;
+    struct burst_head *head;
+    struct burst_data *body;
+    int pktsz;
+    int flen;
+    off_t fsize;
+    int fd;
+    int ret = 0;
+
+    /* TODO: push a file to the client */
+    fd = open(item->data.filename, O_RDONLY);
+    if (fd < 0) {
+       ErrPrint("open: %s\n", strerror(errno));
+       return -EIO;
+    }
+
+    flen = strlen(item->data.filename);
+    if (flen == 0) {
+       ret = -EINVAL;
+       goto errout;
+    }
+
+    pktsz = sizeof(*head) + flen + 1;
+
+    head = malloc(pktsz);
+    if (!head) {
+       ErrPrint("heap: %s\n", strerror(errno));
+       ret = -ENOMEM;
+       goto errout;
+    }
+
+    fsize = lseek(fd, 0L, SEEK_END);
+    if (fsize == (off_t)-1) {
+       ErrPrint("heap: %s\n", strerror(errno));
+       DbgFree(head);
+       ret = -EIO;
+       goto errout;
+    }
+
+    head->flen = flen;
+    head->size = fsize;
+    strcpy(head->fname, item->data.filename);
+
+    /* Anytime we can fail to send packet */
+    ret = com_core_send(handle, (void *)head, pktsz, 2.0f);
+    DbgFree(head);
+    if (ret < 0) {
+       ret = -EFAULT;
+       goto errout;
+    }
+
+    if (lseek(fd, 0L, SEEK_SET) == (off_t)-1) {
+       ErrPrint("seek: %s\n", strerror(errno));
+
+       body = malloc(sizeof(*body));
+       if (!body) {
+           ErrPrint("Heap: %s\n", strerror(errno));
+           return -ENOMEM;
        }
 
-       head->flen = flen;
-       head->size = fsize;
-       strcpy(head->fname, item->data.filename);
+       body->size = -1;
+       ret = com_core_send(handle, (void *)body, sizeof(*body), 2.0f);
+       DbgFree(body);
 
-       /* Anytime we can fail to send packet */
-       ret = com_core_send(handle, (void *)head, pktsz, 2.0f);
-       DbgFree(head);
        if (ret < 0) {
-               ret = -EFAULT;
-               goto errout;
+           ret = -EFAULT;
+       } else {
+           ret = -EIO;
        }
 
-       if (lseek(fd, 0L, SEEK_SET) == (off_t)-1) {
-               ErrPrint("seek: %s\n", strerror(errno));
-
-               body = malloc(sizeof(*body));
-               if (!body) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       return -ENOMEM;
-               }
-
-               body->size = -1;
-               ret = com_core_send(handle, (void *)body, sizeof(*body), 2.0f);
-               DbgFree(body);
+       goto errout;
+    }
 
-               if (ret < 0) {
-                       ret = -EFAULT;
-               } else {
-                       ret = -EIO;
-               }
+    body = malloc(PKT_CHUNKSZ + sizeof(*body));
+    if (!body) {
+       ErrPrint("heap: %s\n", strerror(errno));
+       goto errout;
+    }
 
-               goto errout;
+    /* Burst pushing. */
+    while (fsize > 0) {
+       if (fsize > PKT_CHUNKSZ) {
+           body->size = PKT_CHUNKSZ;
+       } else {
+           body->size = fsize;
        }
 
-       body = malloc(PKT_CHUNKSZ + sizeof(*body));
-       if (!body) {
-               ErrPrint("heap: %s\n", strerror(errno));
-               goto errout;
+       ret = read(fd, body->data, body->size); 
+       if (ret < 0) {
+           ErrPrint("read: %s\n", strerror(errno));
+           ret = -EIO;
+           break;
        }
 
-       /* Burst pushing. */
-       while (fsize > 0) {
-               if (fsize > PKT_CHUNKSZ) {
-                       body->size = PKT_CHUNKSZ;
-               } else {
-                       body->size = fsize;
-               }
+       body->size = ret;
+       fsize -= ret;
+       pktsz = sizeof(*body) + body->size;
 
-               ret = read(fd, body->data, body->size); 
-               if (ret < 0) {
-                       ErrPrint("read: %s\n", strerror(errno));
-                       ret = -EIO;
-                       break;
-               }
-
-               body->size = ret;
-               fsize -= ret;
-               pktsz = sizeof(*body) + body->size;
-
-               /* Send BODY */
-               ret = com_core_send(handle, (void *)body, pktsz, 2.0f);
-               if (ret != pktsz) {
-                       ret = -EFAULT;
-                       break;
-               }
+       /* Send BODY */
+       ret = com_core_send(handle, (void *)body, pktsz, 2.0f);
+       if (ret != pktsz) {
+           ret = -EFAULT;
+           break;
        }
+    }
 
-       /* Send EOF */
-       body->size = -1;
-       ret = com_core_send(handle, (void *)body, sizeof(*body), 2.0f);
-       if (ret < 0) {
-               ret = -EFAULT;
-       }
+    /* Send EOF */
+    body->size = -1;
+    ret = com_core_send(handle, (void *)body, sizeof(*body), 2.0f);
+    if (ret < 0) {
+       ret = -EFAULT;
+    }
 
-       DbgFree(body);
+    DbgFree(body);
 
 errout:
-       if (close(fd) < 0) {
-               ErrPrint("close: %s\n", strerror(errno));
-       }
+    if (close(fd) < 0) {
+       ErrPrint("close: %s\n", strerror(errno));
+    }
 
-       return ret;
+    return ret;
 }
 
 static int send_buffer(int handle, const struct request_item *item)
 {
-       struct buffer *buffer;
-       struct burst_head *head;
-       struct burst_data *body;
-       char *data;
-       int pktsz;
-       int ret;
-       int size;
-       int offset;
-       int type;
-
-       if (item->type == REQUEST_TYPE_SHM) {
-               type = BUFFER_TYPE_SHM;
-       } else {
-               type = BUFFER_TYPE_PIXMAP;
-       }
+    dynamicbox_fb_t buffer;
+    struct burst_head *head;
+    struct burst_data *body;
+    char *data;
+    int pktsz;
+    int ret;
+    int size;
+    int offset;
+    int type;
+
+    if (item->type == REQUEST_TYPE_SHM) {
+       type = DBOX_FB_TYPE_SHM;
+    } else {
+       type = DBOX_FB_TYPE_PIXMAP;
+    }
+
+    buffer = buffer_handler_raw_open(type, (void *)item->data.shm);
+    if (!buffer) {
+       return -EINVAL;
+    }
+
+    pktsz = sizeof(*head);
+
+    head = malloc(pktsz);
+    if (!head) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       (void)buffer_handler_raw_close(buffer);
+       return -ENOMEM;
+    }
 
-       buffer = buffer_handler_raw_open(type, (void *)item->data.shm);
-       if (!buffer) {
-               return -EINVAL;
-       }
+    size = head->size = buffer_handler_raw_size(buffer);
+    head->flen = 0;
 
-       pktsz = sizeof(*head);
+    /* Anytime we can fail to send packet */
+    ret = com_core_send(handle, (void *)head, pktsz, 2.0f);
+    DbgFree(head);
+    if (ret < 0) {
+       ret = -EFAULT;
+       goto errout;
+    }
 
-       head = malloc(pktsz);
-       if (!head) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               (void)buffer_handler_raw_close(buffer);
-               return -ENOMEM;
-       }
+    body = malloc(sizeof(*body) + PKT_CHUNKSZ);
+    if (!body) {
+       ret = -ENOMEM;
+       goto errout;
+    }
 
-       size = head->size = buffer_handler_raw_size(buffer);
-       head->flen = 0;
+    data = (char *)buffer_handler_raw_data(buffer);
+    offset = 0;
+    while (offset < size) {
+       body->size = size - offset;
 
-       /* Anytime we can fail to send packet */
-       ret = com_core_send(handle, (void *)head, pktsz, 2.0f);
-       DbgFree(head);
-       if (ret < 0) {
-               ret = -EFAULT;
-               goto errout;
-       }
-
-       body = malloc(sizeof(*body) + PKT_CHUNKSZ);
-       if (!body) {
-               ret = -ENOMEM;
-               goto errout;
+       if (body->size > PKT_CHUNKSZ) {
+           body->size = PKT_CHUNKSZ;
        }
 
-       data = (char *)buffer_handler_raw_data(buffer);
-       offset = 0;
-       while (offset < size) {
-               body->size = size - offset;
+       memcpy(body->data, data, body->size);
+       pktsz = sizeof(*body) + body->size;
 
-               if (body->size > PKT_CHUNKSZ) {
-                       body->size = PKT_CHUNKSZ;
-               }
-
-               memcpy(body->data, data, body->size);
-               pktsz = sizeof(*body) + body->size;
-
-               ret = com_core_send(handle, (void *)body, pktsz, 2.0f);
-               if (ret < 0) {
-                       ret = -EFAULT;
-                       break;
-               }
-
-               offset += body->size;
+       ret = com_core_send(handle, (void *)body, pktsz, 2.0f);
+       if (ret < 0) {
+           ret = -EFAULT;
+           break;
        }
 
-       DbgFree(body);
+       offset += body->size;
+    }
+
+    DbgFree(body);
 
 errout:
-       (void)buffer_handler_raw_close(buffer);
-       return ret;
+    (void)buffer_handler_raw_close(buffer);
+    return ret;
 }
 
 static void *push_main(void *data)
 {
-       fd_set set;
-       int ret;
-       char ch;
-       struct request_item *item;
-       int conn_fd;
-       send_data_func_t send_data[] = {
-               send_file,
-               send_buffer,
-               send_buffer,
-       };
-
-       while (1) {
-               FD_ZERO(&set);
-               FD_SET(s_info.request_pipe[PIPE_READ], &set);
-
-               ret = select(s_info.request_pipe[PIPE_READ] + 1, &set, NULL, NULL, NULL);
-               if (ret < 0) {
-                       ret = -errno;
-                       if (errno == EINTR) {
-                               ErrPrint("INTERRUPTED\n");
-                               ret = 0;
-                               continue;
-                       }
-                       ErrPrint("Error: %s\n", strerror(errno));
-                       break;
-               } else if (ret == 0) {
-                       ErrPrint("Timeout\n");
-                       ret = -ETIMEDOUT;
-                       break;
-               }
-
-               if (!FD_ISSET(s_info.request_pipe[PIPE_READ], &set)) {
-                       DbgPrint("Unknown data\n");
-                       ret = -EINVAL;
-                       break;
-               }
+    fd_set set;
+    int ret;
+    char ch;
+    struct request_item *item;
+    int conn_fd;
+    send_data_func_t send_data[] = {
+       send_file,
+       send_buffer,
+       send_buffer,
+    };
+
+    while (1) {
+       FD_ZERO(&set);
+       FD_SET(s_info.request_pipe[PIPE_READ], &set);
+
+       ret = select(s_info.request_pipe[PIPE_READ] + 1, &set, NULL, NULL, NULL);
+       if (ret < 0) {
+           ret = -errno;
+           if (errno == EINTR) {
+               ErrPrint("INTERRUPTED\n");
+               ret = 0;
+               continue;
+           }
+           ErrPrint("Error: %s\n", strerror(errno));
+           break;
+       } else if (ret == 0) {
+           ErrPrint("Timeout\n");
+           ret = -ETIMEDOUT;
+           break;
+       }
 
-               ret = read(s_info.request_pipe[PIPE_READ], &ch, sizeof(ch));
-               if (ret != sizeof(ch)) {
-                       ErrPrint("read: %s\n", strerror(errno));
-                       ret = -EFAULT;
-                       break;
-               }
+       if (!FD_ISSET(s_info.request_pipe[PIPE_READ], &set)) {
+           DbgPrint("Unknown data\n");
+           ret = -EINVAL;
+           break;
+       }
 
-               if (ch == PUSH_EXIT) {
-                       DbgPrint("Thread is terminating\n");
-                       ret = -ECANCELED;
-                       break;
-               }
+       ret = read(s_info.request_pipe[PIPE_READ], &ch, sizeof(ch));
+       if (ret != sizeof(ch)) {
+           ErrPrint("read: %s\n", strerror(errno));
+           ret = -EFAULT;
+           break;
+       }
 
-               CRITICAL_SECTION_BEGIN(&s_info.request_list_lock);
-               item = eina_list_nth(s_info.request_list, 0);
-               s_info.request_list = eina_list_remove(s_info.request_list, item);
-               CRITICAL_SECTION_END(&s_info.request_list_lock);
+       if (ch == PUSH_EXIT) {
+           DbgPrint("Thread is terminating\n");
+           ret = -ECANCELED;
+           break;
+       }
 
-               if (!item) {
-                       ErrPrint("Request item is not valid\n");
-                       continue;
-               }
+       CRITICAL_SECTION_BEGIN(&s_info.request_list_lock);
+       item = eina_list_nth(s_info.request_list, 0);
+       s_info.request_list = eina_list_remove(s_info.request_list, item);
+       CRITICAL_SECTION_END(&s_info.request_list_lock);
 
-               /* Validate the TCB? */
-               conn_fd = tcb_is_valid(s_info.svc_ctx, item->tcb);
-               if (conn_fd < 0) {
-                       ErrPrint("TCB is not valid\n");
-                       destroy_request_item(item);
-                       continue;
-               }
+       if (!item) {
+           ErrPrint("Request item is not valid\n");
+           continue;
+       }
 
-               /*
-                * \note
-                * From now, we cannot believe the conn_fd.
-                * It can be closed any time.
-                * Even though we using it.
-                */
-               if (item->type < REQUEST_TYPE_MAX && item->type >= 0) {
-                       (void)send_data[item->type](conn_fd, item);
-               } else {
-                       ErrPrint("Invalid type\n");
-               }
+       /* Validate the TCB? */
+       conn_fd = tcb_is_valid(s_info.svc_ctx, item->tcb);
+       if (conn_fd < 0) {
+           ErrPrint("TCB is not valid\n");
+           destroy_request_item(item);
+           continue;
+       }
 
-               destroy_request_item(item);
+       /*
+        * \note
+        * From now, we cannot believe the conn_fd.
+        * It can be closed any time.
+        * Even though we using it.
+        */
+       if (item->type < REQUEST_TYPE_MAX && item->type >= 0) {
+           (void)send_data[item->type](conn_fd, item);
+       } else {
+           ErrPrint("Invalid type\n");
        }
 
-       return (void *)ret;
+       destroy_request_item(item);
+    }
+
+    return (void *)ret;
 }
 
 /* MAIN THREAD */
 int file_service_init(void)
 {
-       int status;
+    int status;
 
-       if (s_info.svc_ctx) {
-               ErrPrint("Already initialized\n");
-               return LB_STATUS_ERROR_ALREADY;
-       }
-
-       if (pipe2(s_info.request_pipe, O_CLOEXEC) < 0) {
-               ErrPrint("pipe: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (s_info.svc_ctx) {
+       ErrPrint("Already initialized\n");
+       return DBOX_STATUS_ERROR_ALREADY;
+    }
 
-       status = pthread_mutex_init(&s_info.request_list_lock, NULL);
-       if (status != 0) {
-               ErrPrint("Failed to create lock: %s\n", strerror(status));
-               CLOSE_PIPE(s_info.request_pipe);
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (pipe2(s_info.request_pipe, O_CLOEXEC) < 0) {
+       ErrPrint("pipe: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       s_info.svc_ctx = service_common_create(FILE_SERVICE_ADDR, service_thread_main, NULL);
-       if (!s_info.svc_ctx) {
-               ErrPrint("Unable to activate service thread\n");
+    status = pthread_mutex_init(&s_info.request_list_lock, NULL);
+    if (status != 0) {
+       ErrPrint("Failed to create lock: %s\n", strerror(status));
+       CLOSE_PIPE(s_info.request_pipe);
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-               status = pthread_mutex_destroy(&s_info.request_list_lock);
-               if (status != 0) {
-                       ErrPrint("Destroy lock: %s\n", strerror(status));
-               }
+    s_info.svc_ctx = service_common_create(FILE_SERVICE_ADDR, service_thread_main, NULL);
+    if (!s_info.svc_ctx) {
+       ErrPrint("Unable to activate service thread\n");
 
-               CLOSE_PIPE(s_info.request_pipe);
-               return LB_STATUS_ERROR_FAULT;
+       status = pthread_mutex_destroy(&s_info.request_list_lock);
+       if (status != 0) {
+           ErrPrint("Destroy lock: %s\n", strerror(status));
        }
 
-       status = pthread_create(&s_info.push_thid, NULL, push_main, NULL);
-       if (status != 0) {
-               ErrPrint("Failed to create a push service: %s\n", strerror(status));
+       CLOSE_PIPE(s_info.request_pipe);
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-               service_common_destroy(s_info.svc_ctx);
-               s_info.svc_ctx = NULL;
+    status = pthread_create(&s_info.push_thid, NULL, push_main, NULL);
+    if (status != 0) {
+       ErrPrint("Failed to create a push service: %s\n", strerror(status));
 
-               status = pthread_mutex_destroy(&s_info.request_list_lock);
-               if (status != 0) {
-                       ErrPrint("Destroy lock: %s\n", strerror(status));
-               }
+       service_common_destroy(s_info.svc_ctx);
+       s_info.svc_ctx = NULL;
 
-               CLOSE_PIPE(s_info.request_pipe);
-               return LB_STATUS_ERROR_FAULT;
+       status = pthread_mutex_destroy(&s_info.request_list_lock);
+       if (status != 0) {
+           ErrPrint("Destroy lock: %s\n", strerror(status));
        }
 
-       /*!
-        * \note
-        * Remote service doesn't need to set the additional SMAK label.
-        */
+       CLOSE_PIPE(s_info.request_pipe);
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    /*!
+     * \note
+     * Remote service doesn't need to set the additional SMAK label.
+     */
 
-       DbgPrint("Successfully initiated\n");
-       return LB_STATUS_SUCCESS;
+    DbgPrint("Successfully initiated\n");
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 /* MAIN THREAD */
 int file_service_fini(void)
 {
-       struct request_item *item;
-       int status;
-       char ch;
-       void *retval;
-
-       if (!s_info.svc_ctx) {
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       ch = PUSH_EXIT;
-       status = write(s_info.request_pipe[PIPE_WRITE], &ch, sizeof(ch));
-       if (status != sizeof(ch)) {
-               ErrPrint("write: %s\n", strerror(errno));
-               /* Forcely terminate the thread */
-               status = pthread_cancel(s_info.push_thid);
-               if (status != 0) {
-                       ErrPrint("cancel: %s\n", strerror(status));
-               }
-       }
-
-       status = pthread_join(s_info.push_thid, &retval);
+    struct request_item *item;
+    int status;
+    char ch;
+    void *retval;
+
+    if (!s_info.svc_ctx) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    ch = PUSH_EXIT;
+    status = write(s_info.request_pipe[PIPE_WRITE], &ch, sizeof(ch));
+    if (status != sizeof(ch)) {
+       ErrPrint("write: %s\n", strerror(errno));
+       /* Forcely terminate the thread */
+       status = pthread_cancel(s_info.push_thid);
        if (status != 0) {
-               ErrPrint("join: %s\n", strerror(status));
+           ErrPrint("cancel: %s\n", strerror(status));
        }
+    }
 
-       CRITICAL_SECTION_BEGIN(&s_info.request_list_lock);
-       EINA_LIST_FREE(s_info.request_list, item) {
-               destroy_request_item(item);
-       }
-       CRITICAL_SECTION_END(&s_info.request_list_lock);
+    status = pthread_join(s_info.push_thid, &retval);
+    if (status != 0) {
+       ErrPrint("join: %s\n", strerror(status));
+    }
 
-       service_common_destroy(s_info.svc_ctx);
-       s_info.svc_ctx = NULL;
+    CRITICAL_SECTION_BEGIN(&s_info.request_list_lock);
+    EINA_LIST_FREE(s_info.request_list, item) {
+       destroy_request_item(item);
+    }
+    CRITICAL_SECTION_END(&s_info.request_list_lock);
 
-       status = pthread_mutex_destroy(&s_info.request_list_lock);
-       if (status != 0) {
-               ErrPrint("destroy mutex: %s\n", strerror(status));
-       }
+    service_common_destroy(s_info.svc_ctx);
+    s_info.svc_ctx = NULL;
 
-       CLOSE_PIPE(s_info.request_pipe);
+    status = pthread_mutex_destroy(&s_info.request_list_lock);
+    if (status != 0) {
+       ErrPrint("destroy mutex: %s\n", strerror(status));
+    }
+
+    CLOSE_PIPE(s_info.request_pipe);
 
-       DbgPrint("Successfully Finalized\n");
-       return LB_STATUS_SUCCESS;
+    DbgPrint("Successfully Finalized\n");
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 /* End of a file */
index ff03488..d75a3ed 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <dlog.h>
 #include <Eina.h>
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
 
 #include "util.h"
 #include "debug.h"
 int errno;
 
 static struct info {
-       Eina_List *cluster_list;
+    Eina_List *cluster_list;
 } s_info = {
-       .cluster_list = NULL,
+    .cluster_list = NULL,
 };
 
 struct cluster {
-       char *name;
-       Eina_List *category_list;
+    char *name;
+    Eina_List *category_list;
 };
 
 struct category {
-       char *name;
-       struct cluster *cluster;
-       Eina_List *info_list; /* list of instances of the struct inst_info */
+    char *name;
+    struct cluster *cluster;
+    Eina_List *info_list; /* list of instances of the struct inst_info */
 };
 
 struct context_info {
-       char *pkgname;
-       struct category *category;
-       Eina_List *context_list; /* context item list */
+    char *pkgname;
+    struct category *category;
+    Eina_List *context_list; /* context item list */
 };
 
 struct context_item_data {
-       char *tag;
-       void *data;
+    char *tag;
+    void *data;
 };
 
 struct context_item {
-       char *ctx_item;
-       struct context_info *info;
-       Eina_List *option_list;
-       Eina_List *data_list;
+    char *ctx_item;
+    struct context_info *info;
+    Eina_List *option_list;
+    Eina_List *data_list;
 };
 
 struct context_option {
-       struct context_item *item;
-       char *key;
-       char *value;
+    struct context_item *item;
+    char *key;
+    char *value;
 };
 
 HAPI struct context_info *group_create_context_info(struct category *category, const char *pkgname)
 {
-       struct context_info *info;
+    struct context_info *info;
 
-       info = calloc(1, sizeof(*info));
-       if (!info) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return NULL;
-       }
+    info = calloc(1, sizeof(*info));
+    if (!info) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
 
-       info->pkgname = strdup(pkgname);
-       if (!info->pkgname) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(info);
-               return NULL;
-       }
+    info->pkgname = strdup(pkgname);
+    if (!info->pkgname) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(info);
+       return NULL;
+    }
 
-       info->category = category;
-       category->info_list = eina_list_append(category->info_list, info);
-       return info;
+    info->category = category;
+    category->info_list = eina_list_append(category->info_list, info);
+    return info;
 }
 
 static inline void del_options(struct context_item *item)
 {
-       struct context_option *option;
+    struct context_option *option;
 
-       EINA_LIST_FREE(item->option_list, option) {
-               DbgFree(option->key);
-               DbgFree(option->value);
-               DbgFree(option);
-       }
+    EINA_LIST_FREE(item->option_list, option) {
+       DbgFree(option->key);
+       DbgFree(option->value);
+       DbgFree(option);
+    }
 }
 
 static inline void del_context_item(struct context_info *info)
 {
-       struct context_item *item;
+    struct context_item *item;
 
-       EINA_LIST_FREE(info->context_list, item) {
-               del_options(item);
-               DbgFree(item->ctx_item);
-               DbgFree(item);
-       }
+    EINA_LIST_FREE(info->context_list, item) {
+       del_options(item);
+       DbgFree(item->ctx_item);
+       DbgFree(item);
+    }
 }
 
 HAPI struct context_item *group_add_context_item(struct context_info *info, const char *ctx_item)
 {
-       struct context_item *item;
+    struct context_item *item;
 
-       item = calloc(1, sizeof(*item));
-       if (!item) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return NULL;
-       }
+    item = calloc(1, sizeof(*item));
+    if (!item) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
 
-       item->ctx_item = strdup(ctx_item);
-       if (!item->ctx_item) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(item);
-               return NULL;
-       }
+    item->ctx_item = strdup(ctx_item);
+    if (!item->ctx_item) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(item);
+       return NULL;
+    }
 
-       item->info = info;
-       info->context_list = eina_list_append(info->context_list, item);
-       return item;
+    item->info = info;
+    info->context_list = eina_list_append(info->context_list, item);
+    return item;
 }
 
 HAPI int group_add_option(struct context_item *item, const char *key, const char *value)
 {
-       struct context_option *option;
+    struct context_option *option;
 
-       option = calloc(1, sizeof(*option));
-       if (!option) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    option = calloc(1, sizeof(*option));
+    if (!option) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       option->key = strdup(key);
-       if (!option->key) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(option);
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    option->key = strdup(key);
+    if (!option->key) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(option);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       option->value = strdup(value);
-       if (!option->value) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(option->key);
-               DbgFree(option);
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    option->value = strdup(value);
+    if (!option->value) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(option->key);
+       DbgFree(option);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       option->item = item;
-       item->option_list = eina_list_append(item->option_list, option);
-       return LB_STATUS_SUCCESS;
+    option->item = item;
+    item->option_list = eina_list_append(item->option_list, option);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int group_destroy_context_info(struct context_info *info)
 {
-       struct category *category;
+    struct category *category;
 
-       category = info->category;
-       if (!category) {
-               ErrPrint("No category found\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    category = info->category;
+    if (!category) {
+       ErrPrint("No category found\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       category->info_list = eina_list_remove(category->info_list, info);
+    category->info_list = eina_list_remove(category->info_list, info);
 
-       del_context_item(info);
-       DbgFree(info->pkgname);
-       DbgFree(info);
-       return LB_STATUS_SUCCESS;
+    del_context_item(info);
+    DbgFree(info->pkgname);
+    DbgFree(info);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI struct cluster *group_create_cluster(const char *name)
 {
-       struct cluster *cluster;
+    struct cluster *cluster;
 
-       cluster = malloc(sizeof(*cluster));
-       if (!cluster) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return NULL;
-       }
+    cluster = malloc(sizeof(*cluster));
+    if (!cluster) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
 
-       cluster->name = strdup(name);
-       if (!cluster->name) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(cluster);
-               return NULL;
-       }
+    cluster->name = strdup(name);
+    if (!cluster->name) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(cluster);
+       return NULL;
+    }
 
-       cluster->category_list = NULL;
+    cluster->category_list = NULL;
 
-       s_info.cluster_list = eina_list_append(s_info.cluster_list, cluster);
-       return cluster;
+    s_info.cluster_list = eina_list_append(s_info.cluster_list, cluster);
+    return cluster;
 }
 
 HAPI struct cluster *group_find_cluster(const char *name)
 {
-       Eina_List *l;
-       struct cluster *cluster;
+    Eina_List *l;
+    struct cluster *cluster;
 
-       EINA_LIST_FOREACH(s_info.cluster_list, l, cluster) {
-               if (!strcasecmp(cluster->name, name)) {
-                       return cluster;
-               }
+    EINA_LIST_FOREACH(s_info.cluster_list, l, cluster) {
+       if (!strcasecmp(cluster->name, name)) {
+           return cluster;
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
 HAPI struct category *group_create_category(struct cluster *cluster, const char *name)
 {
-       struct category *category;
+    struct category *category;
 
-       category = malloc(sizeof(*category));
-       if (!category) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return NULL;
-       }
+    category = malloc(sizeof(*category));
+    if (!category) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
 
-       category->name = strdup(name);
-       if (!category->name) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(category);
-               return NULL;
-       }
+    category->name = strdup(name);
+    if (!category->name) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(category);
+       return NULL;
+    }
 
-       category->cluster = cluster;
-       category->info_list = NULL;
+    category->cluster = cluster;
+    category->info_list = NULL;
 
-       cluster->category_list = eina_list_append(cluster->category_list, category);
-       return category;
+    cluster->category_list = eina_list_append(cluster->category_list, category);
+    return category;
 }
 
 static inline void destroy_cluster(struct cluster *cluster)
 {
-       struct category *category;
-       Eina_List *l;
-       Eina_List *n;
+    struct category *category;
+    Eina_List *l;
+    Eina_List *n;
 
-       EINA_LIST_FOREACH_SAFE(cluster->category_list, l, n, category) {
-               group_destroy_category(category);
-       }
+    EINA_LIST_FOREACH_SAFE(cluster->category_list, l, n, category) {
+       group_destroy_category(category);
+    }
 
-       DbgFree(cluster->name);
-       DbgFree(cluster);
+    DbgFree(cluster->name);
+    DbgFree(cluster);
 }
 
 HAPI int group_destroy_cluster(struct cluster *cluster)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct cluster *item;
+    Eina_List *l;
+    Eina_List *n;
+    struct cluster *item;
 
-       EINA_LIST_FOREACH_SAFE(s_info.cluster_list, l, n, item) {
-               if (item == cluster) {
-                       s_info.cluster_list = eina_list_remove_list(s_info.cluster_list, l);
-                       destroy_cluster(cluster);
-                       return LB_STATUS_SUCCESS;
-               }
+    EINA_LIST_FOREACH_SAFE(s_info.cluster_list, l, n, item) {
+       if (item == cluster) {
+           s_info.cluster_list = eina_list_remove_list(s_info.cluster_list, l);
+           destroy_cluster(cluster);
+           return DBOX_STATUS_ERROR_NONE;
        }
+    }
 
-       return LB_STATUS_ERROR_NOT_EXIST;
+    return DBOX_STATUS_ERROR_NOT_EXIST;
 }
 
 static inline void destroy_category(struct category *category)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct context_info *info;
+    Eina_List *l;
+    Eina_List *n;
+    struct context_info *info;
 
-       EINA_LIST_FOREACH_SAFE(category->info_list, l, n, info) {
-               group_destroy_context_info(info);
-       }
+    EINA_LIST_FOREACH_SAFE(category->info_list, l, n, info) {
+       group_destroy_context_info(info);
+    }
 
-       DbgFree(category->name);
-       DbgFree(category);
+    DbgFree(category->name);
+    DbgFree(category);
 }
 
 HAPI int group_destroy_category(struct category *category)
 {
-       struct cluster *cluster;
+    struct cluster *cluster;
 
-       cluster = category->cluster;
-       if (cluster) {
-               cluster->category_list = eina_list_remove(cluster->category_list, category);
-       }
+    cluster = category->cluster;
+    if (cluster) {
+       cluster->category_list = eina_list_remove(cluster->category_list, category);
+    }
 
-       destroy_category(category);
-       return LB_STATUS_SUCCESS;
+    destroy_category(category);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI struct category *group_find_category(struct cluster *cluster, const char *name)
 {
-       struct category *category;
-       Eina_List *l;
+    struct category *category;
+    Eina_List *l;
 
-       EINA_LIST_FOREACH(cluster->category_list, l, category) {
-               if (!strcasecmp(category->name, name)) {
-                       return category;
-               }
+    EINA_LIST_FOREACH(cluster->category_list, l, category) {
+       if (!strcasecmp(category->name, name)) {
+           return category;
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
 HAPI Eina_List * const group_context_info_list(struct category *category)
 {
-       return category->info_list;
+    return category->info_list;
 }
 
 HAPI Eina_List *const group_context_item_list(struct context_info *info)
 {
-       return info->context_list;
+    return info->context_list;
 }
 
 HAPI Eina_List *const group_context_option_list(struct context_item *item)
 {
-       return item->option_list;
+    return item->option_list;
 }
 
 HAPI Eina_List *const group_cluster_list(void)
 {
-       return s_info.cluster_list;
+    return s_info.cluster_list;
 }
 
 HAPI Eina_List * const group_category_list(struct cluster *cluster)
 {
-       return cluster->category_list;
+    return cluster->category_list;
 }
 
 HAPI struct context_info * const group_context_info_from_item(struct context_item *item)
 {
-       return item->info;
+    return item->info;
 }
 
 HAPI struct category * const group_category_from_context_info(struct context_info *info)
 {
-       return info->category;
+    return info->category;
 }
 
 HAPI const char * const group_pkgname_from_context_info(struct context_info *info)
 {
-       return info->pkgname;
+    return info->pkgname;
 }
 
 HAPI const char * const group_option_item_key(struct context_option *option)
 {
-       return option->key;
+    return option->key;
 }
 
 HAPI const char * const group_option_item_value(struct context_option *option)
 {
-       return option->value;
+    return option->value;
 }
 
 HAPI const char * const group_context_item(struct context_item *item)
 {
-       return item->ctx_item;
+    return item->ctx_item;
 }
 
 HAPI int group_context_item_add_data(struct context_item *item, const char *tag, void *data)
 {
-       struct context_item_data *tmp;
+    struct context_item_data *tmp;
 
-       tmp = malloc(sizeof(*tmp));
-       if (!tmp) {
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    tmp = malloc(sizeof(*tmp));
+    if (!tmp) {
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       tmp->tag = strdup(tag);
-       if (!tmp->tag) {
-               DbgFree(tmp);
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    tmp->tag = strdup(tag);
+    if (!tmp->tag) {
+       DbgFree(tmp);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       tmp->data = data;
-       item->data_list = eina_list_append(item->data_list, tmp);
-       return LB_STATUS_SUCCESS;
+    tmp->data = data;
+    item->data_list = eina_list_append(item->data_list, tmp);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI void *group_context_item_data(struct context_item *item, const char *tag)
 {
-       struct context_item_data *tmp;
-       Eina_List *l;
+    struct context_item_data *tmp;
+    Eina_List *l;
 
-       EINA_LIST_FOREACH(item->data_list, l, tmp) {
-               if (!strcmp(tmp->tag, tag)) {
-                       return tmp->data;
-               }
+    EINA_LIST_FOREACH(item->data_list, l, tmp) {
+       if (!strcmp(tmp->tag, tag)) {
+           return tmp->data;
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
 HAPI void *group_context_item_del_data(struct context_item *item, const char *tag)
 {
-       struct context_item_data *tmp;
-       Eina_List *l;
-       Eina_List *n;
+    struct context_item_data *tmp;
+    Eina_List *l;
+    Eina_List *n;
 
-       EINA_LIST_FOREACH_SAFE(item->data_list, l, n, tmp) {
-               if (!strcmp(tmp->tag, tag)) {
-                       void *data;
+    EINA_LIST_FOREACH_SAFE(item->data_list, l, n, tmp) {
+       if (!strcmp(tmp->tag, tag)) {
+           void *data;
 
-                       item->data_list = eina_list_remove(item->data_list, tmp);
+           item->data_list = eina_list_remove(item->data_list, tmp);
 
-                       data = tmp->data;
+           data = tmp->data;
 
-                       DbgFree(tmp->tag);
-                       DbgFree(tmp);
+           DbgFree(tmp->tag);
+           DbgFree(tmp);
 
-                       return data;
-               }
+           return data;
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
 HAPI const char * const group_category_name(struct category *category)
 {
-       return category ? category->name : NULL;
+    return category ? category->name : NULL;
 }
 
 HAPI const char * const group_cluster_name(struct cluster *cluster)
 {
-       return cluster ? cluster->name : NULL;
+    return cluster ? cluster->name : NULL;
 }
 
 HAPI const char *group_cluster_name_by_category(struct category *category)
 {
-       return !category ? NULL : (category->cluster ? category->cluster->name : NULL);
+    return !category ? NULL : (category->cluster ? category->cluster->name : NULL);
 }
 
 static inline char *get_token(char *ptr, int *len)
 {
-       char *name;
-       int _len;
+    char *name;
+    int _len;
 
-       if (*len == 0) {
-               ErrPrint("Start brace but len = 0\n");
-               return NULL;
-       }
+    if (*len == 0) {
+       ErrPrint("Start brace but len = 0\n");
+       return NULL;
+    }
 
-       _len = *len;
+    _len = *len;
 
-       while (_len > 0 && isspace(ptr[_len])) {
-               _len--;
-       }
+    while (_len > 0 && isspace(ptr[_len])) {
+       _len--;
+    }
 
-       if (_len == 0) {
-               ErrPrint("Token has no string\n");
-               return NULL;
-       }
+    if (_len == 0) {
+       ErrPrint("Token has no string\n");
+       return NULL;
+    }
 
-       name = malloc(_len + 1);
-       if (!name) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return NULL;
-       }
+    name = malloc(_len + 1);
+    if (!name) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
+
+    strncpy(name, ptr - *len, _len);
+    name[_len] = '\0';
+
+    *len = _len;
+    return name;
+}
+
+HAPI int group_add_dynamicbox(const char *group, const char *pkgname)
+{
+    struct cluster *cluster;
+    struct category *category;
+    struct context_info *info = NULL;
+    struct context_item *item = NULL;
+    char *key;
+    char *name;
+    char *ptr;
+    int len;
+    int is_open = 0;
+    enum {
+       CLUSTER,
+       CATEGORY,
+       CONTEXT_ITEM,
+       CONTEXT_OPTION_KEY,
+       CONTEXT_OPTION_VALUE,
+       CONTEXT_ERROR = 0xFFFFFFFF
+    } state;
+
+    state = CLUSTER;
+
+    ptr = (char *)group;
+    len = 0;
+    key = NULL;
+
+    /* Skip the first space characters */
+    while (*ptr && isspace(*ptr)) ptr++;
+
+    cluster = NULL;
+    while (*ptr) {
+       if (*ptr == '{') {
+           name = get_token(ptr, &len);
+           if (!name) {
+               ErrPrint("Failed to get token\n");
+               return DBOX_STATUS_ERROR_FAULT;
+           }
+           /* cluster{category{context{key=value,key=value},context{key=value}}} */
+           /* cluster{category} */
+
+           switch (state) {
+               case CLUSTER:
+                   cluster = group_find_cluster(name);
+                   if (!cluster) {
+                       cluster = group_create_cluster(name);
+                   }
+
+                   if (!cluster) {
+                       ErrPrint("Failed to get cluster\n");
+                       DbgFree(name);
+                       return DBOX_STATUS_ERROR_FAULT;
+                   }
 
-       strncpy(name, ptr - *len, _len);
-       name[_len] = '\0';
-
-       *len = _len;
-       return name;
-}
-
-HAPI int group_add_livebox(const char *group, const char *pkgname)
-{
-       struct cluster *cluster;
-       struct category *category;
-       struct context_info *info = NULL;
-       struct context_item *item = NULL;
-       char *key;
-       char *name;
-       char *ptr;
-       int len;
-       int is_open = 0;
-       enum {
-               CLUSTER,
-               CATEGORY,
-               CONTEXT_ITEM,
-               CONTEXT_OPTION_KEY,
-               CONTEXT_OPTION_VALUE,
-               CONTEXT_ERROR = 0xFFFFFFFF
-       } state;
-
-       state = CLUSTER;
-
-       ptr = (char *)group;
-       len = 0;
-       key = NULL;
-
-       /* Skip the first space characters */
-       while (*ptr && isspace(*ptr)) ptr++;
-
-       cluster = NULL;
-       while (*ptr) {
-               if (*ptr == '{') {
-                       name = get_token(ptr, &len);
-                       if (!name) {
-                               ErrPrint("Failed to get token\n");
-                               return LB_STATUS_ERROR_FAULT;
-                       }
-                       /* cluster{category{context{key=value,key=value},context{key=value}}} */
-                       /* cluster{category} */
-
-                       switch (state) {
-                       case CLUSTER:
-                               cluster = group_find_cluster(name);
-                               if (!cluster) {
-                                       cluster = group_create_cluster(name);
-                               }
-
-                               if (!cluster) {
-                                       ErrPrint("Failed to get cluster\n");
-                                       DbgFree(name);
-                                       return LB_STATUS_ERROR_FAULT;
-                               }
-
-                               state = CATEGORY;
-                               break;
-
-                       case CATEGORY:
-                               category = group_find_category(cluster, name);
-                               if (!category) {
-                                       category = group_create_category(cluster, name);
-                               }
-
-                               if (!category) {
-                                       ErrPrint("Failed to get category\n");
-                                       DbgFree(name);
-                                       return LB_STATUS_ERROR_FAULT;
-                               }
-
-                               info = group_create_context_info(category, pkgname);
-                               if (!info) {
-                                       ErrPrint("Failed to create ctx info\n");
-                                       DbgFree(name);
-                                       return LB_STATUS_ERROR_FAULT;
-                               }
-
-                               state = CONTEXT_ITEM;
-                               break;
-
-                       case CONTEXT_ITEM:
-                               item = group_add_context_item(info, name);
-                               if (!item) {
-                                       ErrPrint("Failed to create a context item\n");
-                                       DbgFree(name);
-                                       return LB_STATUS_ERROR_FAULT;
-                               }
-
-                               state = CONTEXT_OPTION_KEY;
-                               break;
-
-                       case CONTEXT_OPTION_KEY:
-                       case CONTEXT_OPTION_VALUE:
-                       default:
-                               ErrPrint("Invalid state\n");
-                               DbgFree(name);
-                               return LB_STATUS_ERROR_FAULT;
-                       }
+                   state = CATEGORY;
+                   break;
+
+               case CATEGORY:
+                   category = group_find_category(cluster, name);
+                   if (!category) {
+                       category = group_create_category(cluster, name);
+                   }
 
+                   if (!category) {
+                       ErrPrint("Failed to get category\n");
                        DbgFree(name);
-                       is_open++;
-                       len = 0;
-                       ptr++;
-                       while (*ptr && isspace(*ptr)) ptr++;
-                       continue;
-               } else if (*ptr == ',') {
-                       name = get_token(ptr, &len);
-                       if (!name) {
-                               ErrPrint("Failed to get token (len:%d)\n", len);
-                               len = 0;
-                               ptr++;
-                               while (*ptr && isspace(*ptr)) ptr++;
-                               continue;
-                       }
+                       return DBOX_STATUS_ERROR_FAULT;
+                   }
 
-                       switch (state) {
-                       case CLUSTER:
-                               if (is_open != 0) {
-                                       ErrPrint("Invalid state\n");
-                                       DbgFree(name);
-                                       return LB_STATUS_ERROR_FAULT;
-                               }
-                               cluster = group_find_cluster(name);
-                               if (!cluster) {
-                                       cluster = group_create_cluster(name);
-                               }
-
-                               if (!cluster) {
-                                       ErrPrint("Failed to get cluster\n");
-                                       DbgFree(name);
-                                       return LB_STATUS_ERROR_FAULT;
-                               }
-
-                               state = CATEGORY;
-                               break;
-
-                       case CATEGORY:
-                               if (is_open != 1) {
-                                       ErrPrint("Invalid state\n");
-                                       DbgFree(name);
-                                       return LB_STATUS_ERROR_FAULT;
-                               }
-                               category = group_find_category(cluster, name);
-                               if (!category) {
-                                       category = group_create_category(cluster, name);
-                               }
-
-                               if (!category) {
-                                       ErrPrint("Failed to get category\n");
-                                       DbgFree(name);
-                                       return LB_STATUS_ERROR_FAULT;
-                               }
-
-                               info = group_create_context_info(category, pkgname);
-                               if (!info) {
-                                       ErrPrint("Failed to create ctx info\n");
-                                       DbgFree(name);
-                                       return LB_STATUS_ERROR_FAULT;
-                               }
-
-                               state = CONTEXT_ITEM;
-                               break;
-                       case CONTEXT_ITEM:
-                               if (is_open == 1) {
-                                       category = group_find_category(cluster, name);
-                                       if (!category) {
-                                               category = group_create_category(cluster, name);
-                                       }
-
-                                       if (!category) {
-                                               ErrPrint("Failed to get category\n");
-                                               DbgFree(name);
-                                               return LB_STATUS_ERROR_FAULT;
-                                       }
-
-                                       info = group_create_context_info(category, pkgname);
-                                       if (!info) {
-                                               ErrPrint("Failed to create ctx info\n");
-                                               DbgFree(name);
-                                               return LB_STATUS_ERROR_FAULT;
-                                       }
-                               } else if (is_open == 2) {
-                                       item = group_add_context_item(info, name);
-                                       if (!item) {
-                                               ErrPrint("Failed to create a context item\n");
-                                               DbgFree(name);
-                                               return LB_STATUS_ERROR_FAULT;
-                                       }
-                                       state = CONTEXT_OPTION_KEY;
-                               } else {
-                                       ErrPrint("Invalid state\n");
-                                       DbgFree(name);
-                                       return LB_STATUS_ERROR_FAULT;
-                               }
-
-                               break;
-                       case CONTEXT_OPTION_VALUE:
-                               if (is_open != 3) {
-                                       ErrPrint("Invalid state\n");
-                                       DbgFree(name);
-                                       return LB_STATUS_ERROR_FAULT;
-                               }
-
-                               if (group_add_option(item, key, name) < 0) {
-                                       ErrPrint("Failed to add a new option: %s - %s\n", key, name);
-                               }
-
-                               DbgFree(key);
-                               key = NULL;
-
-                               state = CONTEXT_OPTION_KEY;
-                               break;
-                       case CONTEXT_OPTION_KEY:
-                       default:
-                               ErrPrint("Invalid state (%s)\n", name);
-                               DbgFree(name);
-                               return LB_STATUS_ERROR_FAULT;
-                       }
+                   info = group_create_context_info(category, pkgname);
+                   if (!info) {
+                       ErrPrint("Failed to create ctx info\n");
+                       DbgFree(name);
+                       return DBOX_STATUS_ERROR_FAULT;
+                   }
+
+                   state = CONTEXT_ITEM;
+                   break;
 
+               case CONTEXT_ITEM:
+                   item = group_add_context_item(info, name);
+                   if (!item) {
+                       ErrPrint("Failed to create a context item\n");
                        DbgFree(name);
-                       len = 0;
-                       ptr++;
-                       while (*ptr && isspace(*ptr)) ptr++;
-                       continue;
-               } else if (*ptr == '=') {
-                       if (is_open != 3 || state != CONTEXT_OPTION_KEY) {
-                               ErrPrint("Invalid state\n");
-                               return LB_STATUS_ERROR_FAULT;
-                       }
+                       return DBOX_STATUS_ERROR_FAULT;
+                   }
+
+                   state = CONTEXT_OPTION_KEY;
+                   break;
+
+               case CONTEXT_OPTION_KEY:
+               case CONTEXT_OPTION_VALUE:
+               default:
+                   ErrPrint("Invalid state\n");
+                   DbgFree(name);
+                   return DBOX_STATUS_ERROR_FAULT;
+           }
+
+           DbgFree(name);
+           is_open++;
+           len = 0;
+           ptr++;
+           while (*ptr && isspace(*ptr)) ptr++;
+           continue;
+       } else if (*ptr == ',') {
+           name = get_token(ptr, &len);
+           if (!name) {
+               ErrPrint("Failed to get token (len:%d)\n", len);
+               len = 0;
+               ptr++;
+               while (*ptr && isspace(*ptr)) ptr++;
+               continue;
+           }
+
+           switch (state) {
+               case CLUSTER:
+                   if (is_open != 0) {
+                       ErrPrint("Invalid state\n");
+                       DbgFree(name);
+                       return DBOX_STATUS_ERROR_FAULT;
+                   }
+                   cluster = group_find_cluster(name);
+                   if (!cluster) {
+                       cluster = group_create_cluster(name);
+                   }
+
+                   if (!cluster) {
+                       ErrPrint("Failed to get cluster\n");
+                       DbgFree(name);
+                       return DBOX_STATUS_ERROR_FAULT;
+                   }
 
-                       key = get_token(ptr, &len);
-                       if (!key) {
-                               ErrPrint("Failed to get token\n");
-                               return LB_STATUS_ERROR_FAULT;
-                       }
+                   state = CATEGORY;
+                   break;
 
-                       state = CONTEXT_OPTION_VALUE;
-                       len = 0;
-                       ptr++;
-                       while (*ptr && isspace(*ptr)) ptr++;
-                       continue;
-               } else if (*ptr == '}') {
-                       if (is_open <= 0) {
-                               ErrPrint("Invalid state\n");
-                               return LB_STATUS_ERROR_FAULT;
-                       }
+               case CATEGORY:
+                   if (is_open != 1) {
+                       ErrPrint("Invalid state\n");
+                       DbgFree(name);
+                       return DBOX_STATUS_ERROR_FAULT;
+                   }
+                   category = group_find_category(cluster, name);
+                   if (!category) {
+                       category = group_create_category(cluster, name);
+                   }
+
+                   if (!category) {
+                       ErrPrint("Failed to get category\n");
+                       DbgFree(name);
+                       return DBOX_STATUS_ERROR_FAULT;
+                   }
 
-                       name = get_token(ptr, &len);
-                       if (!name) {
-                               ErrPrint("Failed to get token, len:%d\n", len);
-                               is_open--;
-                               len = 0;
-                               ptr++;
-                               while (*ptr && isspace(*ptr)) ptr++;
-                               continue;
+                   info = group_create_context_info(category, pkgname);
+                   if (!info) {
+                       ErrPrint("Failed to create ctx info\n");
+                       DbgFree(name);
+                       return DBOX_STATUS_ERROR_FAULT;
+                   }
+
+                   state = CONTEXT_ITEM;
+                   break;
+               case CONTEXT_ITEM:
+                   if (is_open == 1) {
+                       category = group_find_category(cluster, name);
+                       if (!category) {
+                           category = group_create_category(cluster, name);
                        }
 
-                       switch (state) {
-                       case CATEGORY:
-                               category = group_find_category(cluster, name);
-                               if (!category) {
-                                       category = group_create_category(cluster, name);
-                               }
-
-                               if (!category) {
-                                       ErrPrint("Failed to get category\n");
-                                       DbgFree(name);
-                                       return LB_STATUS_ERROR_FAULT;
-                               }
-
-                               info = group_create_context_info(category, pkgname);
-                               if (!info) {
-                                       ErrPrint("Failed to create ctx info\n");
-                                       DbgFree(name);
-                                       return LB_STATUS_ERROR_FAULT;
-                               }
-
-                               state = CLUSTER;
-                               break;
-                       case CONTEXT_ITEM:
-                               if (is_open == 1) {
-                                       category = group_find_category(cluster, name);
-                                       if (!category) {
-                                               category = group_create_category(cluster, name);
-                                       }
-
-                                       if (!category) {
-                                               ErrPrint("Failed to get category\n");
-                                               DbgFree(name);
-                                               return LB_STATUS_ERROR_FAULT;
-                                       }
-
-                                       info = group_create_context_info(category, pkgname);
-                                       if (!info) {
-                                               ErrPrint("Failed to create ctx info\n");
-                                               DbgFree(name);
-                                               return LB_STATUS_ERROR_FAULT;
-                                       }
-
-                                       state = CLUSTER;
-                               } else if (is_open == 2) {
-                                       state = CATEGORY;
-                               } else {
-                                       ErrPrint("Invalid state\n");
-                                       DbgFree(name);
-                                       return LB_STATUS_ERROR_FAULT;
-                               }
-                               break;
-                       case CONTEXT_OPTION_VALUE:
-                               if (is_open != 2) {
-                                       ErrPrint("Invalid state (%s)\n", name);
-                                       DbgFree(name);
-                                       return LB_STATUS_ERROR_FAULT;
-                               }
-
-                               if (group_add_option(item, key, name) < 0) {
-                                       ErrPrint("Failed to add a new option: %s - %s\n", key, name);
-                               }
-
-                               DbgFree(key);
-                               key = NULL;
-
-                               state = CONTEXT_ITEM;
-                               break;
-                       case CONTEXT_OPTION_KEY:
-                       case CLUSTER:
-                       default:
-                               ErrPrint("Invalid state (%s)\n", name);
-                               break;
+                       if (!category) {
+                           ErrPrint("Failed to get category\n");
+                           DbgFree(name);
+                           return DBOX_STATUS_ERROR_FAULT;
                        }
 
+                       info = group_create_context_info(category, pkgname);
+                       if (!info) {
+                           ErrPrint("Failed to create ctx info\n");
+                           DbgFree(name);
+                           return DBOX_STATUS_ERROR_FAULT;
+                       }
+                   } else if (is_open == 2) {
+                       item = group_add_context_item(info, name);
+                       if (!item) {
+                           ErrPrint("Failed to create a context item\n");
+                           DbgFree(name);
+                           return DBOX_STATUS_ERROR_FAULT;
+                       }
+                       state = CONTEXT_OPTION_KEY;
+                   } else {
+                       ErrPrint("Invalid state\n");
                        DbgFree(name);
-                       is_open--;
-                       len = 0;
-                       ptr++;
-                       while (*ptr && isspace(*ptr)) ptr++;
-                       continue;
-               }
+                       return DBOX_STATUS_ERROR_FAULT;
+                   }
 
-               len++;
+                   break;
+               case CONTEXT_OPTION_VALUE:
+                   if (is_open != 3) {
+                       ErrPrint("Invalid state\n");
+                       DbgFree(name);
+                       return DBOX_STATUS_ERROR_FAULT;
+                   }
+
+                   if (group_add_option(item, key, name) < 0) {
+                       ErrPrint("Failed to add a new option: %s - %s\n", key, name);
+                   }
+
+                   DbgFree(key);
+                   key = NULL;
+
+                   state = CONTEXT_OPTION_KEY;
+                   break;
+               case CONTEXT_OPTION_KEY:
+               default:
+                   ErrPrint("Invalid state (%s)\n", name);
+                   DbgFree(name);
+                   return DBOX_STATUS_ERROR_FAULT;
+           }
+
+           DbgFree(name);
+           len = 0;
+           ptr++;
+           while (*ptr && isspace(*ptr)) ptr++;
+           continue;
+       } else if (*ptr == '=') {
+           if (is_open != 3 || state != CONTEXT_OPTION_KEY) {
+               ErrPrint("Invalid state\n");
+               return DBOX_STATUS_ERROR_FAULT;
+           }
+
+           key = get_token(ptr, &len);
+           if (!key) {
+               ErrPrint("Failed to get token\n");
+               return DBOX_STATUS_ERROR_FAULT;
+           }
+
+           state = CONTEXT_OPTION_VALUE;
+           len = 0;
+           ptr++;
+           while (*ptr && isspace(*ptr)) ptr++;
+           continue;
+       } else if (*ptr == '}') {
+           if (is_open <= 0) {
+               ErrPrint("Invalid state\n");
+               return DBOX_STATUS_ERROR_FAULT;
+           }
+
+           name = get_token(ptr, &len);
+           if (!name) {
+               ErrPrint("Failed to get token, len:%d\n", len);
+               is_open--;
+               len = 0;
                ptr++;
-       }
-
-       /* If some cases, the key is not released, try release it, doesn't need to check NULL */
-       DbgFree(key);
-
-       if (state != CLUSTER) {
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       return LB_STATUS_SUCCESS;
-}
+               while (*ptr && isspace(*ptr)) ptr++;
+               continue;
+           }
+
+           switch (state) {
+               case CATEGORY:
+                   category = group_find_category(cluster, name);
+                   if (!category) {
+                       category = group_create_category(cluster, name);
+                   }
+
+                   if (!category) {
+                       ErrPrint("Failed to get category\n");
+                       DbgFree(name);
+                       return DBOX_STATUS_ERROR_FAULT;
+                   }
 
-HAPI int group_del_livebox(const char *pkgname)
-{
-       Eina_List *l;
-       Eina_List *n;
-       Eina_List *s_l;
-       Eina_List *s_n;
-       Eina_List *i_l;
-       Eina_List *i_n;
-       struct cluster *cluster;
-       struct category *category;
-       struct context_info *info;
+                   info = group_create_context_info(category, pkgname);
+                   if (!info) {
+                       ErrPrint("Failed to create ctx info\n");
+                       DbgFree(name);
+                       return DBOX_STATUS_ERROR_FAULT;
+                   }
+
+                   state = CLUSTER;
+                   break;
+               case CONTEXT_ITEM:
+                   if (is_open == 1) {
+                       category = group_find_category(cluster, name);
+                       if (!category) {
+                           category = group_create_category(cluster, name);
+                       }
 
-       EINA_LIST_FOREACH_SAFE(s_info.cluster_list, l, n, cluster) {
-               EINA_LIST_FOREACH_SAFE(cluster->category_list, s_l, s_n, category) {
-                       EINA_LIST_FOREACH_SAFE(category->info_list, i_l, i_n, info) {
-                               if (!strcmp(pkgname, info->pkgname)) {
-                                       group_destroy_context_info(info);
-                               }
+                       if (!category) {
+                           ErrPrint("Failed to get category\n");
+                           DbgFree(name);
+                           return DBOX_STATUS_ERROR_FAULT;
                        }
 
-                       if (!category->info_list) {
-                               group_destroy_category(category);
+                       info = group_create_context_info(category, pkgname);
+                       if (!info) {
+                           ErrPrint("Failed to create ctx info\n");
+                           DbgFree(name);
+                           return DBOX_STATUS_ERROR_FAULT;
                        }
-               }
 
-               if (!cluster->category_list) {
-                       group_destroy_cluster(cluster);
+                       state = CLUSTER;
+                   } else if (is_open == 2) {
+                       state = CATEGORY;
+                   } else {
+                       ErrPrint("Invalid state\n");
+                       DbgFree(name);
+                       return DBOX_STATUS_ERROR_FAULT;
+                   }
+                   break;
+               case CONTEXT_OPTION_VALUE:
+                   if (is_open != 2) {
+                       ErrPrint("Invalid state (%s)\n", name);
+                       DbgFree(name);
+                       return DBOX_STATUS_ERROR_FAULT;
+                   }
+
+                   if (group_add_option(item, key, name) < 0) {
+                       ErrPrint("Failed to add a new option: %s - %s\n", key, name);
+                   }
+
+                   DbgFree(key);
+                   key = NULL;
+
+                   state = CONTEXT_ITEM;
+                   break;
+               case CONTEXT_OPTION_KEY:
+               case CLUSTER:
+               default:
+                   ErrPrint("Invalid state (%s)\n", name);
+                   break;
+           }
+
+           DbgFree(name);
+           is_open--;
+           len = 0;
+           ptr++;
+           while (*ptr && isspace(*ptr)) ptr++;
+           continue;
+       }
+
+       len++;
+       ptr++;
+    }
+
+    /* If some cases, the key is not released, try release it, doesn't need to check NULL */
+    DbgFree(key);
+
+    if (state != CLUSTER) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+HAPI int group_del_dynamicbox(const char *pkgname)
+{
+    Eina_List *l;
+    Eina_List *n;
+    Eina_List *s_l;
+    Eina_List *s_n;
+    Eina_List *i_l;
+    Eina_List *i_n;
+    struct cluster *cluster;
+    struct category *category;
+    struct context_info *info;
+
+    EINA_LIST_FOREACH_SAFE(s_info.cluster_list, l, n, cluster) {
+       EINA_LIST_FOREACH_SAFE(cluster->category_list, s_l, s_n, category) {
+           EINA_LIST_FOREACH_SAFE(category->info_list, i_l, i_n, info) {
+               if (!strcmp(pkgname, info->pkgname)) {
+                   group_destroy_context_info(info);
                }
+           }
+
+           if (!category->info_list) {
+               group_destroy_category(category);
+           }
        }
 
-       return LB_STATUS_SUCCESS;
+       if (!cluster->category_list) {
+           group_destroy_cluster(cluster);
+       }
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int group_init(void)
 {
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int group_fini(void)
 {
-       struct cluster *cluster;
-       struct category *category;
+    struct cluster *cluster;
+    struct category *category;
 
-       EINA_LIST_FREE(s_info.cluster_list, cluster) {
+    EINA_LIST_FREE(s_info.cluster_list, cluster) {
 
-               EINA_LIST_FREE(cluster->category_list, category) {
-                       destroy_category(category);
-               }
-
-               destroy_cluster(cluster);
+       EINA_LIST_FREE(cluster->category_list, category) {
+           destroy_category(category);
        }
-       return LB_STATUS_SUCCESS;
+
+       destroy_cluster(cluster);
+    }
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 /* End of a file */
index 32e6b91..dde7275 100644 (file)
 
 #include <packet.h>
 #include <com-core_packet.h>
-#include <livebox-service.h>
-#include <livebox-errno.h>
+#include <dynamicbox_service.h>
+#include <dynamicbox_errno.h>
+#include <dynamicbox_cmd_list.h>
+#include <dynamicbox_buffer.h>
+#include <dynamicbox_conf.h>
 
 #include "conf.h"
 #include "util.h"
 int errno;
 
 static struct info {
-       enum buffer_type env_buf_type;
+    enum dynamicbox_fb_type env_buf_type;
 } s_info = {
-       .env_buf_type = BUFFER_TYPE_FILE,
+    .env_buf_type = DBOX_FB_TYPE_FILE,
 };
 
 struct set_pinup_cbdata {
-       struct inst_info *inst;
-       int pinup;
+    struct inst_info *inst;
+    int pinup;
 };
 
 struct resize_cbdata {
-       struct inst_info *inst;
-       int w;
-       int h;
+    struct inst_info *inst;
+    int w;
+    int h;
 };
 
 struct update_mode_cbdata {
-       struct inst_info *inst;
-       int active_update;
+    struct inst_info *inst;
+    int active_update;
 };
 
 struct change_group_cbdata {
-       struct inst_info *inst;
-       char *cluster;
-       char *category;
+    struct inst_info *inst;
+    char *cluster;
+    char *category;
 };
 
 struct period_cbdata {
-       struct inst_info *inst;
-       double period;
+    struct inst_info *inst;
+    double period;
 };
 
 struct event_item {
-       int (*event_cb)(struct inst_info *inst, void *data);
-       void *data;
-       int deleted;
+    int (*event_cb)(struct inst_info *inst, void *data);
+    void *data;
+    int deleted;
 };
 
 struct tag_item {
-       char *tag;
-       void *data;
+    char *tag;
+    void *data;
 };
 
 struct inst_info {
-       struct pkg_info *info;
-
-       enum instance_state state; /*!< Represents current state */
-       enum instance_state requested_state; /*!< Only ACTIVATED | DESTROYED is acceptable */
-       enum instance_destroy_type destroy_type;
-       int changing_state;
-
-       char *id;
-       double timestamp;
-
-       char *content;
-       char *cluster;
-       char *category;
-       char *title;
-       int is_pinned_up;
-       double sleep_at;
-       int scroll_locked; /*!< Scroller which is in viewer is locked. */
-       int active_update; /*!< Viewer will reload the buffer by itself, so the provider doesn't need to send the updated event */
-
-       char *icon;
-       char *name;
-
-       enum livebox_visible_state visible;
-
-       struct {
-               int width;
-               int height;
-               double priority;
-
-               union {
-                       struct script_info *script;
-                       struct buffer_info *buffer;
-               } canvas;
-
-               double period;
-       } lb;
-
-       struct {
-               int width;
-               int height;
-               double x;
-               double y;
-
-               union {
-                       struct script_info *script;
-                       struct buffer_info *buffer;
-               } canvas;
-
-               struct client_node *owner;
-               int is_opened_for_reactivate;
-               int need_to_send_close_event;
-               char *pended_update_desc;
-               int pended_update_cnt;
-       } pd;
-
-       struct client_node *client; /*!< Owner - creator */
-       Eina_List *client_list; /*!< Viewer list */
-       int refcnt;
-
-       Ecore_Timer *update_timer; /*!< Only used for secured livebox */
-
-       enum event_process {
-               INST_EVENT_PROCESS_IDLE = 0x00,
-               INST_EVENT_PROCESS_DELETE = 0x01
-       } in_event_process;
-       Eina_List *delete_event_list;
-
-       Eina_List *data_list;
+    struct pkg_info *info;
+
+    enum instance_state state; /*!< Represents current state */
+    enum instance_state requested_state; /*!< Only ACTIVATED | DESTROYED is acceptable */
+    dynamicbox_destroy_type_e destroy_type;
+    int changing_state;
+    int unicast_delete_event;
+
+    char *id;
+    double timestamp;
+
+    char *content;
+    char *cluster;
+    char *category;
+    char *title;
+    int is_pinned_up;
+    double sleep_at;
+    int scroll_locked; /*!< Scroller which is in viewer is locked. */
+    int active_update; /*!< Viewer will reload the buffer by itself, so the provider doesn't need to send the updated event */
+
+    char *icon;
+    char *name;
+
+    enum dynamicbox_visible_state visible;
+
+    struct {
+       int width;
+       int height;
+       double priority;
+
+       union {
+           struct script_info *script;
+           struct buffer_info *buffer;
+       } canvas;
+
+       struct buffer_info **extra_buffer;
+
+       double period;
+    } dbox;
+
+    struct {
+       int width;
+       int height;
+       double x;
+       double y;
+
+       union {
+           struct script_info *script;
+           struct buffer_info *buffer;
+       } canvas;
+
+       struct buffer_info **extra_buffer;
+
+       struct client_node *owner;
+       int is_opened_for_reactivate;
+       int need_to_send_close_event;
+       char *pended_update_desc;
+       int pended_update_cnt;
+    } gbar;
+
+    struct client_node *client; /*!< Owner - creator */
+    Eina_List *client_list; /*!< Viewer list */
+    int refcnt;
+
+    Ecore_Timer *update_timer; /*!< Only used for secured dynamicbox */
+
+    enum event_process {
+       INST_EVENT_PROCESS_IDLE = 0x00,
+       INST_EVENT_PROCESS_DELETE = 0x01
+    } in_event_process;
+    Eina_List *delete_event_list;
+
+    Eina_List *data_list;
 };
 
 #define CLIENT_SEND_EVENT(instance, packet)    ((instance)->client ? client_rpc_async_request((instance)->client, (packet)) : client_broadcast((instance), (packet)))
@@ -164,2606 +172,2824 @@ static Eina_Bool update_timer_cb(void *data);
 
 static inline void timer_thaw(struct inst_info *inst)
 {
-       double pending;
-       double period;
-       double delay;
-       double sleep_time;
+    double pending;
+    double period;
+    double delay;
+    double sleep_time;
 
-       ecore_timer_thaw(inst->update_timer);
-       period = ecore_timer_interval_get(inst->update_timer);
-       pending = ecore_timer_pending_get(inst->update_timer);
-       delay = util_time_delay_for_compensation(period) - pending;
-       ecore_timer_delay(inst->update_timer, delay);
+    ecore_timer_thaw(inst->update_timer);
+    period = ecore_timer_interval_get(inst->update_timer);
+    pending = ecore_timer_pending_get(inst->update_timer);
+    delay = util_time_delay_for_compensation(period) - pending;
+    ecore_timer_delay(inst->update_timer, delay);
 
-       if (inst->sleep_at == 0.0f) {
-               return;
-       }
+    if (inst->sleep_at == 0.0f) {
+       return;
+    }
 
-       sleep_time = util_timestamp() - inst->sleep_at;
-       if (sleep_time > pending) {
-               (void)update_timer_cb(inst);
-       }
+    sleep_time = util_timestamp() - inst->sleep_at;
+    if (sleep_time > pending) {
+       (void)update_timer_cb(inst);
+    }
 
-       inst->sleep_at = 0.0f;
+    inst->sleep_at = 0.0f;
 }
 
 static inline void timer_freeze(struct inst_info *inst)
 {
-       ecore_timer_freeze(inst->update_timer);
+    ecore_timer_freeze(inst->update_timer);
 
-       if (ecore_timer_interval_get(inst->update_timer) <= 1.0f) {
-               return;
-       }
+    if (ecore_timer_interval_get(inst->update_timer) <= 1.0f) {
+       return;
+    }
 
 #if defined(_USE_ECORE_TIME_GET)
-       inst->sleep_at = ecore_time_get();
+    inst->sleep_at = ecore_time_get();
 #else
-       struct timeval tv;
-       if (gettimeofday(&tv, NULL) < 0) {
-               ErrPrint("gettimeofday: %s\n", strerror(errno));
-               tv.tv_sec = 0;
-               tv.tv_usec = 0;
-       }
-       inst->sleep_at = (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0f;
+    struct timeval tv;
+    if (gettimeofday(&tv, NULL) < 0) {
+       ErrPrint("gettimeofday: %s\n", strerror(errno));
+       tv.tv_sec = 0;
+       tv.tv_usec = 0;
+    }
+    inst->sleep_at = (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0f;
 #endif
 }
 
-
 static int viewer_deactivated_cb(struct client_node *client, void *data)
 {
-       struct inst_info *inst = data;
+    struct inst_info *inst = data;
 
-       DbgPrint("%d is deleted from the list of viewer of %s(%s)\n", client_pid(client), package_name(instance_package(inst)), instance_id(inst));
-       if (!eina_list_data_find(inst->client_list, client)) {
-               ErrPrint("Not found\n");
-               return LB_STATUS_ERROR_NOT_EXIST;
-       }
+    DbgPrint("%d is deleted from the list of viewer of %s(%s)\n", client_pid(client), package_name(instance_package(inst)), instance_id(inst));
+    if (!eina_list_data_find(inst->client_list, client)) {
+       ErrPrint("Not found\n");
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
 
-       inst->client_list = eina_list_remove(inst->client_list, client);
-       if (!inst->client_list && !inst->client) {
-               DbgPrint("Has no clients\n");
-               instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
-       }
+    inst->client_list = eina_list_remove(inst->client_list, client);
+    if (!inst->client_list && !inst->client) {
+       DbgPrint("Has no clients\n");
+       instance_destroy(inst, DBOX_DESTROY_TYPE_FAULT);
+    }
 
-       instance_unref(inst);
-       return -1; /*!< Remove this callback from the cb list */
+    instance_unref(inst);
+    return -1; /*!< Remove this callback from the cb list */
 }
 
-static int pause_livebox(struct inst_info *inst)
+static int pause_dynamicbox(struct inst_info *inst)
 {
-       struct packet *packet;
+    struct packet *packet;
+    unsigned int cmd = CMD_DBOX_PAUSE;
 
-       packet = packet_create_noack("lb_pause", "ss", package_name(inst->info), inst->id);
-       if (!packet) {
-               ErrPrint("Failed to create a new packet\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    packet = packet_create_noack((const char *)&cmd, "ss", package_name(inst->info), inst->id);
+    if (!packet) {
+       ErrPrint("Failed to create a new packet\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       return slave_rpc_request_only(package_slave(inst->info), package_name(inst->info), packet, 0);
+    return slave_rpc_request_only(package_slave(inst->info), package_name(inst->info), packet, 0);
 }
 
 /*! \TODO Wake up the freeze'd timer */
-static int resume_livebox(struct inst_info *inst)
+static int resume_dynamicbox(struct inst_info *inst)
 {
-       struct packet *packet;
+    struct packet *packet;
+    unsigned int cmd = CMD_DBOX_RESUME;
 
-       packet = packet_create_noack("lb_resume", "ss", package_name(inst->info), inst->id);
-       if (!packet) {
-               ErrPrint("Failed to create a new packet\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    packet = packet_create_noack((const char *)&cmd, "ss", package_name(inst->info), inst->id);
+    if (!packet) {
+       ErrPrint("Failed to create a new packet\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       return slave_rpc_request_only(package_slave(inst->info), package_name(inst->info), packet, 0);
+    return slave_rpc_request_only(package_slave(inst->info), package_name(inst->info), packet, 0);
 }
 
 static inline int instance_recover_visible_state(struct inst_info *inst)
 {
-       int ret;
+    int ret;
 
-       switch (inst->visible) {
-       case LB_SHOW:
-       case LB_HIDE:
-               instance_thaw_updator(inst);
+    switch (inst->visible) {
+    case DBOX_SHOW:
+    case DBOX_HIDE:
+       instance_thaw_updator(inst);
 
-               ret = 0;
-               break;
-       case LB_HIDE_WITH_PAUSE:
-               ret = pause_livebox(inst);
+       ret = 0;
+       break;
+    case DBOX_HIDE_WITH_PAUSE:
+       ret = pause_dynamicbox(inst);
 
-               instance_freeze_updator(inst);
-               break;
-       default:
-               ret = LB_STATUS_ERROR_INVALID;
-               break;
-       }
+       instance_freeze_updator(inst);
+       break;
+    default:
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       break;
+    }
 
-       DbgPrint("Visible state is recovered to %d\n", ret);
-       return ret;
+    DbgPrint("Visible state is recovered to %d\n", ret);
+    return ret;
 }
 
 static inline void instance_send_update_mode_event(struct inst_info *inst, int active_mode, int status)
 {
-       struct packet *packet;
-       const char *pkgname;
+    struct packet *packet;
+    const char *pkgname;
+    unsigned int cmd = CMD_RESULT_UPDATE_MODE;
 
-       if (!inst->info) {
-               ErrPrint("Instance info is not ready to use\n");
-               return;
-       }
+    if (!inst->info) {
+       ErrPrint("Instance info is not ready to use\n");
+       return;
+    }
 
-       pkgname = package_name(inst->info);
+    pkgname = package_name(inst->info);
 
-       packet = packet_create_noack("update_mode", "ssii", pkgname, inst->id, status, active_mode);
-       if (packet) {
-               CLIENT_SEND_EVENT(inst, packet);
-       } else {
-               ErrPrint("Failed to send update mode event\n");
-       }
+    packet = packet_create_noack((const char *)&cmd, "ssii", pkgname, inst->id, status, active_mode);
+    if (packet) {
+       CLIENT_SEND_EVENT(inst, packet);
+    } else {
+       ErrPrint("Failed to send update mode event\n");
+    }
 }
 
-static inline void instance_send_resized_event(struct inst_info *inst, int is_pd, int w, int h, int status)
+static inline void instance_send_update_id(struct inst_info *inst)
 {
-       struct packet *packet;
-       enum lb_type lb_type;
-       const char *pkgname;
-       const char *id;
+    struct packet *packet;
+    unsigned int cmd = CMD_UPDATE_ID;
 
-       if (!inst->info) {
-               ErrPrint("Instance info is not ready to use\n");
-               return;
-       }
+    packet = packet_create_noack((const char *)&cmd, "ds", inst->timestamp, inst->id);
+    if (packet) {
+       CLIENT_SEND_EVENT(inst, packet);
+    } else {
+       ErrPrint("Failed to create update_id packet\n");
+    }
+}
 
-       pkgname = package_name(inst->info);
+static inline void instance_send_resized_event(struct inst_info *inst, int is_gbar, int w, int h, int status)
+{
+    struct packet *packet;
+    enum dynamicbox_dbox_type dbox_type;
+    const char *pkgname;
+    const char *id;
+    unsigned int cmd = CMD_SIZE_CHANGED;
 
-       lb_type = package_lb_type(inst->info);
-       if (lb_type == LB_TYPE_SCRIPT) {
-               id = script_handler_buffer_id(inst->lb.canvas.script);
-       } else if (lb_type == LB_TYPE_BUFFER) {
-               id = buffer_handler_id(inst->lb.canvas.buffer);
-       } else {
-               id = "";
-       }
+    if (!inst->info) {
+       ErrPrint("Instance info is not ready to use\n");
+       return;
+    }
 
-       packet = packet_create_noack("size_changed", "sssiiii", pkgname, inst->id, id, is_pd, w, h, status);
-       if (packet) {
-               CLIENT_SEND_EVENT(inst, packet);
-       } else {
-               ErrPrint("Failed to send size changed event\n");
-       }
+    pkgname = package_name(inst->info);
+
+    dbox_type = package_dbox_type(inst->info);
+    if (dbox_type == DBOX_TYPE_SCRIPT) {
+       id = script_handler_buffer_id(inst->dbox.canvas.script);
+    } else if (dbox_type == DBOX_TYPE_BUFFER) {
+       id = buffer_handler_id(inst->dbox.canvas.buffer);
+    } else {
+       id = "";
+    }
+
+    packet = packet_create_noack((const char *)&cmd, "sssiiii", pkgname, inst->id, id, is_gbar, w, h, status);
+    if (packet) {
+       CLIENT_SEND_EVENT(inst, packet);
+    } else {
+       ErrPrint("Failed to send size changed event\n");
+    }
 }
 
 static void update_mode_cb(struct slave_node *slave, const struct packet *packet, void *data)
 {
-       struct update_mode_cbdata *cbdata = data;
-       int ret;
+    struct update_mode_cbdata *cbdata = data;
+    int ret;
 
-       if (!packet) {
-               ErrPrint("Invalid packet\n");
-               ret = LB_STATUS_ERROR_FAULT;
-               goto out;
-       }
+    if (!packet) {
+       ErrPrint("Invalid packet\n");
+       ret = DBOX_STATUS_ERROR_FAULT;
+       goto out;
+    }
 
-       if (packet_get(packet, "i", &ret) != 1) {
-               ErrPrint("Invalid parameters\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
+    if (packet_get(packet, "i", &ret) != 1) {
+       ErrPrint("Invalid parameters\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
 
-       if (ret == (int)LB_STATUS_SUCCESS) {
-               cbdata->inst->active_update = cbdata->active_update;
-       }
+    if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+       cbdata->inst->active_update = cbdata->active_update;
+    }
 
 out:
-       instance_send_update_mode_event(cbdata->inst, cbdata->active_update, ret);
-       instance_unref(cbdata->inst);
-       DbgFree(cbdata);
+    instance_send_update_mode_event(cbdata->inst, cbdata->active_update, ret);
+    instance_unref(cbdata->inst);
+    DbgFree(cbdata);
 }
 
 HAPI int instance_unicast_created_event(struct inst_info *inst, struct client_node *client)
 {
-       struct packet *packet;
-       enum lb_type lb_type;
-       enum pd_type pd_type;
-       const char *lb_file;
-       const char *pd_file;
+    struct packet *packet;
+    enum dynamicbox_dbox_type dbox_type;
+    enum dynamicbox_gbar_type gbar_type;
+    const char *dbox_file;
+    const char *gbar_file;
+    unsigned int cmd = CMD_CREATED;
 
+    if (!client) {
+       client = inst->client;
        if (!client) {
-               client = inst->client;
-               if (!client) {
-                       return LB_STATUS_SUCCESS;
-               }
-       }
-
-       lb_type = package_lb_type(inst->info);
-       pd_type = package_pd_type(inst->info);
-
-       if (lb_type == LB_TYPE_SCRIPT) {
-               lb_file = script_handler_buffer_id(inst->lb.canvas.script);
-       } else if (lb_type == LB_TYPE_BUFFER) {
-               lb_file = buffer_handler_id(inst->lb.canvas.buffer);
-       } else {
-               lb_file = "";
-       }
-
-       if (pd_type == PD_TYPE_SCRIPT) {
-               pd_file = script_handler_buffer_id(inst->pd.canvas.script);
-       } else if (pd_type == PD_TYPE_BUFFER) {
-               pd_file = buffer_handler_id(inst->pd.canvas.buffer);
-       } else {
-               pd_file = "";
-       }
-
-       packet = packet_create_noack("created", "dsssiiiisssssdiiiiidsi",
-                       inst->timestamp,
-                       package_name(inst->info), inst->id, inst->content,
-                       inst->lb.width, inst->lb.height,
-                       inst->pd.width, inst->pd.height,
-                       inst->cluster, inst->category,
-                       lb_file, pd_file,
-                       package_auto_launch(inst->info),
-                       inst->lb.priority,
-                       package_size_list(inst->info),
-                       !!inst->client,
-                       package_pinup(inst->info),
-                       lb_type, pd_type,
-                       inst->lb.period, inst->title,
-                       inst->is_pinned_up);
-       if (!packet) {
-               ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       return client_rpc_async_request(client, packet);
+           return DBOX_STATUS_ERROR_NONE;
+       }
+    }
+
+    dbox_type = package_dbox_type(inst->info);
+    gbar_type = package_gbar_type(inst->info);
+
+    if (dbox_type == DBOX_TYPE_SCRIPT) {
+       dbox_file = script_handler_buffer_id(inst->dbox.canvas.script);
+    } else if (dbox_type == DBOX_TYPE_BUFFER) {
+       dbox_file = buffer_handler_id(inst->dbox.canvas.buffer);
+    } else {
+       dbox_file = "";
+    }
+
+    if (gbar_type == GBAR_TYPE_SCRIPT) {
+       gbar_file = script_handler_buffer_id(inst->gbar.canvas.script);
+    } else if (gbar_type == GBAR_TYPE_BUFFER) {
+       gbar_file = buffer_handler_id(inst->gbar.canvas.buffer);
+    } else {
+       gbar_file = "";
+    }
+
+    packet = packet_create_noack((const char *)&cmd, "dsssiiiisssssdiiiiidsi",
+           inst->timestamp,
+           package_name(inst->info), inst->id, inst->content,
+           inst->dbox.width, inst->dbox.height,
+           inst->gbar.width, inst->gbar.height,
+           inst->cluster, inst->category,
+           dbox_file, gbar_file,
+           package_auto_launch(inst->info),
+           inst->dbox.priority,
+           package_size_list(inst->info),
+           !!inst->client,
+           package_pinup(inst->info),
+           dbox_type, gbar_type,
+           inst->dbox.period, inst->title,
+           inst->is_pinned_up);
+    if (!packet) {
+       ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    return client_rpc_async_request(client, packet);
 }
 
 static int update_client_list(struct client_node *client, void *data)
 {
-       struct inst_info *inst = data;
+    struct inst_info *inst = data;
 
-       if (!instance_has_client(inst, client)) {
-               instance_add_client(inst, client);
-       }
+    if (!instance_has_client(inst, client)) {
+       instance_add_client(inst, client);
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static int instance_broadcast_created_event(struct inst_info *inst)
 {
-       struct packet *packet;
-       enum lb_type lb_type;
-       enum pd_type pd_type;
-       const char *lb_file;
-       const char *pd_file;
-
-       lb_type = package_lb_type(inst->info);
-       pd_type = package_pd_type(inst->info);
-
-       if (lb_type == LB_TYPE_SCRIPT) {
-               lb_file = script_handler_buffer_id(inst->lb.canvas.script);
-       } else if (lb_type == LB_TYPE_BUFFER) {
-               lb_file = buffer_handler_id(inst->lb.canvas.buffer);
-       } else {
-               lb_file = "";
-       }
-
-       if (pd_type == PD_TYPE_SCRIPT) {
-               pd_file = script_handler_buffer_id(inst->pd.canvas.script);
-       } else if (pd_type == PD_TYPE_BUFFER) {
-               pd_file = buffer_handler_id(inst->pd.canvas.buffer);
-       } else {
-               pd_file = "";
-       }
-
-       if (!inst->client) {
-               client_browse_list(inst->cluster, inst->category, update_client_list, inst);
-       }
-
-       packet = packet_create_noack("created", "dsssiiiisssssdiiiiidsi", 
-                       inst->timestamp,
-                       package_name(inst->info), inst->id, inst->content,
-                       inst->lb.width, inst->lb.height,
-                       inst->pd.width, inst->pd.height,
-                       inst->cluster, inst->category,
-                       lb_file, pd_file,
-                       package_auto_launch(inst->info),
-                       inst->lb.priority,
-                       package_size_list(inst->info),
-                       !!inst->client,
-                       package_pinup(inst->info),
-                       lb_type, pd_type,
-                       inst->lb.period, inst->title,
-                       inst->is_pinned_up);
-       if (!packet) {
-               ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       return CLIENT_SEND_EVENT(inst, packet);
+    struct packet *packet;
+    enum dynamicbox_dbox_type dbox_type;
+    enum dynamicbox_gbar_type gbar_type;
+    const char *dbox_file;
+    const char *gbar_file;
+    unsigned int cmd = CMD_CREATED;
+
+    dbox_type = package_dbox_type(inst->info);
+    gbar_type = package_gbar_type(inst->info);
+
+    if (dbox_type == DBOX_TYPE_SCRIPT) {
+       dbox_file = script_handler_buffer_id(inst->dbox.canvas.script);
+    } else if (dbox_type == DBOX_TYPE_BUFFER) {
+       dbox_file = buffer_handler_id(inst->dbox.canvas.buffer);
+    } else {
+       dbox_file = "";
+    }
+
+    if (gbar_type == GBAR_TYPE_SCRIPT) {
+       gbar_file = script_handler_buffer_id(inst->gbar.canvas.script);
+    } else if (gbar_type == GBAR_TYPE_BUFFER) {
+       gbar_file = buffer_handler_id(inst->gbar.canvas.buffer);
+    } else {
+       gbar_file = "";
+    }
+
+    if (!inst->client) {
+       client_browse_list(inst->cluster, inst->category, update_client_list, inst);
+    }
+
+    packet = packet_create_noack((const char *)&cmd, "dsssiiiisssssdiiiiidsi", 
+           inst->timestamp,
+           package_name(inst->info), inst->id, inst->content,
+           inst->dbox.width, inst->dbox.height,
+           inst->gbar.width, inst->gbar.height,
+           inst->cluster, inst->category,
+           dbox_file, gbar_file,
+           package_auto_launch(inst->info),
+           inst->dbox.priority,
+           package_size_list(inst->info),
+           !!inst->client,
+           package_pinup(inst->info),
+           dbox_type, gbar_type,
+           inst->dbox.period, inst->title,
+           inst->is_pinned_up);
+    if (!packet) {
+       ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    inst->unicast_delete_event = 0;
+    return CLIENT_SEND_EVENT(inst, packet);
 }
 
 HAPI int instance_unicast_deleted_event(struct inst_info *inst, struct client_node *client, int reason)
 {
-       struct packet *packet;
+    struct packet *packet;
+    unsigned int cmd = CMD_DELETED;
 
+    if (!client) {
+       client = inst->client;
        if (!client) {
-               client = inst->client;
-               if (!client) {
-                       return LB_STATUS_ERROR_INVALID;
-               }
+           return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
+    }
 
-       packet = packet_create_noack("deleted", "ssdi", package_name(inst->info), inst->id, inst->timestamp, reason);
-       if (!packet) {
-               ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
-               return LB_STATUS_ERROR_FAULT;
-       }
-               
-       return client_rpc_async_request(client, packet);
+    packet = packet_create_noack((const char *)&cmd, "ssdi", package_name(inst->info), inst->id, inst->timestamp, reason);
+    if (!packet) {
+       ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    return client_rpc_async_request(client, packet);
 }
 
 static int instance_broadcast_deleted_event(struct inst_info *inst, int reason)
 {
-       struct packet *packet;
-       struct client_node *client;
-       Eina_List *l;
-       Eina_List *n;
-       int ret;
+    struct packet *packet;
+    struct client_node *client;
+    Eina_List *l;
+    Eina_List *n;
+    int ret;
+    unsigned int cmd = CMD_DELETED;
 
-       packet = packet_create_noack("deleted", "ssdi", package_name(inst->info), inst->id, inst->timestamp, reason);
-       if (!packet) {
-               ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
-               return LB_STATUS_ERROR_FAULT;
-       }
-               
-       ret = CLIENT_SEND_EVENT(inst, packet);
+    packet = packet_create_noack((const char *)&cmd, "ssdi", package_name(inst->info), inst->id, inst->timestamp, reason);
+    if (!packet) {
+       ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       EINA_LIST_FOREACH_SAFE(inst->client_list, l, n, client) {
-               instance_del_client(inst, client);
-       }
+    ret = CLIENT_SEND_EVENT(inst, packet);
 
-       return ret;
+    EINA_LIST_FOREACH_SAFE(inst->client_list, l, n, client) {
+       instance_del_client(inst, client);
+    }
+
+    return ret;
 }
 
 static int client_deactivated_cb(struct client_node *client, void *data)
 {
-       struct inst_info *inst = data;
-       instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
-       return LB_STATUS_SUCCESS;
+    struct inst_info *inst = data;
+    instance_destroy(inst, DBOX_DESTROY_TYPE_FAULT);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
-static int send_pd_destroyed_to_client(struct inst_info *inst, int status)
+static int send_gbar_destroyed_to_client(struct inst_info *inst, int status)
 {
-       struct packet *packet;
+    struct packet *packet;
+    unsigned int cmd = CMD_GBAR_DESTROYED;
 
-       if (!inst->pd.need_to_send_close_event && status != LB_STATUS_ERROR_FAULT) {
-               ErrPrint("PD is not created\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!inst->gbar.need_to_send_close_event && status != DBOX_STATUS_ERROR_FAULT) {
+       ErrPrint("GBAR is not created\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       packet = packet_create_noack("pd_destroyed", "ssi", package_name(inst->info), inst->id, status);
-       if (!packet) {
-               ErrPrint("Failed to create a packet\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    packet = packet_create_noack((const char *)&cmd, "ssi", package_name(inst->info), inst->id, status);
+    if (!packet) {
+       ErrPrint("Failed to create a packet\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       inst->pd.need_to_send_close_event = 0;
+    inst->gbar.need_to_send_close_event = 0;
 
-       return CLIENT_SEND_EVENT(inst, packet);
+    return CLIENT_SEND_EVENT(inst, packet);
 }
 
 static inline void invoke_delete_callbacks(struct inst_info *inst)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct event_item *item;
+    Eina_List *l;
+    Eina_List *n;
+    struct event_item *item;
 
-       inst->in_event_process |= INST_EVENT_PROCESS_DELETE;
-       EINA_LIST_FOREACH_SAFE(inst->delete_event_list, l, n, item) {
-               if (item->deleted || item->event_cb(inst, item->data) < 0 || item->deleted) {
-                       inst->delete_event_list = eina_list_remove(inst->delete_event_list, item);
-                       DbgFree(item);
-               }
+    inst->in_event_process |= INST_EVENT_PROCESS_DELETE;
+    EINA_LIST_FOREACH_SAFE(inst->delete_event_list, l, n, item) {
+       if (item->deleted || item->event_cb(inst, item->data) < 0 || item->deleted) {
+           inst->delete_event_list = eina_list_remove(inst->delete_event_list, item);
+           DbgFree(item);
        }
-       inst->in_event_process &= ~INST_EVENT_PROCESS_DELETE;
+    }
+    inst->in_event_process &= ~INST_EVENT_PROCESS_DELETE;
 }
 
-HAPI int instance_event_callback_add(struct inst_info *inst, enum instance_event type, int (*event_cb)(struct inst_info *inst, void *data), void *data)
+HAPI int instance_event_callback_is_added(struct inst_info *inst, enum instance_event type, int (*event_cb)(struct inst_info *inst, void *data), void *data)
 {
-       struct event_item *item;
+    struct event_item *item;
+    Eina_List *l;
+
+    if (!event_cb) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (!event_cb) {
-               return LB_STATUS_ERROR_INVALID;
+    switch (type) {
+    case INSTANCE_EVENT_DESTROY:
+       EINA_LIST_FOREACH(inst->delete_event_list, l, item) {
+           if (item->event_cb == event_cb && item->data == data) {
+               return 1;
+           }
        }
 
-       switch (type) {
-       case INSTANCE_EVENT_DESTROY:
-               item = malloc(sizeof(*item));
-               if (!item) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       return LB_STATUS_ERROR_MEMORY;
-               }
+       break;
+    default:
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    return 0;
+}
 
-               item->event_cb = event_cb;
-               item->data = data;
-               item->deleted = 0;
+HAPI int instance_event_callback_add(struct inst_info *inst, enum instance_event type, int (*event_cb)(struct inst_info *inst, void *data), void *data)
+{
+    struct event_item *item;
 
-               inst->delete_event_list = eina_list_append(inst->delete_event_list, item);
-               break;
-       default:
-               return LB_STATUS_ERROR_INVALID;
+    if (!event_cb) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    switch (type) {
+    case INSTANCE_EVENT_DESTROY:
+       item = malloc(sizeof(*item));
+       if (!item) {
+           ErrPrint("Heap: %s\n", strerror(errno));
+           return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
        }
 
-       return LB_STATUS_SUCCESS;
+       item->event_cb = event_cb;
+       item->data = data;
+       item->deleted = 0;
+
+       inst->delete_event_list = eina_list_append(inst->delete_event_list, item);
+       break;
+    default:
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int instance_event_callback_del(struct inst_info *inst, enum instance_event type, int (*event_cb)(struct inst_info *inst, void *data), void *data)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct event_item *item;
-
-       switch (type) {
-       case INSTANCE_EVENT_DESTROY:
-               EINA_LIST_FOREACH_SAFE(inst->delete_event_list, l, n, item) {
-                       if (item->event_cb == event_cb && item->data == data) {
-                               if (inst->in_event_process & INST_EVENT_PROCESS_DELETE) {
-                                       item->deleted = 1;
-                               } else {
-                                       inst->delete_event_list = eina_list_remove(inst->delete_event_list, item);
-                                       DbgFree(item);
-                               }
-                               return LB_STATUS_SUCCESS;
-                       }
+    Eina_List *l;
+    Eina_List *n;
+    struct event_item *item;
+
+    switch (type) {
+    case INSTANCE_EVENT_DESTROY:
+       EINA_LIST_FOREACH_SAFE(inst->delete_event_list, l, n, item) {
+           if (item->event_cb == event_cb && item->data == data) {
+               if (inst->in_event_process & INST_EVENT_PROCESS_DELETE) {
+                   item->deleted = 1;
+               } else {
+                   inst->delete_event_list = eina_list_remove(inst->delete_event_list, item);
+                   DbgFree(item);
                }
-               break;
-       default:
-               break;
+               return DBOX_STATUS_ERROR_NONE;
+           }
        }
+       break;
+    default:
+       break;
+    }
 
-       return LB_STATUS_ERROR_NOT_EXIST;
+    return DBOX_STATUS_ERROR_NOT_EXIST;
 }
 
 static inline void destroy_instance(struct inst_info *inst)
 {
-       struct pkg_info *pkg;
-       enum lb_type lb_type;
-       enum pd_type pd_type;
-       struct slave_node *slave;
-       struct event_item *item;
-       struct tag_item *tag_item;
+    struct pkg_info *pkg;
+    enum dynamicbox_dbox_type dbox_type;
+    enum dynamicbox_gbar_type gbar_type;
+    struct slave_node *slave;
+    struct event_item *item;
+    struct tag_item *tag_item;
 
-       (void)send_pd_destroyed_to_client(inst, LB_STATUS_SUCCESS);
+    (void)send_gbar_destroyed_to_client(inst, DBOX_STATUS_ERROR_NONE);
 
-       invoke_delete_callbacks(inst);
+    invoke_delete_callbacks(inst);
 
-       pkg = inst->info;
+    pkg = inst->info;
 
-       lb_type = package_lb_type(pkg);
-       pd_type = package_pd_type(pkg);
-       slave = package_slave(inst->info);
+    dbox_type = package_dbox_type(pkg);
+    gbar_type = package_gbar_type(pkg);
+    slave = package_slave(inst->info);
 
-       DbgPrint("Instance is destroyed (%p), slave(%p)\n", inst, slave);
+    DbgPrint("Instance is destroyed (%p), slave(%p)\n", inst, slave);
 
-       if (lb_type == LB_TYPE_SCRIPT) {
-               (void)script_handler_unload(inst->lb.canvas.script, 0);
-               if (script_handler_destroy(inst->lb.canvas.script) == (int)LB_STATUS_SUCCESS) {
-                       inst->lb.canvas.script = NULL;
-               }
-       } else if (lb_type == LB_TYPE_BUFFER) {
-               (void)buffer_handler_unload(inst->lb.canvas.buffer);
-               if (buffer_handler_destroy(inst->lb.canvas.buffer) == (int)LB_STATUS_SUCCESS) {
-                       inst->lb.canvas.buffer = NULL;
-               }
+    if (dbox_type == DBOX_TYPE_SCRIPT) {
+       (void)script_handler_unload(inst->dbox.canvas.script, 0);
+       if (script_handler_destroy(inst->dbox.canvas.script) == (int)DBOX_STATUS_ERROR_NONE) {
+           inst->dbox.canvas.script = NULL;
        }
+    } else if (dbox_type == DBOX_TYPE_BUFFER) {
+       (void)buffer_handler_unload(inst->dbox.canvas.buffer);
+       if (buffer_handler_destroy(inst->dbox.canvas.buffer) == (int)DBOX_STATUS_ERROR_NONE) {
+           inst->dbox.canvas.buffer = NULL;
+       }
+
+       if (inst->dbox.extra_buffer) {
+           int i;
 
-       if (pd_type == PD_TYPE_SCRIPT) {
-               (void)script_handler_unload(inst->pd.canvas.script, 1);
-               if (script_handler_destroy(inst->pd.canvas.script) == (int)LB_STATUS_SUCCESS) {
-                       inst->pd.canvas.script = NULL;
+           for (i = 0; i < DYNAMICBOX_CONF_EXTRA_BUFFER_COUNT; i++) {
+               if (!inst->dbox.extra_buffer[i]) {
+                   continue;
                }
-       } else if (pd_type == PD_TYPE_BUFFER) {
-               (void)buffer_handler_unload(inst->pd.canvas.buffer);
-               if (buffer_handler_destroy(inst->pd.canvas.buffer) == (int)LB_STATUS_SUCCESS) {
-                       inst->pd.canvas.buffer = NULL;
+
+               (void)buffer_handler_unload(inst->dbox.extra_buffer[i]);
+               if (buffer_handler_destroy(inst->dbox.extra_buffer[i]) == (int)DBOX_STATUS_ERROR_NONE) {
+                   inst->dbox.extra_buffer[i] = NULL;
                }
-       }
+           }
 
-       if (inst->client) {
-               client_event_callback_del(inst->client, CLIENT_EVENT_DEACTIVATE, client_deactivated_cb, inst);
-               client_unref(inst->client);
+           DbgFree(inst->dbox.extra_buffer);
+           inst->dbox.extra_buffer = NULL;
        }
+    }
 
-       if (inst->update_timer) {
-               ecore_timer_del(inst->update_timer);
+    if (gbar_type == GBAR_TYPE_SCRIPT) {
+       (void)script_handler_unload(inst->gbar.canvas.script, 1);
+       if (script_handler_destroy(inst->gbar.canvas.script) == (int)DBOX_STATUS_ERROR_NONE) {
+           inst->gbar.canvas.script = NULL;
        }
-
-       EINA_LIST_FREE(inst->data_list, tag_item) {
-               DbgPrint("Tagged item[%s] %p\n", tag_item->tag, tag_item->data);
-               DbgFree(tag_item->tag);
-               DbgFree(tag_item);
+    } else if (gbar_type == GBAR_TYPE_BUFFER) {
+       (void)buffer_handler_unload(inst->gbar.canvas.buffer);
+       if (buffer_handler_destroy(inst->gbar.canvas.buffer) == (int)DBOX_STATUS_ERROR_NONE) {
+           inst->gbar.canvas.buffer = NULL;
        }
+       if (inst->gbar.extra_buffer) {
+           int i;
+
+           for (i = 0; i < DYNAMICBOX_CONF_EXTRA_BUFFER_COUNT; i++) {
+               if (!inst->gbar.extra_buffer[i]) {
+                   continue;
+               }
+
+               (void)buffer_handler_unload(inst->gbar.extra_buffer[i]);
+               if (buffer_handler_destroy(inst->gbar.extra_buffer[i]) == (int)DBOX_STATUS_ERROR_NONE) {
+                   inst->gbar.extra_buffer[i] = NULL;
+               }
+           }
 
-       EINA_LIST_FREE(inst->delete_event_list, item) {
-               DbgFree(item);
+           DbgFree(inst->gbar.extra_buffer);
+           inst->gbar.extra_buffer = NULL;
        }
-       DbgFree(inst->icon);
-       DbgFree(inst->name);
-       DbgFree(inst->category);
-       DbgFree(inst->cluster);
-       DbgFree(inst->content);
-       DbgFree(inst->title);
-       util_unlink(util_uri_to_path(inst->id));
-       DbgFree(inst->id);
-       package_del_instance(inst->info, inst);
-       DbgFree(inst);
+    }
+
+    if (inst->client) {
+       client_event_callback_del(inst->client, CLIENT_EVENT_DEACTIVATE, client_deactivated_cb, inst);
+       client_unref(inst->client);
+    }
+
+    if (inst->update_timer) {
+       ecore_timer_del(inst->update_timer);
+    }
 
-       slave = slave_unload_instance(slave);
+    EINA_LIST_FREE(inst->data_list, tag_item) {
+       DbgPrint("Tagged item[%s] %p\n", tag_item->tag, tag_item->data);
+       DbgFree(tag_item->tag);
+       DbgFree(tag_item);
+    }
+
+    EINA_LIST_FREE(inst->delete_event_list, item) {
+       DbgFree(item);
+    }
+
+    DbgFree(inst->icon);
+    DbgFree(inst->name);
+    DbgFree(inst->category);
+    DbgFree(inst->cluster);
+    DbgFree(inst->content);
+    DbgFree(inst->title);
+    util_unlink(util_uri_to_path(inst->id));
+    DbgFree(inst->id);
+    package_del_instance(inst->info, inst);
+    DbgFree(inst);
+
+    slave = slave_unload_instance(slave);
 }
 
 static Eina_Bool update_timer_cb(void *data)
 {
-       struct inst_info *inst = (struct inst_info *)data;
+    struct inst_info *inst = (struct inst_info *)data;
 
-       slave_rpc_request_update(package_name(inst->info), inst->id, inst->cluster, inst->category, NULL, 0);
-       return ECORE_CALLBACK_RENEW;
+    slave_rpc_request_update(package_name(inst->info), inst->id, inst->cluster, inst->category, NULL, 0);
+    return ECORE_CALLBACK_RENEW;
 }
 
 static inline int fork_package(struct inst_info *inst, const char *pkgname)
 {
-       struct pkg_info *info;
-       int len;
+    struct pkg_info *info;
+    int len;
 
-       info = package_find(pkgname);
-       if (!info) {
-               ErrPrint("%s is not found\n", pkgname);
-               return LB_STATUS_ERROR_NOT_EXIST;
-       }
+    info = package_find(pkgname);
+    if (!info) {
+       ErrPrint("%s is not found\n", pkgname);
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
 
-       len = strlen(SCHEMA_FILE "%s%s_%d_%lf.png") + strlen(IMAGE_PATH) + strlen(package_name(info)) + 50;
-       inst->id = malloc(len);
-       if (!inst->id) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    len = strlen(SCHEMA_FILE "%s%s_%d_%lf.png") + strlen(DYNAMICBOX_CONF_IMAGE_PATH) + strlen(package_name(info)) + 50;
+    inst->id = malloc(len);
+    if (!inst->id) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       snprintf(inst->id, len, SCHEMA_FILE "%s%s_%d_%lf.png", IMAGE_PATH, package_name(info), client_pid(inst->client), inst->timestamp);
+    snprintf(inst->id, len, SCHEMA_FILE "%s%s_%d_%lf.png", DYNAMICBOX_CONF_IMAGE_PATH, package_name(info), client_pid(inst->client), inst->timestamp);
 
-       instance_set_pd_size(inst, package_pd_width(info), package_pd_height(info));
+    instance_set_gbar_size(inst, package_gbar_width(info), package_gbar_height(info));
 
-       inst->lb.period = package_period(info);
+    inst->dbox.period = package_period(info);
 
-       inst->info = info;
+    inst->info = info;
 
-       if (package_secured(info)) {
-               if (inst->lb.period > 0.0f) {
-                       inst->update_timer = util_timer_add(inst->lb.period, update_timer_cb, inst);
-                       if (!inst->update_timer) {
-                               ErrPrint("Failed to add an update timer for instance %s\n", inst->id);
-                       } else {
-                               timer_freeze(inst); /* Freeze the update timer as default */
-                       }
-               } else {
-                       inst->update_timer = NULL;
-               }
+    if (package_secured(info)) {
+       if (inst->dbox.period > 0.0f) {
+           inst->update_timer = util_timer_add(inst->dbox.period, update_timer_cb, inst);
+           if (!inst->update_timer) {
+               ErrPrint("Failed to add an update timer for instance %s\n", inst->id);
+           } else {
+               timer_freeze(inst); /* Freeze the update timer as default */
+           }
+       } else {
+           inst->update_timer = NULL;
        }
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI struct inst_info *instance_create(struct client_node *client, double timestamp, const char *pkgname, const char *content, const char *cluster, const char *category, double period, int width, int height)
 {
-       struct inst_info *inst;
+    struct inst_info *inst;
 
-       inst = calloc(1, sizeof(*inst));
-       if (!inst) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return NULL;
-       }
+    inst = calloc(1, sizeof(*inst));
+    if (!inst) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
 
-       inst->timestamp = timestamp;
-       inst->lb.width = width;
-       inst->lb.height = height;
+    inst->timestamp = timestamp;
+    inst->dbox.width = width;
+    inst->dbox.height = height;
 
-       inst->content = strdup(content);
-       if (!inst->content) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(inst);
-               return NULL;
-       }
+    inst->content = strdup(content);
+    if (!inst->content) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(inst);
+       return NULL;
+    }
 
-       inst->cluster = strdup(cluster);
-       if (!inst->cluster) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(inst->content);
-               DbgFree(inst);
-               return NULL;
-       }
+    inst->cluster = strdup(cluster);
+    if (!inst->cluster) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(inst->content);
+       DbgFree(inst);
+       return NULL;
+    }
 
-       inst->category = strdup(category);
-       if (!inst->category) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(inst->cluster);
-               DbgFree(inst->content);
-               DbgFree(inst);
-               return NULL;
-       }
+    inst->category = strdup(category);
+    if (!inst->category) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(inst->cluster);
+       DbgFree(inst->content);
+       DbgFree(inst);
+       return NULL;
+    }
 
-       inst->title = strdup(DEFAULT_TITLE); /*!< Use the DEFAULT Title "" */
-       if (!inst->title) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(inst->category);
-               DbgFree(inst->cluster);
-               DbgFree(inst->content);
-               DbgFree(inst);
-               return NULL;
+    inst->title = strdup(DYNAMICBOX_CONF_DEFAULT_TITLE); /*!< Use the DEFAULT Title "" */
+    if (!inst->title) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(inst->category);
+       DbgFree(inst->cluster);
+       DbgFree(inst->content);
+       DbgFree(inst);
+       return NULL;
+    }
+
+    if (client) {
+       inst->client = client_ref(client);
+       if (client_event_callback_add(inst->client, CLIENT_EVENT_DEACTIVATE, client_deactivated_cb, inst) < 0) {
+           ErrPrint("Failed to add client event callback: %s\n", inst->id);
        }
+    }
 
-       if (client) {
-               inst->client = client_ref(client);
-               if (client_event_callback_add(inst->client, CLIENT_EVENT_DEACTIVATE, client_deactivated_cb, inst) < 0) {
-                       ErrPrint("Failed to add client event callback: %s\n", inst->id);
-               }
+    if (fork_package(inst, pkgname) < 0) {
+       (void)client_unref(inst->client);
+       DbgFree(inst->title);
+       DbgFree(inst->category);
+       DbgFree(inst->cluster);
+       DbgFree(inst->content);
+       DbgFree(inst);
+       return NULL;
+    }
+
+    inst->unicast_delete_event = 1;
+    inst->state = INST_INIT;
+    inst->requested_state = INST_INIT;
+    if (DYNAMICBOX_CONF_EXTRA_BUFFER_COUNT) {
+       inst->dbox.extra_buffer = calloc(DYNAMICBOX_CONF_EXTRA_BUFFER_COUNT, sizeof(*inst->dbox.extra_buffer));
+       if (!inst->dbox.extra_buffer) {
+           ErrPrint("Failed to allocate buffer for dbox extra buffer\n");
        }
 
-       if (fork_package(inst, pkgname) < 0) {
-               (void)client_unref(inst->client);
-               DbgFree(inst->title);
-               DbgFree(inst->category);
-               DbgFree(inst->cluster);
-               DbgFree(inst->content);
-               DbgFree(inst);
-               return NULL;
+       inst->gbar.extra_buffer = calloc(DYNAMICBOX_CONF_EXTRA_BUFFER_COUNT, sizeof(*inst->gbar.extra_buffer));
+       if (!inst->gbar.extra_buffer) {
+           ErrPrint("Failed to allocate buffer for gbar extra buffer\n");
        }
+    }
+    instance_ref(inst);
 
-       inst->state = INST_INIT;
-       inst->requested_state = INST_INIT;
-       instance_ref(inst);
+    if (package_add_instance(inst->info, inst) < 0) {
+       instance_destroy(inst, DBOX_DESTROY_TYPE_FAULT);
+       return NULL;
+    }
 
-       if (package_add_instance(inst->info, inst) < 0) {
-               instance_destroy(inst, INSTANCE_DESTROY_FAULT);
-               return NULL;
-       }
+    slave_load_instance(package_slave(inst->info));
 
-       slave_load_instance(package_slave(inst->info));
+    // Before activate an instance, update its id first for client
+    instance_send_update_id(inst);
 
-       if (instance_activate(inst) < 0) {
-               instance_state_reset(inst);
-               instance_destroy(inst, INSTANCE_DESTROY_FAULT);
-               inst = NULL;
-       }
+    if (instance_activate(inst) < 0) {
+       instance_state_reset(inst);
+       instance_destroy(inst, DBOX_DESTROY_TYPE_FAULT);
+       inst = NULL;
+    }
 
-       return inst;
+    return inst;
 }
 
 HAPI struct inst_info *instance_ref(struct inst_info *inst)
 {
-       if (!inst) {
-               return NULL;
-       }
+    if (!inst) {
+       return NULL;
+    }
 
-       inst->refcnt++;
-       return inst;
+    inst->refcnt++;
+    return inst;
 }
 
 HAPI struct inst_info *instance_unref(struct inst_info *inst)
 {
-       if (!inst) {
-               return NULL;
-       }
+    if (!inst) {
+       return NULL;
+    }
 
-       if (inst->refcnt == 0) {
-               ErrPrint("Instance refcnt is not valid\n");
-               return NULL;
-       }
+    if (inst->refcnt == 0) {
+       ErrPrint("Instance refcnt is not valid\n");
+       return NULL;
+    }
 
-       inst->refcnt--;
-       if (inst->refcnt == 0) {
-               destroy_instance(inst);
-               inst = NULL;
-       }
+    inst->refcnt--;
+    if (inst->refcnt == 0) {
+       destroy_instance(inst);
+       inst = NULL;
+    }
 
-       return inst;
+    return inst;
 }
 
 static void deactivate_cb(struct slave_node *slave, const struct packet *packet, void *data)
 {
-       struct inst_info *inst = data;
-       int ret;
+    struct inst_info *inst = data;
+    int ret;
+
+    /*!
+     * \note
+     * In this callback, we cannot trust the "client" information.
+     * It could be cleared before reach to here.
+     */
 
+    if (!packet) {
        /*!
         * \note
-        * In this callback, we cannot trust the "client" information.
-        * It could be cleared before reach to here.
+        * The instance_reload will care this.
+        * And it will be called from the slave activate callback.
         */
+       goto out;
+    }
 
-       if (!packet) {
-               /*!
-                * \note
-                * The instance_reload will care this.
-                * And it will be called from the slave activate callback.
-                */
-               goto out;
+    if (packet_get(packet, "i", &ret) != 1) {
+       ErrPrint("Invalid argument\n");
+       goto out;
+    }
+
+    DbgPrint("[%s] %d (0x%X)\n", inst->id, ret, inst->state);
+
+    if (inst->state == INST_DESTROYED) {
+       /*!
+        * \note
+        * Already destroyed.
+        * Do nothing at here anymore.
+        */
+       goto out;
+    }
+
+    switch (ret) {
+    case 0:
+       /*!
+        * \note
+        * Successfully unloaded
+        */
+       switch (inst->requested_state) {
+       case INST_ACTIVATED:
+           instance_state_reset(inst);
+           instance_reactivate(inst);
+           break;
+       case INST_DESTROYED:
+           if (inst->unicast_delete_event) {
+               instance_unicast_deleted_event(inst, NULL, ret);
+           } else {
+               instance_broadcast_deleted_event(inst, ret);
+           }
+           instance_state_reset(inst);
+           instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+       default:
+           /*!< Unable to reach here */
+           break;
        }
 
-       if (packet_get(packet, "i", &ret) != 1) {
-               ErrPrint("Invalid argument\n");
-               goto out;
+       break;
+    case DBOX_STATUS_ERROR_INVALID_PARAMETER:
+       /*!
+        * \note
+        * Slave has no instance of this package.
+        */
+    case DBOX_STATUS_ERROR_NOT_EXIST:
+       /*!
+        * \note
+        * This instance's previous state is only can be the INST_ACTIVATED.
+        * So we should care the slave_unload_instance from here.
+        * And we should send notification to clients, about this is deleted.
+        */
+       /*!
+        * \note
+        * Slave has no instance of this.
+        * In this case, ignore the requested_state
+        * Because, this instance is already met a problem.
+        */
+    default:
+       /*!
+        * \note
+        * Failed to unload this instance.
+        * This is not possible, slave will always return DBOX_STATUS_ERROR_NOT_EXIST, DBOX_STATUS_ERROR_INVALID_PARAMETER, or 0.
+        * but care this exceptional case.
+        */
+       instance_broadcast_deleted_event(inst, ret);
+       instance_state_reset(inst);
+       instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+       break;
+    }
+
+out:
+    inst->changing_state--;
+    if (inst->changing_state < 0) {
+       ErrPrint("Changing state is not correct: %d\n", inst->changing_state);
+    }
+    instance_unref(inst);
+}
+
+static void reactivate_cb(struct slave_node *slave, const struct packet *packet, void *data)
+{
+    struct inst_info *inst = data;
+    enum dynamicbox_dbox_type dbox_type;
+    enum dynamicbox_gbar_type gbar_type;
+    int ret;
+    const char *content;
+    const char *title;
+    int is_pinned_up;
+
+    if (!packet) {
+       /*!
+        * \note
+        * instance_reload function will care this.
+        * and it will be called from the slave_activate callback
+        */
+       goto out;
+    }
+
+    if (packet_get(packet, "issi", &ret, &content, &title, &is_pinned_up) != 4) {
+       ErrPrint("Invalid parameter\n");
+       goto out;
+    }
+
+    if (strlen(content)) {
+       char *tmp;
+
+       tmp = strdup(content);
+       if (!tmp) {
+           ErrPrint("Heap: %s\n", strerror(errno));
+           goto out;
        }
 
-       DbgPrint("[%s] %d (0x%X)\n", inst->id, ret, inst->state);
+       DbgFree(inst->content);
+       inst->content = tmp;
+    }
 
-       if (inst->state == INST_DESTROYED) {
-               /*!
-                * \note
-                * Already destroyed.
-                * Do nothing at here anymore.
-                */
-               goto out;
+    if (strlen(title)) {
+       char *tmp;
+
+       tmp = strdup(title);
+       if (!tmp) {
+           ErrPrint("Heap: %s\n", strerror(errno));
+           goto out;
        }
 
-       switch (ret) {
-       case 0:
+       DbgFree(inst->title);
+       inst->title = tmp;
+    }
+
+    if (inst->state == INST_DESTROYED) {
+       /*!
+        * \note
+        * Already destroyed.
+        * Do nothing at here anymore.
+        */
+       goto out;
+    }
+
+    switch (ret) {
+    case 0: /*!< normally created */
+       inst->state = INST_ACTIVATED;
+       switch (inst->requested_state) {
+       case INST_DESTROYED:
+           instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+           break;
+       case INST_ACTIVATED:
+           inst->is_pinned_up = is_pinned_up;
+           dbox_type = package_dbox_type(inst->info);
+           gbar_type = package_gbar_type(inst->info);
+
+           /*!
+            * \note
+            * Optimization point.
+            *   In case of the BUFFER type,
+            *   the slave will request the buffer to render its contents.
+            *   so the buffer will be automatcially recreated when it gots the
+            *   buffer request packet.
+            *   so load a buffer from here is not neccessary.
+            *   I should to revise it and concrete the concept.
+            *   Just leave it only for now.
+            */
+
+           if (dbox_type == DBOX_TYPE_SCRIPT && inst->dbox.canvas.script) {
+               script_handler_load(inst->dbox.canvas.script, 0);
+           } else if (dbox_type == DBOX_TYPE_BUFFER && inst->dbox.canvas.buffer) {
+               buffer_handler_load(inst->dbox.canvas.buffer);
+           }
+
+           if (gbar_type == GBAR_TYPE_SCRIPT && inst->gbar.canvas.script && inst->gbar.is_opened_for_reactivate) {
+               double x, y;
                /*!
                 * \note
-                * Successfully unloaded
+                * We should to send a request to open a GBAR to slave.
+                * if we didn't send it, the slave will not recognize the state of a GBAR.
+                * We have to keep the view of GBAR seamless even if the dynamicbox is reactivated.
+                * To do that, send open request from here.
                 */
-               switch (inst->requested_state) {
-               case INST_ACTIVATED:
-                       instance_state_reset(inst);
-                       instance_reactivate(inst);
-                       break;
-               case INST_DESTROYED:
-                       instance_broadcast_deleted_event(inst, ret);
-                       instance_state_reset(inst);
-                       instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
-               default:
-                       /*!< Unable to reach here */
-                       break;
-               }
+               ret = instance_slave_open_gbar(inst, NULL);
+               instance_slave_get_gbar_pos(inst, &x, &y);
 
-               break;
-       case LB_STATUS_ERROR_INVALID:
                /*!
                 * \note
-                * Slave has no instance of this package.
+                * In this case, master already loads the GBAR script.
+                * So just send the gbar,show event to the slave again.
                 */
-       case LB_STATUS_ERROR_NOT_EXIST:
+               ret = instance_signal_emit(inst, "gbar,show", instance_id(inst), 0.0, 0.0, 0.0, 0.0, x, y, 0);
+           } else if (gbar_type == GBAR_TYPE_BUFFER && inst->gbar.canvas.buffer && inst->gbar.is_opened_for_reactivate) {
+               double x, y;
+
+               buffer_handler_load(inst->gbar.canvas.buffer);
+               instance_slave_get_gbar_pos(inst, &x, &y);
+
                /*!
                 * \note
-                * This instance's previous state is only can be the INST_ACTIVATED.
-                * So we should care the slave_unload_instance from here.
-                * And we should send notification to clients, about this is deleted.
+                * We should to send a request to open a GBAR to slave.
+                * if we didn't send it, the slave will not recognize the state of a GBAR.
+                * We have to keep the view of GBAR seamless even if the dynamicbox is reactivated.
+                * To do that, send open request from here.
                 */
+               ret = instance_slave_open_gbar(inst, NULL);
+
                /*!
                 * \note
-                * Slave has no instance of this.
-                * In this case, ignore the requested_state
-                * Because, this instance is already met a problem.
+                * In this case, just send the gbar,show event for keeping the compatibility
                 */
+               ret = instance_signal_emit(inst, "gbar,show", instance_id(inst), 0.0, 0.0, 0.0, 0.0, x, y, 0);
+           }
+
+           /*!
+            * \note
+            * After create an instance again,
+            * Send resize request to the dynamicbox.
+            * instance_resize(inst, inst->dbox.width, inst->dbox.height);
+            *
+            * renew request will resize the dynamicbox while creating it again
+            */
+
+           /*!
+            * \note
+            * This function will check the visiblity of a dynamicbox and
+            * make decision whether it thaw the update timer or not.
+            */
+           instance_recover_visible_state(inst);
        default:
-               /*!
-                * \note
-                * Failed to unload this instance.
-                * This is not possible, slave will always return LB_STATUS_ERROR_NOT_EXIST, LB_STATUS_ERROR_INVALID, or 0.
-                * but care this exceptional case.
-                */
-               instance_broadcast_deleted_event(inst, ret);
-               instance_state_reset(inst);
-               instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
-               break;
+           break;
        }
+       break;
+    default:
+       instance_broadcast_deleted_event(inst, ret);
+       instance_state_reset(inst);
+       instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+       break;
+    }
 
 out:
-       inst->changing_state = 0;
-       instance_unref(inst);
+    inst->changing_state--;
+    if (inst->changing_state < 0) {
+       ErrPrint("Changing state is not correct: %d\n", inst->changing_state);
+    }
+    instance_unref(inst);
 }
 
-static void reactivate_cb(struct slave_node *slave, const struct packet *packet, void *data)
+static void activate_cb(struct slave_node *slave, const struct packet *packet, void *data)
 {
-       struct inst_info *inst = data;
-       enum lb_type lb_type;
-       enum pd_type pd_type;
-       int ret;
-       const char *content;
-       const char *title;
-       int is_pinned_up;
-
-       if (!packet) {
-               /*!
-                * \note
-                * instance_reload function will care this.
-                * and it will be called from the slave_activate callback
-                */
-               goto out;
-       }
+    struct inst_info *inst = data;
+    int ret;
+    int w;
+    int h;
+    double priority;
+    char *content;
+    char *title;
+    int is_pinned_up;
 
-       if (packet_get(packet, "issi", &ret, &content, &title, &is_pinned_up) != 4) {
-               ErrPrint("Invalid parameter\n");
-               goto out;
-       }
+    if (!packet) {
+       /*!
+        * \note
+        * instance_reload will care this
+        * it will be called from the slave_activate callback
+        */
+       goto out;
+    }
 
-       if (strlen(content)) {
-               char *tmp;
+    if (packet_get(packet, "iiidssi", &ret, &w, &h, &priority, &content, &title, &is_pinned_up) != 7) {
+       ErrPrint("Invalid parameter\n");
+       goto out;
+    }
 
-               tmp = strdup(content);
-               if (!tmp) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       goto out;
-               }
+    DbgPrint("[%s] returns %d (state: 0x%X)\n", inst->id, ret, inst->state);
 
-               DbgFree(inst->content);
-               inst->content = tmp;
+    if (inst->state == INST_DESTROYED) {
+       /*!
+        * \note
+        * Already destroyed.
+        * Do nothing at here anymore.
+        */
+       goto out;
+    }
+
+    switch (ret) {
+    case 1: /*!< need to create */
+       if (util_free_space(DYNAMICBOX_CONF_IMAGE_PATH) > DYNAMICBOX_CONF_MINIMUM_SPACE) {
+           struct inst_info *new_inst;
+           new_inst = instance_create(inst->client, util_timestamp(), package_name(inst->info),
+                   inst->content, inst->cluster, inst->category,
+                   inst->dbox.period, 0, 0);
+           if (!new_inst) {
+               ErrPrint("Failed to create a new instance\n");
+           }
+       } else {
+           ErrPrint("Not enough space\n");
        }
+    case 0: /*!< normally created */
+       /*!
+        * \note
+        * Anyway this instance is loaded to the slave,
+        * just increase the loaded instance counter
+        * And then reset jobs.
+        */
+       instance_set_dbox_size(inst, w, h);
+       instance_set_dbox_info(inst, priority, content, title);
 
-       if (strlen(title)) {
-               char *tmp;
+       inst->state = INST_ACTIVATED;
 
-               tmp = strdup(title);
-               if (!tmp) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       goto out;
+       switch (inst->requested_state) {
+       case INST_DESTROYED:
+           /**
+            * In this case, we should destroy the instance.
+            */
+           instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+           break;
+       case INST_ACTIVATED:
+       default:
+           /**
+            * @note
+            * DBOX should be created at the create time
+            */
+           inst->is_pinned_up = is_pinned_up;
+           if (package_dbox_type(inst->info) == DBOX_TYPE_SCRIPT) {
+               if (inst->dbox.width == 0 && inst->dbox.height == 0) {
+                   dynamicbox_service_get_size(DBOX_SIZE_TYPE_1x1, &inst->dbox.width, &inst->dbox.height);
                }
 
-               DbgFree(inst->title);
-               inst->title = tmp;
-       }
+               inst->dbox.canvas.script = script_handler_create(inst,
+                       package_dbox_path(inst->info),
+                       package_dbox_group(inst->info),
+                       inst->dbox.width, inst->dbox.height);
 
-       if (inst->state == INST_DESTROYED) {
-               /*!
-                * \note
-                * Already destroyed.
-                * Do nothing at here anymore.
-                */
-               goto out;
-       }
-
-       switch (ret) {
-       case 0: /*!< normally created */
-               inst->state = INST_ACTIVATED;
-               switch (inst->requested_state) {
-               case INST_DESTROYED:
-                       instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
-                       break;
-               case INST_ACTIVATED:
-                       inst->is_pinned_up = is_pinned_up;
-                       lb_type = package_lb_type(inst->info);
-                       pd_type = package_pd_type(inst->info);
-
-                       /*!
-                        * \note
-                        * Optimization point.
-                        *   In case of the BUFFER type,
-                        *   the slave will request the buffer to render its contents.
-                        *   so the buffer will be automatcially recreated when it gots the
-                        *   buffer request packet.
-                        *   so load a buffer from here is not neccessary.
-                        *   I should to revise it and concrete the concept.
-                        *   Just leave it only for now.
-                        */
-
-                       if (lb_type == LB_TYPE_SCRIPT && inst->lb.canvas.script) {
-                               script_handler_load(inst->lb.canvas.script, 0);
-                       } else if (lb_type == LB_TYPE_BUFFER && inst->lb.canvas.buffer) {
-                               buffer_handler_load(inst->lb.canvas.buffer);
-                       }
-
-                       if (pd_type == PD_TYPE_SCRIPT && inst->pd.canvas.script && inst->pd.is_opened_for_reactivate) {
-                               double x, y;
-                               /*!
-                                * \note
-                                * We should to send a request to open a PD to slave.
-                                * if we didn't send it, the slave will not recognize the state of a PD.
-                                * We have to keep the view of PD seamless even if the livebox is reactivated.
-                                * To do that, send open request from here.
-                                */
-                               ret = instance_slave_open_pd(inst, NULL);
-                               instance_slave_get_pd_pos(inst, &x, &y);
-
-                               /*!
-                                * \note
-                                * In this case, master already loads the PD script.
-                                * So just send the pd,show event to the slave again.
-                                */
-                               ret = instance_signal_emit(inst, "pd,show", instance_id(inst), 0.0, 0.0, 0.0, 0.0, x, y, 0);
-                       } else if (pd_type == PD_TYPE_BUFFER && inst->pd.canvas.buffer && inst->pd.is_opened_for_reactivate) {
-                               double x, y;
-
-                               buffer_handler_load(inst->pd.canvas.buffer);
-                               instance_slave_get_pd_pos(inst, &x, &y);
-
-                               /*!
-                                * \note
-                                * We should to send a request to open a PD to slave.
-                                * if we didn't send it, the slave will not recognize the state of a PD.
-                                * We have to keep the view of PD seamless even if the livebox is reactivated.
-                                * To do that, send open request from here.
-                                */
-                               ret = instance_slave_open_pd(inst, NULL);
-
-                               /*!
-                                * \note
-                                * In this case, just send the pd,show event for keeping the compatibility
-                                */
-                               ret = instance_signal_emit(inst, "pd,show", instance_id(inst), 0.0, 0.0, 0.0, 0.0, x, y, 0);
-                       }
-
-                       /*!
-                        * \note
-                        * After create an instance again,
-                        * Send resize request to the livebox.
-                        * instance_resize(inst, inst->lb.width, inst->lb.height);
-                        *
-                        * renew request will resize the livebox while creating it again
-                        */
-
-                       /*!
-                        * \note
-                        * This function will check the visiblity of a livebox and
-                        * make decision whether it thaw the update timer or not.
-                        */
-                       instance_recover_visible_state(inst);
-               default:
-                       break;
+               if (!inst->dbox.canvas.script) {
+                   ErrPrint("Failed to create DBOX\n");
+               } else {
+                   script_handler_load(inst->dbox.canvas.script, 0);
                }
-               break;
-       default:
-               instance_broadcast_deleted_event(inst, ret);
-               instance_state_reset(inst);
-               instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
-               break;
-       }
-
-out:
-       inst->changing_state = 0;
-       instance_unref(inst);
-}
+           } else if (package_dbox_type(inst->info) == DBOX_TYPE_BUFFER) {
+               instance_create_dbox_buffer(inst, DYNAMICBOX_CONF_DEFAULT_PIXELS);
+           }
 
-static void activate_cb(struct slave_node *slave, const struct packet *packet, void *data)
-{
-       struct inst_info *inst = data;
-       int ret;
-       int w;
-       int h;
-       double priority;
-       char *content;
-       char *title;
-       int is_pinned_up;
+           if (package_gbar_type(inst->info) == GBAR_TYPE_SCRIPT) {
+               if (inst->gbar.width == 0 && inst->gbar.height == 0) {
+                   instance_set_gbar_size(inst, package_gbar_width(inst->info), package_gbar_height(inst->info));
+               }
 
-       if (!packet) {
-               /*!
-                * \note
-                * instance_reload will care this
-                * it will be called from the slave_activate callback
-                */
-               goto out;
-       }
+               inst->gbar.canvas.script = script_handler_create(inst,
+                       package_gbar_path(inst->info),
+                       package_gbar_group(inst->info),
+                       inst->gbar.width, inst->gbar.height);
 
-       if (packet_get(packet, "iiidssi", &ret, &w, &h, &priority, &content, &title, &is_pinned_up) != 7) {
-               ErrPrint("Invalid parameter\n");
-               goto out;
-       }
+               if (!inst->gbar.canvas.script) {
+                   ErrPrint("Failed to create GBAR\n");
+               }
+           } else if (package_gbar_type(inst->info) == GBAR_TYPE_BUFFER) {
+               instance_create_gbar_buffer(inst, DYNAMICBOX_CONF_DEFAULT_PIXELS);
+           }
 
-       DbgPrint("[%s] returns %d (state: 0x%X)\n", inst->id, ret, inst->state);
+           instance_broadcast_created_event(inst);
 
-       if (inst->state == INST_DESTROYED) {
-               /*!
-                * \note
-                * Already destroyed.
-                * Do nothing at here anymore.
-                */
-               goto out;
-       }
-
-       switch (ret) {
-       case 1: /*!< need to create */
-               if (util_free_space(IMAGE_PATH) > MINIMUM_SPACE) {
-                       struct inst_info *new_inst;
-                       new_inst = instance_create(inst->client, util_timestamp(), package_name(inst->info),
-                                                       inst->content, inst->cluster, inst->category,
-                                                       inst->lb.period, 0, 0);
-                       if (!new_inst) {
-                               ErrPrint("Failed to create a new instance\n");
-                       }
-               } else {
-                       ErrPrint("Not enough space\n");
-               }
-       case 0: /*!< normally created */
-               /*!
-                * \note
-                * Anyway this instance is loaded to the slave,
-                * just increase the loaded instance counter
-                * And then reset jobs.
-                */
-               instance_set_lb_size(inst, w, h);
-               instance_set_lb_info(inst, priority, content, title);
-
-               inst->state = INST_ACTIVATED;
-
-               switch (inst->requested_state) {
-               case INST_DESTROYED:
-                       instance_unicast_deleted_event(inst, NULL, ret);
-                       instance_state_reset(inst);
-                       instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
-                       break;
-               case INST_ACTIVATED:
-               default:
-                       /*!
-                        * \note
-                        * LB should be created at the create time
-                        */
-                       inst->is_pinned_up = is_pinned_up;
-                       if (package_lb_type(inst->info) == LB_TYPE_SCRIPT) {
-                               if (inst->lb.width == 0 && inst->lb.height == 0) {
-                                       livebox_service_get_size(LB_SIZE_TYPE_1x1, &inst->lb.width, &inst->lb.height);
-                               }
-
-                               inst->lb.canvas.script = script_handler_create(inst,
-                                                               package_lb_path(inst->info),
-                                                               package_lb_group(inst->info),
-                                                               inst->lb.width, inst->lb.height);
-
-                               if (!inst->lb.canvas.script) {
-                                       ErrPrint("Failed to create LB\n");
-                               } else {
-                                       script_handler_load(inst->lb.canvas.script, 0);
-                               }
-                       } else if (package_lb_type(inst->info) == LB_TYPE_BUFFER) {
-                               instance_create_lb_buffer(inst, DEFAULT_PIXELS);
-                       }
-
-                       if (package_pd_type(inst->info) == PD_TYPE_SCRIPT) {
-                               if (inst->pd.width == 0 && inst->pd.height == 0) {
-                                       instance_set_pd_size(inst, package_pd_width(inst->info), package_pd_height(inst->info));
-                               }
-
-                               inst->pd.canvas.script = script_handler_create(inst,
-                                                               package_pd_path(inst->info),
-                                                               package_pd_group(inst->info),
-                                                               inst->pd.width, inst->pd.height);
-
-                               if (!inst->pd.canvas.script) {
-                                       ErrPrint("Failed to create PD\n");
-                               }
-                       } else if (package_pd_type(inst->info) == PD_TYPE_BUFFER) {
-                               instance_create_pd_buffer(inst, DEFAULT_PIXELS);
-                       }
-
-                       instance_broadcast_created_event(inst);
-
-                       instance_thaw_updator(inst);
-                       break;
-               }
-               break;
-       default:
-               instance_unicast_deleted_event(inst, NULL, ret);
-               instance_state_reset(inst);
-               instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
-               break;
+           instance_thaw_updator(inst);
+           break;
        }
+       break;
+    default:
+       instance_unicast_deleted_event(inst, NULL, ret);
+       instance_state_reset(inst);
+       instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+       break;
+    }
 
 out:
-       inst->changing_state = 0;
-       instance_unref(inst);
+    inst->changing_state--;
+    if (inst->changing_state < 0) {
+       ErrPrint("Changing state is not correct: %d\n", inst->changing_state);
+    }
+    instance_unref(inst);
 }
 
-HAPI int instance_create_pd_buffer(struct inst_info *inst, int pixels)
+HAPI int instance_create_gbar_buffer(struct inst_info *inst, int pixels)
 {
-       if (inst->pd.width == 0 && inst->pd.height == 0) {
-               instance_set_pd_size(inst, package_pd_width(inst->info), package_pd_height(inst->info));
-       }
+    if (inst->gbar.width == 0 && inst->gbar.height == 0) {
+       instance_set_gbar_size(inst, package_gbar_width(inst->info), package_gbar_height(inst->info));
+    }
 
-       if (!inst->pd.canvas.buffer) {
-               inst->pd.canvas.buffer = buffer_handler_create(inst, s_info.env_buf_type, inst->pd.width, inst->pd.height, pixels);
-               if (!inst->pd.canvas.buffer) {
-                       ErrPrint("Failed to create PD Buffer\n");
-               }
+    if (!inst->gbar.canvas.buffer) {
+       inst->gbar.canvas.buffer = buffer_handler_create(inst, s_info.env_buf_type, inst->gbar.width, inst->gbar.height, pixels);
+       if (!inst->gbar.canvas.buffer) {
+           ErrPrint("Failed to create GBAR Buffer\n");
        }
+    }
 
-       return !!inst->pd.canvas.buffer;
+    return !!inst->gbar.canvas.buffer;
 }
 
-HAPI int instance_create_lb_buffer(struct inst_info *inst, int pixels)
+HAPI int instance_create_gbar_extra_buffer(struct inst_info *inst, int pixels, int idx)
 {
-       if (inst->lb.width == 0 && inst->lb.height == 0) {
-               livebox_service_get_size(LB_SIZE_TYPE_1x1, &inst->lb.width, &inst->lb.height);
-       }
+    if (!inst->gbar.extra_buffer) {
+       return 0;
+    }
 
-       if (!inst->lb.canvas.buffer) {
-               /*!
-                * \note
-                * Slave doesn't call the acquire_buffer.
-                * In this case, create the buffer from here.
-                */
-               inst->lb.canvas.buffer = buffer_handler_create(inst, s_info.env_buf_type, inst->lb.width, inst->lb.height, pixels);
-               if (!inst->lb.canvas.buffer) {
-                       ErrPrint("Failed to create LB\n");
-               }
+    if (inst->gbar.width == 0 && inst->gbar.height == 0) {
+       instance_set_gbar_size(inst, package_gbar_width(inst->info), package_gbar_height(inst->info));
+    }
+
+    if (!inst->gbar.extra_buffer[idx]) {
+       inst->gbar.extra_buffer[idx] = buffer_handler_create(inst, s_info.env_buf_type, inst->gbar.width, inst->gbar.height, pixels);
+       if (!inst->gbar.extra_buffer[idx]) {
+           ErrPrint("Failed to create GBAR Extra Buffer\n");
        }
+    }
 
-       return !!inst->lb.canvas.buffer;
+    return !!inst->gbar.extra_buffer[idx];
 }
 
-HAPI int instance_destroy(struct inst_info *inst, enum instance_destroy_type type)
+HAPI int instance_create_dbox_buffer(struct inst_info *inst, int pixels)
 {
-       struct packet *packet;
-
-       if (!inst) {
-               ErrPrint("Invalid instance handle\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       switch (inst->state) {
-       case INST_REQUEST_TO_ACTIVATE:
-       case INST_REQUEST_TO_DESTROY:
-       case INST_REQUEST_TO_REACTIVATE:
-               inst->requested_state = INST_DESTROYED;
-               return LB_STATUS_SUCCESS;
-       case INST_INIT:
-               inst->state = INST_DESTROYED;
-               inst->requested_state = INST_DESTROYED;
-               (void)instance_unref(inst);
-               return LB_STATUS_SUCCESS;
-       case INST_DESTROYED:
-               inst->requested_state = INST_DESTROYED;
-               return LB_STATUS_SUCCESS;
-       default:
-               break;
-       }
+    if (inst->dbox.width == 0 && inst->dbox.height == 0) {
+       dynamicbox_service_get_size(DBOX_SIZE_TYPE_1x1, &inst->dbox.width, &inst->dbox.height);
+    }
 
-       packet = packet_create("delete", "ssi", package_name(inst->info), inst->id, type);
-       if (!packet) {
-               ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
-               return LB_STATUS_ERROR_FAULT;
+    if (!inst->dbox.canvas.buffer) {
+       /*!
+        * \note
+        * Slave doesn't call the acquire_buffer.
+        * In this case, create the buffer from here.
+        */
+       inst->dbox.canvas.buffer = buffer_handler_create(inst, s_info.env_buf_type, inst->dbox.width, inst->dbox.height, pixels);
+       if (!inst->dbox.canvas.buffer) {
+           ErrPrint("Failed to create DBOX\n");
        }
+    }
 
-       inst->destroy_type = type;
-       inst->requested_state = INST_DESTROYED;
-       inst->state = INST_REQUEST_TO_DESTROY;
-       inst->changing_state = 1;
-       return slave_rpc_async_request(package_slave(inst->info), package_name(inst->info), packet, deactivate_cb, instance_ref(inst), 0);
+    return !!inst->dbox.canvas.buffer;
 }
 
-HAPI int instance_reload(struct inst_info *inst, enum instance_destroy_type type)
+HAPI int instance_create_dbox_extra_buffer(struct inst_info *inst, int pixels, int idx)
 {
-       struct packet *packet;
-       int ret;
+    if (!inst->dbox.extra_buffer) {
+       return 0;
+    }
 
-       if (!inst) {
-               ErrPrint("Invalid instance handle\n");
-               return LB_STATUS_ERROR_INVALID;
+    if (inst->dbox.width == 0 && inst->dbox.height == 0) {
+       dynamicbox_service_get_size(DBOX_SIZE_TYPE_1x1, &inst->dbox.width, &inst->dbox.height);
+    }
+
+    if (!inst->dbox.extra_buffer[idx]) {
+       inst->dbox.extra_buffer[idx] = buffer_handler_create(inst, s_info.env_buf_type, inst->dbox.width, inst->dbox.height, pixels);
+       if (!inst->dbox.extra_buffer[idx]) {
+           ErrPrint("Failed to create DBox Extra buffer\n");
        }
+    }
 
-       DbgPrint("Reload instance (%s)\n", instance_id(inst));
+    return !!inst->dbox.extra_buffer[idx];
+}
 
-       switch (inst->state) {
-       case INST_REQUEST_TO_ACTIVATE:
-       case INST_REQUEST_TO_REACTIVATE:
-               return LB_STATUS_SUCCESS;
-       case INST_INIT:
-               ret = instance_activate(inst);
-               if (ret < 0) {
-                       ErrPrint("Failed to activate instance: %d (%s)\n", ret, instance_id(inst));
-               }
-               return LB_STATUS_SUCCESS;
-       case INST_DESTROYED:
-       case INST_REQUEST_TO_DESTROY:
-               DbgPrint("Instance is destroying now\n");
-               return LB_STATUS_SUCCESS;
-       default:
-               break;
-       }
+HAPI int instance_destroy(struct inst_info *inst, dynamicbox_destroy_type_e type)
+{
+    struct packet *packet;
+    unsigned int cmd = CMD_DELETE;
 
-       packet = packet_create("delete", "ssi", package_name(inst->info), inst->id, type);
-       if (!packet) {
-               ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (!inst) {
+       ErrPrint("Invalid instance handle\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       inst->destroy_type = type;
-       inst->requested_state = INST_ACTIVATED;
-       inst->state = INST_REQUEST_TO_DESTROY;
-       inst->changing_state = 1;
-       return slave_rpc_async_request(package_slave(inst->info), package_name(inst->info), packet, deactivate_cb, instance_ref(inst), 0);
+    switch (inst->state) {
+    case INST_REQUEST_TO_ACTIVATE:
+    case INST_REQUEST_TO_DESTROY:
+    case INST_REQUEST_TO_REACTIVATE:
+       inst->requested_state = INST_DESTROYED;
+       return DBOX_STATUS_ERROR_NONE;
+    case INST_INIT:
+       inst->state = INST_DESTROYED;
+       inst->requested_state = INST_DESTROYED;
+       (void)instance_unref(inst);
+       return DBOX_STATUS_ERROR_NONE;
+    case INST_DESTROYED:
+       inst->requested_state = INST_DESTROYED;
+       return DBOX_STATUS_ERROR_NONE;
+    default:
+       break;
+    }
+
+    packet = packet_create((const char *)&cmd, "ssi", package_name(inst->info), inst->id, type);
+    if (!packet) {
+       ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    inst->destroy_type = type;
+    inst->requested_state = INST_DESTROYED;
+    inst->state = INST_REQUEST_TO_DESTROY;
+    inst->changing_state++;
+    return slave_rpc_async_request(package_slave(inst->info), package_name(inst->info), packet, deactivate_cb, instance_ref(inst), 0);
+}
+
+HAPI int instance_reload(struct inst_info *inst, dynamicbox_destroy_type_e type)
+{
+    struct packet *packet;
+    unsigned int cmd = CMD_DELETE;
+    int ret;
+
+    if (!inst) {
+       ErrPrint("Invalid instance handle\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    DbgPrint("Reload instance (%s)\n", instance_id(inst));
+
+    switch (inst->state) {
+    case INST_REQUEST_TO_ACTIVATE:
+    case INST_REQUEST_TO_REACTIVATE:
+       return DBOX_STATUS_ERROR_NONE;
+    case INST_INIT:
+       ret = instance_activate(inst);
+       if (ret < 0) {
+           ErrPrint("Failed to activate instance: %d (%s)\n", ret, instance_id(inst));
+       }
+       return DBOX_STATUS_ERROR_NONE;
+    case INST_DESTROYED:
+    case INST_REQUEST_TO_DESTROY:
+       DbgPrint("Instance is destroying now\n");
+       return DBOX_STATUS_ERROR_NONE;
+    default:
+       break;
+    }
+
+    packet = packet_create((const char *)&cmd, "ssi", package_name(inst->info), inst->id, type);
+    if (!packet) {
+       ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    inst->destroy_type = type;
+    inst->requested_state = INST_ACTIVATED;
+    inst->state = INST_REQUEST_TO_DESTROY;
+    inst->changing_state++;
+    return slave_rpc_async_request(package_slave(inst->info), package_name(inst->info), packet, deactivate_cb, instance_ref(inst), 0);
 }
 
 /* Client Deactivated Callback */
-static int pd_buffer_close_cb(struct client_node *client, void *inst)
+static int gbar_buffer_close_cb(struct client_node *client, void *inst)
 {
-       int ret;
+    int ret;
 
-       ret = instance_slave_close_pd(inst, client, LB_CLOSE_PD_NORMAL);
-       if (ret < 0) {
-               DbgPrint("Forcely close the PD ret: %d\n", ret);
-       }
+    ret = instance_slave_close_gbar(inst, client, DBOX_CLOSE_GBAR_NORMAL);
+    if (ret < 0) {
+       DbgPrint("Forcely close the GBAR ret: %d\n", ret);
+    }
 
-       instance_unref(inst);
+    instance_unref(inst);
 
-       return -1; /* Delete this callback */
+    return -1; /* Delete this callback */
 }
 
 /* Client Deactivated Callback */
-static int pd_script_close_cb(struct client_node *client, void *inst)
+static int gbar_script_close_cb(struct client_node *client, void *inst)
 {
-       int ret;
+    int ret;
 
-       ret = script_handler_unload(instance_pd_script(inst), 1);
-       if (ret < 0) {
-               DbgPrint("Unload script: %d\n", ret);
-       }
+    ret = script_handler_unload(instance_gbar_script(inst), 1);
+    if (ret < 0) {
+       DbgPrint("Unload script: %d\n", ret);
+    }
 
-       ret = instance_slave_close_pd(inst, client, LB_CLOSE_PD_NORMAL);
-       if (ret < 0) {
-               DbgPrint("Forcely close the PD ret: %d\n", ret);
-       }
+    ret = instance_slave_close_gbar(inst, client, DBOX_CLOSE_GBAR_NORMAL);
+    if (ret < 0) {
+       DbgPrint("Forcely close the GBAR ret: %d\n", ret);
+    }
 
-       instance_unref(inst);
+    instance_unref(inst);
 
-       return -1; /* Delete this callback */
+    return -1; /* Delete this callback */
 }
 
-static inline void release_resource_for_closing_pd(struct pkg_info *info, struct inst_info *inst, struct client_node *client)
+static inline void release_resource_for_closing_gbar(struct pkg_info *info, struct inst_info *inst, struct client_node *client)
 {
+    if (!client) {
+       client = inst->gbar.owner;
        if (!client) {
-               client = inst->pd.owner;
-               if (!client) {
-                       return;
-               }
-       }
-
-       /*!
-        * \note
-        * Clean up the resources
-        */
-       if (package_pd_type(info) == PD_TYPE_BUFFER) {
-               if (client_event_callback_del(client, CLIENT_EVENT_DEACTIVATE, pd_buffer_close_cb, inst) == 0) {
-                       /*!
-                        * \note
-                        * Only if this function succeed to remove the pd_buffer_close_cb,
-                        * Decrease the reference count of this instance
-                        */
-                       instance_unref(inst);
-               }
-       } else if (package_pd_type(info) == PD_TYPE_SCRIPT) {
-               if (client_event_callback_del(client, CLIENT_EVENT_DEACTIVATE, pd_script_close_cb, inst) == 0) {
-                       /*!
-                        * \note
-                        * Only if this function succeed to remove the script_close_cb,
-                        * Decrease the reference count of this instance
-                        */
-                       instance_unref(inst);
-               }
-       } else {
-               ErrPrint("Unknown PD type\n");
-       }
+           return;
+       }
+    }
+
+    /*!
+     * \note
+     * Clean up the resources
+     */
+    if (package_gbar_type(info) == GBAR_TYPE_BUFFER) {
+       if (client_event_callback_del(client, CLIENT_EVENT_DEACTIVATE, gbar_buffer_close_cb, inst) == 0) {
+           /*!
+            * \note
+            * Only if this function succeed to remove the gbar_buffer_close_cb,
+            * Decrease the reference count of this instance
+            */
+           instance_unref(inst);
+       }
+    } else if (package_gbar_type(info) == GBAR_TYPE_SCRIPT) {
+       if (client_event_callback_del(client, CLIENT_EVENT_DEACTIVATE, gbar_script_close_cb, inst) == 0) {
+           /*!
+            * \note
+            * Only if this function succeed to remove the script_close_cb,
+            * Decrease the reference count of this instance
+            */
+           instance_unref(inst);
+       }
+    } else {
+       ErrPrint("Unknown GBAR type\n");
+    }
 
 }
 
 HAPI int instance_state_reset(struct inst_info *inst)
 {
-       enum lb_type lb_type;
-       enum pd_type pd_type;
-
-       if (!inst) {
-               ErrPrint("Invalid instance handle\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       if (inst->state == INST_DESTROYED) {
-               goto out;
-       }
-
-       lb_type = package_lb_type(inst->info);
-       pd_type = package_pd_type(inst->info);
-
-       if (lb_type == LB_TYPE_SCRIPT && inst->lb.canvas.script) {
-               script_handler_unload(inst->lb.canvas.script, 0);
-       } else if (lb_type == LB_TYPE_BUFFER && inst->lb.canvas.buffer) {
-               buffer_handler_unload(inst->lb.canvas.buffer);
-       }
-
-       if (pd_type == PD_TYPE_SCRIPT && inst->pd.canvas.script) {
-               inst->pd.is_opened_for_reactivate = script_handler_is_loaded(inst->pd.canvas.script);
-               release_resource_for_closing_pd(instance_package(inst), inst, NULL);
-               script_handler_unload(inst->pd.canvas.script, 1);
-       } else if (pd_type == PD_TYPE_BUFFER && inst->pd.canvas.buffer) {
-               inst->pd.is_opened_for_reactivate = buffer_handler_is_loaded(inst->pd.canvas.buffer);
-               release_resource_for_closing_pd(instance_package(inst), inst, NULL);
-               buffer_handler_unload(inst->pd.canvas.buffer);
-       }
+    enum dynamicbox_dbox_type dbox_type;
+    enum dynamicbox_gbar_type gbar_type;
+
+    if (!inst) {
+       ErrPrint("Invalid instance handle\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    if (inst->state == INST_DESTROYED) {
+       goto out;
+    }
+
+    dbox_type = package_dbox_type(inst->info);
+    gbar_type = package_gbar_type(inst->info);
+
+    if (dbox_type == DBOX_TYPE_SCRIPT && inst->dbox.canvas.script) {
+       script_handler_unload(inst->dbox.canvas.script, 0);
+    } else if (dbox_type == DBOX_TYPE_BUFFER && inst->dbox.canvas.buffer) {
+       buffer_handler_unload(inst->dbox.canvas.buffer);
+    }
+
+    if (gbar_type == GBAR_TYPE_SCRIPT && inst->gbar.canvas.script) {
+       inst->gbar.is_opened_for_reactivate = script_handler_is_loaded(inst->gbar.canvas.script);
+       release_resource_for_closing_gbar(instance_package(inst), inst, NULL);
+       script_handler_unload(inst->gbar.canvas.script, 1);
+    } else if (gbar_type == GBAR_TYPE_BUFFER && inst->gbar.canvas.buffer) {
+       inst->gbar.is_opened_for_reactivate = buffer_handler_is_loaded(inst->gbar.canvas.buffer);
+       release_resource_for_closing_gbar(instance_package(inst), inst, NULL);
+       buffer_handler_unload(inst->gbar.canvas.buffer);
+    }
 
 out:
-       inst->state = INST_INIT;
-       inst->requested_state = INST_INIT;
-       return LB_STATUS_SUCCESS;
+    inst->state = INST_INIT;
+    inst->requested_state = INST_INIT;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int instance_reactivate(struct inst_info *inst)
 {
-       struct packet *packet;
-       int ret;
-
-       if (!inst) {
-               ErrPrint("Invalid instance handle\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    struct packet *packet;
+    unsigned int cmd = CMD_RENEW;
+    int ret;
 
-       if (package_is_fault(inst->info)) {
-               ErrPrint("Fault package [%s]\n", package_name(inst->info));
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (!inst) {
+       ErrPrint("Invalid instance handle\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       switch (inst->state) {
-       case INST_REQUEST_TO_DESTROY:
-       case INST_REQUEST_TO_ACTIVATE:
-       case INST_REQUEST_TO_REACTIVATE:
-               inst->requested_state = INST_ACTIVATED;
-               return LB_STATUS_SUCCESS;
-       case INST_DESTROYED:
-       case INST_ACTIVATED:
-               return LB_STATUS_SUCCESS;
-       case INST_INIT:
-       default:
-               break;
-       }
-
-       packet = packet_create("renew", "sssiidssiisii",
-                       package_name(inst->info),
-                       inst->id,
-                       inst->content,
-                       package_timeout(inst->info),
-                       !!package_lb_path(inst->info),
-                       inst->lb.period,
-                       inst->cluster,
-                       inst->category,
-                       inst->lb.width, inst->lb.height,
-                       package_abi(inst->info),
-                       inst->scroll_locked,
-                       inst->active_update);
-       if (!packet) {
-               ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       ret = slave_activate(package_slave(inst->info));
-       if (ret < 0 && ret != LB_STATUS_ERROR_ALREADY) {
-               /*!
-                * \note
-                * If the master failed to launch the slave,
-                * Do not send any requests to the slave.
-                */
-               ErrPrint("Failed to launch the slave\n");
-               packet_destroy(packet);
-               return ret;
-       }
+    if (package_is_fault(inst->info)) {
+       ErrPrint("Fault package [%s]\n", package_name(inst->info));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
+    switch (inst->state) {
+    case INST_REQUEST_TO_DESTROY:
+    case INST_REQUEST_TO_ACTIVATE:
+    case INST_REQUEST_TO_REACTIVATE:
        inst->requested_state = INST_ACTIVATED;
-       inst->state = INST_REQUEST_TO_REACTIVATE;
-       inst->changing_state = 1;
+       return DBOX_STATUS_ERROR_NONE;
+    case INST_DESTROYED:
+    case INST_ACTIVATED:
+       return DBOX_STATUS_ERROR_NONE;
+    case INST_INIT:
+    default:
+       break;
+    }
+
+    packet = packet_create((const char *)&cmd, "sssiidssiisiis",
+           package_name(inst->info),
+           inst->id,
+           inst->content,
+           package_timeout(inst->info),
+           !!package_dbox_path(inst->info),
+           inst->dbox.period,
+           inst->cluster,
+           inst->category,
+           inst->dbox.width, inst->dbox.height,
+           package_abi(inst->info),
+           inst->scroll_locked,
+           inst->active_update,
+           client_direct_addr(inst->client));
+    if (!packet) {
+       ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    ret = slave_activate(package_slave(inst->info));
+    if (ret < 0 && ret != DBOX_STATUS_ERROR_ALREADY) {
+       /*!
+        * \note
+        * If the master failed to launch the slave,
+        * Do not send any requests to the slave.
+        */
+       ErrPrint("Failed to launch the slave\n");
+       packet_destroy(packet);
+       return ret;
+    }
+
+    inst->requested_state = INST_ACTIVATED;
+    inst->state = INST_REQUEST_TO_REACTIVATE;
+    inst->changing_state++;
 
-       return slave_rpc_async_request(package_slave(inst->info), package_name(inst->info), packet, reactivate_cb, instance_ref(inst), 1);
+    return slave_rpc_async_request(package_slave(inst->info), package_name(inst->info), packet, reactivate_cb, instance_ref(inst), 1);
 }
 
 HAPI int instance_activate(struct inst_info *inst)
 {
-       struct packet *packet;
-       int ret;
+    struct packet *packet;
+    unsigned int cmd = CMD_NEW;
+    int ret;
 
-       if (!inst) {
-               ErrPrint("Invalid instance handle\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       if (package_is_fault(inst->info)) {
-               ErrPrint("Fault package [%s]\n", package_name(inst->info));
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (!inst) {
+       ErrPrint("Invalid instance handle\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       switch (inst->state) {
-       case INST_REQUEST_TO_REACTIVATE:
-       case INST_REQUEST_TO_ACTIVATE:
-       case INST_REQUEST_TO_DESTROY:
-               inst->requested_state = INST_ACTIVATED;
-               return LB_STATUS_SUCCESS;
-       case INST_ACTIVATED:
-       case INST_DESTROYED:
-               return LB_STATUS_SUCCESS;
-       case INST_INIT:
-       default:
-               break;
-       }
-
-       packet = packet_create("new", "sssiidssisii",
-                       package_name(inst->info),
-                       inst->id,
-                       inst->content,
-                       package_timeout(inst->info),
-                       !!package_lb_path(inst->info),
-                       inst->lb.period,
-                       inst->cluster,
-                       inst->category,
-                       !!inst->client,
-                       package_abi(inst->info),
-                       inst->lb.width,
-                       inst->lb.height);
-       if (!packet) {
-               ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       ret = slave_activate(package_slave(inst->info));
-       if (ret < 0 && ret != LB_STATUS_ERROR_ALREADY) {
-               /*!
-                * \note
-                * If the master failed to launch the slave,
-                * Do not send any requests to the slave.
-                */
-               ErrPrint("Failed to launch the slave\n");
-               packet_destroy(packet);
-               return ret;
-       }
+    if (package_is_fault(inst->info)) {
+       ErrPrint("Fault package [%s]\n", package_name(inst->info));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       inst->state = INST_REQUEST_TO_ACTIVATE;
+    switch (inst->state) {
+    case INST_REQUEST_TO_REACTIVATE:
+    case INST_REQUEST_TO_ACTIVATE:
+    case INST_REQUEST_TO_DESTROY:
        inst->requested_state = INST_ACTIVATED;
-       inst->changing_state = 1;
-
+       return DBOX_STATUS_ERROR_NONE;
+    case INST_ACTIVATED:
+    case INST_DESTROYED:
+       return DBOX_STATUS_ERROR_NONE;
+    case INST_INIT:
+    default:
+       break;
+    }
+
+    packet = packet_create((const char *)&cmd, "sssiidssisiis",
+           package_name(inst->info),
+           inst->id,
+           inst->content,
+           package_timeout(inst->info),
+           !!package_dbox_path(inst->info),
+           inst->dbox.period,
+           inst->cluster,
+           inst->category,
+           !!inst->client,
+           package_abi(inst->info),
+           inst->dbox.width,
+           inst->dbox.height,
+           client_direct_addr(inst->client));
+    if (!packet) {
+       ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    ret = slave_activate(package_slave(inst->info));
+    if (ret < 0 && ret != DBOX_STATUS_ERROR_ALREADY) {
        /*!
         * \note
-        * Try to activate a slave if it is not activated
+        * If the master failed to launch the slave,
+        * Do not send any requests to the slave.
         */
-       return slave_rpc_async_request(package_slave(inst->info), package_name(inst->info), packet, activate_cb, instance_ref(inst), 1);
-}
-
-HAPI int instance_lb_update_begin(struct inst_info *inst, double priority, const char *content, const char *title)
-{
-       struct packet *packet;
-       const char *fbfile;
-
-       if (!inst->active_update) {
-               ErrPrint("Invalid request [%s]\n", inst->id);
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       switch (package_lb_type(inst->info)) {
-       case LB_TYPE_BUFFER:
-               if (!inst->lb.canvas.buffer) {
-                       ErrPrint("Buffer is null [%s]\n", inst->id);
-                       return LB_STATUS_ERROR_INVALID;
-               }
-               fbfile = buffer_handler_id(inst->lb.canvas.buffer);
-               break;
-       case LB_TYPE_SCRIPT:
-               if (!inst->lb.canvas.script) {
-                       ErrPrint("Script is null [%s]\n", inst->id);
-                       return LB_STATUS_ERROR_INVALID;
-               }
-               fbfile = script_handler_buffer_id(inst->lb.canvas.script);
-               break;
-       default:
-               ErrPrint("Invalid request[%s]\n", inst->id);
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       packet = packet_create_noack("lb_update_begin", "ssdsss", package_name(inst->info), inst->id, priority, content, title, fbfile);
-       if (!packet) {
-               ErrPrint("Unable to create a packet\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       return CLIENT_SEND_EVENT(inst, packet);
-}
-
-HAPI int instance_lb_update_end(struct inst_info *inst)
-{
-       struct packet *packet;
-
-       if (!inst->active_update) {
-               ErrPrint("Invalid request [%s]\n", inst->id);
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       switch (package_lb_type(inst->info)) {
-       case LB_TYPE_BUFFER:
-               if (!inst->lb.canvas.buffer) {
-                       ErrPrint("Buffer is null [%s]\n", inst->id);
-                       return LB_STATUS_ERROR_INVALID;
-               }
-               break;
-       case LB_TYPE_SCRIPT:
-               if (!inst->lb.canvas.script) {
-                       ErrPrint("Script is null [%s]\n", inst->id);
-                       return LB_STATUS_ERROR_INVALID;
-               }
-               break;
-       default:
-               ErrPrint("Invalid request[%s]\n", inst->id);
-               return LB_STATUS_ERROR_INVALID;
-       }
+       ErrPrint("Failed to launch the slave\n");
+       packet_destroy(packet);
+       return ret;
+    }
 
-       packet = packet_create_noack("lb_update_end", "ss", package_name(inst->info), inst->id);
-       if (!packet) {
-               ErrPrint("Unable to create a packet\n");
-               return LB_STATUS_ERROR_FAULT;
+    inst->state = INST_REQUEST_TO_ACTIVATE;
+    inst->requested_state = INST_ACTIVATED;
+    inst->changing_state++;
+
+    /*!
+     * \note
+     * Try to activate a slave if it is not activated
+     */
+    return slave_rpc_async_request(package_slave(inst->info), package_name(inst->info), packet, activate_cb, instance_ref(inst), 1);
+}
+
+HAPI int instance_dbox_update_begin(struct inst_info *inst, double priority, const char *content, const char *title)
+{
+    struct packet *packet;
+    const char *fbfile;
+    unsigned int cmd = CMD_DBOX_UPDATE_BEGIN;
+
+    if (!inst->active_update) {
+       ErrPrint("Invalid request [%s]\n", inst->id);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    switch (package_dbox_type(inst->info)) {
+    case DBOX_TYPE_BUFFER:
+       if (!inst->dbox.canvas.buffer) {
+           ErrPrint("Buffer is null [%s]\n", inst->id);
+           return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       }
+       fbfile = buffer_handler_id(inst->dbox.canvas.buffer);
+       break;
+    case DBOX_TYPE_SCRIPT:
+       if (!inst->dbox.canvas.script) {
+           ErrPrint("Script is null [%s]\n", inst->id);
+           return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       }
+       fbfile = script_handler_buffer_id(inst->dbox.canvas.script);
+       break;
+    default:
+       ErrPrint("Invalid request[%s]\n", inst->id);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    packet = packet_create_noack((const char *)&cmd, "ssdsss", package_name(inst->info), inst->id, priority, content, title, fbfile);
+    if (!packet) {
+       ErrPrint("Unable to create a packet\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    return CLIENT_SEND_EVENT(inst, packet);
+}
+
+HAPI int instance_dbox_update_end(struct inst_info *inst)
+{
+    struct packet *packet;
+    unsigned int cmd = CMD_DBOX_UPDATE_END;
+
+    if (!inst->active_update) {
+       ErrPrint("Invalid request [%s]\n", inst->id);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    switch (package_dbox_type(inst->info)) {
+    case DBOX_TYPE_BUFFER:
+       if (!inst->dbox.canvas.buffer) {
+           ErrPrint("Buffer is null [%s]\n", inst->id);
+           return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       }
+       break;
+    case DBOX_TYPE_SCRIPT:
+       if (!inst->dbox.canvas.script) {
+           ErrPrint("Script is null [%s]\n", inst->id);
+           return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       }
+       break;
+    default:
+       ErrPrint("Invalid request[%s]\n", inst->id);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    packet = packet_create_noack((const char *)&cmd, "ss", package_name(inst->info), inst->id);
+    if (!packet) {
+       ErrPrint("Unable to create a packet\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    return CLIENT_SEND_EVENT(inst, packet);
+}
+
+HAPI int instance_gbar_update_begin(struct inst_info *inst)
+{
+    struct packet *packet;
+    const char *fbfile;
+    unsigned int cmd = CMD_GBAR_UPDATE_BEGIN;
+
+    if (!inst->active_update) {
+       ErrPrint("Invalid request [%s]\n", inst->id);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    switch (package_gbar_type(inst->info)) {
+    case GBAR_TYPE_BUFFER:
+       if (!inst->gbar.canvas.buffer) {
+           ErrPrint("Buffer is null [%s]\n", inst->id);
+           return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       }
+       fbfile = buffer_handler_id(inst->gbar.canvas.buffer);
+       break;
+    case GBAR_TYPE_SCRIPT:
+       if (!inst->gbar.canvas.script) {
+           ErrPrint("Script is null [%s]\n", inst->id);
+           return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       }
+       fbfile = script_handler_buffer_id(inst->gbar.canvas.script);
+       break;
+    default:
+       ErrPrint("Invalid request[%s]\n", inst->id);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    packet = packet_create_noack((const char *)&cmd, "sss", package_name(inst->info), inst->id, fbfile);
+    if (!packet) {
+       ErrPrint("Unable to create a packet\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    return CLIENT_SEND_EVENT(inst, packet);
+}
+
+HAPI int instance_gbar_update_end(struct inst_info *inst)
+{
+    struct packet *packet;
+    unsigned int cmd = CMD_GBAR_UPDATE_END;
+
+    if (!inst->active_update) {
+       ErrPrint("Invalid request [%s]\n", inst->id);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    switch (package_gbar_type(inst->info)) {
+    case GBAR_TYPE_BUFFER:
+       if (!inst->gbar.canvas.buffer) {
+           ErrPrint("Buffer is null [%s]\n", inst->id);
+           return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       }
+       break;
+    case GBAR_TYPE_SCRIPT:
+       if (!inst->gbar.canvas.script) {
+           ErrPrint("Script is null [%s]\n", inst->id);
+           return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
+       break;
+    default:
+       ErrPrint("Invalid request[%s]\n", inst->id);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    packet = packet_create_noack((const char *)&cmd, "ss", package_name(inst->info), inst->id);
+    if (!packet) {
+       ErrPrint("Unable to create a packet\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    return CLIENT_SEND_EVENT(inst, packet);
+}
+
+HAPI void instance_extra_info_updated_by_instance(struct inst_info *inst)
+{
+    struct packet *packet;
+    unsigned int cmd = CMD_EXTRA_INFO;
+
+    packet = packet_create_noack((const char *)&cmd, "ssssssd", package_name(inst->info), inst->id,
+           inst->content, inst->title,
+           inst->icon, inst->name,
+           inst->dbox.priority);
+    if (!packet) {
+       ErrPrint("Failed to create param (%s - %s)\n", package_name(inst->info), inst->id);
+       return;
+    }
 
-       return CLIENT_SEND_EVENT(inst, packet);
+    (void)CLIENT_SEND_EVENT(inst, packet);
 }
 
-HAPI int instance_pd_update_begin(struct inst_info *inst)
+HAPI void instance_extra_updated_by_instance(struct inst_info *inst, int is_gbar, int idx, int x, int y, int w, int h)
 {
-       struct packet *packet;
-       const char *fbfile;
+    struct packet *packet;
+    enum dynamicbox_dbox_type dbox_type;
+    unsigned int cmd = CMD_EXTRA_UPDATED;
 
-       if (!inst->active_update) {
-               ErrPrint("Invalid request [%s]\n", inst->id);
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (idx < 0 || idx > DYNAMICBOX_CONF_EXTRA_BUFFER_COUNT) {
+       ErrPrint("Invalid index\n");
+       return;
+    }
 
-       switch (package_pd_type(inst->info)) {
-       case PD_TYPE_BUFFER:
-               if (!inst->pd.canvas.buffer) {
-                       ErrPrint("Buffer is null [%s]\n", inst->id);
-                       return LB_STATUS_ERROR_INVALID;
-               }
-               fbfile = buffer_handler_id(inst->pd.canvas.buffer);
-               break;
-       case PD_TYPE_SCRIPT:
-               if (!inst->pd.canvas.script) {
-                       ErrPrint("Script is null [%s]\n", inst->id);
-                       return LB_STATUS_ERROR_INVALID;
-               }
-               fbfile = script_handler_buffer_id(inst->pd.canvas.script);
-               break;
-       default:
-               ErrPrint("Invalid request[%s]\n", inst->id);
-               return LB_STATUS_ERROR_INVALID;
+    if (is_gbar == 0) {
+       if (!inst->dbox.extra_buffer || inst->dbox.extra_buffer[idx] == 0u) {
+           ErrPrint("Invalid extra buffer\n");
+           return;
        }
-
-       packet = packet_create_noack("pd_update_begin", "sss", package_name(inst->info), inst->id, fbfile);
-       if (!packet) {
-               ErrPrint("Unable to create a packet\n");
-               return LB_STATUS_ERROR_FAULT;
+    } else {
+       if (!inst->gbar.extra_buffer || inst->gbar.extra_buffer[idx] == 0u) {
+           ErrPrint("Invalid extra buffer\n");
+           return;
        }
+    }
 
-       return CLIENT_SEND_EVENT(inst, packet);
-}
-
-HAPI int instance_pd_update_end(struct inst_info *inst)
-{
-       struct packet *packet;
-
-       if (!inst->active_update) {
-               ErrPrint("Invalid request [%s]\n", inst->id);
-               return LB_STATUS_ERROR_INVALID;
+    if (inst->client && inst->visible != DBOX_SHOW) {
+       if (inst->visible == DBOX_HIDE) {
+           DbgPrint("Ignore update event %s(HIDE)\n", inst->id);
+           return;
        }
+    }
 
-       switch (package_pd_type(inst->info)) {
-       case PD_TYPE_BUFFER:
-               if (!inst->pd.canvas.buffer) {
-                       ErrPrint("Buffer is null [%s]\n", inst->id);
-                       return LB_STATUS_ERROR_INVALID;
-               }
-               break;
-       case PD_TYPE_SCRIPT:
-               if (!inst->pd.canvas.script) {
-                       ErrPrint("Script is null [%s]\n", inst->id);
-                       return LB_STATUS_ERROR_INVALID;
-               }
-               break;
-       default:
-               ErrPrint("Invalid request[%s]\n", inst->id);
-               return LB_STATUS_ERROR_INVALID;
-       }
+    dbox_type = package_dbox_type(inst->info);
+    if (dbox_type != DBOX_TYPE_BUFFER) {
+       ErrPrint("Unsupported type\n");
+       return;
+    }
 
-       packet = packet_create_noack("pd_update_end", "ss", package_name(inst->info), inst->id);
-       if (!packet) {
-               ErrPrint("Unable to create a packet\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    packet = packet_create_noack((const char *)&cmd, "ssiiiiii", package_name(inst->info), inst->id, is_gbar, idx, x, y, w, h);
+    if (!packet) {
+       ErrPrint("Failed to create param (%s - %s)\n", package_name(inst->info), inst->id);
+       return;
+    }
 
-       return CLIENT_SEND_EVENT(inst, packet);
+    (void)CLIENT_SEND_EVENT(inst, packet);
 }
 
-HAPI void instance_lb_updated_by_instance(struct inst_info *inst, const char *safe_file)
+HAPI void instance_dbox_updated_by_instance(struct inst_info *inst, const char *safe_file, int x, int y, int w, int h)
 {
-       struct packet *packet;
-       const char *id;
-       enum lb_type lb_type;
-       const char *title;
-       const char *content;
-       const char *icon;
-       const char *name;
-
-       if (inst->client && inst->visible != LB_SHOW) {
-               if (inst->visible == LB_HIDE) {
-                       DbgPrint("Ignore update event %s(HIDE)\n", inst->id);
-                       return;
-               }
-               DbgPrint("Livebox(%s) is PAUSED. But content is updated.\n", inst->id);
-       }
-
-       lb_type = package_lb_type(inst->info);
-       if (lb_type == LB_TYPE_SCRIPT) {
-               id = script_handler_buffer_id(inst->lb.canvas.script);
-       } else if (lb_type == LB_TYPE_BUFFER) {
-               id = buffer_handler_id(inst->lb.canvas.buffer);
-       } else {
-               id = "";
-       }
+    struct packet *packet;
+    const char *id = NULL;
+    enum dynamicbox_dbox_type dbox_type;
+    unsigned int cmd = CMD_DBOX_UPDATED;
 
-       if (inst->content) {
-               content = inst->content;
-       } else {
-               content = "";
-       }
-
-       if (inst->title) {
-               title = inst->title;
-       } else {
-               title = "";
+    if (inst->client && inst->visible != DBOX_SHOW) {
+       if (inst->visible == DBOX_HIDE) {
+           DbgPrint("Ignore update event %s(HIDE)\n", inst->id);
+           return;
        }
+    }
 
-       if (inst->icon) {
-               icon = inst->icon;
-       } else {
-               icon = "";
-       }
-
-       if (inst->name) {
-               name = inst->name;
-       } else {
-               name = "";
-       }
+    dbox_type = package_dbox_type(inst->info);
+    if (dbox_type == DBOX_TYPE_SCRIPT) {
+       id = script_handler_buffer_id(inst->dbox.canvas.script);
+    } else if (dbox_type == DBOX_TYPE_BUFFER) {
+       id = buffer_handler_id(inst->dbox.canvas.buffer);
+    }
 
-       packet = packet_create_noack("lb_updated", "sssiidsssss",
-                       package_name(inst->info), inst->id, id,
-                       inst->lb.width, inst->lb.height, inst->lb.priority, content, title, safe_file, icon, name);
-       if (!packet) {
-               ErrPrint("Failed to create param (%s - %s)\n", package_name(inst->info), inst->id);
-               return;
-       }
+    packet = packet_create_noack((const char *)&cmd, "ssssiiii", package_name(inst->info), inst->id, id, safe_file, x, y, w, h);
+    if (!packet) {
+       ErrPrint("Failed to create param (%s - %s)\n", package_name(inst->info), inst->id);
+       return;
+    }
 
-       (void)CLIENT_SEND_EVENT(inst, packet);
+    (void)CLIENT_SEND_EVENT(inst, packet);
 }
 
 HAPI int instance_hold_scroll(struct inst_info *inst, int hold)
 {
-       struct packet *packet;
+    struct packet *packet;
+    unsigned int cmd = CMD_SCROLL;
 
-       DbgPrint("HOLD: (%s) %d\n", inst->id, hold);
-       if (inst->scroll_locked == hold) {
-               return LB_STATUS_ERROR_ALREADY;
-       }
+    DbgPrint("HOLD: (%s) %d\n", inst->id, hold);
+    if (inst->scroll_locked == hold) {
+       return DBOX_STATUS_ERROR_ALREADY;
+    }
 
-       packet = packet_create_noack("scroll", "ssi", package_name(inst->info), inst->id, hold);
-       if (!packet) {
-               ErrPrint("Failed to build a packet\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    packet = packet_create_noack((const char *)&cmd, "ssi", package_name(inst->info), inst->id, hold);
+    if (!packet) {
+       ErrPrint("Failed to build a packet\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       inst->scroll_locked = hold;
-       return CLIENT_SEND_EVENT(inst, packet);
+    inst->scroll_locked = hold;
+    return CLIENT_SEND_EVENT(inst, packet);
 }
 
-HAPI void instance_pd_updated_by_instance(struct inst_info *inst, const char *descfile)
+HAPI void instance_gbar_updated_by_instance(struct inst_info *inst, const char *descfile, int x, int y, int w, int h)
 {
-       struct packet *packet;
-       const char *id;
-
-       if (inst->client && inst->visible != LB_SHOW) {
-               DbgPrint("Livebox is hidden. ignore update event\n");
-               return;
-       }
-
-       if (!inst->pd.need_to_send_close_event) {
-               DbgPrint("PD is not created yet. Ignore update event - %s\n", descfile);
-
-               if (inst->pd.pended_update_desc) {
-                       DbgFree(inst->pd.pended_update_desc);
-                       inst->pd.pended_update_desc = NULL;
-               }
+    struct packet *packet;
+    unsigned int cmd = CMD_GBAR_UPDATED;
+    const char *id;
 
-               if (descfile) {
-                       inst->pd.pended_update_desc = strdup(descfile);
-                       if (!inst->pd.pended_update_desc) {
-                               ErrPrint("Heap: %s\n", strerror(errno));
-                       }
-               }
+    if (inst->client && inst->visible != DBOX_SHOW) {
+       DbgPrint("Dynamicbox is hidden. ignore update event\n");
+       return;
+    }
 
-               inst->pd.pended_update_cnt++;
-               return;
-       }
+    if (!inst->gbar.need_to_send_close_event) {
+       DbgPrint("GBAR is not created yet. Ignore update event - %s\n", descfile);
 
-       if (!descfile) {
-               descfile = inst->id;
+       if (inst->gbar.pended_update_desc) {
+           DbgFree(inst->gbar.pended_update_desc);
+           inst->gbar.pended_update_desc = NULL;
        }
 
-       switch (package_pd_type(inst->info)) {
-       case PD_TYPE_SCRIPT:
-               id = script_handler_buffer_id(inst->pd.canvas.script);
-               break;
-       case PD_TYPE_BUFFER:
-               id = buffer_handler_id(inst->pd.canvas.buffer);
-               break;
-       case PD_TYPE_TEXT:
-       default:
-               id = "";
-               break;
+       if (descfile) {
+           inst->gbar.pended_update_desc = strdup(descfile);
+           if (!inst->gbar.pended_update_desc) {
+               ErrPrint("Heap: %s\n", strerror(errno));
+           }
        }
 
-       packet = packet_create_noack("pd_updated", "ssssii",
-                       package_name(inst->info), inst->id, descfile, id,
-                       inst->pd.width, inst->pd.height);
-       if (!packet) {
-               ErrPrint("Failed to create param (%s - %s)\n", package_name(inst->info), inst->id);
-               return;
-       }
+       inst->gbar.pended_update_cnt++;
+       return;
+    }
+
+    if (!descfile) {
+       descfile = inst->id;
+    }
+
+    switch (package_gbar_type(inst->info)) {
+    case GBAR_TYPE_SCRIPT:
+       id = script_handler_buffer_id(inst->gbar.canvas.script);
+       break;
+    case GBAR_TYPE_BUFFER:
+       id = buffer_handler_id(inst->gbar.canvas.buffer);
+       break;
+    case GBAR_TYPE_TEXT:
+    default:
+       id = "";
+       break;
+    }
+
+    packet = packet_create_noack((const char *)&cmd, "ssssiiii", package_name(inst->info), inst->id, id, descfile, x, y, w, h);
+    if (!packet) {
+       ErrPrint("Failed to create param (%s - %s)\n", package_name(inst->info), inst->id);
+       return;
+    }
 
-       (void)CLIENT_SEND_EVENT(inst, packet);
+    (void)CLIENT_SEND_EVENT(inst, packet);
 }
 
-HAPI void instance_pd_updated(const char *pkgname, const char *id, const char *descfile)
+HAPI void instance_gbar_updated(const char *pkgname, const char *id, const char *descfile, int x, int y, int w, int h)
 {
-       struct inst_info *inst;
+    struct inst_info *inst;
 
-       inst = package_find_instance_by_id(pkgname, id);
-       if (!inst) {
-               return;
-       }
+    inst = package_find_instance_by_id(pkgname, id);
+    if (!inst) {
+       return;
+    }
 
-       instance_pd_updated_by_instance(inst, descfile);
+    instance_gbar_updated_by_instance(inst, descfile, x, y, w, h);
 }
 
 HAPI int instance_set_update_mode(struct inst_info *inst, int active_update)
 {
-       struct packet *packet;
-       struct update_mode_cbdata *cbdata;
-
-       if (package_is_fault(inst->info)) {
-               ErrPrint("Fault package [%s]\n", package_name(inst->info));
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       if (inst->active_update == active_update) {
-               DbgPrint("Active update is not changed: %d\n", inst->active_update);
-               return LB_STATUS_ERROR_ALREADY;
-       }
-
-       cbdata = malloc(sizeof(*cbdata));
-       if (!cbdata) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       cbdata->inst = instance_ref(inst);
-       cbdata->active_update = active_update;
-
-       /* NOTE: param is resued from here */
-       packet = packet_create("update_mode", "ssi", package_name(inst->info), inst->id, active_update);
-       if (!packet) {
-               ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
-               instance_unref(cbdata->inst);
-               DbgFree(cbdata);
-               return LB_STATUS_ERROR_FAULT;
-       }
+    struct packet *packet;
+    struct update_mode_cbdata *cbdata;
+    unsigned int cmd = CMD_UPDATE_MODE;
+
+    if (package_is_fault(inst->info)) {
+       ErrPrint("Fault package [%s]\n", package_name(inst->info));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    if (inst->active_update == active_update) {
+       DbgPrint("Active update is not changed: %d\n", inst->active_update);
+       return DBOX_STATUS_ERROR_ALREADY;
+    }
+
+    cbdata = malloc(sizeof(*cbdata));
+    if (!cbdata) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    cbdata->inst = instance_ref(inst);
+    cbdata->active_update = active_update;
+
+    /* NOTE: param is resued from here */
+    packet = packet_create((const char *)&cmd, "ssi", package_name(inst->info), inst->id, active_update);
+    if (!packet) {
+       ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
+       instance_unref(cbdata->inst);
+       DbgFree(cbdata);
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       return slave_rpc_async_request(package_slave(inst->info), package_name(inst->info), packet, update_mode_cb, cbdata, 0);
+    return slave_rpc_async_request(package_slave(inst->info), package_name(inst->info), packet, update_mode_cb, cbdata, 0);
 }
 
 HAPI int instance_active_update(struct inst_info *inst)
 {
-       return inst->active_update;
+    return inst->active_update;
 }
 
-HAPI void instance_set_lb_info(struct inst_info *inst, double priority, const char *content, const char *title)
+HAPI void instance_set_dbox_info(struct inst_info *inst, double priority, const char *content, const char *title)
 {
-       char *_content = NULL;
-       char *_title = NULL;
+    char *_content = NULL;
+    char *_title = NULL;
 
-       if (content && strlen(content)) {
-               _content = strdup(content);
-               if (!_content) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-               }
+    if (content && strlen(content)) {
+       _content = strdup(content);
+       if (!_content) {
+           ErrPrint("Heap: %s\n", strerror(errno));
        }
+    }
 
-       if (title && strlen(title)) {
-               _title = strdup(title);
-               if (!_title) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-               }
+    if (title && strlen(title)) {
+       _title = strdup(title);
+       if (!_title) {
+           ErrPrint("Heap: %s\n", strerror(errno));
        }
+    }
 
-       if (_content) {
-               DbgFree(inst->content);
-               inst->content= _content;
-       }
+    if (_content) {
+       DbgFree(inst->content);
+       inst->content= _content;
+    }
 
-       if (_title) {
-               DbgFree(inst->title);
-               inst->title = _title;
-       }
+    if (_title) {
+       DbgFree(inst->title);
+       inst->title = _title;
+    }
 
-       if (priority >= 0.0f && priority <= 1.0f) {
-               inst->lb.priority = priority;
-       }
+    if (priority >= 0.0f && priority <= 1.0f) {
+       inst->dbox.priority = priority;
+    }
 }
 
 HAPI void instance_set_alt_info(struct inst_info *inst, const char *icon, const char *name)
 {
-       char *_icon = NULL;
-       char *_name = NULL;
+    char *_icon = NULL;
+    char *_name = NULL;
 
-       if (icon && strlen(icon)) {
-               _icon = strdup(icon);
-               if (!_icon) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-               }
+    if (icon && strlen(icon)) {
+       _icon = strdup(icon);
+       if (!_icon) {
+           ErrPrint("Heap: %s\n", strerror(errno));
        }
+    }
 
-       if (name && strlen(name)) {
-               _name = strdup(name);
-               if (!_name) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-               }
+    if (name && strlen(name)) {
+       _name = strdup(name);
+       if (!_name) {
+           ErrPrint("Heap: %s\n", strerror(errno));
        }
+    }
 
-       if (_icon) {
-               DbgFree(inst->icon);
-               inst->icon = _icon;
-       }
+    if (_icon) {
+       DbgFree(inst->icon);
+       inst->icon = _icon;
+    }
 
-       if (_name) {
-               DbgFree(inst->name);
-               inst->name = _name;
-       }
+    if (_name) {
+       DbgFree(inst->name);
+       inst->name = _name;
+    }
 }
 
-HAPI void instance_set_lb_size(struct inst_info *inst, int w, int h)
+HAPI void instance_set_dbox_size(struct inst_info *inst, int w, int h)
 {
-       if (inst->lb.width != w || inst->lb.height != h) {
-               instance_send_resized_event(inst, IS_LB, w, h, LB_STATUS_SUCCESS);
-       }
+    if (inst->dbox.width != w || inst->dbox.height != h) {
+       instance_send_resized_event(inst, IS_DBOX, w, h, DBOX_STATUS_ERROR_NONE);
+    }
 
-       inst->lb.width = w;
-       inst->lb.height = h;
+    inst->dbox.width = w;
+    inst->dbox.height = h;
 }
 
-HAPI void instance_set_pd_size(struct inst_info *inst, int w, int h)
+HAPI void instance_set_gbar_size(struct inst_info *inst, int w, int h)
 {
-       if (inst->pd.width != w || inst->pd.height != h) {
-               instance_send_resized_event(inst, IS_PD, w, h, LB_STATUS_SUCCESS);
-       }
+    if (inst->gbar.width != w || inst->gbar.height != h) {
+       instance_send_resized_event(inst, IS_GBAR, w, h, DBOX_STATUS_ERROR_NONE);
+    }
 
-       inst->pd.width = w;
-       inst->pd.height = h;
+    inst->gbar.width = w;
+    inst->gbar.height = h;
 }
 
 static void pinup_cb(struct slave_node *slave, const struct packet *packet, void *data)
 {
-       struct set_pinup_cbdata *cbdata = data;
-       const char *content;
-       struct packet *result;
-       int ret;
-
-       if (!packet) {
-               /*!
-                * \todo
-                * Send pinup failed event to client.
-                */
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       if (packet_get(packet, "is", &ret, &content) != 2) {
-               /*!
-                * \todo
-                * Send pinup failed event to client
-                */
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       if (ret == 0) {
-               char *new_content;
-
-               new_content = strdup(content);
-               if (!new_content) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       /*!
-                        * \note
-                        * send pinup failed event to client
-                        */
-                       ret = LB_STATUS_ERROR_MEMORY;
-                       goto out;
-               }
-       
-               cbdata->inst->is_pinned_up = cbdata->pinup;
-               DbgFree(cbdata->inst->content);
+    struct set_pinup_cbdata *cbdata = data;
+    const char *content;
+    struct packet *result;
+    unsigned int cmd = CMD_RESULT_PINUP;
+    int ret;
 
-               cbdata->inst->content = new_content;
-       }
+    if (!packet) {
+       /*!
+        * \todo
+        * Send pinup failed event to client.
+        */
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
 
-out:
+    if (packet_get(packet, "is", &ret, &content) != 2) {
        /*!
-        * \node
-        * Send PINUP Result to client.
-        * Client should wait this event.
+        * \todo
+        * Send pinup failed event to client
         */
-       result = packet_create_noack("pinup", "iisss", ret, cbdata->inst->is_pinned_up,
-                                                       package_name(cbdata->inst->info), cbdata->inst->id, cbdata->inst->content);
-       if (result) {
-               (void)CLIENT_SEND_EVENT(cbdata->inst, result);
-       } else {
-               ErrPrint("Failed to build a packet for %s\n", package_name(cbdata->inst->info));
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    if (ret == 0) {
+       char *new_content;
+
+       new_content = strdup(content);
+       if (!new_content) {
+           ErrPrint("Heap: %s\n", strerror(errno));
+           /*!
+            * \note
+            * send pinup failed event to client
+            */
+           ret = DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+           goto out;
        }
 
-       instance_unref(cbdata->inst);
-       DbgFree(cbdata);
+       cbdata->inst->is_pinned_up = cbdata->pinup;
+       DbgFree(cbdata->inst->content);
+
+       cbdata->inst->content = new_content;
+    }
+
+out:
+    /*!
+     * \node
+     * Send PINUP Result to client.
+     * Client should wait this event.
+     */
+    result = packet_create_noack((const char *)&cmd, "iisss", ret, cbdata->inst->is_pinned_up,
+           package_name(cbdata->inst->info), cbdata->inst->id, cbdata->inst->content);
+    if (result) {
+       (void)CLIENT_SEND_EVENT(cbdata->inst, result);
+    } else {
+       ErrPrint("Failed to build a packet for %s\n", package_name(cbdata->inst->info));
+    }
+
+    instance_unref(cbdata->inst);
+    DbgFree(cbdata);
 }
 
 HAPI int instance_set_pinup(struct inst_info *inst, int pinup)
 {
-       struct set_pinup_cbdata *cbdata;
-       struct packet *packet;
+    struct set_pinup_cbdata *cbdata;
+    struct packet *packet;
+    unsigned int cmd = CMD_PINUP;
 
-       if (!inst) {
-               ErrPrint("Invalid instance handle\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!inst) {
+       ErrPrint("Invalid instance handle\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (package_is_fault(inst->info)) {
-               ErrPrint("Fault package [%s]\n", package_name(inst->info));
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (package_is_fault(inst->info)) {
+       ErrPrint("Fault package [%s]\n", package_name(inst->info));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       if (!package_pinup(inst->info)) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!package_pinup(inst->info)) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (pinup == inst->is_pinned_up) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (pinup == inst->is_pinned_up) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       cbdata = malloc(sizeof(*cbdata));
-       if (!cbdata) {
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    cbdata = malloc(sizeof(*cbdata));
+    if (!cbdata) {
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       cbdata->inst = instance_ref(inst);
-       cbdata->pinup = pinup;
+    cbdata->inst = instance_ref(inst);
+    cbdata->pinup = pinup;
 
-       packet = packet_create("pinup", "ssi", package_name(inst->info), inst->id, pinup);
-       if (!packet) {
-               ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
-               instance_unref(cbdata->inst);
-               DbgFree(cbdata);
-               return LB_STATUS_ERROR_FAULT;
-       }
+    packet = packet_create((const char *)&cmd, "ssi", package_name(inst->info), inst->id, pinup);
+    if (!packet) {
+       ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
+       instance_unref(cbdata->inst);
+       DbgFree(cbdata);
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       return slave_rpc_async_request(package_slave(inst->info), package_name(inst->info), packet, pinup_cb, cbdata, 0);
+    return slave_rpc_async_request(package_slave(inst->info), package_name(inst->info), packet, pinup_cb, cbdata, 0);
 }
 
 HAPI int instance_freeze_updator(struct inst_info *inst)
 {
-       if (!inst->update_timer) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!inst->update_timer) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       timer_freeze(inst);
-       return LB_STATUS_SUCCESS;
+    timer_freeze(inst);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int instance_thaw_updator(struct inst_info *inst)
 {
-       if (!inst->update_timer) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!inst->update_timer) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (client_is_all_paused() || setting_is_lcd_off()) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (client_is_all_paused() || setting_is_lcd_off()) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (inst->visible == LB_HIDE_WITH_PAUSE) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (inst->visible == DBOX_HIDE_WITH_PAUSE) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       timer_thaw(inst);
-       return LB_STATUS_SUCCESS;
+    timer_thaw(inst);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
-HAPI enum livebox_visible_state instance_visible_state(struct inst_info *inst)
+HAPI enum dynamicbox_visible_state instance_visible_state(struct inst_info *inst)
 {
-       return inst->visible;
+    return inst->visible;
 }
 
-HAPI int instance_set_visible_state(struct inst_info *inst, enum livebox_visible_state state)
+HAPI int instance_set_visible_state(struct inst_info *inst, enum dynamicbox_visible_state state)
 {
-       if (inst->visible == state) {
-               return LB_STATUS_SUCCESS;
-       }
+    if (inst->visible == state) {
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
-       switch (state) {
-       case LB_SHOW:
-       case LB_HIDE:
-               if (inst->visible == LB_HIDE_WITH_PAUSE) {
-                       if (resume_livebox(inst) == 0) {
-                               inst->visible = state;
-                       }
+    switch (state) {
+    case DBOX_SHOW:
+    case DBOX_HIDE:
+       if (inst->visible == DBOX_HIDE_WITH_PAUSE) {
+           if (resume_dynamicbox(inst) == 0) {
+               inst->visible = state;
+           }
 
-                       instance_thaw_updator(inst);
-               } else {
-                       inst->visible = state;
-               }
-               break;
+           instance_thaw_updator(inst);
+       } else {
+           inst->visible = state;
+       }
+       break;
 
-       case LB_HIDE_WITH_PAUSE:
-               if (pause_livebox(inst) == 0) {
-                       inst->visible = LB_HIDE_WITH_PAUSE;
-               }
+    case DBOX_HIDE_WITH_PAUSE:
+       if (pause_dynamicbox(inst) == 0) {
+           inst->visible = DBOX_HIDE_WITH_PAUSE;
+       }
 
-               instance_freeze_updator(inst);
-               break;
+       instance_freeze_updator(inst);
+       break;
 
-       default:
-               return LB_STATUS_ERROR_INVALID;
-       }
+    default:
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static void resize_cb(struct slave_node *slave, const struct packet *packet, void *data)
 {
-       struct resize_cbdata *cbdata = data;
-       int ret;
+    struct resize_cbdata *cbdata = data;
+    int ret;
 
-       if (!packet) {
-               ErrPrint("RESIZE: Invalid packet\n");
-               instance_send_resized_event(cbdata->inst, IS_LB, cbdata->inst->lb.width, cbdata->inst->lb.height, LB_STATUS_ERROR_FAULT);
-               instance_unref(cbdata->inst);
-               DbgFree(cbdata);
-               return;
-       }
+    if (!packet) {
+       ErrPrint("RESIZE: Invalid packet\n");
+       instance_send_resized_event(cbdata->inst, IS_DBOX, cbdata->inst->dbox.width, cbdata->inst->dbox.height, DBOX_STATUS_ERROR_FAULT);
+       instance_unref(cbdata->inst);
+       DbgFree(cbdata);
+       return;
+    }
 
-       if (packet_get(packet, "i", &ret) != 1) {
-               ErrPrint("RESIZE: Invalid parameter\n");
-               instance_send_resized_event(cbdata->inst, IS_LB, cbdata->inst->lb.width, cbdata->inst->lb.height, LB_STATUS_ERROR_INVALID);
-               instance_unref(cbdata->inst);
-               DbgFree(cbdata);
-               return;
-       }
+    if (packet_get(packet, "i", &ret) != 1) {
+       ErrPrint("RESIZE: Invalid parameter\n");
+       instance_send_resized_event(cbdata->inst, IS_DBOX, cbdata->inst->dbox.width, cbdata->inst->dbox.height, DBOX_STATUS_ERROR_INVALID_PARAMETER);
+       instance_unref(cbdata->inst);
+       DbgFree(cbdata);
+       return;
+    }
 
-       if (ret == (int)LB_STATUS_SUCCESS) {
-               /*!
-                * \note
-                * else waiting the first update with new size
-                */
-               if (cbdata->inst->lb.width == cbdata->w && cbdata->inst->lb.height == cbdata->h) {
-                       /*!
-                        * \note
-                        * Right after the viewer adds a new box,
-                        * Box has no size information, then it will try to use the default size,
-                        * After a box returns created event.
-                        *
-                        * A box will start to generate default size content.
-                        * But the viewer doesn't know it,.
-                        *
-                        * So the viewer will try to change the size of a box.
-                        *
-                        * At that time, the provider gots the size changed event from the box.
-                        * So it sent the size changed event to the viewer.
-                        * But the viewer ignores it. if it doesn't care the size changed event.
-                        * (even if it cares the size changed event, there is a timing issue)
-                        *
-                        * And the provider receives resize request,
-                        * right before send the size changed event.
-                        * but there is no changes about the size.
-                        *
-                        * Now the view will waits size changed event forever.
-                        * To resolve this timing issue.
-                        *
-                        * Check the size of a box from here.
-                        * And if the size is already updated, send the ALREADY event to the viewer
-                        * to get the size changed event callback correctly.
-                        */
-                       instance_send_resized_event(cbdata->inst, IS_LB, cbdata->inst->lb.width, cbdata->inst->lb.height, LB_STATUS_ERROR_ALREADY);
-                       DbgPrint("RESIZE: Livebox is already resized [%s - %dx%d]\n", instance_id(cbdata->inst), cbdata->w, cbdata->h);
-               } else {
-                       DbgPrint("RESIZE: Request is successfully sent [%s - %dx%d]\n", instance_id(cbdata->inst), cbdata->w, cbdata->h);
-               }
+    if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+       /*!
+        * \note
+        * else waiting the first update with new size
+        */
+       if (cbdata->inst->dbox.width == cbdata->w && cbdata->inst->dbox.height == cbdata->h) {
+           /*!
+            * \note
+            * Right after the viewer adds a new box,
+            * Box has no size information, then it will try to use the default size,
+            * After a box returns created event.
+            *
+            * A box will start to generate default size content.
+            * But the viewer doesn't know it,.
+            *
+            * So the viewer will try to change the size of a box.
+            *
+            * At that time, the provider gots the size changed event from the box.
+            * So it sent the size changed event to the viewer.
+            * But the viewer ignores it. if it doesn't care the size changed event.
+            * (even if it cares the size changed event, there is a timing issue)
+            *
+            * And the provider receives resize request,
+            * right before send the size changed event.
+            * but there is no changes about the size.
+            *
+            * Now the view will waits size changed event forever.
+            * To resolve this timing issue.
+            *
+            * Check the size of a box from here.
+            * And if the size is already updated, send the ALREADY event to the viewer
+            * to get the size changed event callback correctly.
+            */
+           instance_send_resized_event(cbdata->inst, IS_DBOX, cbdata->inst->dbox.width, cbdata->inst->dbox.height, DBOX_STATUS_ERROR_ALREADY);
+           DbgPrint("RESIZE: Dynamicbox is already resized [%s - %dx%d]\n", instance_id(cbdata->inst), cbdata->w, cbdata->h);
        } else {
-               DbgPrint("RESIZE: Livebox rejects the new size: %s - %dx%d (%d)\n", instance_id(cbdata->inst), cbdata->w, cbdata->h, ret);
-               instance_send_resized_event(cbdata->inst, IS_LB, cbdata->inst->lb.width, cbdata->inst->lb.height, ret);
+           DbgPrint("RESIZE: Request is successfully sent [%s - %dx%d]\n", instance_id(cbdata->inst), cbdata->w, cbdata->h);
        }
+    } else {
+       DbgPrint("RESIZE: Dynamicbox rejects the new size: %s - %dx%d (%d)\n", instance_id(cbdata->inst), cbdata->w, cbdata->h, ret);
+       instance_send_resized_event(cbdata->inst, IS_DBOX, cbdata->inst->dbox.width, cbdata->inst->dbox.height, ret);
+    }
 
-       instance_unref(cbdata->inst);
-       DbgFree(cbdata);
+    instance_unref(cbdata->inst);
+    DbgFree(cbdata);
 }
 
 HAPI int instance_resize(struct inst_info *inst, int w, int h)
 {
-       struct resize_cbdata *cbdata;
-       struct packet *packet;
-       int ret;
-
-       if (!inst) {
-               ErrPrint("Invalid instance handle\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       if (package_is_fault(inst->info)) {
-               ErrPrint("Fault package: %s\n", package_name(inst->info));
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       cbdata = malloc(sizeof(*cbdata));
-       if (!cbdata) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       cbdata->inst = instance_ref(inst);
-       cbdata->w = w;
-       cbdata->h = h;
-
-       /* NOTE: param is resued from here */
-       packet = packet_create("resize", "ssii", package_name(inst->info), inst->id, w, h);
-       if (!packet) {
-               ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
-               instance_unref(cbdata->inst);
-               DbgFree(cbdata);
-               return LB_STATUS_ERROR_FAULT;
-       }
+    struct resize_cbdata *cbdata;
+    struct packet *packet;
+    unsigned int cmd = CMD_RESIZE;
+    int ret;
+
+    if (!inst) {
+       ErrPrint("Invalid instance handle\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    if (package_is_fault(inst->info)) {
+       ErrPrint("Fault package: %s\n", package_name(inst->info));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    cbdata = malloc(sizeof(*cbdata));
+    if (!cbdata) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    cbdata->inst = instance_ref(inst);
+    cbdata->w = w;
+    cbdata->h = h;
+
+    /* NOTE: param is resued from here */
+    packet = packet_create((const char *)&cmd, "ssii", package_name(inst->info), inst->id, w, h);
+    if (!packet) {
+       ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
+       instance_unref(cbdata->inst);
+       DbgFree(cbdata);
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       DbgPrint("RESIZE: [%s] resize[%dx%d]\n", instance_id(inst), w, h);
-       ret = slave_rpc_async_request(package_slave(inst->info), package_name(inst->info), packet, resize_cb, cbdata, 0);
-       return ret;
+    DbgPrint("RESIZE: [%s] resize[%dx%d]\n", instance_id(inst), w, h);
+    ret = slave_rpc_async_request(package_slave(inst->info), package_name(inst->info), packet, resize_cb, cbdata, 0);
+    return ret;
 }
 
 static void set_period_cb(struct slave_node *slave, const struct packet *packet, void *data)
 {
-       int ret;
-       struct period_cbdata *cbdata = data;
-       struct packet *result;
+    struct period_cbdata *cbdata = data;
+    unsigned int cmd = CMD_PERIOD_CHANGED;
+    struct packet *result;
+    int ret;
 
-       if (!packet) {
-               ret = LB_STATUS_ERROR_FAULT;
-               goto out;
-       }
+    if (!packet) {
+       ret = DBOX_STATUS_ERROR_FAULT;
+       goto out;
+    }
 
-       if (packet_get(packet, "i", &ret) != 1) {
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
+    if (packet_get(packet, "i", &ret) != 1) {
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
 
-       if (ret == 0) {
-               cbdata->inst->lb.period = cbdata->period;
-       } else {
-               ErrPrint("Failed to set period %d\n", ret);
-       }
+    if (ret == 0) {
+       cbdata->inst->dbox.period = cbdata->period;
+    } else {
+       ErrPrint("Failed to set period %d\n", ret);
+    }
 
 out:
-       result = packet_create_noack("period_changed", "idss", ret, cbdata->inst->lb.period, package_name(cbdata->inst->info), cbdata->inst->id);
-       if (result) {
-               (void)CLIENT_SEND_EVENT(cbdata->inst, result);
-       } else {
-               ErrPrint("Failed to build a packet for %s\n", package_name(cbdata->inst->info));
-       }
+    result = packet_create_noack((const char *)&cmd, "idss", ret, cbdata->inst->dbox.period, package_name(cbdata->inst->info), cbdata->inst->id);
+    if (result) {
+       (void)CLIENT_SEND_EVENT(cbdata->inst, result);
+    } else {
+       ErrPrint("Failed to build a packet for %s\n", package_name(cbdata->inst->info));
+    }
 
-       instance_unref(cbdata->inst);
-       DbgFree(cbdata);
-       return;
+    instance_unref(cbdata->inst);
+    DbgFree(cbdata);
+    return;
 }
 
 static Eina_Bool timer_updator_cb(void *data)
 {
-       struct period_cbdata *cbdata = data;
-       struct inst_info *inst;
-       double period;
-       struct packet *result;
-
-       period = cbdata->period;
-       inst = cbdata->inst;
-       DbgFree(cbdata);
-
-       inst->lb.period = period;
-       if (inst->update_timer) {
-               if (inst->lb.period == 0.0f) {
-                       ecore_timer_del(inst->update_timer);
-                       inst->update_timer = NULL;
-               } else {
-                       util_timer_interval_set(inst->update_timer, inst->lb.period);
-               }
-       } else if (inst->lb.period > 0.0f) {
-               inst->update_timer = util_timer_add(inst->lb.period, update_timer_cb, inst);
-               if (!inst->update_timer) {
-                       ErrPrint("Failed to add an update timer for instance %s\n", inst->id);
-               } else {
-                       timer_freeze(inst); /* Freeze the update timer as default */
-               }
+    struct period_cbdata *cbdata = data;
+    struct inst_info *inst;
+    struct packet *result;
+    unsigned int cmd = CMD_PERIOD_CHANGED;
+    double period;
+
+    period = cbdata->period;
+    inst = cbdata->inst;
+    DbgFree(cbdata);
+
+    inst->dbox.period = period;
+    if (inst->update_timer) {
+       if (inst->dbox.period == 0.0f) {
+           ecore_timer_del(inst->update_timer);
+           inst->update_timer = NULL;
+       } else {
+           util_timer_interval_set(inst->update_timer, inst->dbox.period);
        }
-
-       result = packet_create_noack("period_changed", "idss", 0, inst->lb.period, package_name(inst->info), inst->id);
-       if (result) {
-               (void)CLIENT_SEND_EVENT(inst, result);
+    } else if (inst->dbox.period > 0.0f) {
+       inst->update_timer = util_timer_add(inst->dbox.period, update_timer_cb, inst);
+       if (!inst->update_timer) {
+           ErrPrint("Failed to add an update timer for instance %s\n", inst->id);
        } else {
-               ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
+           timer_freeze(inst); /* Freeze the update timer as default */
        }
+    }
+
+    result = packet_create_noack((const char *)&cmd, "idss", 0, inst->dbox.period, package_name(inst->info), inst->id);
+    if (result) {
+       (void)CLIENT_SEND_EVENT(inst, result);
+    } else {
+       ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
+    }
 
-       instance_unref(inst);
-       return ECORE_CALLBACK_CANCEL;
+    instance_unref(inst);
+    return ECORE_CALLBACK_CANCEL;
 }
 
 HAPI void instance_reload_period(struct inst_info *inst, double period)
 {
-       inst->lb.period = period;
+    inst->dbox.period = period;
 }
 
 HAPI int instance_set_period(struct inst_info *inst, double period)
 {
-       struct packet *packet;
-       struct period_cbdata *cbdata;
+    struct packet *packet;
+    struct period_cbdata *cbdata;
+    unsigned int cmd = CMD_SET_PERIOD;
 
-       if (!inst) {
-               ErrPrint("Invalid instance handle\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!inst) {
+       ErrPrint("Invalid instance handle\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (package_is_fault(inst->info)) {
-               ErrPrint("Fault package [%s]\n", package_name(inst->info));
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (package_is_fault(inst->info)) {
+       ErrPrint("Fault package [%s]\n", package_name(inst->info));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       if (period < 0.0f) { /* Use the default period */
-               period = package_period(inst->info);
-       } else if (period > 0.0f && period < MINIMUM_PERIOD) {
-               period = MINIMUM_PERIOD; /* defined at conf.h */
-       }
+    if (period < 0.0f) { /* Use the default period */
+       period = package_period(inst->info);
+    } else if (period > 0.0f && period < DYNAMICBOX_CONF_MINIMUM_PERIOD) {
+       period = DYNAMICBOX_CONF_MINIMUM_PERIOD; /* defined at conf.h */
+    }
 
-       cbdata = malloc(sizeof(*cbdata));
-       if (!cbdata) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    cbdata = malloc(sizeof(*cbdata));
+    if (!cbdata) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       cbdata->period = period;
-       cbdata->inst = instance_ref(inst);
+    cbdata->period = period;
+    cbdata->inst = instance_ref(inst);
 
-       if (package_secured(inst->info)) {
-               /*!
-                * \note
-                * Secured livebox doesn't need to send its update period to the slave.
-                * Slave has no local timer for updating liveboxes
-                *
-                * So update its timer at here.
-                */
-               if (!ecore_timer_add(DELAY_TIME, timer_updator_cb, cbdata)) {
-                       timer_updator_cb(cbdata);
-               }
-               return LB_STATUS_SUCCESS;
+    if (package_secured(inst->info)) {
+       /*!
+        * \note
+        * Secured dynamicbox doesn't need to send its update period to the slave.
+        * Slave has no local timer for updating dynamicboxes
+        *
+        * So update its timer at here.
+        */
+       if (!ecore_timer_add(DELAY_TIME, timer_updator_cb, cbdata)) {
+           timer_updator_cb(cbdata);
        }
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
-       packet = packet_create("set_period", "ssd", package_name(inst->info), inst->id, period);
-       if (!packet) {
-               ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
-               instance_unref(cbdata->inst);
-               DbgFree(cbdata);
-               return LB_STATUS_ERROR_FAULT;
-       }
+    packet = packet_create((const char *)&cmd, "ssd", package_name(inst->info), inst->id, period);
+    if (!packet) {
+       ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
+       instance_unref(cbdata->inst);
+       DbgFree(cbdata);
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       return slave_rpc_async_request(package_slave(inst->info), package_name(inst->info), packet, set_period_cb, cbdata, 0);
+    return slave_rpc_async_request(package_slave(inst->info), package_name(inst->info), packet, set_period_cb, cbdata, 0);
 }
 
 HAPI int instance_clicked(struct inst_info *inst, const char *event, double timestamp, double x, double y)
 {
-       struct packet *packet;
+    struct packet *packet;
+    unsigned int cmd = CMD_CLICKED;
 
-       if (!inst) {
-               ErrPrint("Invalid instance handle\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!inst) {
+       ErrPrint("Invalid instance handle\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (package_is_fault(inst->info)) {
-               ErrPrint("Fault package [%s]\n", package_name(inst->info));
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (package_is_fault(inst->info)) {
+       ErrPrint("Fault package [%s]\n", package_name(inst->info));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       /* NOTE: param is resued from here */
-       packet = packet_create_noack("clicked", "sssddd", package_name(inst->info), inst->id, event, timestamp, x, y);
-       if (!packet) {
-               ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
-               return LB_STATUS_ERROR_FAULT;
-       }
+    /* NOTE: param is resued from here */
+    packet = packet_create_noack((const char *)&cmd, "sssddd", package_name(inst->info), inst->id, event, timestamp, x, y);
+    if (!packet) {
+       ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       return slave_rpc_request_only(package_slave(inst->info), package_name(inst->info), packet, 0);
+    return slave_rpc_request_only(package_slave(inst->info), package_name(inst->info), packet, 0);
 }
 
 HAPI int instance_signal_emit(struct inst_info *inst, const char *signal, const char *part, double sx, double sy, double ex, double ey, double x, double y, int down)
 {
-       const char *pkgname;
-       const char *id;
-       struct slave_node *slave;
-       struct packet *packet;
-       struct pkg_info *pkg;
-
-       pkg = instance_package(inst);
-       pkgname = package_name(pkg);
-       id = instance_id(inst);
-       if (!pkgname || !id) {
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       slave = package_slave(pkg);
-       if (!slave) {
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       packet = packet_create_noack("script", "ssssddddddi",
-                       pkgname, id,
-                       signal, part,
-                       sx, sy, ex, ey,
-                       x, y, down);
-       if (!packet) {
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       return slave_rpc_request_only(slave, pkgname, packet, 0); 
+    const char *pkgname;
+    const char *id;
+    struct slave_node *slave;
+    struct packet *packet;
+    struct pkg_info *pkg;
+    unsigned int cmd = CMD_SCRIPT;
+
+    pkg = instance_package(inst);
+    pkgname = package_name(pkg);
+    id = instance_id(inst);
+    if (!pkgname || !id) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    slave = package_slave(pkg);
+    if (!slave) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    packet = packet_create_noack((const char *)&cmd, "ssssddddddi",
+           pkgname, id,
+           signal, part,
+           sx, sy, ex, ey,
+           x, y, down);
+    if (!packet) {
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    return slave_rpc_request_only(slave, pkgname, packet, 0); 
 }
 
 HAPI int instance_text_signal_emit(struct inst_info *inst, const char *emission, const char *source, double sx, double sy, double ex, double ey)
 {
-       struct packet *packet;
+    struct packet *packet;
+    unsigned int cmd = CMD_TEXT_SIGNAL;
 
-       if (!inst) {
-               ErrPrint("Invalid instance handle\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!inst) {
+       ErrPrint("Invalid instance handle\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (package_is_fault(inst->info)) {
-               ErrPrint("Fault package [%s]\n", package_name(inst->info));
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (package_is_fault(inst->info)) {
+       ErrPrint("Fault package [%s]\n", package_name(inst->info));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       packet = packet_create_noack("text_signal", "ssssdddd", package_name(inst->info), inst->id, emission, source, sx, sy, ex, ey);
-       if (!packet) {
-               ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
-               return LB_STATUS_ERROR_FAULT;
-       }
+    packet = packet_create_noack((const char *)&cmd, "ssssdddd", package_name(inst->info), inst->id, emission, source, sx, sy, ex, ey);
+    if (!packet) {
+       ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       return slave_rpc_request_only(package_slave(inst->info), package_name(inst->info), packet, 0);
+    return slave_rpc_request_only(package_slave(inst->info), package_name(inst->info), packet, 0);
 }
 
 static void change_group_cb(struct slave_node *slave, const struct packet *packet, void *data)
 {
-       struct change_group_cbdata *cbdata = data;
-       struct packet *result;
-       int ret;
-
-       if (!packet) {
-               DbgFree(cbdata->cluster);
-               DbgFree(cbdata->category);
-               ret = LB_STATUS_ERROR_FAULT;
-               goto out;
-       }
-
-       if (packet_get(packet, "i", &ret) != 1) {
-               ErrPrint("Invalid packet\n");
-               DbgFree(cbdata->cluster);
-               DbgFree(cbdata->category);
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       if (ret == 0) {
-               DbgFree(cbdata->inst->cluster);
-               cbdata->inst->cluster = cbdata->cluster;
-
-               DbgFree(cbdata->inst->category);
-               cbdata->inst->category = cbdata->category;
-       } else {
-               DbgFree(cbdata->cluster);
-               DbgFree(cbdata->category);
-       }
+    struct change_group_cbdata *cbdata = data;
+    struct packet *result;
+    unsigned int cmd = CMD_GROUP_CHANGED;
+    int ret;
+
+    if (!packet) {
+       DbgFree(cbdata->cluster);
+       DbgFree(cbdata->category);
+       ret = DBOX_STATUS_ERROR_FAULT;
+       goto out;
+    }
+
+    if (packet_get(packet, "i", &ret) != 1) {
+       ErrPrint("Invalid packet\n");
+       DbgFree(cbdata->cluster);
+       DbgFree(cbdata->category);
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    if (ret == 0) {
+       DbgFree(cbdata->inst->cluster);
+       cbdata->inst->cluster = cbdata->cluster;
+
+       DbgFree(cbdata->inst->category);
+       cbdata->inst->category = cbdata->category;
+    } else {
+       DbgFree(cbdata->cluster);
+       DbgFree(cbdata->category);
+    }
 
 out:
-       result = packet_create_noack("group_changed", "ssiss",
-                               package_name(cbdata->inst->info), cbdata->inst->id, ret,
-                               cbdata->inst->cluster, cbdata->inst->category);
-       if (!result) {
-               ErrPrint("Failed to build a packet %s\n", package_name(cbdata->inst->info));
-       } else {
-               (void)CLIENT_SEND_EVENT(cbdata->inst, result);
-       }
+    result = packet_create_noack((const char *)&cmd, "ssiss",
+           package_name(cbdata->inst->info), cbdata->inst->id, ret,
+           cbdata->inst->cluster, cbdata->inst->category);
+    if (!result) {
+       ErrPrint("Failed to build a packet %s\n", package_name(cbdata->inst->info));
+    } else {
+       (void)CLIENT_SEND_EVENT(cbdata->inst, result);
+    }
 
-       instance_unref(cbdata->inst);
-       DbgFree(cbdata);
+    instance_unref(cbdata->inst);
+    DbgFree(cbdata);
 }
 
 HAPI int instance_change_group(struct inst_info *inst, const char *cluster, const char *category)
 {
-       struct packet *packet;
-       struct change_group_cbdata *cbdata;
-
-       if (!inst) {
-               ErrPrint("Invalid instance handle\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       if (package_is_fault(inst->info)) {
-               ErrPrint("Fault package [%s]\n", package_name(inst->info));
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       cbdata = malloc(sizeof(*cbdata));
-       if (!cbdata) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       cbdata->cluster = strdup(cluster);
-       if (!cbdata->cluster) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(cbdata);
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    struct packet *packet;
+    struct change_group_cbdata *cbdata;
+    unsigned int cmd = CMD_CHANGE_GROUP;
+
+    if (!inst) {
+       ErrPrint("Invalid instance handle\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    if (package_is_fault(inst->info)) {
+       ErrPrint("Fault package [%s]\n", package_name(inst->info));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    cbdata = malloc(sizeof(*cbdata));
+    if (!cbdata) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    cbdata->cluster = strdup(cluster);
+    if (!cbdata->cluster) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(cbdata);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       cbdata->category = strdup(category);
-       if (!cbdata->category) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(cbdata->cluster);
-               DbgFree(cbdata);
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    cbdata->category = strdup(category);
+    if (!cbdata->category) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(cbdata->cluster);
+       DbgFree(cbdata);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       cbdata->inst = instance_ref(inst);
+    cbdata->inst = instance_ref(inst);
 
-       packet = packet_create("change_group","ssss", package_name(inst->info), inst->id, cluster, category);
-       if (!packet) {
-               ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
-               instance_unref(cbdata->inst);
-               DbgFree(cbdata->category);
-               DbgFree(cbdata->cluster);
-               DbgFree(cbdata);
-               return LB_STATUS_ERROR_FAULT;
-       }
+    packet = packet_create((const char *)&cmd, "ssss", package_name(inst->info), inst->id, cluster, category);
+    if (!packet) {
+       ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
+       instance_unref(cbdata->inst);
+       DbgFree(cbdata->category);
+       DbgFree(cbdata->cluster);
+       DbgFree(cbdata);
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       return slave_rpc_async_request(package_slave(inst->info), package_name(inst->info), packet, change_group_cb, cbdata, 0);
+    return slave_rpc_async_request(package_slave(inst->info), package_name(inst->info), packet, change_group_cb, cbdata, 0);
 }
 
 HAPI const char * const instance_auto_launch(const struct inst_info *inst)
 {
-       return package_auto_launch(inst->info);
+    return package_auto_launch(inst->info);
 }
 
 HAPI const int const instance_priority(const struct inst_info *inst)
 {
-       return inst->lb.priority;
+    return inst->dbox.priority;
 }
 
 HAPI const struct client_node *const instance_client(const struct inst_info *inst)
 {
-       return inst->client;
+    return inst->client;
 }
 
 HAPI const int const instance_timeout(const struct inst_info *inst)
 {
-       return package_timeout(inst->info);
+    return package_timeout(inst->info);
 }
 
 HAPI const double const instance_period(const struct inst_info *inst)
 {
-       return inst->lb.period;
+    return inst->dbox.period;
 }
 
-HAPI const int const instance_lb_width(const struct inst_info *inst)
+HAPI const int const instance_dbox_width(const struct inst_info *inst)
 {
-       return inst->lb.width;
+    return inst->dbox.width;
 }
 
-HAPI const int const instance_lb_height(const struct inst_info *inst)
+HAPI const int const instance_dbox_height(const struct inst_info *inst)
 {
-       return inst->lb.height;
+    return inst->dbox.height;
 }
 
-HAPI const int const instance_pd_width(const struct inst_info *inst)
+HAPI const int const instance_gbar_width(const struct inst_info *inst)
 {
-       return inst->pd.width;
+    return inst->gbar.width;
 }
 
-HAPI const int const instance_pd_height(const struct inst_info *inst)
+HAPI const int const instance_gbar_height(const struct inst_info *inst)
 {
-       return inst->pd.height;
+    return inst->gbar.height;
 }
 
 HAPI struct pkg_info *const instance_package(const struct inst_info *inst)
 {
-       return inst->info;
+    return inst->info;
+}
+
+HAPI struct script_info *const instance_dbox_script(const struct inst_info *inst)
+{
+    return (package_dbox_type(inst->info) == DBOX_TYPE_SCRIPT) ? inst->dbox.canvas.script : NULL;
 }
 
-HAPI struct script_info *const instance_lb_script(const struct inst_info *inst)
+HAPI struct script_info *const instance_gbar_script(const struct inst_info *inst)
 {
-       return (package_lb_type(inst->info) == LB_TYPE_SCRIPT) ? inst->lb.canvas.script : NULL;
+    return (package_gbar_type(inst->info) == GBAR_TYPE_SCRIPT) ? inst->gbar.canvas.script : NULL;
 }
 
-HAPI struct script_info *const instance_pd_script(const struct inst_info *inst)
+HAPI struct buffer_info *const instance_dbox_buffer(const struct inst_info *inst)
 {
-       return (package_pd_type(inst->info) == PD_TYPE_SCRIPT) ? inst->pd.canvas.script : NULL;
+    return (package_dbox_type(inst->info) == DBOX_TYPE_BUFFER) ? inst->dbox.canvas.buffer : NULL;
 }
 
-HAPI struct buffer_info *const instance_lb_buffer(const struct inst_info *inst)
+HAPI struct buffer_info *const instance_gbar_buffer(const struct inst_info *inst)
 {
-       return (package_lb_type(inst->info) == LB_TYPE_BUFFER) ? inst->lb.canvas.buffer : NULL;
+    return (package_gbar_type(inst->info) == GBAR_TYPE_BUFFER) ? inst->gbar.canvas.buffer : NULL;
 }
 
-HAPI struct buffer_info *const instance_pd_buffer(const struct inst_info *inst)
+HAPI struct buffer_info *const instance_dbox_extra_buffer(const struct inst_info *inst, int idx)
 {
-       return (package_pd_type(inst->info) == PD_TYPE_BUFFER) ? inst->pd.canvas.buffer : NULL;
+    return (package_dbox_type(inst->info) == DBOX_TYPE_BUFFER) ? (inst->dbox.extra_buffer ? inst->dbox.extra_buffer[idx] : NULL) : NULL;
+}
+
+HAPI struct buffer_info *const instance_gbar_extra_buffer(const struct inst_info *inst, int idx)
+{
+    return (package_gbar_type(inst->info) == GBAR_TYPE_BUFFER) ? (inst->gbar.extra_buffer ? inst->gbar.extra_buffer[idx] : NULL) : NULL;
 }
 
 HAPI const char *const instance_id(const struct inst_info *inst)
 {
-       return inst->id;
+    return inst->id;
 }
 
 HAPI const char *const instance_content(const struct inst_info *inst)
 {
-       return inst->content;
+    return inst->content;
 }
 
 HAPI const char *const instance_category(const struct inst_info *inst)
 {
-       return inst->category;
+    return inst->category;
 }
 
 HAPI const char *const instance_cluster(const struct inst_info *inst)
 {
-       return inst->cluster;
+    return inst->cluster;
 }
 
 HAPI const char * const instance_title(const struct inst_info *inst)
 {
-       return inst->title;
+    return inst->title;
 }
 
 HAPI const double const instance_timestamp(const struct inst_info *inst)
 {
-       return inst->timestamp;
+    return inst->timestamp;
 }
 
 HAPI const enum instance_state const instance_state(const struct inst_info *inst)
 {
-       return inst->state;
+    return inst->state;
 }
 
 HAPI int instance_destroyed(struct inst_info *inst, int reason)
 {
-       switch (inst->state) {
-       case INST_INIT:
-       case INST_REQUEST_TO_ACTIVATE:
-               /*!
-                * \note
-                * No other clients know the existence of this instance,
-                * only who added this knows it.
-                * So send deleted event to only it.
-                */
-               DbgPrint("Send deleted event - unicast - %p\n", inst->client);
-               instance_unicast_deleted_event(inst, NULL, reason);
-               instance_state_reset(inst);
-               instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
-               break;
-       case INST_REQUEST_TO_REACTIVATE:
-       case INST_REQUEST_TO_DESTROY:
-       case INST_ACTIVATED:
-               DbgPrint("Send deleted event - multicast\n");
-               instance_broadcast_deleted_event(inst, reason);
-               instance_state_reset(inst);
-               instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
-       case INST_DESTROYED:
-               break;
-       default:
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       return LB_STATUS_SUCCESS;
+    switch (inst->state) {
+    case INST_INIT:
+    case INST_REQUEST_TO_ACTIVATE:
+       if (inst->unicast_delete_event) {
+           /*!
+            * \note
+            * No other clients know the existence of this instance,
+            * only who added this knows it.
+            * So send deleted event to only it.
+            */
+           DbgPrint("Send deleted event - unicast - %p\n", inst->client);
+           instance_unicast_deleted_event(inst, NULL, reason);
+       } else {
+           instance_broadcast_deleted_event(inst, reason);
+       }
+       instance_state_reset(inst);
+       instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+       break;
+    case INST_REQUEST_TO_REACTIVATE:
+    case INST_REQUEST_TO_DESTROY:
+    case INST_ACTIVATED:
+       DbgPrint("Send deleted event - multicast\n");
+       instance_broadcast_deleted_event(inst, reason);
+       instance_state_reset(inst);
+       instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+    case INST_DESTROYED:
+       break;
+    default:
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 /*!
@@ -2771,69 +2997,69 @@ HAPI int instance_destroyed(struct inst_info *inst, int reason)
  */
 HAPI int instance_recover_state(struct inst_info *inst)
 {
-       int ret = 0;
+    int ret = 0;
 
-       if (inst->changing_state) {
-               DbgPrint("Doesn't need to recover the state\n");
-               return LB_STATUS_SUCCESS;
-       }
+    if (inst->changing_state > 0) {
+       DbgPrint("Doesn't need to recover the state\n");
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
-       if (package_is_fault(inst->info)) {
-               ErrPrint("Package is faulted(%s), Delete it\n", inst->id);
-               inst->requested_state = INST_DESTROYED;
-       }
+    if (package_is_fault(inst->info)) {
+       ErrPrint("Package is faulted(%s), Delete it\n", inst->id);
+       inst->requested_state = INST_DESTROYED;
+    }
 
-       switch (inst->state) {
+    switch (inst->state) {
+    case INST_ACTIVATED:
+    case INST_REQUEST_TO_REACTIVATE:
+    case INST_REQUEST_TO_DESTROY:
+       switch (inst->requested_state) {
+       case INST_ACTIVATED:
+           DbgPrint("Req. to RE-ACTIVATED (%s)\n", package_name(inst->info));
+           instance_state_reset(inst);
+           instance_reactivate(inst);
+           ret = 1;
+           break;
+       case INST_DESTROYED:
+           DbgPrint("Req. to DESTROYED (%s)\n", package_name(inst->info));
+           instance_state_reset(inst);
+           instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+           break;
+       default:
+           break;
+       }
+       break;
+    case INST_INIT:
+    case INST_REQUEST_TO_ACTIVATE:
+       switch (inst->requested_state) {
        case INST_ACTIVATED:
-       case INST_REQUEST_TO_REACTIVATE:
-       case INST_REQUEST_TO_DESTROY:
-               switch (inst->requested_state) {
-               case INST_ACTIVATED:
-                       DbgPrint("Req. to RE-ACTIVATED (%s)\n", package_name(inst->info));
-                       instance_state_reset(inst);
-                       instance_reactivate(inst);
-                       ret = 1;
-                       break;
-               case INST_DESTROYED:
-                       DbgPrint("Req. to DESTROYED (%s)\n", package_name(inst->info));
-                       instance_state_reset(inst);
-                       instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
-                       break;
-               default:
-                       break;
-               }
-               break;
        case INST_INIT:
-       case INST_REQUEST_TO_ACTIVATE:
-               switch (inst->requested_state) {
-               case INST_ACTIVATED:
-               case INST_INIT:
-                       DbgPrint("Req. to ACTIVATED (%s)\n", package_name(inst->info));
-                       instance_state_reset(inst);
-                       if (instance_activate(inst) < 0) {
-                               DbgPrint("Failed to reactivate the instance\n");
-                               instance_broadcast_deleted_event(inst, LB_STATUS_ERROR_FAULT);
-                               instance_state_reset(inst);
-                               instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
-                       } else {
-                               ret = 1;
-                       }
-                       break;
-               case INST_DESTROYED:
-                       DbgPrint("Req. to DESTROYED (%s)\n", package_name(inst->info));
-                       instance_state_reset(inst);
-                       instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
-                       break;
-               default:
-                       break;
-               }
-               break;
+           DbgPrint("Req. to ACTIVATED (%s)\n", package_name(inst->info));
+           instance_state_reset(inst);
+           if (instance_activate(inst) < 0) {
+               DbgPrint("Failed to reactivate the instance\n");
+               instance_broadcast_deleted_event(inst, DBOX_STATUS_ERROR_FAULT);
+               instance_state_reset(inst);
+               instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+           } else {
+               ret = 1;
+           }
+           break;
        case INST_DESTROYED:
+           DbgPrint("Req. to DESTROYED (%s)\n", package_name(inst->info));
+           instance_state_reset(inst);
+           instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+           break;
        default:
-               break;
+           break;
        }
+       break;
+    case INST_DESTROYED:
+    default:
+       break;
+    }
 
-       return ret;
+    return ret;
 }
 
 /*!
@@ -2841,454 +3067,543 @@ HAPI int instance_recover_state(struct inst_info *inst)
  */
 HAPI int instance_need_slave(struct inst_info *inst)
 {
-       int ret = 0;
-
-       if (inst->client && client_is_faulted(inst->client)) {
-               /*!
-                * \note
-                * In this case, the client is faulted(disconnected)
-                * when the client is deactivated, its liveboxes should be removed too.
-                * So if the current inst is created by the faulted client,
-                * remove it and don't try to recover its states
-                */
-
-               DbgPrint("CLIENT FAULT: Req. to DESTROYED (%s)\n", package_name(inst->info));
-               switch (inst->state) {
-               case INST_INIT:
-               case INST_ACTIVATED:
-               case INST_REQUEST_TO_REACTIVATE:
-               case INST_REQUEST_TO_DESTROY:
-               case INST_REQUEST_TO_ACTIVATE:
-                       instance_state_reset(inst);
-                       instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
-                       break;
-               case INST_DESTROYED:
-                       break;
-               }
+    int ret = 0;
 
-               return LB_STATUS_SUCCESS;
-       }
+    if (inst->client && client_is_faulted(inst->client)) {
+       /*!
+        * \note
+        * In this case, the client is faulted(disconnected)
+        * when the client is deactivated, its dynamicboxes should be removed too.
+        * So if the current inst is created by the faulted client,
+        * remove it and don't try to recover its states
+        */
 
+       DbgPrint("CLIENT FAULT: Req. to DESTROYED (%s)\n", package_name(inst->info));
        switch (inst->state) {
+       case INST_INIT:
        case INST_ACTIVATED:
        case INST_REQUEST_TO_REACTIVATE:
        case INST_REQUEST_TO_DESTROY:
-               switch (inst->requested_state) {
-               case INST_INIT:
-               case INST_ACTIVATED:
-                       DbgPrint("Req. to ACTIVATED (%s)\n", package_name(inst->info));
-                       ret = 1;
-                       break;
-               case INST_DESTROYED:
-                       DbgPrint("Req. to DESTROYED (%s)\n", package_name(inst->info));
-                       instance_state_reset(inst);
-                       instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
-                       break;
-               default:
-                       break;
-               }
-               break;
-       case INST_INIT:
        case INST_REQUEST_TO_ACTIVATE:
-               switch (inst->requested_state) {
-               case INST_INIT:
-               case INST_ACTIVATED:
-                       DbgPrint("Req. to ACTIVATED (%s)\n", package_name(inst->info));
-                       ret = 1;
-                       break;
-               case INST_DESTROYED:
-                       DbgPrint("Req. to DESTROYED (%s)\n", package_name(inst->info));
-                       instance_state_reset(inst);
-                       instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
-                       break;
-               default:
-                       break;
-               }
-               break;
+           instance_state_reset(inst);
+           instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+           break;
        case INST_DESTROYED:
+           break;
+       }
+
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    switch (inst->state) {
+    case INST_ACTIVATED:
+    case INST_REQUEST_TO_REACTIVATE:
+    case INST_REQUEST_TO_DESTROY:
+       switch (inst->requested_state) {
+       case INST_INIT:
+       case INST_ACTIVATED:
+           DbgPrint("Req. to ACTIVATED (%s)\n", package_name(inst->info));
+           ret = 1;
+           break;
+       case INST_DESTROYED:
+           DbgPrint("Req. to DESTROYED (%s)\n", package_name(inst->info));
+           instance_state_reset(inst);
+           instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+           break;
+       default:
+           break;
+       }
+       break;
+    case INST_INIT:
+    case INST_REQUEST_TO_ACTIVATE:
+       switch (inst->requested_state) {
+       case INST_INIT:
+       case INST_ACTIVATED:
+           DbgPrint("Req. to ACTIVATED (%s)\n", package_name(inst->info));
+           ret = 1;
+           break;
+       case INST_DESTROYED:
+           DbgPrint("Req. to DESTROYED (%s)\n", package_name(inst->info));
+           instance_state_reset(inst);
+           instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+           break;
        default:
-               break;
+           break;
        }
+       break;
+    case INST_DESTROYED:
+    default:
+       break;
+    }
 
-       return ret;
+    return ret;
 }
 
 HAPI int instance_forward_packet(struct inst_info *inst, struct packet *packet)
 {
-       return CLIENT_SEND_EVENT(inst, packet);
+    return CLIENT_SEND_EVENT(inst, packet);
 }
 
 HAPI int instance_send_key_status(struct inst_info *inst, int status)
 {
-       struct packet *packet;
+    struct packet *packet;
+    unsigned int cmd = CMD_KEY_STATUS;
 
-       packet = packet_create_noack("key_status", "ssi", package_name(inst->info), inst->id, status);
-       if (!packet) {
-               ErrPrint("Failed to build a packet\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    packet = packet_create_noack((const char *)&cmd, "ssi", package_name(inst->info), inst->id, status);
+    if (!packet) {
+       ErrPrint("Failed to build a packet\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       return CLIENT_SEND_EVENT(inst, packet);
+    return CLIENT_SEND_EVENT(inst, packet);
 }
 
 HAPI int instance_send_access_status(struct inst_info *inst, int status)
 {
-       struct packet *packet;
+    struct packet *packet;
+    unsigned int cmd = CMD_ACCESS_STATUS;
 
-       packet = packet_create_noack("access_status", "ssi", package_name(inst->info), inst->id, status);
-       if (!packet) {
-               ErrPrint("Failed to build a packet\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    packet = packet_create_noack((const char *)&cmd, "ssi", package_name(inst->info), inst->id, status);
+    if (!packet) {
+       ErrPrint("Failed to build a packet\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       return CLIENT_SEND_EVENT(inst, packet);
+    return CLIENT_SEND_EVENT(inst, packet);
 }
 
-HAPI void instance_slave_set_pd_pos(struct inst_info *inst, double x, double y)
+HAPI void instance_slave_set_gbar_pos(struct inst_info *inst, double x, double y)
 {
-       inst->pd.x = x;
-       inst->pd.y = y;
+    inst->gbar.x = x;
+    inst->gbar.y = y;
 }
 
-HAPI void instance_slave_get_pd_pos(struct inst_info *inst, double *x, double *y)
+HAPI void instance_slave_get_gbar_pos(struct inst_info *inst, double *x, double *y)
 {
-       if (x) {
-               *x = inst->pd.x;
-       }
+    if (x) {
+       *x = inst->gbar.x;
+    }
 
-       if (y) {
-               *y = inst->pd.y;
-       }
+    if (y) {
+       *y = inst->gbar.y;
+    }
 }
 
-HAPI int instance_slave_open_pd(struct inst_info *inst, struct client_node *client)
+HAPI int instance_slave_open_gbar(struct inst_info *inst, struct client_node *client)
 {
-       const char *pkgname;
-       const char *id;
-       struct packet *packet;
-       struct slave_node *slave;
-       const struct pkg_info *info;
-       int ret;
+    const char *pkgname;
+    const char *id;
+    struct packet *packet;
+    struct slave_node *slave;
+    const struct pkg_info *info;
+    unsigned int cmd = CMD_GBAR_SHOW;
+    int ret;
 
+    if (!client) {
+       client = inst->gbar.owner;
        if (!client) {
-               client = inst->pd.owner;
-               if (!client) {
-                       ErrPrint("Client is not valid\n");
-                       return LB_STATUS_ERROR_INVALID;
-               }
-       } else if (inst->pd.owner) {
-               if (inst->pd.owner != client) {
-                       ErrPrint("Client is already owned\n");
-                       return LB_STATUS_ERROR_ALREADY;
-               }
-       }
-
-       info = instance_package(inst);
-       if (!info) {
-               ErrPrint("No package info\n");
-               return LB_STATUS_ERROR_INVALID;
+           ErrPrint("Client is not valid\n");
+           return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       }
+    } else if (inst->gbar.owner) {
+       if (inst->gbar.owner != client) {
+           ErrPrint("Client is already owned\n");
+           return DBOX_STATUS_ERROR_ALREADY;
+       }
+    }
+
+    info = instance_package(inst);
+    if (!info) {
+       ErrPrint("No package info\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    slave = package_slave(info);
+    if (!slave) {
+       ErrPrint("No slave\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    pkgname = package_name(info);
+    id = instance_id(inst);
+
+    if (!pkgname || !id) {
+       ErrPrint("pkgname[%s] id[%s]\n", pkgname, id);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    packet = packet_create_noack((const char *)&cmd, "ssiidd", pkgname, id, instance_gbar_width(inst), instance_gbar_height(inst), inst->gbar.x, inst->gbar.y);
+    if (!packet) {
+       ErrPrint("Failed to create a packet\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    /*!
+     * \note
+     * Do not return from here even though we failed to freeze the TTL timer.
+     * Because the TTL timer is not able to be exists.
+     * So we can ignore this error.
+     */
+    (void)slave_freeze_ttl(slave);
+
+    DbgPrint("PERF_DBOX\n");
+    ret = slave_rpc_request_only(slave, pkgname, packet, 0);
+    if (ret < 0) {
+       ErrPrint("Unable to send request to slave\n");
+       /*!
+        * \note
+        * Also we can ignore the TTL timer at here too ;)
+        */
+       (void)slave_thaw_ttl(slave);
+       return ret;
+    }
+
+    /*!
+     * \note
+     * If a client is disconnected, the slave has to close the GBAR
+     * So the gbar_buffer_close_cb/gbar_script_close_cb will catch the disconnection event
+     * then it will send the close request to the slave
+     */
+    if (package_gbar_type(info) == GBAR_TYPE_BUFFER) {
+       instance_ref(inst);
+       if (client_event_callback_add(client, CLIENT_EVENT_DEACTIVATE, gbar_buffer_close_cb, inst) < 0) {
+           instance_unref(inst);
        }
+    } else if (package_gbar_type(info) == GBAR_TYPE_SCRIPT) {
+       instance_ref(inst);
+       if (client_event_callback_add(client, CLIENT_EVENT_DEACTIVATE, gbar_script_close_cb, inst) < 0) {
+           instance_unref(inst);
+       }
+    }
+
+    inst->gbar.owner = client;
+    return ret;
+}
+
+HAPI int instance_slave_close_gbar(struct inst_info *inst, struct client_node *client, int reason)
+{
+    const char *pkgname;
+    const char *id;
+    struct packet *packet;
+    struct slave_node *slave;
+    struct pkg_info *pkg;
+    unsigned int cmd = CMD_GBAR_HIDE;
+    int ret;
 
-       slave = package_slave(info);
-       if (!slave) {
-               ErrPrint("No slave\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (inst->gbar.owner != client) {
+       ErrPrint("Has no permission\n");
+       return DBOX_STATUS_ERROR_PERMISSION_DENIED;
+    }
 
-       pkgname = package_name(info);
-       id = instance_id(inst);
+    pkg = instance_package(inst);
+    if (!pkg) {
+       ErrPrint("No package info\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (!pkgname || !id) {
-               ErrPrint("pkgname[%s] id[%s]\n", pkgname, id);
-               return LB_STATUS_ERROR_INVALID;
-       }
+    slave = package_slave(pkg);
+    if (!slave) {
+       ErrPrint("No assigned slave\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       packet = packet_create_noack("pd_show", "ssiidd", pkgname, id, instance_pd_width(inst), instance_pd_height(inst), inst->pd.x, inst->pd.y);
-       if (!packet) {
-               ErrPrint("Failed to create a packet\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    pkgname = package_name(pkg);
+    id = instance_id(inst);
 
-       /*!
-        * \note
-        * Do not return from here even though we failed to freeze the TTL timer.
-        * Because the TTL timer is not able to be exists.
-        * So we can ignore this error.
-        */
-       (void)slave_freeze_ttl(slave);
+    if (!pkgname || !id) {
+       ErrPrint("pkgname[%s] & id[%s] is not valid\n", pkgname, id);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       DbgPrint("PERF_DBOX\n");
-       ret = slave_rpc_request_only(slave, pkgname, packet, 0);
-       if (ret < 0) {
-               ErrPrint("Unable to send request to slave\n");
-               /*!
-                * \note
-                * Also we can ignore the TTL timer at here too ;)
-                */
-               (void)slave_thaw_ttl(slave);
-               return ret;
-       }
+    packet = packet_create_noack((const char *)&cmd, "ssi", pkgname, id, reason);
+    if (!packet) {
+       ErrPrint("Failed to create a packet\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       /*!
-        * \note
-        * If a client is disconnected, the slave has to close the PD
-        * So the pd_buffer_close_cb/pd_script_close_cb will catch the disconnection event
-        * then it will send the close request to the slave
-        */
-       if (package_pd_type(info) == PD_TYPE_BUFFER) {
-               instance_ref(inst);
-               if (client_event_callback_add(client, CLIENT_EVENT_DEACTIVATE, pd_buffer_close_cb, inst) < 0) {
-                       instance_unref(inst);
-               }
-       } else if (package_pd_type(info) == PD_TYPE_SCRIPT) {
-               instance_ref(inst);
-               if (client_event_callback_add(client, CLIENT_EVENT_DEACTIVATE, pd_script_close_cb, inst) < 0) {
-                       instance_unref(inst);
-               }
-       }
+    slave_thaw_ttl(slave);
 
-       inst->pd.owner = client;
-       return ret;
+    ret = slave_rpc_request_only(slave, pkgname, packet, 0);
+    release_resource_for_closing_gbar(pkg, inst, client);
+    inst->gbar.owner = NULL;
+    DbgPrint("PERF_DBOX\n");
+    return ret;
 }
 
-HAPI int instance_slave_close_pd(struct inst_info *inst, struct client_node *client, int reason)
+HAPI int instance_client_gbar_created(struct inst_info *inst, int status)
 {
-       const char *pkgname;
-       const char *id;
-       struct packet *packet;
-       struct slave_node *slave;
-       struct pkg_info *pkg;
-       int ret;
+    struct packet *packet;
+    const char *buf_id;
+    unsigned int cmd = CMD_GBAR_CREATED;
+    int ret;
 
-       if (inst->pd.owner != client) {
-               ErrPrint("Has no permission\n");
-               return LB_STATUS_ERROR_PERMISSION;
-       }
+    if (inst->gbar.need_to_send_close_event) {
+       DbgPrint("GBAR is already created\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       pkg = instance_package(inst);
-       if (!pkg) {
-               ErrPrint("No package info\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    switch (package_gbar_type(inst->info)) {
+    case GBAR_TYPE_SCRIPT:
+       buf_id = script_handler_buffer_id(inst->gbar.canvas.script);
+       break;
+    case GBAR_TYPE_BUFFER:
+       buf_id = buffer_handler_id(inst->gbar.canvas.buffer);
+       break;
+    case GBAR_TYPE_TEXT:
+    default:
+       buf_id = "";
+       break;
+    }
 
-       slave = package_slave(pkg);
-       if (!slave) {
-               ErrPrint("No assigned slave\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    inst->gbar.need_to_send_close_event = (status == 0);
 
-       pkgname = package_name(pkg);
-       id = instance_id(inst);
+    packet = packet_create_noack((const char *)&cmd, "sssiii", 
+           package_name(inst->info), inst->id, buf_id,
+           inst->gbar.width, inst->gbar.height, status);
+    if (!packet) {
+       ErrPrint("Failed to create a packet\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       if (!pkgname || !id) {
-               ErrPrint("pkgname[%s] & id[%s] is not valid\n", pkgname, id);
-               return LB_STATUS_ERROR_INVALID;
-       }
+    ret = CLIENT_SEND_EVENT(inst, packet);
 
-       packet = packet_create_noack("pd_hide", "ssi", pkgname, id, reason);
-       if (!packet) {
-               ErrPrint("Failed to create a packet\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (inst->gbar.need_to_send_close_event && inst->gbar.pended_update_cnt) {
+       DbgPrint("Apply pended desc(%d) - %s\n", inst->gbar.pended_update_cnt, inst->gbar.pended_update_desc);
+       instance_gbar_updated_by_instance(inst, inst->gbar.pended_update_desc, 0, 0, inst->gbar.width, inst->gbar.height);
+       inst->gbar.pended_update_cnt = 0;
+       DbgFree(inst->gbar.pended_update_desc);
+       inst->gbar.pended_update_desc = NULL;
+    }
 
-       slave_thaw_ttl(slave);
+    return ret;
+}
 
-       ret = slave_rpc_request_only(slave, pkgname, packet, 0);
-       release_resource_for_closing_pd(pkg, inst, client);
-       inst->pd.owner = NULL;
-       DbgPrint("PERF_DBOX\n");
-       return ret;
+HAPI int instance_client_gbar_destroyed(struct inst_info *inst, int status)
+{
+    return send_gbar_destroyed_to_client(inst, status);
 }
 
-HAPI int instance_client_pd_created(struct inst_info *inst, int status)
+HAPI int instance_client_gbar_extra_buffer_created(struct inst_info *inst, int idx)
 {
-       struct packet *packet;
-       const char *buf_id;
-       int ret;
+    struct packet *packet;
+    unsigned int cmd = CMD_GBAR_CREATE_XBUF;
+    int pixmap;
 
-       if (inst->pd.need_to_send_close_event) {
-               DbgPrint("PD is already created\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    pixmap = buffer_handler_pixmap(inst->gbar.extra_buffer[idx]);
+    if (pixmap == 0) {
+       ErrPrint("Invalid buffer\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       switch (package_pd_type(inst->info)) {
-       case PD_TYPE_SCRIPT:
-               buf_id = script_handler_buffer_id(inst->pd.canvas.script);
-               break;
-       case PD_TYPE_BUFFER:
-               buf_id = buffer_handler_id(inst->pd.canvas.buffer);
-               break;
-       case PD_TYPE_TEXT:
-       default:
-               buf_id = "";
-               break;
-       }
+    packet = packet_create_noack((const char *)&cmd, "ssii", package_name(inst->info), inst->id, pixmap, idx);
+    if (!packet) {
+       ErrPrint("Failed to create a packet\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       inst->pd.need_to_send_close_event = (status == 0);
+    return CLIENT_SEND_EVENT(inst, packet);
+}
 
-       packet = packet_create_noack("pd_created", "sssiii", 
-                       package_name(inst->info), inst->id, buf_id,
-                       inst->pd.width, inst->pd.height, status);
-       if (!packet) {
-               ErrPrint("Failed to create a packet\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
+HAPI int instance_client_gbar_extra_buffer_destroyed(struct inst_info *inst, int idx)
+{
+    struct packet *packet;
+    unsigned int cmd = CMD_GBAR_DESTROY_XBUF;
+    int pixmap;
 
-       ret = CLIENT_SEND_EVENT(inst, packet);
+    pixmap = buffer_handler_pixmap(inst->gbar.extra_buffer[idx]);
+    if (pixmap == 0) {
+       ErrPrint("Invalid buffer\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (inst->pd.need_to_send_close_event && inst->pd.pended_update_cnt) {
-               DbgPrint("Apply pended desc(%d) - %s\n", inst->pd.pended_update_cnt, inst->pd.pended_update_desc);
-               instance_pd_updated_by_instance(inst, inst->pd.pended_update_desc);
-               inst->pd.pended_update_cnt = 0;
-               DbgFree(inst->pd.pended_update_desc);
-               inst->pd.pended_update_desc = NULL;
-       }
+    packet = packet_create_noack((const char *)&cmd, "ssii", package_name(inst->info), inst->id, pixmap, idx);
+    if (!packet) {
+       ErrPrint("Failed to create a packet\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       return ret;
+    return CLIENT_SEND_EVENT(inst, packet);
+}
+
+HAPI int instance_client_dbox_extra_buffer_created(struct inst_info *inst, int idx)
+{
+    struct packet *packet;
+    unsigned int cmd = CMD_DBOX_CREATE_XBUF;
+    int pixmap;
+
+    pixmap = buffer_handler_pixmap(inst->dbox.extra_buffer[idx]);
+    if (pixmap == 0) {
+       ErrPrint("Invalid buffer\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    packet = packet_create_noack((const char *)&cmd, "ssii", package_name(inst->info), inst->id, pixmap, idx);
+    if (!packet) {
+       ErrPrint("Failed to create a packet\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    return CLIENT_SEND_EVENT(inst, packet);
 }
 
-HAPI int instance_client_pd_destroyed(struct inst_info *inst, int status)
+HAPI int instance_client_dbox_extra_buffer_destroyed(struct inst_info *inst, int idx)
 {
-       return send_pd_destroyed_to_client(inst, status);
+    struct packet *packet;
+    unsigned int cmd = CMD_DBOX_DESTROY_XBUF;
+    int pixmap;
+
+    pixmap = buffer_handler_pixmap(inst->dbox.extra_buffer[idx]);
+    if (pixmap == 0) {
+       ErrPrint("Invalid buffer\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    packet = packet_create_noack((const char *)&cmd, "ssii", package_name(inst->info), inst->id, pixmap, idx);
+    if (!packet) {
+       ErrPrint("Failed to create a packet\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    return CLIENT_SEND_EVENT(inst, packet);
 }
 
 HAPI int instance_add_client(struct inst_info *inst, struct client_node *client)
 {
-       if (inst->client == client) {
-               ErrPrint("Owner cannot be the viewer\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (inst->client == client) {
+       ErrPrint("Owner cannot be the viewer\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       DbgPrint("%d is added to the list of viewer of %s(%s)\n", client_pid(client), package_name(instance_package(inst)), instance_id(inst));
-       if (client_event_callback_add(client, CLIENT_EVENT_DEACTIVATE, viewer_deactivated_cb, inst) < 0) {
-               ErrPrint("Failed to add a deactivate callback\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    DbgPrint("%d is added to the list of viewer of %s(%s)\n", client_pid(client), package_name(instance_package(inst)), instance_id(inst));
+    if (client_event_callback_add(client, CLIENT_EVENT_DEACTIVATE, viewer_deactivated_cb, inst) < 0) {
+       ErrPrint("Failed to add a deactivate callback\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       instance_ref(inst);
-       inst->client_list = eina_list_append(inst->client_list, client);
-       return LB_STATUS_SUCCESS;
+    instance_ref(inst);
+    inst->client_list = eina_list_append(inst->client_list, client);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int instance_del_client(struct inst_info *inst, struct client_node *client)
 {
-       if (inst->client == client) {
-               ErrPrint("Owner is not in the viewer list\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (inst->client == client) {
+       ErrPrint("Owner is not in the viewer list\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       client_event_callback_del(client, CLIENT_EVENT_DEACTIVATE, viewer_deactivated_cb, inst);
-       viewer_deactivated_cb(client, inst);
-       return LB_STATUS_SUCCESS;
+    client_event_callback_del(client, CLIENT_EVENT_DEACTIVATE, viewer_deactivated_cb, inst);
+    viewer_deactivated_cb(client, inst);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int instance_has_client(struct inst_info *inst, struct client_node *client)
 {
-       return !!eina_list_data_find(inst->client_list, client);
+    return !!eina_list_data_find(inst->client_list, client);
 }
 
 HAPI void *instance_client_list(struct inst_info *inst)
 {
-       return inst->client_list;
+    return inst->client_list;
 }
 
 HAPI int instance_init(void)
 {
-       if (!strcasecmp(PROVIDER_METHOD, "shm")) {
-               s_info.env_buf_type = BUFFER_TYPE_SHM;
-       } else if (!strcasecmp(PROVIDER_METHOD, "pixmap")) {
-               s_info.env_buf_type = BUFFER_TYPE_PIXMAP;
-       }
-       /* Default method is BUFFER_TYPE_FILE */
+    if (!strcasecmp(DYNAMICBOX_CONF_PROVIDER_METHOD, "shm")) {
+       s_info.env_buf_type = DBOX_FB_TYPE_SHM;
+    } else if (!strcasecmp(DYNAMICBOX_CONF_PROVIDER_METHOD, "pixmap")) {
+       s_info.env_buf_type = DBOX_FB_TYPE_PIXMAP;
+    }
+    /* Default method is DBOX_FB_TYPE_FILE */
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int instance_fini(void)
 {
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static inline struct tag_item *find_tag_item(struct inst_info *inst, const char *tag)
 {
-       struct tag_item *item;
-       Eina_List *l;
+    struct tag_item *item;
+    Eina_List *l;
 
-       EINA_LIST_FOREACH(inst->data_list, l, item) {
-               if (!strcmp(item->tag, tag)) {
-                       return item;
-               }
+    EINA_LIST_FOREACH(inst->data_list, l, item) {
+       if (!strcmp(item->tag, tag)) {
+           return item;
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
 HAPI int instance_set_data(struct inst_info *inst, const char *tag, void *data)
 {
-       struct tag_item *item;
+    struct tag_item *item;
 
-       item = find_tag_item(inst, tag);
+    item = find_tag_item(inst, tag);
+    if (!item) {
+       item = malloc(sizeof(*item));
        if (!item) {
-               item = malloc(sizeof(*item));
-               if (!item) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       return LB_STATUS_ERROR_MEMORY;
-               }
-
-               item->tag = strdup(tag);
-               if (!item->tag) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       DbgFree(item);
-                       return LB_STATUS_ERROR_MEMORY;
-               }
-
-               inst->data_list = eina_list_append(inst->data_list, item);
+           ErrPrint("Heap: %s\n", strerror(errno));
+           return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
        }
 
-       if (!data) {
-               inst->data_list = eina_list_remove(inst->data_list, item);
-               DbgFree(item->tag);
-               DbgFree(item);
-       } else {
-               item->data = data;
+       item->tag = strdup(tag);
+       if (!item->tag) {
+           ErrPrint("Heap: %s\n", strerror(errno));
+           DbgFree(item);
+           return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
        }
 
-       return LB_STATUS_SUCCESS;
+       inst->data_list = eina_list_append(inst->data_list, item);
+    }
+
+    if (!data) {
+       inst->data_list = eina_list_remove(inst->data_list, item);
+       DbgFree(item->tag);
+       DbgFree(item);
+    } else {
+       item->data = data;
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI void *instance_del_data(struct inst_info *inst, const char *tag)
 {
-       struct tag_item *item;
-       void *data;
+    struct tag_item *item;
+    void *data;
 
-       item = find_tag_item(inst, tag);
-       if (!item) {
-               return NULL;
-       }
+    item = find_tag_item(inst, tag);
+    if (!item) {
+       return NULL;
+    }
 
-       inst->data_list = eina_list_remove(inst->data_list, item);
-       data = item->data;
-       DbgFree(item->tag);
-       DbgFree(item);
+    inst->data_list = eina_list_remove(inst->data_list, item);
+    data = item->data;
+    DbgFree(item->tag);
+    DbgFree(item);
 
-       return data;
+    return data;
 }
 
 HAPI void *instance_get_data(struct inst_info *inst, const char *tag)
 {
-       struct tag_item *item;
+    struct tag_item *item;
 
-       item = find_tag_item(inst, tag);
-       if (!item) {
-               return NULL;
-       }
+    item = find_tag_item(inst, tag);
+    if (!item) {
+       return NULL;
+    }
 
-       return item->data;
+    return item->data;
 }
 
-HAPI struct client_node *instance_pd_owner(struct inst_info *inst)
+HAPI struct client_node *instance_gbar_owner(struct inst_info *inst)
 {
-       return inst->pd.owner;
+    return inst->gbar.owner;
 }
 
 /* End of a file */
index 8593ab7..906a715 100644 (file)
--- a/src/io.c
+++ b/src/io.c
@@ -27,7 +27,9 @@
 #include <Eina.h>
 #include <sqlite3.h>
 #include <db-util.h>
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
+#include <dynamicbox_service.h>
+#include <dynamicbox_conf.h>
 
 #include "debug.h"
 #include "conf.h"
 
 int errno;
 
+#define MAX_ABI                256
+#define MAX_PKGNAME    512
+
 static struct {
-       sqlite3 *handle;
+    sqlite3 *handle;
 } s_info = {
-       .handle = NULL,
+    .handle = NULL,
 };
 
 static int load_abi_table(void)
 {
-       FILE *fp;
-       int ch;
-       int idx = 0;
-       int tag_id = 0;
-       enum {
-               INIT = 0x0,
-               GROUP = 0x1,
-               TAG = 0x02,
-               VALUE = 0x03,
-               ERROR = 0x05
-       } state;
-       enum {
-               PKGNAME = 0x0,
-       };
-       static const char *field[] = {
-               "package",
-               NULL,
-       };
-       const char *ptr = NULL;
-
-       char group[MAX_ABI + 1];
-       char pkgname[MAX_PKGNAME + 1];
-
-       fp = fopen("/usr/share/"PACKAGE"/abi.ini", "rt");
-       if (!fp) {
-               return LB_STATUS_ERROR_IO;
-       }
+    FILE *fp;
+    int ch;
+    int idx = 0;
+    int tag_id = 0;
+    enum {
+       INIT = 0x0,
+       GROUP = 0x1,
+       TAG = 0x02,
+       VALUE = 0x03,
+       ERROR = 0x05
+    } state;
+    enum {
+       PKGNAME = 0x0,
+    };
+    static const char *field[] = {
+       "package",
+       NULL,
+    };
+    const char *ptr = NULL;
+
+    char group[MAX_ABI + 1];
+    char pkgname[MAX_PKGNAME + 1];
+
+    fp = fopen("/usr/share/"PACKAGE"/abi.ini", "rt");
+    if (!fp) {
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
+
+    state = INIT;
+    while ((ch = getc(fp)) != EOF && state != ERROR) {
+       switch (state) {
+       case INIT:
+           if (isspace(ch)) {
+               continue;
+           }
+           if (ch == '[') {
+               state = GROUP;
+               idx = 0;
+           } else {
+               state = ERROR;
+           }
+           break;
+       case GROUP:
+           if (ch == ']') {
+               if (idx == 0) {
+                   state = ERROR;
+               } else {
+                   group[idx] = '\0';
+                   state = TAG;
+                   idx = 0;
+                   ptr = NULL;
+               }
+           } else if (idx < MAX_ABI) {
+               group[idx++] = ch;
+           } else {
+               ErrPrint("Overflow\n");
+               state = ERROR;
+           }
+           break;
+       case TAG:
+           if (ptr == NULL) {
+               if (idx == 0) {
+                   if (isspace(ch)) {
+                       continue;
+                   }
 
-       state = INIT;
-       while ((ch = getc(fp)) != EOF && state != ERROR) {
-               switch (state) {
-               case INIT:
-                       if (isspace(ch)) {
-                               continue;
-                       }
-                       if (ch == '[') {
-                               state = GROUP;
-                               idx = 0;
-                       } else {
-                               state = ERROR;
-                       }
-                       break;
-               case GROUP:
-                       if (ch == ']') {
-                               if (idx == 0) {
-                                       state = ERROR;
-                               } else {
-                                       group[idx] = '\0';
-                                       state = TAG;
-                                       idx = 0;
-                                       ptr = NULL;
-                               }
-                       } else if (idx < MAX_ABI) {
-                               group[idx++] = ch;
-                       } else {
-                               ErrPrint("Overflow\n");
-                               state = ERROR;
-                       }
-                       break;
-               case TAG:
-                       if (ptr == NULL) {
-                               if (idx == 0) {
-                                       if (isspace(ch)) {
-                                               continue;
-                                       }
-
-                                       /* New group started */
-                                       if (ch == '[') {
-                                               ungetc(ch, fp);
-                                               state = INIT;
-                                               continue;
-                                       }
-                               }
-
-                               ptr = field[idx];
-                       }
-
-                       if (ptr == NULL) {
-                               ErrPrint("unknown tag\n");
-                               state = ERROR;
-                               continue;
-                       }
-
-                       if (*ptr == '\0' && ch == '=') {
-                               /* MATCHED */
-                               state = VALUE;
-                               tag_id = idx;
-                               idx = 0;
-                               ptr = NULL;
-                       } else if (*ptr == ch) {
-                               ptr++;
-                       } else {
-                               ungetc(ch, fp);
-                               ptr--;
-                               while (ptr >= field[idx]) {
-                                       ungetc(*ptr, fp);
-                                       ptr--;
-                               }
-                               ptr = NULL;
-                               idx++;
-                       }
-                       break;
-               case VALUE:
-                       switch (tag_id) {
-                       case PKGNAME:
-                               if (idx == 0) { /* LTRIM */
-                                       if (isspace(ch)) {
-                                               continue;
-                                       }
-
-                                       pkgname[idx] = ch;
-                                       idx++;
-                               } else if (isspace(ch)) {
-                                       int ret;
-                                       pkgname[idx] = '\0';
-
-                                       ret = abi_add_entry(group, pkgname);
-                                       if (ret != 0) {
-                                               ErrPrint("Failed to add %s for %s\n", pkgname, group);
-                                       }
-
-                                       state = TAG;
-                                       idx = 0;
-                               } else if (idx < MAX_PKGNAME) {
-                                       pkgname[idx] = ch;
-                                       idx++;
-                               } else {
-                                       ErrPrint("Overflow\n");
-                                       state = ERROR;
-                               }
-                               break;
-                       default:
-                               break;
-                       }
-                       break;
-               case ERROR:
-               default:
-                       break;
+                   /* New group started */
+                   if (ch == '[') {
+                       ungetc(ch, fp);
+                       state = INIT;
+                       continue;
+                   }
                }
-       }
 
-       if (state == VALUE) {
-               switch (tag_id) {
-               case PKGNAME:
-                       if (idx) {
-                               int ret;
-                               pkgname[idx] = '\0';
-                               ret = abi_add_entry(group, pkgname);
-                               if (ret != 0) {
-                                       ErrPrint("Failed to add %s for %s\n", pkgname, group);
-                               }
-                       }
-                       break;
-               default:
-                       break;
+               ptr = field[idx];
+           }
+
+           if (ptr == NULL) {
+               ErrPrint("unknown tag\n");
+               state = ERROR;
+               continue;
+           }
+
+           if (*ptr == '\0' && ch == '=') {
+               /* MATCHED */
+               state = VALUE;
+               tag_id = idx;
+               idx = 0;
+               ptr = NULL;
+           } else if (*ptr == ch) {
+               ptr++;
+           } else {
+               ungetc(ch, fp);
+               ptr--;
+               while (ptr >= field[idx]) {
+                   ungetc(*ptr, fp);
+                   ptr--;
+               }
+               ptr = NULL;
+               idx++;
+           }
+           break;
+       case VALUE:
+           switch (tag_id) {
+           case PKGNAME:
+               if (idx == 0) { /* LTRIM */
+                   if (isspace(ch)) {
+                       continue;
+                   }
+
+                   pkgname[idx] = ch;
+                   idx++;
+               } else if (isspace(ch)) {
+                   int ret;
+                   pkgname[idx] = '\0';
+
+                   ret = abi_add_entry(group, pkgname);
+                   if (ret != 0) {
+                       ErrPrint("Failed to add %s for %s\n", pkgname, group);
+                   }
+
+                   state = TAG;
+                   idx = 0;
+               } else if (idx < MAX_PKGNAME) {
+                   pkgname[idx] = ch;
+                   idx++;
+               } else {
+                   ErrPrint("Overflow\n");
+                   state = ERROR;
+               }
+               break;
+           default:
+               break;
+           }
+           break;
+       case ERROR:
+       default:
+           break;
+       }
+    }
+
+    if (state == VALUE) {
+       switch (tag_id) {
+       case PKGNAME:
+           if (idx) {
+               int ret;
+               pkgname[idx] = '\0';
+               ret = abi_add_entry(group, pkgname);
+               if (ret != 0) {
+                   ErrPrint("Failed to add %s for %s\n", pkgname, group);
                }
+           }
+           break;
+       default:
+           break;
        }
+    }
 
-       if (fclose(fp) != 0) {
-               ErrPrint("fclose: %s\n", strerror(errno));
-       }
-       return LB_STATUS_SUCCESS;
+    if (fclose(fp) != 0) {
+       ErrPrint("fclose: %s\n", strerror(errno));
+    }
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static inline int build_client_info(struct pkg_info *info)
 {
-       static const char *dml = "SELECT auto_launch, pd_size FROM client WHERE pkgid = ?";
-       sqlite3_stmt *stmt;
-       int width;
-       int height;
-       int ret;
-       const char *tmp;
-
-       ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL);
-       if (ret != SQLITE_OK) {
-               ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
-               return LB_STATUS_ERROR_IO;
-       }
-
-       ret = sqlite3_bind_text(stmt, 1, package_name(info), -1, SQLITE_TRANSIENT);
-       if (ret != SQLITE_OK) {
-               ErrPrint("Failed to bind a pkgname %s\n", package_name(info));
-               sqlite3_finalize(stmt);
-               return LB_STATUS_ERROR_IO;
-       }
+    static const char *dml = "SELECT auto_launch, gbar_size FROM client WHERE pkgid = ?";
+    sqlite3_stmt *stmt;
+    int width;
+    int height;
+    int ret;
+    const char *tmp;
+
+    ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL);
+    if (ret != SQLITE_OK) {
+       ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
+
+    ret = sqlite3_bind_text(stmt, 1, package_name(info), -1, SQLITE_TRANSIENT);
+    if (ret != SQLITE_OK) {
+       ErrPrint("Failed to bind a pkgname %s\n", package_name(info));
+       sqlite3_finalize(stmt);
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
 
-       if (sqlite3_step(stmt) != SQLITE_ROW) {
-               ErrPrint("%s has no records (%s)\n", package_name(info), sqlite3_errmsg(s_info.handle));
-               sqlite3_reset(stmt);
-               sqlite3_clear_bindings(stmt);
-               sqlite3_finalize(stmt);
-               return LB_STATUS_ERROR_IO;
-       }
+    if (sqlite3_step(stmt) != SQLITE_ROW) {
+       ErrPrint("%s has no records (%s)\n", package_name(info), sqlite3_errmsg(s_info.handle));
+       sqlite3_reset(stmt);
+       sqlite3_clear_bindings(stmt);
+       sqlite3_finalize(stmt);
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
 
-       package_set_auto_launch(info, (const char *)sqlite3_column_text(stmt, 0));
+    package_set_auto_launch(info, (const char *)sqlite3_column_text(stmt, 0));
 
-       tmp = (const char *)sqlite3_column_text(stmt, 1);
-       if (tmp && strlen(tmp)) {
-               if (sscanf(tmp, "%dx%d", &width, &height) != 2) {
-                       ErrPrint("Failed to get PD width and Height (%s)\n", tmp);
-               } else {
-                       package_set_pd_width(info, width);
-                       package_set_pd_height(info, height);
-               }
+    tmp = (const char *)sqlite3_column_text(stmt, 1);
+    if (tmp && strlen(tmp)) {
+       if (sscanf(tmp, "%dx%d", &width, &height) != 2) {
+           ErrPrint("Failed to get GBAR width and Height (%s)\n", tmp);
+       } else {
+           package_set_gbar_width(info, width);
+           package_set_gbar_height(info, height);
        }
+    }
 
-       sqlite3_reset(stmt);
-       sqlite3_clear_bindings(stmt);
-       sqlite3_finalize(stmt);
-       return LB_STATUS_SUCCESS;
+    sqlite3_reset(stmt);
+    sqlite3_clear_bindings(stmt);
+    sqlite3_finalize(stmt);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static inline int build_provider_info(struct pkg_info *info)
 {
-       static const char *dml = "SELECT provider.network, provider.abi, provider.secured, provider.box_type, provider.box_src, provider.box_group, provider.pd_type, provider.pd_src, provider.pd_group, provider.libexec, provider.timeout, provider.period, provider.script, provider.pinup, pkgmap.appid FROM provider, pkgmap WHERE pkgmap.pkgid = ? AND provider.pkgid = ?";
-       sqlite3_stmt *stmt;
-       int ret;
-       const char *tmp;
-       const char *appid;
+    static const char *dml = "SELECT provider.network, provider.abi, provider.secured, provider.box_type, provider.box_src, provider.box_group, provider.gbar_type, provider.gbar_src, provider.gbar_group, provider.libexec, provider.timeout, provider.period, provider.script, provider.pinup, pkgmap.appid FROM provider, pkgmap WHERE pkgmap.pkgid = ? AND provider.pkgid = ?";
+    sqlite3_stmt *stmt;
+    int ret;
+    const char *tmp;
+    const char *appid;
+
+    ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL);
+    if (ret != SQLITE_OK) {
+       ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
+
+    if (sqlite3_bind_text(stmt, 1, package_name(info), -1, SQLITE_TRANSIENT) != SQLITE_OK) {
+       ErrPrint("Failed to bind a pkgname(%s) - %s\n", package_name(info), sqlite3_errmsg(s_info.handle));
+       sqlite3_finalize(stmt);
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
 
-       ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL);
-       if (ret != SQLITE_OK) {
-               ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
-               return LB_STATUS_ERROR_IO;
-       }
+    if (sqlite3_bind_text(stmt, 2, package_name(info), -1, SQLITE_TRANSIENT) != SQLITE_OK) {
+       ErrPrint("Failed to bind a pkgname(%s) - %s\n", package_name(info), sqlite3_errmsg(s_info.handle));
+       sqlite3_finalize(stmt);
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
 
-       if (sqlite3_bind_text(stmt, 1, package_name(info), -1, SQLITE_TRANSIENT) != SQLITE_OK) {
-               ErrPrint("Failed to bind a pkgname(%s) - %s\n", package_name(info), sqlite3_errmsg(s_info.handle));
-               sqlite3_finalize(stmt);
-               return LB_STATUS_ERROR_IO;
-       }
+    if (sqlite3_step(stmt) != SQLITE_ROW) {
+       ErrPrint("%s has no record(%s)\n", package_name(info), sqlite3_errmsg(s_info.handle));
+       sqlite3_reset(stmt);
+       sqlite3_clear_bindings(stmt);
+       sqlite3_finalize(stmt);
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
 
-       if (sqlite3_bind_text(stmt, 2, package_name(info), -1, SQLITE_TRANSIENT) != SQLITE_OK) {
-               ErrPrint("Failed to bind a pkgname(%s) - %s\n", package_name(info), sqlite3_errmsg(s_info.handle));
-               sqlite3_finalize(stmt);
-               return LB_STATUS_ERROR_IO;
-       }
+    appid = (const char *)sqlite3_column_text(stmt, 14);
+    if (!appid || !strlen(appid)) {
+       ErrPrint("Failed to execute the DML for %s\n", package_name(info));
+       sqlite3_reset(stmt);
+       sqlite3_clear_bindings(stmt);
+       sqlite3_finalize(stmt);
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
 
-       if (sqlite3_step(stmt) != SQLITE_ROW) {
-               ErrPrint("%s has no record(%s)\n", package_name(info), sqlite3_errmsg(s_info.handle));
-               sqlite3_reset(stmt);
-               sqlite3_clear_bindings(stmt);
-               sqlite3_finalize(stmt);
-               return LB_STATUS_ERROR_IO;
-       }
+    package_set_network(info, sqlite3_column_int(stmt, 0));
+    package_set_secured(info, sqlite3_column_int(stmt, 2));
 
-       appid = (const char *)sqlite3_column_text(stmt, 14);
-       if (!appid || !strlen(appid)) {
-               ErrPrint("Failed to execute the DML for %s\n", package_name(info));
-               sqlite3_reset(stmt);
-               sqlite3_clear_bindings(stmt);
-               sqlite3_finalize(stmt);
-               return LB_STATUS_ERROR_IO;
-       }
+    tmp = (const char *)sqlite3_column_text(stmt, 1);
+    if (tmp && strlen(tmp)) {
+       package_set_abi(info, tmp);
+    }
 
-       package_set_network(info, sqlite3_column_int(stmt, 0));
-       package_set_secured(info, sqlite3_column_int(stmt, 2));
+    package_set_dbox_type(info, sqlite3_column_int(stmt, 3));
+    tmp = (const char *)sqlite3_column_text(stmt, 4);
+    if (tmp && strlen(tmp)) {
+       package_set_dbox_path(info, tmp);
 
-       tmp = (const char *)sqlite3_column_text(stmt, 1);
+       tmp = (const char *)sqlite3_column_text(stmt, 5);
        if (tmp && strlen(tmp)) {
-               package_set_abi(info, tmp);
+           package_set_dbox_group(info, tmp);
        }
+    }
 
-       package_set_lb_type(info, sqlite3_column_int(stmt, 3));
-       tmp = (const char *)sqlite3_column_text(stmt, 4);
-       if (tmp && strlen(tmp)) {
-               package_set_lb_path(info, tmp);
-
-               tmp = (const char *)sqlite3_column_text(stmt, 5);
-               if (tmp && strlen(tmp)) {
-                       package_set_lb_group(info, tmp);
-               }
-       }
+    package_set_gbar_type(info, sqlite3_column_int(stmt, 6));
+    tmp = (const char *)sqlite3_column_text(stmt, 7);
+    if (tmp && strlen(tmp)) {
+       package_set_gbar_path(info, tmp);
 
-       package_set_pd_type(info, sqlite3_column_int(stmt, 6));
-       tmp = (const char *)sqlite3_column_text(stmt, 7);
+       tmp = (const char *)sqlite3_column_text(stmt, 8);
        if (tmp && strlen(tmp)) {
-               package_set_pd_path(info, tmp);
-
-               tmp = (const char *)sqlite3_column_text(stmt, 8);
-               if (tmp && strlen(tmp)) {
-                       package_set_pd_group(info, tmp);
-               }
+           package_set_gbar_group(info, tmp);
        }
+    }
 
-       tmp = (const char *)sqlite3_column_text(stmt, 9);
-       if (tmp && strlen(tmp)) {
-               package_set_libexec(info, tmp);
-       }
+    tmp = (const char *)sqlite3_column_text(stmt, 9);
+    if (tmp && strlen(tmp)) {
+       package_set_libexec(info, tmp);
+    }
 
-       package_set_timeout(info, sqlite3_column_int(stmt, 10));
+    package_set_timeout(info, sqlite3_column_int(stmt, 10));
 
-       tmp = (const char *)sqlite3_column_text(stmt, 11);
-       if (tmp && strlen(tmp)) {
-               package_set_period(info, atof(tmp));
-       }
+    tmp = (const char *)sqlite3_column_text(stmt, 11);
+    if (tmp && strlen(tmp)) {
+       package_set_period(info, atof(tmp));
+    }
 
-       tmp = (const char *)sqlite3_column_text(stmt, 12);
-       if (tmp && strlen(tmp)) {
-               package_set_script(info, tmp);
-       }
+    tmp = (const char *)sqlite3_column_text(stmt, 12);
+    if (tmp && strlen(tmp)) {
+       package_set_script(info, tmp);
+    }
 
-       package_set_pinup(info, sqlite3_column_int(stmt, 13));
+    package_set_pinup(info, sqlite3_column_int(stmt, 13));
 
-       sqlite3_reset(stmt);
-       sqlite3_clear_bindings(stmt);
-       sqlite3_finalize(stmt);
-       return LB_STATUS_SUCCESS;
+    sqlite3_reset(stmt);
+    sqlite3_clear_bindings(stmt);
+    sqlite3_finalize(stmt);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static inline int build_box_size_info(struct pkg_info *info)
 {
-       static const char *dml = "SELECT size_type FROM box_size WHERE pkgid = ?";
-       sqlite3_stmt *stmt;
-       int ret;
-       unsigned int size_type;
-       unsigned int size_list;
-
-       ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL);
-       if (ret != SQLITE_OK) {
-               ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
-               return LB_STATUS_ERROR_IO;
-       }
-
-       if (sqlite3_bind_text(stmt, 1, package_name(info), -1, SQLITE_TRANSIENT) != SQLITE_OK) {
-               ErrPrint("Failed to bind a pkgname(%s) - %s\n", package_name(info), sqlite3_errmsg(s_info.handle));
-               sqlite3_finalize(stmt);
-               return LB_STATUS_ERROR_IO;
-       }
+    static const char *dml = "SELECT size_type FROM box_size WHERE pkgid = ?";
+    sqlite3_stmt *stmt;
+    int ret;
+    unsigned int size_type;
+    unsigned int size_list;
+
+    ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL);
+    if (ret != SQLITE_OK) {
+       ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
+
+    if (sqlite3_bind_text(stmt, 1, package_name(info), -1, SQLITE_TRANSIENT) != SQLITE_OK) {
+       ErrPrint("Failed to bind a pkgname(%s) - %s\n", package_name(info), sqlite3_errmsg(s_info.handle));
+       sqlite3_finalize(stmt);
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
 
-       size_list = 0;
-       while (sqlite3_step(stmt) == SQLITE_ROW) {
-               size_type = sqlite3_column_int(stmt, 0);
-               size_list |= size_type;
-       }
+    size_list = 0;
+    while (sqlite3_step(stmt) == SQLITE_ROW) {
+       size_type = sqlite3_column_int(stmt, 0);
+       size_list |= size_type;
+    }
 
-       package_set_size_list(info, size_list);
+    package_set_size_list(info, size_list);
 
-       sqlite3_reset(stmt);
-       sqlite3_clear_bindings(stmt);
-       sqlite3_finalize(stmt);
-       return LB_STATUS_SUCCESS;
+    sqlite3_reset(stmt);
+    sqlite3_clear_bindings(stmt);
+    sqlite3_finalize(stmt);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static inline int load_context_option(struct context_item *item, int id)
 {
-       static const char *dml = "SELECT key, value FROM option WHERE option_id = ?";
-       sqlite3_stmt *stmt;
-       const char *key;
-       const char *value;
-       int ret;
-
-       ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL);
-       if (ret != SQLITE_OK) {
-               ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
-               return LB_STATUS_ERROR_IO;
-       }
-
-       ret = sqlite3_bind_int(stmt, 1, id);
-       if (ret != SQLITE_OK) {
-               ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
-               ret = LB_STATUS_ERROR_IO;
-               goto out;
-       }
-
-       ret = LB_STATUS_ERROR_NOT_EXIST;
-       while (sqlite3_step(stmt) == SQLITE_ROW) {
-               key = (const char *)sqlite3_column_text(stmt, 0);
-               if (!key || !strlen(key)) {
-                       ErrPrint("KEY is nil\n");
-                       continue;
-               }
-
-               value = (const char *)sqlite3_column_text(stmt, 1);
-               if (!value || !strlen(value)) {
-                       ErrPrint("VALUE is nil\n");
-                       continue;
-               }
-
-               ret = group_add_option(item, key, value);
-               if (ret < 0) {
-                       break;
-               }
+    static const char *dml = "SELECT key, value FROM option WHERE option_id = ?";
+    sqlite3_stmt *stmt;
+    const char *key;
+    const char *value;
+    int ret;
+
+    ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL);
+    if (ret != SQLITE_OK) {
+       ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
+
+    ret = sqlite3_bind_int(stmt, 1, id);
+    if (ret != SQLITE_OK) {
+       ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
+       ret = DBOX_STATUS_ERROR_IO_ERROR;
+       goto out;
+    }
+
+    ret = DBOX_STATUS_ERROR_NOT_EXIST;
+    while (sqlite3_step(stmt) == SQLITE_ROW) {
+       key = (const char *)sqlite3_column_text(stmt, 0);
+       if (!key || !strlen(key)) {
+           ErrPrint("KEY is nil\n");
+           continue;
+       }
+
+       value = (const char *)sqlite3_column_text(stmt, 1);
+       if (!value || !strlen(value)) {
+           ErrPrint("VALUE is nil\n");
+           continue;
+       }
+
+       ret = group_add_option(item, key, value);
+       if (ret < 0) {
+           break;
        }
+    }
 
 out:
-       sqlite3_reset(stmt);
-       sqlite3_clear_bindings(stmt);
-       sqlite3_finalize(stmt);
-       return ret;
+    sqlite3_reset(stmt);
+    sqlite3_clear_bindings(stmt);
+    sqlite3_finalize(stmt);
+    return ret;
 }
 
 static inline int load_context_item(struct context_info *info, int id)
 {
-       static const char *dml = "SELECT ctx_item, option_id FROM groupmap WHERE id = ?";
-       struct context_item *item;
-       sqlite3_stmt *stmt;
-       const char *ctx_item;
-       int option_id;
-       int ret;
-
-       ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL);
-       if (ret != SQLITE_OK) {
-               ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
-               return LB_STATUS_ERROR_IO;
-       }
-
-       ret = sqlite3_bind_int(stmt, 1, id);
-       if (ret != SQLITE_OK) {
-               ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
-               ret = LB_STATUS_ERROR_IO;
-               goto out;
-       }
-
-       ret = LB_STATUS_ERROR_NOT_EXIST;
-       while (sqlite3_step(stmt) == SQLITE_ROW) {
-               ctx_item = (const char *)sqlite3_column_text(stmt, 0);
-               option_id = sqlite3_column_int(stmt, 1);
-
-               item = group_add_context_item(info, ctx_item);
-               if (!item) {
-                       ErrPrint("Failed to add a new context item\n");
-                       ret = LB_STATUS_ERROR_FAULT;
-                       break;
-               }
-
-               ret = load_context_option(item, option_id);
-               if (ret < 0) {
-                       break;
-               }
+    static const char *dml = "SELECT ctx_item, option_id FROM groupmap WHERE id = ?";
+    struct context_item *item;
+    sqlite3_stmt *stmt;
+    const char *ctx_item;
+    int option_id;
+    int ret;
+
+    ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL);
+    if (ret != SQLITE_OK) {
+       ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
+
+    ret = sqlite3_bind_int(stmt, 1, id);
+    if (ret != SQLITE_OK) {
+       ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
+       ret = DBOX_STATUS_ERROR_IO_ERROR;
+       goto out;
+    }
+
+    ret = DBOX_STATUS_ERROR_NOT_EXIST;
+    while (sqlite3_step(stmt) == SQLITE_ROW) {
+       ctx_item = (const char *)sqlite3_column_text(stmt, 0);
+       option_id = sqlite3_column_int(stmt, 1);
+
+       item = group_add_context_item(info, ctx_item);
+       if (!item) {
+           ErrPrint("Failed to add a new context item\n");
+           ret = DBOX_STATUS_ERROR_FAULT;
+           break;
+       }
+
+       ret = load_context_option(item, option_id);
+       if (ret < 0) {
+           break;
        }
+    }
 
 out:
-       sqlite3_reset(stmt);
-       sqlite3_clear_bindings(stmt);
-       sqlite3_finalize(stmt);
-       return ret;
+    sqlite3_reset(stmt);
+    sqlite3_clear_bindings(stmt);
+    sqlite3_finalize(stmt);
+    return ret;
 }
 
 static inline int build_group_info(struct pkg_info *info)
 {
-       static const char *dml = "SELECT id, cluster, category FROM groupinfo WHERE pkgid = ?";
-       sqlite3_stmt *stmt;
-       int ret;
-       int id;
-       const char *cluster_name;
-       const char *category_name;
-       struct cluster *cluster;
-       struct category *category;
-       struct context_info *ctx_info;
-
-       ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL);
-       if (ret != SQLITE_OK) {
-               ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
-               return LB_STATUS_ERROR_IO;
-       }
-
-       ret = sqlite3_bind_text(stmt, 1, package_name(info), -1, SQLITE_TRANSIENT);
-       if (ret != SQLITE_OK) {
-               ErrPrint("Failed to bind a package name(%s)\n", package_name(info));
-               sqlite3_finalize(stmt);
-               return LB_STATUS_ERROR_IO;
-       }
-
-       while (sqlite3_step(stmt) == SQLITE_ROW) {
-               id = sqlite3_column_int(stmt, 0);
-               cluster_name = (const char *)sqlite3_column_text(stmt, 1);
-               if (!cluster_name || !strlen(cluster_name)) {
-                       DbgPrint("Cluster name is not valid\n");
-                       continue;
-               }
-
-               category_name = (const char *)sqlite3_column_text(stmt, 2);
-               if (!category_name || !strlen(category_name)) {
-                       DbgPrint("Category name is not valid\n");
-                       continue;
-               }
-
-               cluster = group_find_cluster(cluster_name);
-               if (!cluster) {
-                       cluster = group_create_cluster(cluster_name);
-                       if (!cluster) {
-                               ErrPrint("Failed to create a cluster(%s)\n", cluster_name);
-                               continue;
-                       }
-               }
-
-               category = group_find_category(cluster, category_name);
-               if (!category) {
-                       category = group_create_category(cluster, category_name);
-                       if (!category) {
-                               ErrPrint("Failed to create a category(%s)\n", category_name);
-                               continue;
-                       }
+    static const char *dml = "SELECT id, cluster, category FROM groupinfo WHERE pkgid = ?";
+    sqlite3_stmt *stmt;
+    int ret;
+    int id;
+    const char *cluster_name;
+    const char *category_name;
+    struct cluster *cluster;
+    struct category *category;
+    struct context_info *ctx_info;
+
+    ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL);
+    if (ret != SQLITE_OK) {
+       ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
+
+    ret = sqlite3_bind_text(stmt, 1, package_name(info), -1, SQLITE_TRANSIENT);
+    if (ret != SQLITE_OK) {
+       ErrPrint("Failed to bind a package name(%s)\n", package_name(info));
+       sqlite3_finalize(stmt);
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
+
+    while (sqlite3_step(stmt) == SQLITE_ROW) {
+       id = sqlite3_column_int(stmt, 0);
+       cluster_name = (const char *)sqlite3_column_text(stmt, 1);
+       if (!cluster_name || !strlen(cluster_name)) {
+           DbgPrint("Cluster name is not valid\n");
+           continue;
+       }
+
+       category_name = (const char *)sqlite3_column_text(stmt, 2);
+       if (!category_name || !strlen(category_name)) {
+           DbgPrint("Category name is not valid\n");
+           continue;
+       }
+
+       cluster = group_find_cluster(cluster_name);
+       if (!cluster) {
+           cluster = group_create_cluster(cluster_name);
+           if (!cluster) {
+               ErrPrint("Failed to create a cluster(%s)\n", cluster_name);
+               continue;
+           }
+       }
+
+       category = group_find_category(cluster, category_name);
+       if (!category) {
+           category = group_create_category(cluster, category_name);
+           if (!category) {
+               ErrPrint("Failed to create a category(%s)\n", category_name);
+               continue;
+           }
+       }
+
+       /*!
+        * \TODO
+        * Step 1. Get the list of the context item from the DB using 'id'
+        *         {context_item, option_id}
+        * Step 2. Get the list of the options from the DB using option_id
+        *         key, value
+        */
+       ctx_info = group_create_context_info(category, package_name(info));
+       if (ctx_info) {
+           ret = load_context_item(ctx_info, id);
+           if (ret < 0) {
+               if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST) {
+                   DbgPrint("Has no specific context info\n");
+               } else {
+                   DbgPrint("Context info is not valid\n");
+                   group_destroy_context_info(ctx_info);
+                   ctx_info = NULL;
                }
+           }
 
-               /*!
-                * \TODO
-                * Step 1. Get the list of the context item from the DB using 'id'
-                *         {context_item, option_id}
-                * Step 2. Get the list of the options from the DB using option_id
-                *         key, value
-                */
-               ctx_info = group_create_context_info(category, package_name(info));
-               if (ctx_info) {
-                       ret = load_context_item(ctx_info, id);
-                       if (ret < 0) {
-                               if (ret == (int)LB_STATUS_ERROR_NOT_EXIST) {
-                                       DbgPrint("Has no specific context info\n");
-                               } else {
-                                       DbgPrint("Context info is not valid\n");
-                                       group_destroy_context_info(ctx_info);
-                                       ctx_info = NULL;
-                               }
-                       }
-
-                       if (ctx_info) {
-                               package_add_ctx_info(info, ctx_info);
-                       }
-               }
+           if (ctx_info) {
+               package_add_ctx_info(info, ctx_info);
+           }
        }
+    }
 
-       sqlite3_reset(stmt);
-       sqlite3_clear_bindings(stmt);
-       sqlite3_finalize(stmt);
-       return LB_STATUS_SUCCESS;
+    sqlite3_reset(stmt);
+    sqlite3_clear_bindings(stmt);
+    sqlite3_finalize(stmt);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int io_is_exists(const char *lbid)
 {
-       sqlite3_stmt *stmt;
-       int ret;
-
-       if (!s_info.handle) {
-               ErrPrint("DB is not ready\n");
-               return LB_STATUS_ERROR_IO;
-       }
-
-       ret = sqlite3_prepare_v2(s_info.handle, "SELECT COUNT(pkgid) FROM pkgmap WHERE pkgid = ?", -1, &stmt, NULL);
-       if (ret != SQLITE_OK) {
-               ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
-               return LB_STATUS_ERROR_IO;
-       }
-
-       ret = sqlite3_bind_text(stmt, 1, lbid, -1, SQLITE_TRANSIENT);
-       if (ret != SQLITE_OK) {
-               ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
-               ret = LB_STATUS_ERROR_IO;
-               goto out;
-       }
-
-       if (sqlite3_step(stmt) != SQLITE_ROW) {
-               ErrPrint("%s has no record (%s)\n", lbid, sqlite3_errmsg(s_info.handle));
-               ret = LB_STATUS_ERROR_IO;
-               goto out;
-       }
-
-       ret = sqlite3_column_int(stmt, 0);
+    sqlite3_stmt *stmt;
+    int ret;
+
+    if (!s_info.handle) {
+       ErrPrint("DB is not ready\n");
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
+
+    ret = sqlite3_prepare_v2(s_info.handle, "SELECT COUNT(pkgid) FROM pkgmap WHERE pkgid = ?", -1, &stmt, NULL);
+    if (ret != SQLITE_OK) {
+       ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
+
+    ret = sqlite3_bind_text(stmt, 1, lbid, -1, SQLITE_TRANSIENT);
+    if (ret != SQLITE_OK) {
+       ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
+       ret = DBOX_STATUS_ERROR_IO_ERROR;
+       goto out;
+    }
+
+    if (sqlite3_step(stmt) != SQLITE_ROW) {
+       ErrPrint("%s has no record (%s)\n", lbid, sqlite3_errmsg(s_info.handle));
+       ret = DBOX_STATUS_ERROR_IO_ERROR;
+       goto out;
+    }
+
+    ret = sqlite3_column_int(stmt, 0);
 out:
-       sqlite3_reset(stmt);
-       sqlite3_finalize(stmt);
-       return ret;
+    sqlite3_reset(stmt);
+    sqlite3_finalize(stmt);
+    return ret;
 }
 
-HAPI char *io_livebox_pkgname(const char *pkgname)
+HAPI char *io_dynamicbox_pkgname(const char *pkgname)
 {
-       sqlite3_stmt *stmt;
-       char *pkgid;
-       char *tmp;
-       int ret;
+    sqlite3_stmt *stmt;
+    char *pkgid;
+    char *tmp;
+    int ret;
+
+    pkgid = NULL;
+
+    if (!s_info.handle) {
+       ErrPrint("DB is not ready\n");
+       return NULL;
+    }
+
+    ret = sqlite3_prepare_v2(s_info.handle, "SELECT pkgid FROM pkgmap WHERE (appid = ? AND prime = 1) OR pkgid = ?", -1, &stmt, NULL);
+    if (ret != SQLITE_OK) {
+       ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
+       return NULL;
+    }
+
+    ret = sqlite3_bind_text(stmt, 1, pkgname, -1, SQLITE_TRANSIENT);
+    if (ret != SQLITE_OK) {
+       ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
+       goto out;
+    }
+
+    ret = sqlite3_bind_text(stmt, 2, pkgname, -1, SQLITE_TRANSIENT);
+    if (ret != SQLITE_OK) {
+       ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
+       goto out;
+    }
+
+    if (sqlite3_step(stmt) != SQLITE_ROW) {
+       ErrPrint("%s has no record (%s)\n", pkgname, sqlite3_errmsg(s_info.handle));
+       goto out;
+    }
+
+    tmp = (char *)sqlite3_column_text(stmt, 0);
+    if (tmp && strlen(tmp)) {
+       pkgid = strdup(tmp);
+       if (!pkgid) {
+           ErrPrint("Heap: %s\n", strerror(errno));
+       }
+    }
 
-       pkgid = NULL;
+out:
+    sqlite3_reset(stmt);
+    sqlite3_finalize(stmt);
+    return pkgid;
+}
 
-       if (!s_info.handle) {
-               ErrPrint("DB is not ready\n");
-               return NULL;
-       }
+HAPI int io_crawling_dynamicboxes(int (*cb)(const char *pkgid, const char *lbid, int prime, void *data), void *data)
+{
+    DIR *dir;
 
-       ret = sqlite3_prepare_v2(s_info.handle, "SELECT pkgid FROM pkgmap WHERE (appid = ? AND prime = 1) OR pkgid = ?", -1, &stmt, NULL);
-       if (ret != SQLITE_OK) {
-               ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
-               return NULL;
-       }
+    if (!s_info.handle) {
+       ErrPrint("DB is not ready\n");
+    } else {
+       int ret;
+       sqlite3_stmt *stmt;
 
-       ret = sqlite3_bind_text(stmt, 1, pkgname, -1, SQLITE_TRANSIENT);
+       ret = sqlite3_prepare_v2(s_info.handle, "SELECT appid, pkgid, prime FROM pkgmap", -1, &stmt, NULL);
        if (ret != SQLITE_OK) {
-               ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
-               goto out;
-       }
+           ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
+       } else {
+           const char *lbid;
+           const char *pkgid;
+           int prime;
+
+           while (sqlite3_step(stmt) == SQLITE_ROW) {
+               pkgid = (const char *)sqlite3_column_text(stmt, 0);
+               if (!pkgid || !strlen(pkgid)) {
+                   continue;
+               }
 
-       ret = sqlite3_bind_text(stmt, 2, pkgname, -1, SQLITE_TRANSIENT);
-       if (ret != SQLITE_OK) {
-               ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
-               goto out;
-       }
+               lbid = (const char *)sqlite3_column_text(stmt, 1);
+               if (!lbid || !strlen(lbid)) {
+                   continue;
+               }
 
-       if (sqlite3_step(stmt) != SQLITE_ROW) {
-               ErrPrint("%s has no record (%s)\n", pkgname, sqlite3_errmsg(s_info.handle));
-               goto out;
-       }
+               prime = (int)sqlite3_column_int(stmt, 1);
 
-       tmp = (char *)sqlite3_column_text(stmt, 0);
-       if (tmp && strlen(tmp)) {
-               pkgid = strdup(tmp);
-               if (!pkgid) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
+               if (cb(pkgid, lbid, prime, data) < 0) {
+                   sqlite3_reset(stmt);
+                   sqlite3_finalize(stmt);
+                   return DBOX_STATUS_ERROR_CANCEL;
                }
-       }
+           }
 
-out:
-       sqlite3_reset(stmt);
-       sqlite3_finalize(stmt);
-       return pkgid;
-}
+           sqlite3_reset(stmt);
+           sqlite3_finalize(stmt);
+       }
+    }
 
-HAPI int io_crawling_liveboxes(int (*cb)(const char *pkgid, const char *lbid, int prime, void *data), void *data)
-{
-       DIR *dir;
+    dir = opendir(DYNAMICBOX_CONF_ROOT_PATH);
+    if (!dir) {
+       ErrPrint("Error: %s\n", strerror(errno));
+    } else {
+       struct dirent *ent;
 
-       if (!s_info.handle) {
-               ErrPrint("DB is not ready\n");
-       } else {
-               int ret;
-               sqlite3_stmt *stmt;
+       while ((ent = readdir(dir))) {
+           if (ent->d_name[0] == '.') {
+               continue;
+           }
 
-               ret = sqlite3_prepare_v2(s_info.handle, "SELECT appid, pkgid, prime FROM pkgmap", -1, &stmt, NULL);
-               if (ret != SQLITE_OK) {
-                       ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
-               } else {
-                       const char *lbid;
-                       const char *pkgid;
-                       int prime;
-
-                       while (sqlite3_step(stmt) == SQLITE_ROW) {
-                               pkgid = (const char *)sqlite3_column_text(stmt, 0);
-                               if (!pkgid || !strlen(pkgid)) {
-                                       continue;
-                               }
-
-                               lbid = (const char *)sqlite3_column_text(stmt, 1);
-                               if (!lbid || !strlen(lbid)) {
-                                       continue;
-                               }
-
-                               prime = (int)sqlite3_column_int(stmt, 1);
-
-                               if (cb(pkgid, lbid, prime, data) < 0) {
-                                       sqlite3_reset(stmt);
-                                       sqlite3_finalize(stmt);
-                                       return LB_STATUS_ERROR_CANCEL;
-                               }
-                       }
-
-                       sqlite3_reset(stmt);
-                       sqlite3_finalize(stmt);
+           if (cb(ent->d_name, ent->d_name, -2, data) < 0) {
+               if (closedir(dir) < 0) {
+                   ErrPrint("closedir: %s\n", strerror(errno));
                }
+               return DBOX_STATUS_ERROR_CANCEL;
+           }
        }
 
-       dir = opendir(ROOT_PATH);
-       if (!dir) {
-               ErrPrint("Error: %s\n", strerror(errno));
-       } else {
-               struct dirent *ent;
-
-               while ((ent = readdir(dir))) {
-                       if (ent->d_name[0] == '.') {
-                               continue;
-                       }
-
-                       if (cb(ent->d_name, ent->d_name, -2, data) < 0) {
-                               if (closedir(dir) < 0) {
-                                       ErrPrint("closedir: %s\n", strerror(errno));
-                               }
-                               return LB_STATUS_ERROR_CANCEL;
-                       }
-               }
-
-               if (closedir(dir) < 0) {
-                       ErrPrint("closedir: %s\n", strerror(errno));
-               }
+       if (closedir(dir) < 0) {
+           ErrPrint("closedir: %s\n", strerror(errno));
        }
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
-HAPI int io_update_livebox_package(const char *pkgid, int (*cb)(const char *pkgid, const char *lbid, int prime, void *data), void *data)
+HAPI int io_update_dynamicbox_package(const char *pkgid, int (*cb)(const char *pkgid, const char *lbid, int prime, void *data), void *data)
 {
-       sqlite3_stmt *stmt;
-       char *lbid;
-       int prime;
-       int ret;
+    sqlite3_stmt *stmt;
+    char *lbid;
+    int prime;
+    int ret;
 
-       if (!cb || !pkgid) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!cb || !pkgid) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (!s_info.handle) {
-               ErrPrint("DB is not ready\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!s_info.handle) {
+       ErrPrint("DB is not ready\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       ret = sqlite3_prepare_v2(s_info.handle, "SELECT pkgid, prime FROM pkgmap WHERE appid = ?", -1, &stmt, NULL);
-       if (ret != SQLITE_OK) {
-               ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
-       if (ret != SQLITE_OK) {
-               ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
-               ret = LB_STATUS_ERROR_FAULT;
-               goto out;
-       }
+    ret = sqlite3_prepare_v2(s_info.handle, "SELECT pkgid, prime FROM pkgmap WHERE appid = ?", -1, &stmt, NULL);
+    if (ret != SQLITE_OK) {
+       ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       ret = 0;
-       while (sqlite3_step(stmt) == SQLITE_ROW) {
-               lbid = (char *)sqlite3_column_text(stmt, 0);
-               if (!lbid || !strlen(lbid)) {
-                       continue;
-               }
+    ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
+    if (ret != SQLITE_OK) {
+       ErrPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
+       ret = DBOX_STATUS_ERROR_FAULT;
+       goto out;
+    }
 
-               prime = sqlite3_column_int(stmt, 1);
+    ret = 0;
+    while (sqlite3_step(stmt) == SQLITE_ROW) {
+       lbid = (char *)sqlite3_column_text(stmt, 0);
+       if (!lbid || !strlen(lbid)) {
+           continue;
+       }
 
-               if (cb(pkgid, lbid, prime, data) < 0) {
-                       DbgPrint("Callback canceled\n");
-                       break;
-               }
+       prime = sqlite3_column_int(stmt, 1);
 
-               ret++;
+       if (cb(pkgid, lbid, prime, data) < 0) {
+           DbgPrint("Callback canceled\n");
+           break;
        }
+
+       ret++;
+    }
 out:
-       sqlite3_reset(stmt);
-       sqlite3_finalize(stmt);
-       return ret;
+    sqlite3_reset(stmt);
+    sqlite3_finalize(stmt);
+    return ret;
 }
 
 HAPI int io_load_package_db(struct pkg_info *info)
 {
-       int ret;
+    int ret;
 
-       if (!s_info.handle) {
-               ErrPrint("DB is not ready\n");
-               return LB_STATUS_ERROR_IO;
-       }
+    if (!s_info.handle) {
+       ErrPrint("DB is not ready\n");
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
 
-       ret = build_provider_info(info);
-       if (ret < 0) {
-               return ret;
-       }
+    ret = build_provider_info(info);
+    if (ret < 0) {
+       return ret;
+    }
 
-       ret = build_client_info(info);
-       if (ret < 0) {
-               return ret;
-       }
+    ret = build_client_info(info);
+    if (ret < 0) {
+       return ret;
+    }
 
-       ret = build_box_size_info(info);
-       if (ret < 0) {
-               return ret;
-       }
+    ret = build_box_size_info(info);
+    if (ret < 0) {
+       return ret;
+    }
 
-       ret = build_group_info(info);
-       if (ret < 0) {
-               return ret;
-       }
+    ret = build_group_info(info);
+    if (ret < 0) {
+       return ret;
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static inline int db_init(void)
 {
-       int ret;
-       struct stat stat;
+    int ret;
+    struct stat stat;
 
-       ret = db_util_open_with_options(DBFILE, &s_info.handle, SQLITE_OPEN_READONLY, NULL);
-       if (ret != SQLITE_OK) {
-               ErrPrint("Failed to open a DB\n");
-               return LB_STATUS_ERROR_IO;
-       }
+    ret = db_util_open_with_options(DYNAMICBOX_CONF_DBFILE, &s_info.handle, SQLITE_OPEN_READONLY, NULL);
+    if (ret != SQLITE_OK) {
+       ErrPrint("Failed to open a DB\n");
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
 
-       if (lstat(DBFILE, &stat) < 0) {
-               db_util_close(s_info.handle);
-               s_info.handle = NULL;
-               ErrPrint("%s\n", strerror(errno));
-               return LB_STATUS_ERROR_IO;
-       }
+    if (lstat(DYNAMICBOX_CONF_DBFILE, &stat) < 0) {
+       db_util_close(s_info.handle);
+       s_info.handle = NULL;
+       ErrPrint("%s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
 
-       if (!S_ISREG(stat.st_mode)) {
-               ErrPrint("Invalid file\n");
-               db_util_close(s_info.handle);
-               s_info.handle = NULL;
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!S_ISREG(stat.st_mode)) {
+       ErrPrint("Invalid file\n");
+       db_util_close(s_info.handle);
+       s_info.handle = NULL;
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (stat.st_size <= 0) {
-               DbgPrint("Size is %d (But use this ;)\n", stat.st_size);
-       }
+    if (stat.st_size <= 0) {
+       DbgPrint("Size is %d (But use this ;)\n", stat.st_size);
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static inline int db_fini(void)
 {
-       if (!s_info.handle) {
-               return LB_STATUS_SUCCESS;
-       }
+    if (!s_info.handle) {
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
-       db_util_close(s_info.handle);
-       s_info.handle = NULL;
+    db_util_close(s_info.handle);
+    s_info.handle = NULL;
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int io_init(void)
 {
-       int ret;
+    int ret;
 
-       ret = db_init();
-       if (ret < 0) {
-               DbgPrint("DB initialized: %d\n", ret);
-       }
+    ret = db_init();
+    if (ret < 0) {
+       DbgPrint("DB initialized: %d\n", ret);
+    }
 
-       ret = load_abi_table();
-       if (ret < 0) {
-               DbgPrint("ABI table is loaded: %d\n", ret);
-       }
+    ret = load_abi_table();
+    if (ret < 0) {
+       DbgPrint("ABI table is loaded: %d\n", ret);
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int io_fini(void)
 {
-       int ret;
+    int ret;
 
-       abi_del_all();
+    abi_del_all();
 
-       ret = db_fini();
-       if (ret < 0) {
-               DbgPrint("DB finalized: %d\n", ret);
-       }
-       return LB_STATUS_SUCCESS;
+    ret = db_fini();
+    if (ret < 0) {
+       DbgPrint("DB finalized: %d\n", ret);
+    }
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 /* End of a file */
index 9c8f217..a0ec213 100644 (file)
@@ -27,7 +27,7 @@
 #include <Eina.h>
 
 #include <dlog.h>
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
 
 #include "util.h"
 #include "debug.h"
 int errno;
 
 static struct info {
-       Eina_List *info_list;
+    Eina_List *info_list;
 } s_info = {
-       .info_list = NULL,
+    .info_list = NULL,
 };
 
 struct liveinfo {
-       FILE *fp;
-       char fifo_name[60];
-       pid_t pid;
-       int handle;
-       void *data;
+    FILE *fp;
+    char fifo_name[60];
+    pid_t pid;
+    int handle;
+    void *data;
 };
 
 HAPI int liveinfo_init(void)
 {
-       return 0;
+    return 0;
 }
 
 HAPI void liveinfo_fini(void)
 {
-       struct liveinfo *info;
-
-       EINA_LIST_FREE(s_info.info_list, info) {
-               if (fclose(info->fp) != 0) {
-                       ErrPrint("fclose: %s\n", strerror(errno));
-               }
-               if (unlink(info->fifo_name) < 0) {
-                       ErrPrint("unlink: %s\n", strerror(errno));
-               }
-               DbgFree(info);
+    struct liveinfo *info;
+
+    EINA_LIST_FREE(s_info.info_list, info) {
+       if (fclose(info->fp) != 0) {
+           ErrPrint("fclose: %s\n", strerror(errno));
+       }
+       if (unlink(info->fifo_name) < 0) {
+           ErrPrint("unlink: %s\n", strerror(errno));
        }
+       DbgFree(info);
+    }
 }
 
 static inline int valid_requestor(pid_t pid)
 {
-       char cmdline[60]; /* strlen("/proc/%d/cmdline") + 30 */
-       struct stat target;
-       struct stat src;
+    char cmdline[60]; /* strlen("/proc/%d/cmdline") + 30 */
+    struct stat target;
+    struct stat src;
 
-       snprintf(cmdline, sizeof(cmdline), "/proc/%d/exe", pid);
+    snprintf(cmdline, sizeof(cmdline), "/proc/%d/exe", pid);
 
-       DbgPrint("Open cmdline: %s (%d)\n", cmdline, pid);
+    DbgPrint("Open cmdline: %s (%d)\n", cmdline, pid);
 
-       if (stat(cmdline, &target) < 0) {
-               ErrPrint("Error: %s\n", strerror(errno));
-               return 0;
-       }
+    if (stat(cmdline, &target) < 0) {
+       ErrPrint("Error: %s\n", strerror(errno));
+       return 0;
+    }
 
-       if (stat("/opt/usr/devel/usr/bin/liveinfo", &src) < 0) {
-               ErrPrint("Error: %s\n", strerror(errno));
-               return 0;
-       }
+    if (stat("/opt/usr/devel/usr/bin/liveinfo", &src) < 0) {
+       ErrPrint("Error: %s\n", strerror(errno));
+       return 0;
+    }
 
-       if (target.st_ino == src.st_ino) {
-               return 1;
-       }
+    if (target.st_ino == src.st_ino) {
+       return 1;
+    }
 
-       if (stat("/opt/usr/devel/usr/bin/dbox-mgr", &src) < 0) {
-               ErrPrint("Error: %s\n", strerror(errno));
-               return 0;
-       }
+    if (stat("/opt/usr/devel/usr/bin/dbox-mgr", &src) < 0) {
+       ErrPrint("Error: %s\n", strerror(errno));
+       return 0;
+    }
 
-       return target.st_ino == src.st_ino;
+    return target.st_ino == src.st_ino;
 }
 
 HAPI void liveinfo_set_data(struct liveinfo *info, void *data)
 {
-       info->data = data;
+    info->data = data;
 }
 
 HAPI void *liveinfo_data(struct liveinfo *info)
 {
-       return info->data;
+    return info->data;
 }
 
 HAPI struct liveinfo *liveinfo_create(pid_t pid, int handle)
 {
-       struct liveinfo *info;
+    struct liveinfo *info;
 
-       if (!valid_requestor(pid)) {
-               ErrPrint("Invalid requestor\n");
-               return NULL;
-       }
+    if (!valid_requestor(pid)) {
+       ErrPrint("Invalid requestor\n");
+       return NULL;
+    }
 
-       info = calloc(1, sizeof(*info));
-       if (!info) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return NULL;
-       }
+    info = calloc(1, sizeof(*info));
+    if (!info) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
 
-       snprintf(info->fifo_name, sizeof(info->fifo_name), "/tmp/.live_info.%lf", util_timestamp());
-       if (mkfifo(info->fifo_name, 0644) < 0) {
-               ErrPrint("mkfifo: %s\n", strerror(errno));
-               if (unlink(info->fifo_name) < 0) {
-                       ErrPrint("unlink: %s\n", strerror(errno));
-               }
-               DbgFree(info);
-               return NULL;
+    snprintf(info->fifo_name, sizeof(info->fifo_name), "/tmp/.live_info.%lf", util_timestamp());
+    if (mkfifo(info->fifo_name, 0644) < 0) {
+       ErrPrint("mkfifo: %s\n", strerror(errno));
+       if (unlink(info->fifo_name) < 0) {
+           ErrPrint("unlink: %s\n", strerror(errno));
        }
+       DbgFree(info);
+       return NULL;
+    }
 
-       info->fp = NULL;
-       info->pid = pid;
-       info->handle = handle;
+    info->fp = NULL;
+    info->pid = pid;
+    info->handle = handle;
 
-       DbgPrint("Live info is successfully created\n");
-       s_info.info_list = eina_list_append(s_info.info_list, info);
-       return info;
+    DbgPrint("Live info is successfully created\n");
+    s_info.info_list = eina_list_append(s_info.info_list, info);
+    return info;
 }
 
 HAPI int liveinfo_open_fifo(struct liveinfo *info)
 {
-       DbgPrint("FIFO is created (%s)\n", info->fifo_name);
-       info->fp = fopen(info->fifo_name, "w");
-       if (!info->fp) {
-               ErrPrint("open: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_IO;
-       }
-
-       return LB_STATUS_SUCCESS;
+    DbgPrint("FIFO is created (%s)\n", info->fifo_name);
+    info->fp = fopen(info->fifo_name, "w");
+    if (!info->fp) {
+       ErrPrint("open: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI void liveinfo_close_fifo(struct liveinfo *info)
 {
-       if (info->fp) {
-               if (fclose(info->fp) != 0) {
-                       ErrPrint("fclose: %s\n", strerror(errno));
-               }
-               info->fp = NULL;
+    if (info->fp) {
+       if (fclose(info->fp) != 0) {
+           ErrPrint("fclose: %s\n", strerror(errno));
        }
+       info->fp = NULL;
+    }
 }
 
 HAPI void liveinfo_destroy(struct liveinfo *info)
 {
-       s_info.info_list = eina_list_remove(s_info.info_list, info);
-       liveinfo_close_fifo(info);
-       if (unlink(info->fifo_name) < 0) {
-               ErrPrint("unlink: %s\n", strerror(errno));
-       }
-       DbgFree(info);
+    s_info.info_list = eina_list_remove(s_info.info_list, info);
+    liveinfo_close_fifo(info);
+    if (unlink(info->fifo_name) < 0) {
+       ErrPrint("unlink: %s\n", strerror(errno));
+    }
+    DbgFree(info);
 }
 
 HAPI pid_t liveinfo_pid(struct liveinfo *info)
 {
-       return info ? info->pid : (pid_t)-1;
+    return info ? info->pid : (pid_t)-1;
 }
 
 HAPI const char *liveinfo_filename(struct liveinfo *info)
 {
-       return info ? info->fifo_name : NULL;
+    return info ? info->fifo_name : NULL;
 }
 
 HAPI FILE *liveinfo_fifo(struct liveinfo *info)
 {
-       return info ? info->fp : NULL;
+    return info ? info->fp : NULL;
 }
 
 HAPI struct liveinfo *liveinfo_find_by_pid(pid_t pid)
 {
-       Eina_List *l;
-       struct liveinfo *info;
+    Eina_List *l;
+    struct liveinfo *info;
 
-       EINA_LIST_FOREACH(s_info.info_list, l, info) {
-               if (info->pid == pid) {
-                       return info;
-               }
+    EINA_LIST_FOREACH(s_info.info_list, l, info) {
+       if (info->pid == pid) {
+           return info;
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
 HAPI struct liveinfo *liveinfo_find_by_handle(int handle)
 {
-       Eina_List *l;
-       struct liveinfo *info;
+    Eina_List *l;
+    struct liveinfo *info;
 
-       EINA_LIST_FOREACH(s_info.info_list, l, info) {
-               if (info->handle == handle) {
-                       return info;
-               }
+    EINA_LIST_FOREACH(s_info.info_list, l, info) {
+       if (info->handle == handle) {
+           return info;
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
 /* End of a file */
index ff14f9c..4bfdf45 100644 (file)
 
 #include <packet.h>
 #include <dlog.h>
-#include <systemd/sd-daemon.h>
-
 
 #if defined(HAVE_LIVEBOX)
+
+#include <dynamicbox_service.h>
+#include <dynamicbox_conf.h>
+
 #include "slave_life.h"
 #include "slave_rpc.h"
 #include "client_life.h"
 #include "badge_service.h"
 
 #if defined(FLOG)
+#define TMP_LOG_FILE "/tmp/live.log"
 FILE *__file_log_fp;
 #endif
 
 static inline int app_create(void)
 {
-       int ret;
-
-       if (access(SLAVE_LOG_PATH, R_OK | W_OK) != 0) {
-               if (mkdir(SLAVE_LOG_PATH, 0755) < 0) {
-                       ErrPrint("Failed to create %s (%s)\n", SLAVE_LOG_PATH, strerror(errno));
-               }
-       }
-
-       /*!
-        * \note
-        * Dead signal handler has to be initialized before
-        * initate package or client (slave and client).
-        *
-        * Because while creating slaves for packages.
-        * It could be crashed before complete the initation stage.
-        *
-        * Then the dead callback should be invoked to handle it properly.
-        *
-        * To enable the dead signal handler,
-        * dead_init should be done before other components are initiated.
-        */
-       ret = setting_init();
-       if (ret < 0) {
-               DbgPrint("Setting initialized: %d\n", ret);
-       }
+    int ret;
+
+    if (access(DYNAMICBOX_CONF_LOG_PATH, R_OK | W_OK) != 0) {
+       if (mkdir(DYNAMICBOX_CONF_LOG_PATH, 0755) < 0) {
+           ErrPrint("Failed to create %s (%s)\n", DYNAMICBOX_CONF_LOG_PATH, strerror(errno));
+       }
+    }
+
+    /*!
+     * \note
+     * Dead signal handler has to be initialized before
+     * initate package or client (slave and client).
+     *
+     * Because while creating slaves for packages.
+     * It could be crashed before complete the initation stage.
+     *
+     * Then the dead callback should be invoked to handle it properly.
+     *
+     * To enable the dead signal handler,
+     * dead_init should be done before other components are initiated.
+     */
+    ret = setting_init();
+    if (ret < 0) {
+       DbgPrint("Setting initialized: %d\n", ret);
+    }
 
 #if defined(HAVE_LIVEBOX)
-       ret = client_init();
-       if (ret < 0) {
-               DbgPrint("Client initialized: %d\n", ret);
-       }
-
-       ret = dead_init();
-       if (ret < 0) {
-               DbgPrint("Dead callback is registered: %d\n", ret);
-       }
-
-       ret = group_init();
-       if (ret < 0) {
-               DbgPrint("group init: %d\n", ret);
-       }
-
-       ret = io_init();
-       if (ret < 0) {
-               DbgPrint("Init I/O: %d\n", ret);
-       }
-
-       ret = package_init();
-       if (ret < 0) {
-               DbgPrint("pkgmgr initialized: %d\n", ret);
-       }
-
-       instance_init();
-
-       ret = xmonitor_init();
-       if (ret < 0) {
-               DbgPrint("XMonitor init is done: %d\n", ret);
-       }
-
-       ret = buffer_handler_init();
-       if (ret < 0) {
-               DbgPrint("Buffer handler init is done: %d\n", ret);
-       }
-
-       /*!
-        * \note
-        * After initiate all other sub-systtems,
-        * Enable the server socket.
-        */
-       ret = server_init();
-       if (ret < 0) {
-               DbgPrint("Server initialized: %d\n", ret);
-       }
-
-       event_init();
-
-       script_init();
-
-       if (util_service_is_enabled(SERVICE_FILE)) {
-               file_service_init();
-       }
-
-       if (util_service_is_enabled(SERVICE_UTILITY)) {
-               utility_service_init();
-       }
+    ret = client_init();
+    if (ret < 0) {
+       DbgPrint("Client initialized: %d\n", ret);
+    }
+
+    ret = dead_init();
+    if (ret < 0) {
+       DbgPrint("Dead callback is registered: %d\n", ret);
+    }
+
+    ret = group_init();
+    if (ret < 0) {
+       DbgPrint("group init: %d\n", ret);
+    }
+
+    ret = io_init();
+    if (ret < 0) {
+       DbgPrint("Init I/O: %d\n", ret);
+    }
+
+    ret = package_init();
+    if (ret < 0) {
+       DbgPrint("pkgmgr initialized: %d\n", ret);
+    }
+
+    instance_init();
+
+    ret = xmonitor_init();
+    if (ret < 0) {
+       DbgPrint("XMonitor init is done: %d\n", ret);
+    }
+
+    ret = buffer_handler_init();
+    if (ret < 0) {
+       DbgPrint("Buffer handler init is done: %d\n", ret);
+    }
+
+    /*!
+     * \note
+     * After initiate all other sub-systtems,
+     * Enable the server socket.
+     */
+    ret = server_init();
+    if (ret < 0) {
+       DbgPrint("Server initialized: %d\n", ret);
+    }
+
+    event_init();
+
+    script_init();
+
+    if (util_service_is_enabled(DYNAMICBOX_CONF_SERVICE_FILE)) {
+       file_service_init();
+    }
+
+    if (util_service_is_enabled(DYNAMICBOX_CONF_SERVICE_UTILITY)) {
+       utility_service_init();
+    }
 #endif
 
-       if (util_service_is_enabled(SERVICE_SHORTCUT)) {
-               shortcut_service_init();
-       }
+    if (util_service_is_enabled(DYNAMICBOX_CONF_SERVICE_SHORTCUT)) {
+       shortcut_service_init();
+    }
 
-       if (util_service_is_enabled(SERVICE_NOTIFICATION)) {
-               notification_service_init();
-       }
+    if (util_service_is_enabled(DYNAMICBOX_CONF_SERVICE_NOTIFICATION)) {
+       notification_service_init();
+    }
 
-       if (util_service_is_enabled(SERVICE_BADGE)) {
-               badge_service_init();
-       }
+    if (util_service_is_enabled(DYNAMICBOX_CONF_SERVICE_BADGE)) {
+       badge_service_init();
+    }
 
-       return 0;
+    return 0;
 }
 
 static inline int app_terminate(void)
 {
-       int ret;
+    int ret;
 
-       if (util_service_is_enabled(SERVICE_BADGE)) {
-               ret = badge_service_fini();
-               if (ret < 0) {
-                       DbgPrint("badge: %d\n", ret);
-               }
+    if (util_service_is_enabled(DYNAMICBOX_CONF_SERVICE_BADGE)) {
+       ret = badge_service_fini();
+       if (ret < 0) {
+           DbgPrint("badge: %d\n", ret);
        }
+    }
 
-       if (util_service_is_enabled(SERVICE_NOTIFICATION)) {
-               ret = notification_service_fini();
-               if (ret < 0) {
-                       DbgPrint("noti: %d\n", ret);
-               }
+    if (util_service_is_enabled(DYNAMICBOX_CONF_SERVICE_NOTIFICATION)) {
+       ret = notification_service_fini();
+       if (ret < 0) {
+           DbgPrint("noti: %d\n", ret);
        }
+    }
 
-       if (util_service_is_enabled(SERVICE_SHORTCUT)) {
-               ret = shortcut_service_fini();
-               if (ret < 0) {
-                       DbgPrint("shortcut: %d\n", ret);
-               }
+    if (util_service_is_enabled(DYNAMICBOX_CONF_SERVICE_SHORTCUT)) {
+       ret = shortcut_service_fini();
+       if (ret < 0) {
+           DbgPrint("shortcut: %d\n", ret);
        }
+    }
 
 #if defined(HAVE_LIVEBOX)
-       if (util_service_is_enabled(SERVICE_FILE)) {
-               ret = file_service_fini();
-               if (ret < 0) {
-                       DbgPrint("Finalize the file service: %d\n", ret);
-               }
-       }
-
-       ret = server_fini();
+    if (util_service_is_enabled(DYNAMICBOX_CONF_SERVICE_FILE)) {
+       ret = file_service_fini();
        if (ret < 0) {
-               DbgPrint("Finalize server: %d\n", ret);
+           DbgPrint("Finalize the file service: %d\n", ret);
        }
+    }
 
-       ret = dead_fini();
-       if (ret < 0) {
-               DbgPrint("dead signal handler finalized: %d\n", ret);
-       }
+    ret = server_fini();
+    if (ret < 0) {
+       DbgPrint("Finalize server: %d\n", ret);
+    }
 
-       if (util_service_is_enabled(SERVICE_UTILITY)) {
-               ret = utility_service_fini();
-               if (ret < 0) {
-                       DbgPrint("utility: %d\n", ret);
-               }
-       }
+    ret = dead_fini();
+    if (ret < 0) {
+       DbgPrint("dead signal handler finalized: %d\n", ret);
+    }
 
-       ret = event_fini();
+    if (util_service_is_enabled(DYNAMICBOX_CONF_SERVICE_UTILITY)) {
+       ret = utility_service_fini();
        if (ret < 0) {
-               DbgPrint("event: %d\n", ret);
+           DbgPrint("utility: %d\n", ret);
        }
+    }
 
-       ret = setting_fini();
-       if (ret < 0) {
-               DbgPrint("Finalize setting : %d\n", ret);
-       }
+    ret = event_fini();
+    if (ret < 0) {
+       DbgPrint("event: %d\n", ret);
+    }
 
-       ret = instance_fini();
-       if (ret < 0) {
-               DbgPrint("Finalizing instances: %d\n", ret);
-       }
+    ret = setting_fini();
+    if (ret < 0) {
+       DbgPrint("Finalize setting : %d\n", ret);
+    }
 
-       ret = package_fini();
-       if (ret < 0) {
-               DbgPrint("Finalize package info: %d\n", ret);
-       }
+    ret = instance_fini();
+    if (ret < 0) {
+       DbgPrint("Finalizing instances: %d\n", ret);
+    }
 
-       ret = script_fini();
-       if (ret < 0) {
-               DbgPrint("script: %d\n", ret);
-       }
+    ret = package_fini();
+    if (ret < 0) {
+       DbgPrint("Finalize package info: %d\n", ret);
+    }
 
-       ret = buffer_handler_fini();
-       if (ret < 0) {
-               DbgPrint("buffer handler: %d\n", ret);
-       }
+    ret = script_fini();
+    if (ret < 0) {
+       DbgPrint("script: %d\n", ret);
+    }
 
-       xmonitor_fini();
+    ret = buffer_handler_fini();
+    if (ret < 0) {
+       DbgPrint("buffer handler: %d\n", ret);
+    }
 
-       client_fini();
+    xmonitor_fini();
 
-       ret = io_fini();
-       if (ret < 0) {
-               DbgPrint("IO finalized: %d\n", ret);
-       }
+    client_fini();
 
-       ret = group_fini();
-       if (ret < 0) {
-               DbgPrint("Group finalized: %d\n", ret);
-       }
+    ret = io_fini();
+    if (ret < 0) {
+       DbgPrint("IO finalized: %d\n", ret);
+    }
+
+    ret = group_fini();
+    if (ret < 0) {
+       DbgPrint("Group finalized: %d\n", ret);
+    }
 #endif
 
-       DbgPrint("Terminated\n");
-       return 0;
+    DbgPrint("Terminated\n");
+    return 0;
 }
 
 static Eina_Bool signal_cb(void *data, Ecore_Fd_Handler *handler)
 {
-       struct signalfd_siginfo fdsi;
-       ssize_t size;
-       int fd;
-
-       fd = ecore_main_fd_handler_fd_get(handler);
-       if (fd < 0) {
-               ErrPrint("Unable to get FD\n");
-               return ECORE_CALLBACK_CANCEL;
-       }
+    struct signalfd_siginfo fdsi;
+    ssize_t size;
+    int fd;
 
-       size = read(fd, &fdsi, sizeof(fdsi));
-       if (size != sizeof(fdsi)) {
-               ErrPrint("Unable to get siginfo: %s\n", strerror(errno));
-               return ECORE_CALLBACK_CANCEL;
-       }
+    fd = ecore_main_fd_handler_fd_get(handler);
+    if (fd < 0) {
+       ErrPrint("Unable to get FD\n");
+       ecore_main_fd_handler_del(handler);
+       return ECORE_CALLBACK_CANCEL;
+    }
+
+    size = read(fd, &fdsi, sizeof(fdsi));
+    if (size != sizeof(fdsi)) {
+       ErrPrint("Unable to get siginfo: %s\n", strerror(errno));
+       ecore_main_fd_handler_del(handler);
+       return ECORE_CALLBACK_CANCEL;
+    }
 
-       if (fdsi.ssi_signo == SIGTERM) {
-               int cfd;
+    if (fdsi.ssi_signo == SIGTERM) {
+       int cfd;
 
-               CRITICAL_LOG("Terminated(SIGTERM)\n");
+       CRITICAL_LOG("Terminated(SIGTERM)\n");
 
-               cfd = creat("/tmp/.stop.provider", 0644);
-               if (cfd < 0 || close(cfd) < 0) {
-                       ErrPrint("stop.provider: %s\n", strerror(errno));
-               }
+       cfd = creat("/tmp/.stop.provider", 0644);
+       if (cfd < 0 || close(cfd) < 0) {
+           ErrPrint("stop.provider: %s\n", strerror(errno));
+       }
 
-               vconf_set_bool(VCONFKEY_MASTER_STARTED, 0);
-               //exit(0);
-               ecore_main_loop_quit();
-       } else if (fdsi.ssi_signo == SIGUSR1) {
-               /*!
-                * Turn off auto-reactivation
-                * Terminate all slaves
-                */
+       vconf_set_bool(VCONFKEY_MASTER_STARTED, 0);
+       //exit(0);
+       ecore_main_loop_quit();
+    } else if (fdsi.ssi_signo == SIGUSR1) {
+       /*!
+        * Turn off auto-reactivation
+        * Terminate all slaves
+        */
 #if defined(HAVE_LIVEBOX)
-               CRITICAL_LOG("USRS1, Deactivate ALL\n");
-               slave_deactivate_all(0, 1, 1);
+       CRITICAL_LOG("USRS1, Deactivate ALL\n");
+       slave_deactivate_all(0, 1, 1);
 #endif
-       } else if (fdsi.ssi_signo == SIGUSR2) {
-               /*!
-                * Turn on auto-reactivation
-                * Launch all slaves again
-                */
+    } else if (fdsi.ssi_signo == SIGUSR2) {
+       /*!
+        * Turn on auto-reactivation
+        * Launch all slaves again
+        */
 #if defined(HAVE_LIVEBOX)
-               CRITICAL_LOG("USR2, Activate ALL\n");
-               slave_activate_all();
+       CRITICAL_LOG("USR2, Activate ALL\n");
+       slave_activate_all();
 #endif
-       } else {
-               CRITICAL_LOG("Unknown SIG[%d] received\n", fdsi.ssi_signo);
-       }
+    } else {
+       CRITICAL_LOG("Unknown SIG[%d] received\n", fdsi.ssi_signo);
+    }
 
-       return ECORE_CALLBACK_RENEW;
+    return ECORE_CALLBACK_RENEW;
 }
 
 int main(int argc, char *argv[])
 {
-       int ret;
-       int restart_count = 0;
-       sigset_t mask;
-       Ecore_Fd_Handler *signal_handler = NULL;
-
-#if defined(HAVE_LIVEBOX)
-       conf_init();
-       conf_loader();
-#endif
-
-       /*!
-        * \note
-        * Clear old contents files before start the master provider.
-        */
-       (void)util_unlink_files(ALWAYS_PATH);
-       (void)util_unlink_files(READER_PATH);
-       (void)util_unlink_files(IMAGE_PATH);
-       (void)util_unlink_files(SLAVE_LOG_PATH);
-
-       if (util_free_space(IMAGE_PATH) < MINIMUM_SPACE) {
-               util_remove_emergency_disk();
-               util_prepare_emergency_disk();
-       }
-
-       util_setup_log_disk();
-
-       /*!
-        * How could we care this return values?
-        * Is there any way to print something on the screen?
-        */
-       ret = critical_log_init(util_basename(argv[0]));
-       if (ret < 0) {
-               ErrPrint("Failed to init the critical log\n");
-       }
+    int ret;
+    int restart_count = 0;
+    sigset_t mask;
+    Ecore_Fd_Handler *signal_handler = NULL;
 
 #if defined(FLOG)
-       __file_log_fp = fopen("/tmp/live.log", "w+t");
-       if (!__file_log_fp) {
-               __file_log_fp = fdopen(1, "w+t");
-       }
+    __file_log_fp = fopen(TMP_LOG_FILE, "w+t");
+    if (!__file_log_fp) {
+       __file_log_fp = fdopen(1, "w+t");
+    }
 #endif
-       /* appcore_agent_terminate */
-       if (ecore_init() <= 0) {
-               CRITICAL_LOG("Failed to initiate ecore\n");
-               critical_log_fini();
-               return -EFAULT;
-       }
-
-       sigemptyset(&mask);
-
-       ret = sigaddset(&mask, SIGTERM);
-       if (ret < 0) {
-               CRITICAL_LOG("Failed to do sigemptyset: %s\n", strerror(errno));
-       }
-
-       ret = sigaddset(&mask, SIGUSR1);
-       if (ret < 0) {
-               CRITICAL_LOG("Failed to do sigemptyset: %s\n", strerror(errno));
-       }
-
-       ret = sigaddset(&mask, SIGUSR2);
-       if (ret < 0) {
-               CRITICAL_LOG("Failed to do sigemptyset: %s\n", strerror(errno));
-       }
-
-       ret = sigprocmask(SIG_BLOCK, &mask, NULL);
-       if (ret < 0) {
-               CRITICAL_LOG("Failed to mask the SIGTERM: %s\n", strerror(errno));
-       }
 
-       ret = signalfd(-1, &mask, 0);
-       if (ret < 0) {
-               CRITICAL_LOG("Failed to initiate the signalfd: %s\n", strerror(errno));
-       } else {
-               signal_handler = ecore_main_fd_handler_add(ret, ECORE_FD_READ, signal_cb, NULL, NULL, NULL);
-               CRITICAL_LOG("Signal handler initiated: %d\n", ret);
-       }
-
-       if (util_screen_init() <= 0) {
-               CRITICAL_LOG("Failed to ecore x init\n");
-               ecore_shutdown();
-               critical_log_fini();
-               return -EFAULT;
-       }
+    /* appcore_agent_terminate */
+    if (ecore_init() <= 0) {
+       return -EFAULT;
+    }
 
-       ecore_app_args_set(argc, (const char **)argv);
+    if (util_screen_init() <= 0) {
+       ecore_shutdown();
+       return -EFAULT;
+    }
+
+    dynamicbox_conf_init();
+    dynamicbox_conf_load();
+
+    /*!
+     * How could we care this return values?
+     * Is there any way to print something on the screen?
+     */
+    ret = critical_log_init(util_basename(argv[0]));
+    if (ret < 0) {
+       ErrPrint("Failed to init the critical log\n");
+    }
+
+    /*!
+     * \note
+     * Clear old contents files before start the master provider.
+     */
+    (void)util_unlink_files(DYNAMICBOX_CONF_ALWAYS_PATH);
+    (void)util_unlink_files(DYNAMICBOX_CONF_READER_PATH);
+    (void)util_unlink_files(DYNAMICBOX_CONF_IMAGE_PATH);
+    (void)util_unlink_files(DYNAMICBOX_CONF_LOG_PATH);
+
+    if (util_free_space(DYNAMICBOX_CONF_IMAGE_PATH) < DYNAMICBOX_CONF_MINIMUM_SPACE) {
+       util_remove_emergency_disk();
+       util_prepare_emergency_disk();
+    }
+
+    util_setup_log_disk();
+
+    sigemptyset(&mask);
+
+    ret = sigaddset(&mask, SIGTERM);
+    if (ret < 0) {
+       CRITICAL_LOG("Failed to do sigemptyset: %s\n", strerror(errno));
+    }
+
+    ret = sigaddset(&mask, SIGUSR1);
+    if (ret < 0) {
+       CRITICAL_LOG("Failed to do sigemptyset: %s\n", strerror(errno));
+    }
+
+    ret = sigaddset(&mask, SIGUSR2);
+    if (ret < 0) {
+       CRITICAL_LOG("Failed to do sigemptyset: %s\n", strerror(errno));
+    }
+
+    ret = sigprocmask(SIG_BLOCK, &mask, NULL);
+    if (ret < 0) {
+       CRITICAL_LOG("Failed to mask the SIGTERM: %s\n", strerror(errno));
+    }
+
+    ret = signalfd(-1, &mask, 0);
+    if (ret < 0) {
+       CRITICAL_LOG("Failed to initiate the signalfd: %s\n", strerror(errno));
+    } else {
+       signal_handler = ecore_main_fd_handler_add(ret, ECORE_FD_READ, signal_cb, NULL, NULL, NULL);
+       CRITICAL_LOG("Signal handler initiated: %d\n", ret);
+    }
+
+    ecore_app_args_set(argc, (const char **)argv);
 
 #if (GLIB_MAJOR_VERSION <= 2 && GLIB_MINOR_VERSION < 36)
-       g_type_init();
+    g_type_init();
 #endif
 
-#if defined(HAVE_LIVEBOX)
-       /*!
-        * \note
-        * conf_update_size requires util_screen_init.
-        */
-       conf_update_size();
-#endif
-
-       app_create();
+    app_create();
 
-       sd_notify(0, "READY=1");
+    vconf_get_int(VCONFKEY_MASTER_RESTART_COUNT, &restart_count);
+    restart_count++;
+    vconf_set_int(VCONFKEY_MASTER_RESTART_COUNT, restart_count);
 
-       vconf_get_int(VCONFKEY_MASTER_RESTART_COUNT, &restart_count);
-       restart_count++;
-       vconf_set_int(VCONFKEY_MASTER_RESTART_COUNT, restart_count);
+    vconf_set_bool(VCONFKEY_MASTER_STARTED, 1);
+    ecore_main_loop_begin();
+    vconf_set_bool(VCONFKEY_MASTER_STARTED, 0);
 
-       vconf_set_bool(VCONFKEY_MASTER_STARTED, 1);
-       ecore_main_loop_begin();
-       vconf_set_bool(VCONFKEY_MASTER_STARTED, 0);
+    app_terminate();
 
-       app_terminate();
+    util_screen_fini();
 
-       util_screen_fini();
+    if (signal_handler) {
+       ecore_main_fd_handler_del(signal_handler);
+    }
 
-       if (signal_handler) {
-               ecore_main_fd_handler_del(signal_handler);
-       }
-
-       ecore_shutdown();
-       critical_log_fini();
+    ecore_shutdown();
+    critical_log_fini();
 
 #if defined(FLOG)
-       if (__file_log_fp) {
-               fclose(__file_log_fp);
-       }
+    if (__file_log_fp) {
+       fclose(__file_log_fp);
+    }
 #endif
 
-       conf_reset();
-       return 0;
+    dynamicbox_conf_reset();
+    return 0;
 }
 
 /* End of a file */
index 76a1149..fa0e82b 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <dlog.h>
 #if defined(HAVE_LIVEBOX)
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
 #else
 #include "lite-errno.h"
 #endif
 #include <security-server.h>
 
 #include <vconf.h>
+#include <notification.h>
+#include <notification_internal.h>
 #include <notification_ipc.h>
 #include <notification_noti.h>
-#include <notification_error.h>
 #include <notification_setting_service.h>
 
 #include "service_common.h"
 #endif
 
 static struct info {
-       Eina_List *context_list;
-       struct service_context *svc_ctx;
+    Eina_List *context_list;
+    struct service_context *svc_ctx;
 } s_info = {
-       .context_list = NULL, /*!< \WARN: This is only used for SERVICE THREAD */
-       .svc_ctx = NULL, /*!< \WARN: This is only used for MAIN THREAD */
+    .context_list = NULL, /*!< \WARN: This is only used for SERVICE THREAD */
+    .svc_ctx = NULL, /*!< \WARN: This is only used for MAIN THREAD */
 };
 
 struct context {
-       struct tcb *tcb;
-       double seq;
+    struct tcb *tcb;
+    double seq;
 };
 
 struct noti_service {
-       const char *cmd;
-       void (*handler)(struct tcb *tcb, struct packet *packet, void *data);
-       const char *rule;
-       const char *access;
-       void (*handler_access_error)(struct tcb *tcb, struct packet *packet);
+    const char *cmd;
+    void (*handler)(struct tcb *tcb, struct packet *packet, void *data);
+    const char *rule;
+    const char *access;
+    void (*handler_access_error)(struct tcb *tcb, struct packet *packet);
 };
 
 static inline char *_string_get(char *string)
 {
-       if (string == NULL) {
-               return NULL;
-       }
-       if (string[0] == '\0') {
-               return NULL;
-       }
-
-       return string;
+    if (string == NULL) {
+       return NULL;
+    }
+    if (string[0] == '\0') {
+       return NULL;
+    }
+
+    return string;
 }
 
 /*!
  * FUNCTIONS to create packets
  */
 static inline int _priv_id_get_from_list(int num_data, int *list, int index) {
-       if (index < num_data) {
-               return *(list + index);
-       } else {
-               return -1;
-       }
+    if (index < num_data) {
+       return *(list + index);
+    } else {
+       return -1;
+    }
 }
 
 static inline struct packet *_packet_create_with_list(int op_num, int *list, int start_index) {
-       return packet_create(
-               "del_noti_multiple",
-               "iiiiiiiiiii",
-               ((op_num - start_index) > NOTIFICATION_DEL_PACKET_UNIT) ? NOTIFICATION_DEL_PACKET_UNIT : op_num - start_index,
-               _priv_id_get_from_list(op_num, list, start_index),
-               _priv_id_get_from_list(op_num, list, start_index + 1),
-               _priv_id_get_from_list(op_num, list, start_index + 2),
-               _priv_id_get_from_list(op_num, list, start_index + 3),
-               _priv_id_get_from_list(op_num, list, start_index + 4),
-               _priv_id_get_from_list(op_num, list, start_index + 5),
-               _priv_id_get_from_list(op_num, list, start_index + 6),
-               _priv_id_get_from_list(op_num, list, start_index + 7),
-               _priv_id_get_from_list(op_num, list, start_index + 8),
-               _priv_id_get_from_list(op_num, list, start_index + 9)
-               );
+    return packet_create(
+           "del_noti_multiple",
+           "iiiiiiiiiii",
+           ((op_num - start_index) > NOTIFICATION_DEL_PACKET_UNIT) ? NOTIFICATION_DEL_PACKET_UNIT : op_num - start_index,
+           _priv_id_get_from_list(op_num, list, start_index),
+           _priv_id_get_from_list(op_num, list, start_index + 1),
+           _priv_id_get_from_list(op_num, list, start_index + 2),
+           _priv_id_get_from_list(op_num, list, start_index + 3),
+           _priv_id_get_from_list(op_num, list, start_index + 4),
+           _priv_id_get_from_list(op_num, list, start_index + 5),
+           _priv_id_get_from_list(op_num, list, start_index + 6),
+           _priv_id_get_from_list(op_num, list, start_index + 7),
+           _priv_id_get_from_list(op_num, list, start_index + 8),
+           _priv_id_get_from_list(op_num, list, start_index + 9)
+           );
 }
 
 /*!
  * SERVICE HANDLER
  */
-static void _handler_insert(struct tcb *tcb, struct packet *packet, void *data)
+static void _handler_insert_noti(struct tcb *tcb, struct packet *packet, notification_h noti, void *data)
 {
-       int ret = 0, ret_p = 0;
-       int priv_id = 0;
-       struct packet *packet_reply = NULL;
-       struct packet *packet_service = NULL;
-       notification_h noti = NULL;
-
-       noti = notification_create(NOTIFICATION_TYPE_NOTI);
-       if (noti != NULL) {
-               if (notification_ipc_make_noti_from_packet(noti, packet) == NOTIFICATION_ERROR_NONE) {
-                       ret = notification_noti_insert(noti);
-                       notification_get_id(noti, NULL, &priv_id);
-                       DbgPrint("priv_id: [%d]\n", priv_id);
-                       packet_reply = packet_create_reply(packet, "ii", ret, priv_id);
-                       if (packet_reply) {
-                               if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
-                                       ErrPrint("failed to send reply packet: %d\n", ret_p);
-                               }
-                               packet_destroy(packet_reply);
-                       } else {
-                               ErrPrint("failed to create a reply packet\n");
-                       }
-
-                       if (ret != NOTIFICATION_ERROR_NONE) {
-                               ErrPrint("failed to insert a notification: %d\n", ret);
-                               notification_free(noti);
-                               return ;
-                       }
+    int ret = 0, ret_p = 0;
+    int priv_id = 0;
+    struct packet *packet_reply = NULL;
+    struct packet *packet_service = NULL;
+
+    ret = notification_noti_insert(noti);
+    notification_get_id(noti, NULL, &priv_id);
+    DbgPrint("priv_id: [%d]\n", priv_id);
+    packet_reply = packet_create_reply(packet, "ii", ret, priv_id);
+    if (packet_reply) {
+       if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
+           ErrPrint("failed to send reply packet: %d\n", ret_p);
+       }
+       packet_destroy(packet_reply);
+    } else {
+       ErrPrint("failed to create a reply packet\n");
+    }
+
+    if (ret != NOTIFICATION_ERROR_NONE) {
+       ErrPrint("failed to insert a notification: %d\n", ret);
+       return ;
+    }
+
+    packet_service = notification_ipc_make_packet_from_noti(noti, "add_noti", 2);
+    if (packet_service != NULL) {
+       if ((ret_p = service_common_multicast_packet(tcb, packet_service, TCB_CLIENT_TYPE_SERVICE)) < 0) {
+           ErrPrint("failed to send a multicast packet: %d\n", ret_p);
+       }
+       packet_destroy(packet_service);
+    } else {
+       ErrPrint("failed to create a multicats packet\n");
+    }
+}
 
-                       packet_service = notification_ipc_make_packet_from_noti(noti, "add_noti", 2);
-                       if (packet_service != NULL) {
-                               if ((ret_p = service_common_multicast_packet(tcb, packet_service, TCB_CLIENT_TYPE_SERVICE)) < 0) {
-                                       ErrPrint("failed to send a multicast packet: %d\n", ret_p);
-                               }
-                               packet_destroy(packet_service);
-                       } else {
-                               ErrPrint("failed to create a multicats packet\n");
-                       }
-               } else {
-                       ErrPrint("Failed to create the packet");
-               }
-               notification_free(noti);
+/*static void _handler_insert(struct tcb *tcb, struct packet *packet, void *data) // not used
+  {
+  notification_h noti = NULL;
+
+  noti = notification_create(NOTIFICATION_TYPE_NOTI);
+  if (noti != NULL) {
+  if (notification_ipc_make_noti_from_packet(noti, packet) == NOTIFICATION_ERROR_NONE) {
+  _handler_insert_noti(tcb, packet, noti, data);
+  } else {
+  ErrPrint("Failed to create the packet");
+  }
+  notification_free(noti);
+  }
+  }*/
+
+static void _handler_update_noti(struct tcb *tcb, struct packet *packet, notification_h noti, void *data)
+{
+    int ret = 0, ret_p = 0;
+    int priv_id = 0;
+    struct packet *packet_reply = NULL;
+    struct packet *packet_service = NULL;
+
+    ret = notification_noti_update(noti);
+
+    notification_get_id(noti, NULL, &priv_id);
+    DbgPrint("priv_id: [%d]\n", priv_id);
+    packet_reply = packet_create_reply(packet, "ii", ret, priv_id);
+    if (packet_reply) {
+       if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
+           ErrPrint("failed to send reply packet:%d\n", ret_p);
        }
+       packet_destroy(packet_reply);
+    } else {
+       ErrPrint("failed to create a reply packet\n");
+    }
+
+    if (ret != NOTIFICATION_ERROR_NONE) {
+       ErrPrint("failed to update a notification:%d\n", ret);
+       return ;
+    }
+
+    packet_service = notification_ipc_make_packet_from_noti(noti, "update_noti", 2);
+    if (packet_service != NULL) {
+       if ((ret_p = service_common_multicast_packet(tcb, packet_service, TCB_CLIENT_TYPE_SERVICE)) < 0) {
+           ErrPrint("failed to send a multicast packet: %d\n", ret_p);
+       }
+       packet_destroy(packet_service);
+    }
 }
 
 static void _handler_update(struct tcb *tcb, struct packet *packet, void *data)
 {
-       int ret = 0, ret_p = 0;
-       int priv_id = 0;
-       struct packet *packet_reply = NULL;
-       struct packet *packet_service = NULL;
-       notification_h noti = NULL;
-
-       noti = notification_create(NOTIFICATION_TYPE_NOTI);
-       if (noti != NULL) {
-               if (notification_ipc_make_noti_from_packet(noti, packet) == NOTIFICATION_ERROR_NONE) {
-                       ret = notification_noti_update(noti);
-
-                       notification_get_id(noti, NULL, &priv_id);
-                       DbgPrint("priv_id: [%d]\n", priv_id);
-                       packet_reply = packet_create_reply(packet, "ii", ret, priv_id);
-                       if (packet_reply) {
-                               if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
-                                       ErrPrint("failed to send reply packet:%d\n", ret_p);
-                               }
-                               packet_destroy(packet_reply);
-                       } else {
-                               ErrPrint("failed to create a reply packet\n");
-                       }
+    notification_h noti = NULL;
 
-                       if (ret != NOTIFICATION_ERROR_NONE) {
-                               ErrPrint("failed to update a notification:%d\n", ret);
-                               notification_free(noti);
-                               return ;
-                       }
-
-                       packet_service = notification_ipc_make_packet_from_noti(noti, "update_noti", 2);
-                       if (packet_service != NULL) {
-                               if ((ret_p = service_common_multicast_packet(tcb, packet_service, TCB_CLIENT_TYPE_SERVICE)) < 0) {
-                                       ErrPrint("failed to send a multicast packet: %d\n", ret_p);
-                               }
-                               packet_destroy(packet_service);
-                       }
-               } else {
-                       ErrPrint("Failed to create the packet");
-               }
-               notification_free(noti);
+    noti = notification_create(NOTIFICATION_TYPE_NOTI);
+    if (noti != NULL) {
+       if (notification_ipc_make_noti_from_packet(noti, packet) == NOTIFICATION_ERROR_NONE) {
+           _handler_update_noti(tcb, packet, noti, data);
+       } else {
+           ErrPrint("Failed to create the packet");
        }
+       notification_free(noti);
+    }
 }
 
-static void _handler_refresh(struct tcb *tcb, struct packet *packet, void *data)
+static void _handler_check_noti_by_tag(struct tcb *tcb, struct packet *packet, void *data)
 {
-       int ret = 0;
-       struct packet *packet_reply = NULL;
+    int ret = 0;
+    notification_h noti = NULL;
+
+    noti = notification_create(NOTIFICATION_TYPE_NOTI);
+    if (noti != NULL) {
+       if (notification_ipc_make_noti_from_packet(noti, packet) == NOTIFICATION_ERROR_NONE) {
+           ret = notification_noti_check_tag(noti);
+           if (ret == NOTIFICATION_ERROR_NOT_EXIST_ID) {
+               _handler_insert_noti(tcb, packet, noti, data);
+           } else if (ret == NOTIFICATION_ERROR_ALREADY_EXIST_ID) {
+               _handler_update_noti(tcb, packet, noti, data);
+           }
+       }
+       notification_free(noti);
+    }
+}
 
-       packet_reply = packet_create_reply(packet, "i", ret);
-       if (packet_reply) {
-               if ((ret = service_common_unicast_packet(tcb, packet_reply)) < 0) {
-                       ErrPrint("failed to send reply packet:%d\n", ret);
+static void _handler_load_noti_by_tag(struct tcb *tcb, struct packet *packet, void *data)
+{
+    int ret = 0, ret_p = 0;
+    char* tag;
+    char* pkgname;
+    struct packet *packet_reply = NULL;
+    notification_h noti = NULL;
+
+    noti = notification_create(NOTIFICATION_TYPE_NOTI);
+    if (noti != NULL) {
+       if (packet_get(packet, "ss", &pkgname, &tag) == 2) {
+           ret = notification_noti_get_by_tag(noti, pkgname, tag);
+           packet_reply = notification_ipc_make_reply_packet_from_noti(noti, packet);
+           if (packet_reply) {
+               if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
+                   ErrPrint("failed to send reply packet: %d\n", ret_p);
                }
                packet_destroy(packet_reply);
-       } else {
+           } else {
                ErrPrint("failed to create a reply packet\n");
+           }
+
+           if (ret != NOTIFICATION_ERROR_NONE) {
+               ErrPrint("failed to load_noti_by_tag : %d\n", ret);
+               notification_free(noti);
+               return ;
+           }
+       } else {
+           ErrPrint("Failed to create the packet");
        }
+       notification_free(noti);
+    }
+}
 
-       if ((ret = service_common_multicast_packet(tcb, packet, TCB_CLIENT_TYPE_SERVICE)) < 0) {
-               ErrPrint("failed to send a multicast packet:%d\n", ret);
+
+static void _handler_refresh(struct tcb *tcb, struct packet *packet, void *data)
+{
+    int ret = 0;
+    struct packet *packet_reply = NULL;
+
+    packet_reply = packet_create_reply(packet, "i", ret);
+    if (packet_reply) {
+       if ((ret = service_common_unicast_packet(tcb, packet_reply)) < 0) {
+           ErrPrint("failed to send reply packet:%d\n", ret);
        }
+       packet_destroy(packet_reply);
+    } else {
+       ErrPrint("failed to create a reply packet\n");
+    }
+
+    if ((ret = service_common_multicast_packet(tcb, packet, TCB_CLIENT_TYPE_SERVICE)) < 0) {
+       ErrPrint("failed to send a multicast packet:%d\n", ret);
+    }
 }
 
 static void _handler_delete_single(struct tcb *tcb, struct packet *packet, void *data)
 {
-       int num_changes = 0;
-       int ret = 0, ret_p = 0;
-       int priv_id = 0;
-       struct packet *packet_reply = NULL;
-       struct packet *packet_service = NULL;
-       char *pkgname = NULL;
-
-       if (packet_get(packet, "si", &pkgname, &priv_id) == 2) {
-               pkgname = _string_get(pkgname);
-
-               ret = notification_noti_delete_by_priv_id_get_changes(pkgname, priv_id, &num_changes);
-
-               DbgPrint("priv_id: [%d] num_delete:%d\n", priv_id, num_changes);
-               packet_reply = packet_create_reply(packet, "ii", ret, priv_id);
-               if (packet_reply) {
-                       if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
-                               ErrPrint("failed to send reply packet:%d\n", ret_p);
-                       }
-                       packet_destroy(packet_reply);
-               } else {
-                       ErrPrint("failed to create a reply packet\n");
-               }
+    int num_changes = 0;
+    int ret = 0, ret_p = 0;
+    int priv_id = 0;
+    struct packet *packet_reply = NULL;
+    struct packet *packet_service = NULL;
+    char *pkgname = NULL;
 
-               if (ret != NOTIFICATION_ERROR_NONE || num_changes <= 0) {
-                       ErrPrint("failed to delete a notification:%d %d\n", ret, num_changes);
-                       return ;
-               }
+    if (packet_get(packet, "si", &pkgname, &priv_id) == 2) {
+       pkgname = _string_get(pkgname);
 
-               packet_service = packet_create("del_noti_single", "ii", 1, priv_id);
-               if (packet_service != NULL) {
-                       if ((ret_p = service_common_multicast_packet(tcb, packet_service, TCB_CLIENT_TYPE_SERVICE)) < 0) {
-                               ErrPrint("failed to send a multicast packet: %d\n", ret_p);
-                       }
-                       packet_destroy(packet_service);
-               }
+       ret = notification_noti_delete_by_priv_id_get_changes(pkgname, priv_id, &num_changes);
+
+       DbgPrint("priv_id: [%d] num_delete:%d\n", priv_id, num_changes);
+       packet_reply = packet_create_reply(packet, "ii", ret, priv_id);
+       if (packet_reply) {
+           if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
+               ErrPrint("failed to send reply packet:%d\n", ret_p);
+           }
+           packet_destroy(packet_reply);
        } else {
-               ErrPrint("Failed to get data from the packet");
+           ErrPrint("failed to create a reply packet\n");
+       }
+
+       if (ret != NOTIFICATION_ERROR_NONE || num_changes <= 0) {
+           ErrPrint("failed to delete a notification:%d %d\n", ret, num_changes);
+           return ;
+       }
+
+       packet_service = packet_create("del_noti_single", "ii", 1, priv_id);
+       if (packet_service != NULL) {
+           if ((ret_p = service_common_multicast_packet(tcb, packet_service, TCB_CLIENT_TYPE_SERVICE)) < 0) {
+               ErrPrint("failed to send a multicast packet: %d\n", ret_p);
+           }
+           packet_destroy(packet_service);
        }
+    } else {
+       ErrPrint("Failed to get data from the packet");
+    }
 }
 
 static void _handler_delete_multiple(struct tcb *tcb, struct packet *packet, void *data)
 {
-       int ret = 0, ret_p = 0;
-       struct packet *packet_reply = NULL;
-       struct packet *packet_service = NULL;
-       char *pkgname = NULL;
-       notification_type_e type = 0;
-       int num_deleted = 0;
-       int *list_deleted = NULL;
-
-       if (packet_get(packet, "si", &pkgname, &type) == 2) {
-               pkgname = _string_get(pkgname);
-               DbgPrint("pkgname: [%s] type: [%d]\n", pkgname, type);
-
-               ret = notification_noti_delete_all(type, pkgname, &num_deleted, &list_deleted);
-               DbgPrint("ret: [%d] num_deleted: [%d]\n", ret, num_deleted);
-
-               packet_reply = packet_create_reply(packet, "ii", ret, num_deleted);
-               if (packet_reply) {
-                       if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
-                               ErrPrint("failed to send reply packet:%d\n", ret_p);
-                       }
-                       packet_destroy(packet_reply);
+    int ret = 0, ret_p = 0;
+    struct packet *packet_reply = NULL;
+    struct packet *packet_service = NULL;
+    char *pkgname = NULL;
+    notification_type_e type = 0;
+    int num_deleted = 0;
+    int *list_deleted = NULL;
+
+    if (packet_get(packet, "si", &pkgname, &type) == 2) {
+       pkgname = _string_get(pkgname);
+       DbgPrint("pkgname: [%s] type: [%d]\n", pkgname, type);
+
+       ret = notification_noti_delete_all(type, pkgname, &num_deleted, &list_deleted);
+       DbgPrint("ret: [%d] num_deleted: [%d]\n", ret, num_deleted);
+
+       packet_reply = packet_create_reply(packet, "ii", ret, num_deleted);
+       if (packet_reply) {
+           if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
+               ErrPrint("failed to send reply packet:%d\n", ret_p);
+           }
+           packet_destroy(packet_reply);
+       } else {
+           ErrPrint("failed to create a reply packet\n");
+       }
+
+       if (ret != NOTIFICATION_ERROR_NONE) {
+           ErrPrint("failed to delete notifications:%d\n", ret);
+           if (list_deleted != NULL) {
+               DbgFree(list_deleted);
+           }
+           return ;
+       }
+
+       if (num_deleted > 0) {
+           if (num_deleted <= NOTIFICATION_DEL_PACKET_UNIT) {
+               packet_service = _packet_create_with_list(num_deleted, list_deleted, 0);
+
+               if (packet_service) {
+                   if ((ret_p = service_common_multicast_packet(tcb, packet_service, TCB_CLIENT_TYPE_SERVICE)) < 0) {
+                       ErrPrint("failed to send a multicast packet: %d\n", ret_p);
+                   }
+                   packet_destroy(packet_service);
                } else {
-                       ErrPrint("failed to create a reply packet\n");
+                   ErrPrint("failed to create a multicast packet\n");
                }
+           } else {
+               int set = 0;
+               int set_total = num_deleted / NOTIFICATION_DEL_PACKET_UNIT;
 
-               if (ret != NOTIFICATION_ERROR_NONE) {
-                       ErrPrint("failed to delete notifications:%d\n", ret);
-                       if (list_deleted != NULL) {
-                               DbgFree(list_deleted);
-                       }
-                       return ;
-               }
+               for (set = 0; set <= set_total; set++) {
+                   packet_service = _packet_create_with_list(num_deleted,
+                           list_deleted, set * NOTIFICATION_DEL_PACKET_UNIT);
 
-               if (num_deleted > 0) {
-                       if (num_deleted <= NOTIFICATION_DEL_PACKET_UNIT) {
-                               packet_service = _packet_create_with_list(num_deleted, list_deleted, 0);
-
-                               if (packet_service) {
-                                       if ((ret_p = service_common_multicast_packet(tcb, packet_service, TCB_CLIENT_TYPE_SERVICE)) < 0) {
-                                               ErrPrint("failed to send a multicast packet: %d\n", ret_p);
-                                       }
-                                       packet_destroy(packet_service);
-                               } else {
-                                       ErrPrint("failed to create a multicast packet\n");
-                               }
-                       } else {
-                               int set = 0;
-                               int set_total = num_deleted / NOTIFICATION_DEL_PACKET_UNIT;
-
-                               for (set = 0; set <= set_total; set++) {
-                                       packet_service = _packet_create_with_list(num_deleted,
-                                                       list_deleted, set * NOTIFICATION_DEL_PACKET_UNIT);
-
-                                       if (packet_service) {
-                                               if ((ret_p = service_common_multicast_packet(tcb, packet_service, TCB_CLIENT_TYPE_SERVICE)) < 0) {
-                                                       ErrPrint("failed to send a multicast packet:%d\n", ret_p);
-                                               }
-                                               packet_destroy(packet_service);
-                                       } else {
-                                               ErrPrint("failed to create a multicast packet\n");
-                                       }
-                               }
+                   if (packet_service) {
+                       if ((ret_p = service_common_multicast_packet(tcb, packet_service, TCB_CLIENT_TYPE_SERVICE)) < 0) {
+                           ErrPrint("failed to send a multicast packet:%d\n", ret_p);
                        }
+                       packet_destroy(packet_service);
+                   } else {
+                       ErrPrint("failed to create a multicast packet\n");
+                   }
                }
+           }
+       }
 
-               if (list_deleted != NULL) {
-                       DbgFree(list_deleted);
-                       list_deleted = NULL;
-               }
-       } else {
-               ErrPrint("Failed to get data from the packet");
+       if (list_deleted != NULL) {
+           DbgFree(list_deleted);
+           list_deleted = NULL;
        }
+    } else {
+       ErrPrint("Failed to get data from the packet");
+    }
 }
 
 static void _handler_noti_property_set(struct tcb *tcb, struct packet *packet, void *data)
 {
-       int ret = 0, ret_p = 0;
-       struct packet *packet_reply = NULL;
-       char *pkgname = NULL;
-       char *property = NULL;
-       char *value = NULL;
-
-       if (packet_get(packet, "sss", &pkgname, &property, &value) == 3) {
-               pkgname = _string_get(pkgname);
-               property = _string_get(property);
-               value = _string_get(value);
-
-               ret = notification_setting_db_set(pkgname, property, value);
-
-               packet_reply = packet_create_reply(packet, "ii", ret, ret);
-               if (packet_reply) {
-                       if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
-                               ErrPrint("failed to send reply packet:%d\n", ret_p);
-                       }
-                       packet_destroy(packet_reply);
-               } else {
-                       ErrPrint("failed to create a reply packet\n");
-               }
+    int ret = 0, ret_p = 0;
+    struct packet *packet_reply = NULL;
+    char *pkgname = NULL;
+    char *property = NULL;
+    char *value = NULL;
 
-               if (ret != NOTIFICATION_ERROR_NONE) {
-                       ErrPrint("failed to set noti property:%d\n", ret);
-               }
+    if (packet_get(packet, "sss", &pkgname, &property, &value) == 3) {
+       pkgname = _string_get(pkgname);
+       property = _string_get(property);
+       value = _string_get(value);
+
+       ret = notification_setting_db_set(pkgname, property, value);
+
+       packet_reply = packet_create_reply(packet, "ii", ret, ret);
+       if (packet_reply) {
+           if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
+               ErrPrint("failed to send reply packet:%d\n", ret_p);
+           }
+           packet_destroy(packet_reply);
        } else {
-               ErrPrint("Failed to get data from the packet");
+           ErrPrint("failed to create a reply packet\n");
        }
+
+       if (ret != NOTIFICATION_ERROR_NONE) {
+           ErrPrint("failed to set noti property:%d\n", ret);
+       }
+    } else {
+       ErrPrint("Failed to get data from the packet");
+    }
 }
 
 static void _handler_noti_property_get(struct tcb *tcb, struct packet *packet, void *data)
 {
-       int ret = 0, ret_p = 0;
-       struct packet *packet_reply = NULL;
-       char *pkgname = NULL;
-       char *property = NULL;
-       char *value = NULL;
-
-       if (packet_get(packet, "sss", &pkgname, &property) == 2) {
-               pkgname = _string_get(pkgname);
-               property = _string_get(property);
-
-               ret = notification_setting_db_get(pkgname, property, &value);
-
-               packet_reply = packet_create_reply(packet, "is", ret, value);
-               if (packet_reply) {
-                       if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
-                               ErrPrint("failed to send reply packet:%d\n", ret_p);
-                       }
-                       packet_destroy(packet_reply);
-               } else {
-                       ErrPrint("failed to create a reply packet\n");
-               }
+    int ret = 0, ret_p = 0;
+    struct packet *packet_reply = NULL;
+    char *pkgname = NULL;
+    char *property = NULL;
+    char *value = NULL;
 
-               if (value != NULL) {
-                       DbgFree(value);
-               }
+    if (packet_get(packet, "sss", &pkgname, &property) == 2) {
+       pkgname = _string_get(pkgname);
+       property = _string_get(property);
+
+       ret = notification_setting_db_get(pkgname, property, &value);
+
+       packet_reply = packet_create_reply(packet, "is", ret, value);
+       if (packet_reply) {
+           if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
+               ErrPrint("failed to send reply packet:%d\n", ret_p);
+           }
+           packet_destroy(packet_reply);
+       } else {
+           ErrPrint("failed to create a reply packet\n");
        }
+
+       if (value != NULL) {
+           DbgFree(value);
+       }
+    }
 }
 
 static void _handler_service_register(struct tcb *tcb, struct packet *packet, void *data)
 {
-       int ret = 0;
-       struct packet *packet_reply;
+    int ret = 0;
+    struct packet *packet_reply;
 
-       ret = tcb_client_type_set(tcb, TCB_CLIENT_TYPE_SERVICE);
+    ret = tcb_client_type_set(tcb, TCB_CLIENT_TYPE_SERVICE);
 
-       packet_reply = packet_create_reply(packet, "i", ret);
-       if (packet_reply) {
-               if ((ret = service_common_unicast_packet(tcb, packet_reply)) < 0) {
-                       ErrPrint("failed to send reply packet:%d\n", ret);
-               }
-               packet_destroy(packet_reply);
-       } else {
-               ErrPrint("failed to create a reply packet\n");
+    packet_reply = packet_create_reply(packet, "i", ret);
+    if (packet_reply) {
+       if ((ret = service_common_unicast_packet(tcb, packet_reply)) < 0) {
+           ErrPrint("failed to send reply packet:%d\n", ret);
        }
+       packet_destroy(packet_reply);
+    } else {
+       ErrPrint("failed to create a reply packet\n");
+    }
+}
+
+static void _handler_post_toast_message(struct tcb *tcb, struct packet *packet, void *data)
+{
+    int ret = 0;
+    struct packet *packet_reply = NULL;
+
+    packet_reply = packet_create_reply(packet, "i", ret);
+    if (packet_reply) {
+       if ((ret = service_common_unicast_packet(tcb, packet_reply)) < 0) {
+           ErrPrint("failed to send reply packet:%d\n", ret);
+       }
+       packet_destroy(packet_reply);
+    } else {
+       ErrPrint("failed to create a reply packet\n");
+    }
+
+    if ((ret = service_common_multicast_packet(tcb, packet, TCB_CLIENT_TYPE_SERVICE)) < 0) {
+       ErrPrint("failed to send a multicast packet:%d\n", ret);
+    }
+
 }
 
 /*!
@@ -423,65 +509,65 @@ static void _handler_service_register(struct tcb *tcb, struct packet *packet, vo
  */
 static void _permission_check_common(struct tcb *tcb, struct packet *packet)
 {
-       int ret_p = 0;
-       struct packet *packet_reply = NULL;
+    int ret_p = 0;
+    struct packet *packet_reply = NULL;
 
-       packet_reply = packet_create_reply(packet, "ii", NOTIFICATION_ERROR_PERMISSION_DENIED, 0);
-       if (packet_reply) {
-               if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
-                       ErrPrint("Failed to send a reply packet:%d", ret_p);
-               }
-               packet_destroy(packet_reply);
-       } else {
-               ErrPrint("Failed to create a reply packet");
+    packet_reply = packet_create_reply(packet, "ii", NOTIFICATION_ERROR_PERMISSION_DENIED, 0);
+    if (packet_reply) {
+       if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
+           ErrPrint("Failed to send a reply packet:%d", ret_p);
        }
+       packet_destroy(packet_reply);
+    } else {
+       ErrPrint("Failed to create a reply packet");
+    }
 }
 
 static void _permission_check_refresh(struct tcb *tcb, struct packet *packet)
 {
-       int ret_p = 0;
-       struct packet *packet_reply = NULL;
+    int ret_p = 0;
+    struct packet *packet_reply = NULL;
 
-       packet_reply = packet_create_reply(packet, "i", NOTIFICATION_ERROR_PERMISSION_DENIED);
-       if (packet_reply) {
-               if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
-                       ErrPrint("Failed to send a reply packet:%d", ret_p);
-               }
-               packet_destroy(packet_reply);
-       } else {
-               ErrPrint("Failed to create a reply packet");
+    packet_reply = packet_create_reply(packet, "i", NOTIFICATION_ERROR_PERMISSION_DENIED);
+    if (packet_reply) {
+       if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
+           ErrPrint("Failed to send a reply packet:%d", ret_p);
        }
+       packet_destroy(packet_reply);
+    } else {
+       ErrPrint("Failed to create a reply packet");
+    }
 }
 
 static void _permission_check_property_get(struct tcb *tcb, struct packet *packet)
 {
-       int ret_p = 0;
-       struct packet *packet_reply = NULL;
+    int ret_p = 0;
+    struct packet *packet_reply = NULL;
 
-       packet_reply = packet_create_reply(packet, "is", NOTIFICATION_ERROR_PERMISSION_DENIED, NULL);
-       if (packet_reply) {
-               if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
-                       ErrPrint("Failed to send a reply packet:%d", ret_p);
-               }
-               packet_destroy(packet_reply);
-       } else {
-               ErrPrint("Failed to create a reply packet");
+    packet_reply = packet_create_reply(packet, "is", NOTIFICATION_ERROR_PERMISSION_DENIED, NULL);
+    if (packet_reply) {
+       if ((ret_p = service_common_unicast_packet(tcb, packet_reply)) < 0) {
+           ErrPrint("Failed to send a reply packet:%d", ret_p);
        }
+       packet_destroy(packet_reply);
+    } else {
+       ErrPrint("Failed to create a reply packet");
+    }
 }
 
 static int _persmission_check(int fd, struct noti_service *service)
 {
-       int ret;
+    int ret;
 
-       if (service->rule != NULL && service->access != NULL) {
-               ret = security_server_check_privilege_by_sockfd(fd, service->rule, service->access);
-               if (ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) {
-                       ErrPrint("SMACK:Access denied\n");
-                       return 0;
-               }
+    if (service->rule != NULL && service->access != NULL) {
+       ret = security_server_check_privilege_by_sockfd(fd, service->rule, service->access);
+       if (ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) {
+           ErrPrint("SMACK:Access denied\n");
+           return 0;
        }
+    }
 
-       return 1;
+    return 1;
 }
 
 /*!
@@ -489,46 +575,46 @@ static int _persmission_check(int fd, struct noti_service *service)
  */
 static void _notification_data_init(void)
 {
-       int property = 0;
-       int priv_id = 0;
-       char *noti_pkgname = NULL;
-       notification_h noti = NULL;
-       notification_list_h noti_list = NULL;
-       notification_list_h noti_list_head = NULL;
-       notification_type_e noti_type = NOTIFICATION_TYPE_NONE;
-
-       notification_get_list(NOTIFICATION_TYPE_NONE, -1, &noti_list);
-       noti_list_head = noti_list;
-
-       while (noti_list != NULL) {
-               noti = notification_list_get_data(noti_list);
-               if (noti) {
-                       notification_get_id(noti, NULL, &priv_id);
-                       notification_get_pkgname(noti, &noti_pkgname);
-                       notification_get_property(noti, &property);
-                       notification_get_type(noti, &noti_type);
-
-                       if (noti_type == NOTIFICATION_TYPE_ONGOING
-                                       || property & NOTIFICATION_PROP_VOLATILE_DISPLAY) {
-                               notification_noti_delete_by_priv_id(noti_pkgname, priv_id);
-                       }
-               }
-               noti_list = notification_list_get_next(noti_list);
+    int property = 0;
+    int priv_id = 0;
+    char *noti_pkgname = NULL;
+    notification_h noti = NULL;
+    notification_list_h noti_list = NULL;
+    notification_list_h noti_list_head = NULL;
+    notification_type_e noti_type = NOTIFICATION_TYPE_NONE;
+
+    notification_get_list(NOTIFICATION_TYPE_NONE, -1, &noti_list);
+    noti_list_head = noti_list;
+
+    while (noti_list != NULL) {
+       noti = notification_list_get_data(noti_list);
+       if (noti) {
+           notification_get_id(noti, NULL, &priv_id);
+           notification_get_pkgname(noti, &noti_pkgname);
+           notification_get_property(noti, &property);
+           notification_get_type(noti, &noti_type);
+
+           if (noti_type == NOTIFICATION_TYPE_ONGOING
+                   || property & NOTIFICATION_PROP_VOLATILE_DISPLAY) {
+               notification_noti_delete_by_priv_id(noti_pkgname, priv_id);
+           }
        }
+       noti_list = notification_list_get_next(noti_list);
+    }
 
-       if (noti_list_head != NULL) {
-               notification_free_list(noti_list_head);
-       }
+    if (noti_list_head != NULL) {
+       notification_free_list(noti_list_head);
+    }
 }
 
 static void _notification_init(void) {
-       int ret = -1;
-       int restart_count = 0;
+    int ret = -1;
+    int restart_count = 0;
 
-       ret = vconf_get_int(VCONFKEY_MASTER_RESTART_COUNT, &restart_count);
-       if (ret == 0 && restart_count <= 1) {
-               _notification_data_init();
-       }
+    ret = vconf_get_int(VCONFKEY_MASTER_RESTART_COUNT, &restart_count);
+    if (ret == 0 && restart_count <= 1) {
+       _notification_data_init();
+    }
 }
 
 /*!
@@ -536,120 +622,135 @@ static void _notification_init(void) {
  */
 static int service_thread_main(struct tcb *tcb, struct packet *packet, void *data)
 {
-       int i = 0;
-       const char *command;
-       static struct noti_service service_req_table[] = {
-               {
-                       .cmd = "add_noti",
-                       .handler = _handler_insert,
-                       .rule = "data-provider-master::notification.client",
-                       .access = "w",
-                       .handler_access_error = _permission_check_common,
-               },
-               {
-                       .cmd = "update_noti",
-                       .handler = _handler_update,
-                       .rule = "data-provider-master::notification.client",
-                       .access = "w",
-                       .handler_access_error = _permission_check_common,
-               },
-               {
-                       .cmd = "refresh_noti",
-                       .handler = _handler_refresh,
-                       .rule = "data-provider-master::notification.client",
-                       .access = "w",
-                       .handler_access_error = _permission_check_refresh,
-               },
-               {
-                       .cmd = "del_noti_single",
-                       .handler = _handler_delete_single,
-                       .rule = "data-provider-master::notification.client",
-                       .access = "w",
-                       .handler_access_error = _permission_check_common,
-               },
-               {
-                       .cmd = "del_noti_multiple",
-                       .handler = _handler_delete_multiple,
-                       .rule = "data-provider-master::notification.client",
-                       .access = "w",
-                       .handler_access_error = _permission_check_common,
-               },
-               {
-                       .cmd = "set_noti_property",
-                       .handler = _handler_noti_property_set,
-                       .rule = "data-provider-master::notification.client",
-                       .access = "w",
-                       .handler_access_error = _permission_check_common,
-               },
-               {
-                       .cmd = "get_noti_property",
-                       .handler = _handler_noti_property_get,
-                       .rule = "data-provider-master::notification.client",
-                       .access = "r",
-                       .handler_access_error = _permission_check_property_get,
-               },
-               {
-                       .cmd = "service_register",
-                       .handler = _handler_service_register,
-                       .rule = NULL,
-                       .access = NULL,
-                       .handler_access_error = NULL,
-               },
-               {
-                       .cmd = NULL,
-                       .handler = NULL,
-                       .rule = NULL,
-                       .access = NULL,
-                       .handler_access_error = NULL,
-               },
-       };
-
-       if (!packet) {
-               DbgPrint("TCB: %p is terminated\n", tcb);
-               return 0;
-       }
+    int i = 0;
+    const char *command;
+
+    static struct noti_service service_req_table[] = {
+       {
+           .cmd = "add_noti",
+           .handler = _handler_check_noti_by_tag,
+           .rule = "data-provider-master::notification.client",
+           .access = "w",
+           .handler_access_error = _permission_check_common,
+       },
+       {
+           .cmd = "update_noti",
+           .handler = _handler_update,
+           .rule = "data-provider-master::notification.client",
+           .access = "w",
+           .handler_access_error = _permission_check_common,
+       },
+       {
+           .cmd = "load_noti_by_tag",
+           .handler = _handler_load_noti_by_tag,
+           .rule = "data-provider-master::notification.client",
+           .access = "r",
+           .handler_access_error = _permission_check_common,
+       },
+       {
+           .cmd = "refresh_noti",
+           .handler = _handler_refresh,
+           .rule = "data-provider-master::notification.client",
+           .access = "w",
+           .handler_access_error = _permission_check_refresh,
+       },
+       {
+           .cmd = "del_noti_single",
+           .handler = _handler_delete_single,
+           .rule = "data-provider-master::notification.client",
+           .access = "w",
+           .handler_access_error = _permission_check_common,
+       },
+       {
+           .cmd = "del_noti_multiple",
+           .handler = _handler_delete_multiple,
+           .rule = "data-provider-master::notification.client",
+           .access = "w",
+           .handler_access_error = _permission_check_common,
+       },
+       {
+           .cmd = "set_noti_property",
+           .handler = _handler_noti_property_set,
+           .rule = "data-provider-master::notification.client",
+           .access = "w",
+           .handler_access_error = _permission_check_common,
+       },
+       {
+           .cmd = "get_noti_property",
+           .handler = _handler_noti_property_get,
+           .rule = "data-provider-master::notification.client",
+           .access = "r",
+           .handler_access_error = _permission_check_property_get,
+       },
+       {
+           .cmd = "service_register",
+           .handler = _handler_service_register,
+           .rule = NULL,
+           .access = NULL,
+           .handler_access_error = NULL,
+       },
+       {
+           .cmd = "post_toast",
+           .handler = _handler_post_toast_message,
+           .rule = NULL,
+           .access = NULL,
+           .handler_access_error = NULL,
+       },
+       {
+           .cmd = NULL,
+           .handler = NULL,
+           .rule = NULL,
+           .access = NULL,
+           .handler_access_error = NULL,
+       },
+    };
+
+    if (!packet) {
+       DbgPrint("TCB: %p is terminated\n", tcb);
+       return 0;
+    }
 
-       command = packet_command(packet);
-       if (!command) {
-               ErrPrint("Invalid command\n");
-               return -EINVAL;
-       }
+    command = packet_command(packet);
+    if (!command) {
+       ErrPrint("Invalid command\n");
+       return -EINVAL;
+    }
 
-       switch (packet_type(packet)) {
+    switch (packet_type(packet)) {
        case PACKET_REQ:
-               /* Need to send reply packet */
-               DbgPrint("%p REQ: Command: [%s]\n", tcb, command);
-
-               for (i = 0; service_req_table[i].cmd; i++) {
-                       if (strcmp(service_req_table[i].cmd, command)) {
-                               continue;
-                       }
+           /* Need to send reply packet */
+           DbgPrint("%p REQ: Command: [%s]\n", tcb, command);
 
-                       if (_persmission_check(tcb_fd(tcb), &(service_req_table[i])) == 1) {
-                               service_req_table[i].handler(tcb, packet, data);
-                       } else {
-                               if (service_req_table[i].handler_access_error != NULL) {
-                                       service_req_table[i].handler_access_error(tcb, packet);
-                               }
-                       }
-                       break;
+           for (i = 0; service_req_table[i].cmd; i++) {
+               if (strcmp(service_req_table[i].cmd, command)) {
+                   continue;
                }
 
+               if (_persmission_check(tcb_fd(tcb), &(service_req_table[i])) == 1) {
+                   service_req_table[i].handler(tcb, packet, data);
+               } else {
+                   if (service_req_table[i].handler_access_error != NULL) {
+                       service_req_table[i].handler_access_error(tcb, packet);
+                   }
+               }
                break;
+           }
+
+           break;
        case PACKET_REQ_NOACK:
-               break;
+           break;
        case PACKET_ACK:
-               break;
+           break;
        default:
-               ErrPrint("Packet type is not valid[%s]\n", command);
-               return -EINVAL;
-       }
-
-       /*!
-        * return value has no meanning,
-        * it will be printed by dlogutil.
-        */
-       return 0;
+           ErrPrint("Packet type is not valid[%s]\n", command);
+           return -EINVAL;
+    }
+
+    /*!
+     * return value has no meanning,
+     * it will be printed by dlogutil.
+     */
+    return 0;
 }
 
 
@@ -659,51 +760,51 @@ static int service_thread_main(struct tcb *tcb, struct packet *packet, void *dat
  */
 HAPI int notification_service_init(void)
 {
-       if (s_info.svc_ctx) {
-               ErrPrint("Already initialized\n");
-               return LB_STATUS_ERROR_ALREADY;
-       }
-
-       _notification_init();
-
-       s_info.svc_ctx = service_common_create(NOTIFICATION_SOCKET, service_thread_main, NULL);
-       if (!s_info.svc_ctx) {
-               ErrPrint("Unable to activate service thread\n");
-               return LB_STATUS_ERROR_FAULT;
+    if (s_info.svc_ctx) {
+       ErrPrint("Already initialized\n");
+       return DBOX_STATUS_ERROR_ALREADY;
+    }
+
+    _notification_init();
+
+    s_info.svc_ctx = service_common_create(NOTIFICATION_SOCKET, service_thread_main, NULL);
+    if (!s_info.svc_ctx) {
+       ErrPrint("Unable to activate service thread\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    if (smack_fsetlabel(service_common_fd(s_info.svc_ctx), NOTIFICATION_SMACK_LABEL, SMACK_LABEL_IPOUT) != 0) {
+       if (errno != EOPNOTSUPP) {
+           ErrPrint("Unable to set SMACK label(%d)\n", errno);
+           service_common_destroy(s_info.svc_ctx);
+           s_info.svc_ctx = NULL;
+           return DBOX_STATUS_ERROR_FAULT;
        }
-
-       if (smack_fsetlabel(service_common_fd(s_info.svc_ctx), NOTIFICATION_SMACK_LABEL, SMACK_LABEL_IPOUT) != 0) {
-               if (errno != EOPNOTSUPP) {
-                       ErrPrint("Unable to set SMACK label(%d)\n", errno);
-                       service_common_destroy(s_info.svc_ctx);
-                       s_info.svc_ctx = NULL;
-                       return LB_STATUS_ERROR_FAULT;
-               }
+    }
+
+    if (smack_fsetlabel(service_common_fd(s_info.svc_ctx), NOTIFICATION_SMACK_LABEL, SMACK_LABEL_IPIN) != 0) {
+       if (errno != EOPNOTSUPP) {
+           ErrPrint("Unable to set SMACK label(%d)\n", errno);
+           service_common_destroy(s_info.svc_ctx);
+           s_info.svc_ctx = NULL;
+           return DBOX_STATUS_ERROR_FAULT;
        }
+    }
 
-       if (smack_fsetlabel(service_common_fd(s_info.svc_ctx), NOTIFICATION_SMACK_LABEL, SMACK_LABEL_IPIN) != 0) {
-               if (errno != EOPNOTSUPP) {
-                       ErrPrint("Unable to set SMACK label(%d)\n", errno);
-                       service_common_destroy(s_info.svc_ctx);
-                       s_info.svc_ctx = NULL;
-                       return LB_STATUS_ERROR_FAULT;
-               }
-       }
-
-       DbgPrint("Successfully initiated\n");
-       return LB_STATUS_SUCCESS;
+    DbgPrint("Successfully initiated\n");
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int notification_service_fini(void)
 {
-       if (!s_info.svc_ctx) {
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       service_common_destroy(s_info.svc_ctx);
-       s_info.svc_ctx = NULL;
-       DbgPrint("Successfully Finalized\n");
-       return LB_STATUS_SUCCESS;
+    if (!s_info.svc_ctx) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    service_common_destroy(s_info.svc_ctx);
+    s_info.svc_ctx = NULL;
+    DbgPrint("Successfully Finalized\n");
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 /* End of a file */
index 30790e2..5b3ae32 100644 (file)
 #include <Eina.h>
 
 #include <packet.h>
-#include <livebox-errno.h>
-#include <livebox-service.h>
+#include <dynamicbox_errno.h>
+#include <dynamicbox_service.h>
+#include <dynamicbox_conf.h>
+#include <pkgmgr-info.h>
 #include <ail.h>
 
 #include "critical_log.h"
@@ -48,9 +50,9 @@
 int errno;
 
 struct fault_info {
-       double timestamp;
-       char *filename;
-       char *function;
+    double timestamp;
+    char *filename;
+    char *function;
 };
 
 /*!
@@ -58,1010 +60,999 @@ struct fault_info {
  */
 
 struct pkg_info {
-       char *pkgid;
-       char *lbid;
-
-       struct {
-               enum lb_type type;
-
-               union {
-                       struct {
-                               char *path;
-                               char *group;
-                       } script;
-
-                       struct {
-                               /*!< Reserved for future use */
-                       } file;
-
-                       struct {
-                               /*!< Reserved for future use */
-                       } text;
-
-                       struct {
-                               /*!< Reserved for future use */
-                       } buffer;
-               } info;
-
-               unsigned int size_list;
-               char *auto_launch;
-               int pinup;
-               int timeout;
-               double period;
-               char *libexec;
-       } lb;
-
-       struct {
-               enum pd_type type;
-
-               union {
-                       struct {
-                               char *path;
-                               char *group;
-                       } script;
-
-                       struct {
-                               /*!< Reserved for future use */
-                       } text;
-
-                       struct {
-                               /*!< Reserved for future use */
-                       } buffer;
-               } info;
-
-               unsigned int width;
-               unsigned int height;
-       } pd;
-
-       int network;
-       int secured;
-       char *script; /* script type: edje, ... */
-       char *abi;
-
-       int fault_count;
-       struct fault_info *fault_info;
-
-       struct slave_node *slave;
-       int refcnt;
-
-       Eina_List *inst_list;
-       Eina_List *ctx_list;
-
-       int is_uninstalled;
+    char *pkgid;
+    char *dbox_id;
+
+    struct {
+       enum dynamicbox_dbox_type type;
+
+       union {
+           struct {
+               char *path;
+               char *group;
+           } script;
+
+           struct {
+               /*!< Reserved for future use */
+           } file;
+
+           struct {
+               /*!< Reserved for future use */
+           } text;
+
+           struct {
+               /*!< Reserved for future use */
+           } buffer;
+       } info;
+
+       unsigned int size_list;
+       char *auto_launch;
+       int pinup;
+       int timeout;
+       double period;
+       char *libexec;
+    } dbox;
+
+    struct {
+       enum dynamicbox_gbar_type type;
+
+       union {
+           struct {
+               char *path;
+               char *group;
+           } script;
+
+           struct {
+               /*!< Reserved for future use */
+           } text;
+
+           struct {
+               /*!< Reserved for future use */
+           } buffer;
+       } info;
+
+       unsigned int width;
+       unsigned int height;
+    } gbar;
+
+    int network;
+    int secured;
+    char *script; /* script type: edje, ... */
+    char *abi;
+
+    int fault_count;
+    struct fault_info *fault_info;
+
+    struct slave_node *slave;
+    int refcnt;
+
+    Eina_List *inst_list;
+    Eina_List *ctx_list;
+
+    int is_uninstalled;
 };
 
 static struct {
-       Eina_List *pkg_list;
+    Eina_List *pkg_list;
 } s_info = {
-       .pkg_list = NULL,
+    .pkg_list = NULL,
 };
 
 static int slave_activated_cb(struct slave_node *slave, void *data)
 {
-       struct pkg_info *info = data;
-       struct inst_info *inst;
-       Eina_List *l;
-       Eina_List *n;
-       int cnt;
-       int ret;
+    struct pkg_info *info = data;
+    struct inst_info *inst;
+    Eina_List *l;
+    Eina_List *n;
+    int cnt;
+    int ret;
 
-       if (!slave_need_to_reactivate_instances(slave)) {
-               DbgPrint("Do not need to reactivate instances\n");
-               return 0;
-       }
-
-       cnt = 0;
-       EINA_LIST_FOREACH_SAFE(info->inst_list, l, n, inst) {
-               ret = instance_recover_state(inst);
-               if (!ret) {
-                       continue;
-               }
+    if (!slave_need_to_reactivate_instances(slave)) {
+       DbgPrint("Do not need to reactivate instances\n");
+       return 0;
+    }
 
-               instance_thaw_updator(inst);
-               cnt++;
+    cnt = 0;
+    EINA_LIST_FOREACH_SAFE(info->inst_list, l, n, inst) {
+       ret = instance_recover_state(inst);
+       if (!ret) {
+           continue;
        }
 
-       DbgPrint("Recover state for %d instances of %s\n", cnt, package_name(info));
-       return 0;
+       instance_thaw_updator(inst);
+       cnt++;
+    }
+
+    DbgPrint("Recover state for %d instances of %s\n", cnt, package_name(info));
+    return 0;
 }
 
 static int slave_fault_cb(struct slave_node *slave, void *data)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct inst_info *inst;
-       struct pkg_info *info = (struct pkg_info *)data;
+    Eina_List *l;
+    Eina_List *n;
+    struct inst_info *inst;
+    struct pkg_info *info = (struct pkg_info *)data;
 
-       if (package_is_fault(info)) {
-               ErrPrint("Already faulted package: %s\n", package_name(info));
-               return 0;
-       }
+    if (package_is_fault(info)) {
+       ErrPrint("Already faulted package: %s\n", package_name(info));
+       return 0;
+    }
 
-       (void)package_set_fault_info(info, util_timestamp(), slave_name(slave), __func__);
-       fault_broadcast_info(package_name(info), slave_name(slave), __func__);
+    (void)package_set_fault_info(info, util_timestamp(), slave_name(slave), __func__);
+    fault_broadcast_info(package_name(info), slave_name(slave), __func__);
 
-       DbgPrint("Slave critical fault - package: %s (by slave fault %s\n", package_name(info), slave_name(slave));
-       EINA_LIST_FOREACH_SAFE(info->inst_list, l, n, inst) {
-               DbgPrint("Destroy instance %p\n", inst);
-               instance_destroyed(inst, LB_STATUS_ERROR_FAULT);
-       }
+    DbgPrint("Slave critical fault - package: %s (by slave fault %s\n", package_name(info), slave_name(slave));
+    EINA_LIST_FOREACH_SAFE(info->inst_list, l, n, inst) {
+       DbgPrint("Destroy instance %p\n", inst);
+       instance_destroyed(inst, DBOX_STATUS_ERROR_FAULT);
+    }
 
-       return 0;
+    return 0;
 }
 
 static int slave_deactivated_cb(struct slave_node *slave, void *data)
 {
-       struct pkg_info *info = data;
-       struct inst_info *inst;
-       Eina_List *l;
-       Eina_List *n;
-       int cnt = 0;
+    struct pkg_info *info = data;
+    struct inst_info *inst;
+    Eina_List *l;
+    Eina_List *n;
+    int cnt = 0;
 
-       if (info->fault_info) {
-               EINA_LIST_FOREACH_SAFE(info->inst_list, l, n, inst) {
-                       instance_destroyed(inst, LB_STATUS_ERROR_FAULT);
-               }
-       } else {
-               EINA_LIST_FOREACH_SAFE(info->inst_list, l, n, inst) {
-                       cnt += instance_need_slave(inst);
-                       /*!
-                        * instance_deactivated will call the slave_unload_instance.
-                        * if the loaded instance counter meets 0,
-                        * the slave will be deactivated.
-                        * so we should not call the instance activate function
-                        * from here.
-                        *
-                        * activate slave when the slave is reactivated
-                        */
-               }
+    if (info->fault_info) {
+       EINA_LIST_FOREACH_SAFE(info->inst_list, l, n, inst) {
+           instance_destroyed(inst, DBOX_STATUS_ERROR_FAULT);
+       }
+    } else {
+       EINA_LIST_FOREACH_SAFE(info->inst_list, l, n, inst) {
+           cnt += instance_need_slave(inst);
+           /*!
+            * instance_deactivated will call the slave_unload_instance.
+            * if the loaded instance counter meets 0,
+            * the slave will be deactivated.
+            * so we should not call the instance activate function
+            * from here.
+            *
+            * activate slave when the slave is reactivated
+            */
        }
+    }
 
-       return cnt ? SLAVE_NEED_TO_REACTIVATE : 0;
+    return cnt ? SLAVE_NEED_TO_REACTIVATE : 0;
 }
 
 static int xmonitor_paused_cb(void *data)
 {
-       struct pkg_info *info = (struct pkg_info *)data;
-       struct inst_info *inst;
-       Eina_List *l;
+    struct pkg_info *info = (struct pkg_info *)data;
+    struct inst_info *inst;
+    Eina_List *l;
 
-       if (slave_state(info->slave) != SLAVE_TERMINATED) {
-               return 0;
-       }
+    if (slave_state(info->slave) != SLAVE_TERMINATED) {
+       return 0;
+    }
 
-       EINA_LIST_FOREACH(info->inst_list, l, inst) {
-               instance_freeze_updator(inst);
-       }
+    EINA_LIST_FOREACH(info->inst_list, l, inst) {
+       instance_freeze_updator(inst);
+    }
 
-       return 0;
+    return 0;
 }
 
 static int xmonitor_resumed_cb(void *data)
 {
-       struct pkg_info *info = data;
-       struct inst_info *inst;
-       Eina_List *l;
+    struct pkg_info *info = data;
+    struct inst_info *inst;
+    Eina_List *l;
 
-       if (slave_state(info->slave) != SLAVE_TERMINATED) {
-               return 0;
-       }
+    if (slave_state(info->slave) != SLAVE_TERMINATED) {
+       return 0;
+    }
 
-       EINA_LIST_FOREACH(info->inst_list, l, inst) {
-               instance_thaw_updator(inst);
-       }
+    EINA_LIST_FOREACH(info->inst_list, l, inst) {
+       instance_thaw_updator(inst);
+    }
 
-       return 0;
+    return 0;
 }
 
 static int slave_paused_cb(struct slave_node *slave, void *data)
 {
-       struct pkg_info *info = (struct pkg_info *)data;
-       struct inst_info *inst;
-       Eina_List *l;
+    struct pkg_info *info = (struct pkg_info *)data;
+    struct inst_info *inst;
+    Eina_List *l;
 
-       EINA_LIST_FOREACH(info->inst_list, l, inst) {
-               instance_freeze_updator(inst);
-       }
+    EINA_LIST_FOREACH(info->inst_list, l, inst) {
+       instance_freeze_updator(inst);
+    }
 
-       return 0;
+    return 0;
 }
 
 static int slave_resumed_cb(struct slave_node *slave, void *data)
 {
-       struct pkg_info *info = (struct pkg_info *)data;
-       struct inst_info *inst;
-       Eina_List *l;
+    struct pkg_info *info = (struct pkg_info *)data;
+    struct inst_info *inst;
+    Eina_List *l;
 
-       EINA_LIST_FOREACH(info->inst_list, l, inst) {
-               instance_thaw_updator(inst);
-       }
+    EINA_LIST_FOREACH(info->inst_list, l, inst) {
+       instance_thaw_updator(inst);
+    }
 
-       return 0;
+    return 0;
 }
 
 static inline void destroy_package(struct pkg_info *info)
 {
-       eina_list_free(info->ctx_list);
-       /* This items will be deleted from group_del_livebox */
-       info->ctx_list = NULL;
+    eina_list_free(info->ctx_list);
+    /* This items will be deleted from group_del_dynamicbox */
+    info->ctx_list = NULL;
 
-       group_del_livebox(info->lbid);
-       package_clear_fault(info);
+    group_del_dynamicbox(info->dbox_id);
+    package_clear_fault(info);
 
-       s_info.pkg_list = eina_list_remove(s_info.pkg_list, info);
+    s_info.pkg_list = eina_list_remove(s_info.pkg_list, info);
 
-       if (info->lb.type == LB_TYPE_SCRIPT) {
-               DbgFree(info->lb.info.script.path);
-               DbgFree(info->lb.info.script.group);
-       }
+    if (info->dbox.type == DBOX_TYPE_SCRIPT) {
+       DbgFree(info->dbox.info.script.path);
+       DbgFree(info->dbox.info.script.group);
+    }
 
-       if (info->pd.type == PD_TYPE_SCRIPT) {
-               DbgFree(info->pd.info.script.path);
-               DbgFree(info->pd.info.script.group);
-       }
+    if (info->gbar.type == GBAR_TYPE_SCRIPT) {
+       DbgFree(info->gbar.info.script.path);
+       DbgFree(info->gbar.info.script.group);
+    }
 
-       DbgFree(info->script);
-       DbgFree(info->abi);
-       DbgFree(info->lbid);
-       DbgFree(info->lb.libexec);
-       DbgFree(info->lb.auto_launch);
-       DbgFree(info->pkgid);
+    DbgFree(info->script);
+    DbgFree(info->abi);
+    DbgFree(info->dbox_id);
+    DbgFree(info->dbox.libexec);
+    DbgFree(info->dbox.auto_launch);
+    DbgFree(info->pkgid);
 
-       DbgFree(info);
+    DbgFree(info);
 }
 
 static inline int load_conf(struct pkg_info *info)
 {
-       struct parser *parser;
-       const char *str;
-       const char *group;
-
-       parser = parser_load(info->lbid);
-       if (!parser) {
-               info->lb.size_list = 0x01; /* Default */
-
-               info->script = strdup(DEFAULT_SCRIPT);
-               if (!info->script) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       return LB_STATUS_ERROR_MEMORY;
-               }
-
-               info->abi = strdup(DEFAULT_ABI);
-               if (!info->abi) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       DbgFree(info->script);
-                       info->script = NULL;
-                       return LB_STATUS_ERROR_MEMORY;
-               }
-
-               info->pd.width = g_conf.width;
-               info->pd.height = g_conf.height >> 2;
-               info->lb.pinup = 1;
-               return LB_STATUS_SUCCESS;
-       }
-
-       info->lb.type = LB_TYPE_FILE;
-       if (parser_text_lb(parser)) {
-               info->lb.type = LB_TYPE_TEXT;
-       } else if (parser_buffer_lb(parser)) {
-               info->lb.type = LB_TYPE_BUFFER;
-       } else {
-               str = parser_lb_path(parser);
-               if (str) {
-                       info->lb.type = LB_TYPE_SCRIPT;
-
-                       info->lb.info.script.path = strdup(str);
-                       if (!info->lb.info.script.path) {
-                               ErrPrint("Heap: %s\n", strerror(errno));
-                               parser_unload(parser);
-                               return LB_STATUS_ERROR_MEMORY;
-                       }
-
-                       str = parser_lb_group(parser);
-                       if (str) {
-                               info->lb.info.script.group = strdup(str);
-                               if (!info->lb.info.script.group) {
-                                       ErrPrint("Heap: %s\n", strerror(errno));
-                                       DbgFree(info->lb.info.script.path);
-                                       parser_unload(parser);
-                                       return LB_STATUS_ERROR_MEMORY;
-                               }
-                       }
-               }
-       }
-
-       if (parser_text_pd(parser)) {
-               info->pd.type = PD_TYPE_TEXT;
-       } else if (parser_buffer_pd(parser)) {
-               info->pd.type = PD_TYPE_BUFFER;
-       } else {
-               str = parser_pd_path(parser);
-               if (str) {
-                       info->pd.type = PD_TYPE_SCRIPT;
-                       info->pd.info.script.path = strdup(str);
-                       if (!info->pd.info.script.path) {
-                               ErrPrint("Heap: %s\n", strerror(errno));
-                               if (info->lb.type == LB_TYPE_SCRIPT) {
-                                       DbgFree(info->lb.info.script.path);
-                                       DbgFree(info->lb.info.script.group);
-                               }
-                               parser_unload(parser);
-                               return LB_STATUS_ERROR_MEMORY;
-                       }
+    struct parser *parser;
+    const char *str;
+    const char *group;
 
-                       str = parser_pd_group(parser);
-                       if (str) {
-                               info->pd.info.script.group = strdup(str);
-                               if (!info->pd.info.script.group) {
-                                       ErrPrint("Heap: %s\n", strerror(errno));
-                                       DbgFree(info->pd.info.script.path);
-                                       if (info->lb.type == LB_TYPE_SCRIPT) {
-                                               DbgFree(info->lb.info.script.path);
-                                               DbgFree(info->lb.info.script.group);
-                                       }
-                                       parser_unload(parser);
-                                       return LB_STATUS_ERROR_MEMORY;
-                               }
-                       }
-               }
-       }
+    parser = parser_load(info->dbox_id);
+    if (!parser) {
+       info->dbox.size_list = 0x01; /* Default */
 
-       str = parser_script(parser);
-       str = str ? str : DEFAULT_SCRIPT;
-       info->script = strdup(str);
+       info->script = strdup(DYNAMICBOX_CONF_DEFAULT_SCRIPT);
        if (!info->script) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               if (info->pd.type == PD_TYPE_SCRIPT) {
-                       DbgFree(info->pd.info.script.path);
-                       DbgFree(info->pd.info.script.group);
-               }
-
-               if (info->lb.type == LB_TYPE_SCRIPT) {
-                       DbgFree(info->lb.info.script.path);
-                       DbgFree(info->lb.info.script.group);
-               }
-
-               parser_unload(parser);
-               return LB_STATUS_ERROR_MEMORY;
+           ErrPrint("Heap: %s\n", strerror(errno));
+           return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
        }
 
-       str = parser_abi(parser);
-       str = str ? str : DEFAULT_ABI;
-       info->abi = strdup(str);
+       info->abi = strdup(DYNAMICBOX_CONF_DEFAULT_ABI);
        if (!info->abi) {
+           ErrPrint("Heap: %s\n", strerror(errno));
+           DbgFree(info->script);
+           info->script = NULL;
+           return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+       }
+
+       info->gbar.width = DYNAMICBOX_CONF_BASE_W;
+       info->gbar.height = DYNAMICBOX_CONF_BASE_H >> 2;
+       info->dbox.pinup = 1;
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    info->dbox.type = DBOX_TYPE_FILE;
+    if (parser_text_dbox(parser)) {
+       info->dbox.type = DBOX_TYPE_TEXT;
+    } else if (parser_buffer_dbox(parser)) {
+       info->dbox.type = DBOX_TYPE_BUFFER;
+    } else {
+       str = parser_dbox_path(parser);
+       if (str) {
+           info->dbox.type = DBOX_TYPE_SCRIPT;
+
+           info->dbox.info.script.path = strdup(str);
+           if (!info->dbox.info.script.path) {
                ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(info->script);
-               if (info->pd.type == PD_TYPE_SCRIPT) {
-                       DbgFree(info->pd.info.script.path);
-                       DbgFree(info->pd.info.script.group);
+               parser_unload(parser);
+               return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+           }
+
+           str = parser_dbox_group(parser);
+           if (str) {
+               info->dbox.info.script.group = strdup(str);
+               if (!info->dbox.info.script.group) {
+                   ErrPrint("Heap: %s\n", strerror(errno));
+                   DbgFree(info->dbox.info.script.path);
+                   parser_unload(parser);
+                   return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
                }
-
-               if (info->lb.type == LB_TYPE_SCRIPT) {
-                       DbgFree(info->lb.info.script.path);
-                       DbgFree(info->lb.info.script.group);
+           }
+       }
+    }
+
+    if (parser_text_gbar(parser)) {
+       info->gbar.type = GBAR_TYPE_TEXT;
+    } else if (parser_buffer_gbar(parser)) {
+       info->gbar.type = GBAR_TYPE_BUFFER;
+    } else {
+       str = parser_gbar_path(parser);
+       if (str) {
+           info->gbar.type = GBAR_TYPE_SCRIPT;
+           info->gbar.info.script.path = strdup(str);
+           if (!info->gbar.info.script.path) {
+               ErrPrint("Heap: %s\n", strerror(errno));
+               if (info->dbox.type == DBOX_TYPE_SCRIPT) {
+                   DbgFree(info->dbox.info.script.path);
+                   DbgFree(info->dbox.info.script.group);
                }
                parser_unload(parser);
-               return LB_STATUS_ERROR_MEMORY;
+               return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+           }
+
+           str = parser_gbar_group(parser);
+           if (str) {
+               info->gbar.info.script.group = strdup(str);
+               if (!info->gbar.info.script.group) {
+                   ErrPrint("Heap: %s\n", strerror(errno));
+                   DbgFree(info->gbar.info.script.path);
+                   if (info->dbox.type == DBOX_TYPE_SCRIPT) {
+                       DbgFree(info->dbox.info.script.path);
+                       DbgFree(info->dbox.info.script.group);
+                   }
+                   parser_unload(parser);
+                   return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+               }
+           }
        }
+    }
 
-       info->lb.timeout = parser_timeout(parser);
-       info->network = parser_network(parser);
+    str = parser_script(parser);
+    str = str ? str : DYNAMICBOX_CONF_DEFAULT_SCRIPT;
+    info->script = strdup(str);
+    if (!info->script) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       if (info->gbar.type == GBAR_TYPE_SCRIPT) {
+           DbgFree(info->gbar.info.script.path);
+           DbgFree(info->gbar.info.script.group);
+       }
 
-       info->lb.period = parser_period(parser);
-       if (info->lb.period < 0.0f) {
-               info->lb.period = 0.0f;
-       } else if (info->lb.period > 0.0f && info->lb.period < MINIMUM_PERIOD) {
-               info->lb.period = MINIMUM_PERIOD;
+       if (info->dbox.type == DBOX_TYPE_SCRIPT) {
+           DbgFree(info->dbox.info.script.path);
+           DbgFree(info->dbox.info.script.group);
        }
 
-       info->lb.size_list = parser_size(parser);
+       parser_unload(parser);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    str = parser_abi(parser);
+    str = str ? str : DYNAMICBOX_CONF_DEFAULT_ABI;
+    info->abi = strdup(str);
+    if (!info->abi) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(info->script);
+       if (info->gbar.type == GBAR_TYPE_SCRIPT) {
+           DbgFree(info->gbar.info.script.path);
+           DbgFree(info->gbar.info.script.group);
+       }
 
-       str = parser_auto_launch(parser);
-       str = str ? str : "";
-       info->lb.auto_launch = strdup(str);
-       if (!info->lb.auto_launch) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(info->abi);
-               DbgFree(info->script);
-               if (info->pd.type == PD_TYPE_SCRIPT) {
-                       DbgFree(info->pd.info.script.path);
-                       DbgFree(info->pd.info.script.group);
-               }
+       if (info->dbox.type == DBOX_TYPE_SCRIPT) {
+           DbgFree(info->dbox.info.script.path);
+           DbgFree(info->dbox.info.script.group);
+       }
+       parser_unload(parser);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    info->dbox.timeout = parser_timeout(parser);
+    info->network = parser_network(parser);
+
+    info->dbox.period = parser_period(parser);
+    if (info->dbox.period < 0.0f) {
+       info->dbox.period = 0.0f;
+    } else if (info->dbox.period > 0.0f && info->dbox.period < DYNAMICBOX_CONF_MINIMUM_PERIOD) {
+       info->dbox.period = DYNAMICBOX_CONF_MINIMUM_PERIOD;
+    }
+
+    info->dbox.size_list = parser_size(parser);
+
+    str = parser_auto_launch(parser);
+    str = str ? str : "";
+    info->dbox.auto_launch = strdup(str);
+    if (!info->dbox.auto_launch) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(info->abi);
+       DbgFree(info->script);
+       if (info->gbar.type == GBAR_TYPE_SCRIPT) {
+           DbgFree(info->gbar.info.script.path);
+           DbgFree(info->gbar.info.script.group);
+       }
 
-               if (info->lb.type == LB_TYPE_SCRIPT) {
-                       DbgFree(info->lb.info.script.path);
-                       DbgFree(info->lb.info.script.group);
-               }
-               parser_unload(parser);
-               return LB_STATUS_ERROR_MEMORY;
+       if (info->dbox.type == DBOX_TYPE_SCRIPT) {
+           DbgFree(info->dbox.info.script.path);
+           DbgFree(info->dbox.info.script.group);
        }
+       parser_unload(parser);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       info->secured = parser_secured(parser);
-       info->lb.pinup = parser_pinup(parser);
+    info->secured = parser_secured(parser);
+    info->dbox.pinup = parser_pinup(parser);
 
-       parser_get_pdsize(parser, &info->pd.width, &info->pd.height);
+    parser_get_gbar_size(parser, &info->gbar.width, &info->gbar.height);
 
-       group = parser_group_str(parser);
-       if (group && group_add_livebox(group, info->lbid) < 0) {
-               ErrPrint("Failed to build cluster tree for %s{%s}\n", info->lbid, group);
-       }
+    group = parser_group_str(parser);
+    if (group && group_add_dynamicbox(group, info->dbox_id) < 0) {
+       ErrPrint("Failed to build cluster tree for %s{%s}\n", info->dbox_id, group);
+    }
 
-       parser_unload(parser);
-       return LB_STATUS_SUCCESS;
+    parser_unload(parser);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
-HAPI struct pkg_info *package_create(const char *pkgid, const char *lbid)
+HAPI struct pkg_info *package_create(const char *pkgid, const char *dbox_id)
 {
-       struct pkg_info *pkginfo;
+    struct pkg_info *pkginfo;
 
-       pkginfo = calloc(1, sizeof(*pkginfo));
-       if (!pkginfo) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return NULL;
-       }
-
-       pkginfo->pkgid = strdup(pkgid);
-       if (!pkginfo->pkgid) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(pkginfo);
-               return NULL;
-       }
+    pkginfo = calloc(1, sizeof(*pkginfo));
+    if (!pkginfo) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
 
-       pkginfo->lbid = io_livebox_pkgname(lbid);
-       if (!pkginfo->lbid) {
-               ErrPrint("Failed to get pkgname, fallback to fs checker\n");
-               if (util_validate_livebox_package(lbid) < 0) {
-                       ErrPrint("Invalid package name: %s\n", lbid);
-                       DbgFree(pkginfo->pkgid);
-                       DbgFree(pkginfo);
-                       return NULL;
-               }
+    pkginfo->pkgid = strdup(pkgid);
+    if (!pkginfo->pkgid) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(pkginfo);
+       return NULL;
+    }
 
-               pkginfo->lbid = strdup(lbid);
-               if (!pkginfo->lbid) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       DbgFree(pkginfo->pkgid);
-                       DbgFree(pkginfo);
-                       return NULL;
-               }
+    pkginfo->dbox_id = io_dynamicbox_pkgname(dbox_id);
+    if (!pkginfo->dbox_id) {
+       ErrPrint("Failed to get pkgname, fallback to fs checker\n");
+       pkginfo->dbox_id = strdup(dbox_id);
+       if (!pkginfo->dbox_id) {
+           ErrPrint("Heap: %s\n", strerror(errno));
+           DbgFree(pkginfo->pkgid);
+           DbgFree(pkginfo);
+           return NULL;
        }
+    }
 
-       if (io_load_package_db(pkginfo) < 0) {
-               ErrPrint("Failed to load DB, fall back to conf file loader\n");
-               if (load_conf(pkginfo) < 0) {
-                       ErrPrint("Failed to initiate the conf file loader\n");
-                       DbgFree(pkginfo->lbid);
-                       DbgFree(pkginfo->pkgid);
-                       DbgFree(pkginfo);
-                       return NULL;
-               }
+    if (io_load_package_db(pkginfo) < 0) {
+       ErrPrint("Failed to load DB, fall back to conf file loader\n");
+       if (load_conf(pkginfo) < 0) {
+           ErrPrint("Failed to initiate the conf file loader\n");
+           DbgFree(pkginfo->dbox_id);
+           DbgFree(pkginfo->pkgid);
+           DbgFree(pkginfo);
+           return NULL;
        }
+    }
 
-       package_ref(pkginfo);
+    package_ref(pkginfo);
 
-       s_info.pkg_list = eina_list_append(s_info.pkg_list, pkginfo);
+    s_info.pkg_list = eina_list_append(s_info.pkg_list, pkginfo);
 
-       return pkginfo;
+    return pkginfo;
 }
 
 HAPI int package_destroy(struct pkg_info *info)
 {
-       package_unref(info);
-       return LB_STATUS_SUCCESS;
+    package_unref(info);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI Eina_List *package_ctx_info(struct pkg_info *pkginfo)
 {
-       return pkginfo->ctx_list;
+    return pkginfo->ctx_list;
 }
 
 HAPI void package_add_ctx_info(struct pkg_info *pkginfo, struct context_info *info)
 {
-       pkginfo->ctx_list = eina_list_append(pkginfo->ctx_list, info);
+    pkginfo->ctx_list = eina_list_append(pkginfo->ctx_list, info);
 }
 
 HAPI void package_del_ctx_info(struct pkg_info *pkginfo, struct context_info *info)
 {
-       pkginfo->ctx_list = eina_list_remove(pkginfo->ctx_list, info);
+    pkginfo->ctx_list = eina_list_remove(pkginfo->ctx_list, info);
 }
 
-HAPI char *package_lb_pkgname(const char *pkgname)
+HAPI char *package_dbox_pkgname(const char *pkgname)
 {
-       char *lbid;
-
-       lbid = io_livebox_pkgname(pkgname);
-       if (!lbid) {
-               if (util_validate_livebox_package(pkgname) < 0) {
-                       return NULL;
-               }
+    char *dbox_id;
 
-               lbid = strdup(pkgname);
-               if (!lbid) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       return NULL;
-               }
+    dbox_id = io_dynamicbox_pkgname(pkgname);
+    if (!dbox_id) {
+       dbox_id = strdup(pkgname);
+       if (!dbox_id) {
+           ErrPrint("Heap: %s\n", strerror(errno));
+           return NULL;
        }
+    }
 
-       return lbid;
+    return dbox_id;
 }
 
-HAPI int package_is_lb_pkgname(const char *pkgname)
+HAPI int package_is_dbox_pkgname(const char *pkgname)
 {
-       char *lbid;
-       int ret;
+    char *dbox_id;
+    int ret;
 
-       lbid = package_lb_pkgname(pkgname);
-       ret = !!lbid;
-       DbgFree(lbid);
+    dbox_id = package_dbox_pkgname(pkgname);
+    ret = !!dbox_id;
+    DbgFree(dbox_id);
 
-       return ret;
+    return ret;
 }
 
-HAPI struct pkg_info *package_find(const char *lbid)
+HAPI struct pkg_info *package_find(const char *dbox_id)
 {
-       Eina_List *l;
-       struct pkg_info *info;
+    Eina_List *l;
+    struct pkg_info *info;
 
-       if (!lbid) {
-               return NULL;
-       }
+    if (!dbox_id) {
+       return NULL;
+    }
 
-       EINA_LIST_FOREACH(s_info.pkg_list, l, info) {
-               if (!strcmp(info->lbid, lbid)) {
-                       return info;
-               }
+    EINA_LIST_FOREACH(s_info.pkg_list, l, info) {
+       if (!strcmp(info->dbox_id, dbox_id)) {
+           return info;
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
-HAPI struct inst_info *package_find_instance_by_id(const char *lbid, const char *id)
+HAPI struct inst_info *package_find_instance_by_id(const char *dbox_id, const char *id)
 {
-       Eina_List *l;
-       struct inst_info *inst;
-       struct pkg_info *info;
+    Eina_List *l;
+    struct inst_info *inst;
+    struct pkg_info *info;
 
-       info = package_find(lbid);
-       if (!info) {
-               ErrPrint("Package %s is not exists\n", lbid);
-               return NULL;
-       }
+    info = package_find(dbox_id);
+    if (!info) {
+       ErrPrint("Package %s is not exists\n", dbox_id);
+       return NULL;
+    }
 
-       EINA_LIST_FOREACH(info->inst_list, l, inst) {
-               if (!strcmp(instance_id(inst), id)) {
-                       return inst;
-               }
+    EINA_LIST_FOREACH(info->inst_list, l, inst) {
+       if (!strcmp(instance_id(inst), id)) {
+           return inst;
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
-HAPI struct inst_info *package_find_instance_by_timestamp(const char *lbid, double timestamp)
+HAPI struct inst_info *package_find_instance_by_timestamp(const char *dbox_id, double timestamp)
 {
-       Eina_List *l;
-       struct inst_info *inst;
-       struct pkg_info *info;
+    Eina_List *l;
+    struct inst_info *inst;
+    struct pkg_info *info;
 
-       info = package_find(lbid);
-       if (!info) {
-               ErrPrint("Package %s is not exists\n", lbid);
-               return NULL;
-       }
+    info = package_find(dbox_id);
+    if (!info) {
+       ErrPrint("Package %s is not exists\n", dbox_id);
+       return NULL;
+    }
 
-       EINA_LIST_FOREACH(info->inst_list, l, inst) {
-               if (instance_timestamp(inst) == timestamp) {
-                       return inst;
-               }
+    EINA_LIST_FOREACH(info->inst_list, l, inst) {
+       if (instance_timestamp(inst) == timestamp) {
+           return inst;
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
 HAPI int package_dump_fault_info(struct pkg_info *info)
 {
-       if (!info->fault_info) {
-               return LB_STATUS_ERROR_NOT_EXIST;
-       }
+    if (!info->fault_info) {
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
 
-       CRITICAL_LOG("=============\n");
-       CRITICAL_LOG("faulted at %lf\n", info->fault_info->timestamp);
-       CRITICAL_LOG("Package: %s\n", info->lbid);
-       CRITICAL_LOG("Function: %s\n", info->fault_info->function);
-       CRITICAL_LOG("InstanceID: %s\n", info->fault_info->filename);
-       return LB_STATUS_SUCCESS;
+    CRITICAL_LOG("=============\n");
+    CRITICAL_LOG("faulted at %lf\n", info->fault_info->timestamp);
+    CRITICAL_LOG("Package: %s\n", info->dbox_id);
+    CRITICAL_LOG("Function: %s\n", info->fault_info->function);
+    CRITICAL_LOG("InstanceID: %s\n", info->fault_info->filename);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int package_get_fault_info(struct pkg_info *info, double *timestamp, const char **filename, const char **function)
 {
-       if (!info->fault_info) {
-               return LB_STATUS_ERROR_NOT_EXIST;
-       }
+    if (!info->fault_info) {
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
 
-       *timestamp = info->fault_info->timestamp;
-       *filename = info->fault_info->filename;
-       *function = info->fault_info->function;
-       return LB_STATUS_SUCCESS;
+    *timestamp = info->fault_info->timestamp;
+    *filename = info->fault_info->filename;
+    *function = info->fault_info->function;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int package_set_fault_info(struct pkg_info *info, double timestamp, const char *filename, const char *function)
 {
-       struct fault_info *fault;
+    struct fault_info *fault;
 
-       package_clear_fault(info);
+    package_clear_fault(info);
 
-       fault = calloc(1, sizeof(*fault));
-       if (!fault) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    fault = calloc(1, sizeof(*fault));
+    if (!fault) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       fault->timestamp = timestamp;
-       if (!filename) {
-               filename = "unknown";
-       }
-       if (!function) {
-               function = "unknown";
-       }
+    fault->timestamp = timestamp;
+    if (!filename) {
+       filename = "unknown";
+    }
+    if (!function) {
+       function = "unknown";
+    }
 
-       fault->filename = strdup(filename);
-       if (!fault->filename) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(fault);
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    fault->filename = strdup(filename);
+    if (!fault->filename) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(fault);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       fault->function = strdup(function);
-       if (!fault->function) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(fault->filename);
-               DbgFree(fault);
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    fault->function = strdup(function);
+    if (!fault->function) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(fault->filename);
+       DbgFree(fault);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       info->fault_info = fault;
-       info->fault_count++;
-       return LB_STATUS_SUCCESS;
+    info->fault_info = fault;
+    info->fault_count++;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int package_clear_fault(struct pkg_info *info)
 {
-       if (!info->fault_info) {
-               return LB_STATUS_ERROR_INVALID;
-       }
-       
-       package_dump_fault_info(info);
+    if (!info->fault_info) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    package_dump_fault_info(info);
 
-       DbgFree(info->fault_info->function);
-       DbgFree(info->fault_info->filename);
-       DbgFree(info->fault_info);
-       info->fault_info = NULL;
-       return LB_STATUS_SUCCESS;
+    DbgFree(info->fault_info->function);
+    DbgFree(info->fault_info->filename);
+    DbgFree(info->fault_info);
+    info->fault_info = NULL;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI const int const package_is_fault(const struct pkg_info *info)
 {
-       return !!info->fault_info;
+    return !!info->fault_info;
 }
 
 HAPI struct slave_node * const package_slave(const struct pkg_info *info)
 {
-       return info->slave;
+    return info->slave;
 }
 
 HAPI const int const package_timeout(const struct pkg_info *info)
 {
-       return info->lb.timeout;
+    return info->dbox.timeout;
 }
 
 HAPI void package_set_timeout(struct pkg_info *info, int timeout)
 {
-       info->lb.timeout = timeout;
+    info->dbox.timeout = timeout;
 }
 
 HAPI const double const package_period(const struct pkg_info *info)
 {
-       return info->lb.period;
+    return info->dbox.period;
 }
 
 HAPI void package_set_period(struct pkg_info *info, double period)
 {
-       info->lb.period = period;
+    info->dbox.period = period;
 }
 
 HAPI const int const package_secured(const struct pkg_info *info)
 {
-       return info->secured;
+    return info->secured;
 }
 
 HAPI void package_set_secured(struct pkg_info *info, int secured)
 {
-       info->secured = secured;
+    info->secured = secured;
 }
 
 HAPI const char * const package_script(const struct pkg_info *info)
 {
-       return info->script;
+    return info->script;
 }
 
 HAPI int package_set_script(struct pkg_info *info, const char *script)
 {
-       char *tmp;
+    char *tmp;
 
-       tmp = strdup(script);
-       if (!tmp) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    tmp = strdup(script);
+    if (!tmp) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       DbgFree(info->script);
-       info->script = tmp;
-       return LB_STATUS_SUCCESS;
+    DbgFree(info->script);
+    info->script = tmp;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI const char * const package_abi(const struct pkg_info *info)
 {
-       return info->abi;
+    return info->abi;
 }
 
 HAPI int package_set_abi(struct pkg_info *info, const char *abi)
 {
-       char *tmp;
-       tmp = strdup(abi);
-       if (!tmp) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    char *tmp;
+    tmp = strdup(abi);
+    if (!tmp) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       DbgFree(info->abi);
-       info->abi = tmp;
-       return LB_STATUS_SUCCESS;
+    DbgFree(info->abi);
+    info->abi = tmp;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
-HAPI const char * const package_lb_path(const struct pkg_info *info)
+HAPI const char * const package_dbox_path(const struct pkg_info *info)
 {
-       if (info->lb.type != LB_TYPE_SCRIPT) {
-               return NULL;
-       }
+    if (info->dbox.type != DBOX_TYPE_SCRIPT) {
+       return NULL;
+    }
 
-       return info->lb.info.script.path;
+    return info->dbox.info.script.path;
 }
 
-HAPI int package_set_lb_path(struct pkg_info *info, const char *path)
+HAPI int package_set_dbox_path(struct pkg_info *info, const char *path)
 {
-       char *tmp;
+    char *tmp;
 
-       if (info->lb.type != LB_TYPE_SCRIPT) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (info->dbox.type != DBOX_TYPE_SCRIPT) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       tmp = strdup(path);
-       if (!tmp) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    tmp = strdup(path);
+    if (!tmp) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       DbgFree(info->lb.info.script.path);
-       info->lb.info.script.path = tmp;
-       return LB_STATUS_SUCCESS;
+    DbgFree(info->dbox.info.script.path);
+    info->dbox.info.script.path = tmp;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
-HAPI const char * const package_lb_group(const struct pkg_info *info)
+HAPI const char * const package_dbox_group(const struct pkg_info *info)
 {
-       if (info->lb.type != LB_TYPE_SCRIPT) {
-               return NULL;
-       }
+    if (info->dbox.type != DBOX_TYPE_SCRIPT) {
+       return NULL;
+    }
 
-       return info->lb.info.script.group;
+    return info->dbox.info.script.group;
 }
 
-HAPI int package_set_lb_group(struct pkg_info *info, const char *group)
+HAPI int package_set_dbox_group(struct pkg_info *info, const char *group)
 {
-       char *tmp;
+    char *tmp;
 
-       if (info->lb.type != LB_TYPE_SCRIPT) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (info->dbox.type != DBOX_TYPE_SCRIPT) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       tmp = strdup(group);
-       if (!tmp) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    tmp = strdup(group);
+    if (!tmp) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       DbgFree(info->lb.info.script.group);
-       info->lb.info.script.group = tmp;
-       return LB_STATUS_SUCCESS;
+    DbgFree(info->dbox.info.script.group);
+    info->dbox.info.script.group = tmp;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
-HAPI const char * const package_pd_path(const struct pkg_info *info)
+HAPI const char * const package_gbar_path(const struct pkg_info *info)
 {
-       if (info->pd.type != PD_TYPE_SCRIPT) {
-               return NULL;
-       }
+    if (info->gbar.type != GBAR_TYPE_SCRIPT) {
+       return NULL;
+    }
 
-       return info->pd.info.script.path;
+    return info->gbar.info.script.path;
 }
 
-HAPI int package_set_pd_path(struct pkg_info *info, const char *path)
+HAPI int package_set_gbar_path(struct pkg_info *info, const char *path)
 {
-       char *tmp;
+    char *tmp;
 
-       if (info->pd.type != PD_TYPE_SCRIPT) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (info->gbar.type != GBAR_TYPE_SCRIPT) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       tmp = strdup(path);
-       if (!tmp) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    tmp = strdup(path);
+    if (!tmp) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       DbgFree(info->pd.info.script.path);
-       info->pd.info.script.path = tmp;
-       return LB_STATUS_SUCCESS;
+    DbgFree(info->gbar.info.script.path);
+    info->gbar.info.script.path = tmp;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
-HAPI const char * const package_pd_group(const struct pkg_info *info)
+HAPI const char * const package_gbar_group(const struct pkg_info *info)
 {
-       if (info->pd.type != PD_TYPE_SCRIPT) {
-               return NULL;
-       }
+    if (info->gbar.type != GBAR_TYPE_SCRIPT) {
+       return NULL;
+    }
 
-       return info->pd.info.script.group;
+    return info->gbar.info.script.group;
 }
 
-HAPI int package_set_pd_group(struct pkg_info *info, const char *group)
+HAPI int package_set_gbar_group(struct pkg_info *info, const char *group)
 {
-       char *tmp;
+    char *tmp;
 
-       if (info->pd.type != PD_TYPE_SCRIPT) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (info->gbar.type != GBAR_TYPE_SCRIPT) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       tmp = strdup(group);
-       if (!tmp) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    tmp = strdup(group);
+    if (!tmp) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       DbgFree(info->pd.info.script.group);
-       info->pd.info.script.group = tmp;
-       return LB_STATUS_SUCCESS;
+    DbgFree(info->gbar.info.script.group);
+    info->gbar.info.script.group = tmp;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI const int const package_pinup(const struct pkg_info *info)
 {
-       return info->lb.pinup;
+    return info->dbox.pinup;
 }
 
 HAPI void package_set_pinup(struct pkg_info *info, int pinup)
 {
-       info->lb.pinup = pinup;
+    info->dbox.pinup = pinup;
 }
 
 HAPI const char * const package_auto_launch(const struct pkg_info *info)
 {
-       return info->lb.auto_launch;
+    return info->dbox.auto_launch;
 }
 
 HAPI void package_set_auto_launch(struct pkg_info *info, const char *auto_launch)
 {
-       if (!auto_launch) {
-               auto_launch = "";
-       }
+    if (!auto_launch) {
+       auto_launch = "";
+    }
 
-       info->lb.auto_launch = strdup(auto_launch);
-       if (!info->lb.auto_launch) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return;
-       }
+    info->dbox.auto_launch = strdup(auto_launch);
+    if (!info->dbox.auto_launch) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return;
+    }
 }
 
 HAPI const unsigned int const package_size_list(const struct pkg_info *info)
 {
-       return info->lb.size_list;
+    return info->dbox.size_list;
 }
 
 HAPI void package_set_size_list(struct pkg_info *info, unsigned int size_list)
 {
-       info->lb.size_list = size_list;
+    info->dbox.size_list = size_list;
 }
 
-HAPI const int const package_pd_width(const struct pkg_info *info)
+HAPI const int const package_gbar_width(const struct pkg_info *info)
 {
-       return info->pd.width;
+    return info->gbar.width;
 }
 
-HAPI void package_set_pd_width(struct pkg_info *info, int width)
+HAPI void package_set_gbar_width(struct pkg_info *info, int width)
 {
-       info->pd.width = width;
+    info->gbar.width = width;
 }
 
-HAPI const int const package_pd_height(const struct pkg_info *info)
+HAPI const int const package_gbar_height(const struct pkg_info *info)
 {
-       return info->pd.height;
+    return info->gbar.height;
 }
 
-HAPI void package_set_pd_height(struct pkg_info *info, int height)
+HAPI void package_set_gbar_height(struct pkg_info *info, int height)
 {
-       info->pd.height = height;
+    info->gbar.height = height;
 }
 
 HAPI struct pkg_info * const package_ref(struct pkg_info *info)
 {
-       info->refcnt++;
-       return info;
+    info->refcnt++;
+    return info;
 }
 
 HAPI struct pkg_info * const package_unref(struct pkg_info *info)
 {
-       if (info->refcnt == 0) {
-               ErrPrint("Invalid request\n");
-               return NULL;
-       }
+    if (info->refcnt == 0) {
+       ErrPrint("Invalid request\n");
+       return NULL;
+    }
 
-       info->refcnt--;
-       if (info->refcnt == 0) {
-               destroy_package(info);
-               info = NULL;
-       }
+    info->refcnt--;
+    if (info->refcnt == 0) {
+       destroy_package(info);
+       info = NULL;
+    }
 
-       return info;
+    return info;
 }
 
 HAPI const int const package_refcnt(const struct pkg_info *info)
 {
-       return info->refcnt;
+    return info->refcnt;
 }
 
-HAPI const enum lb_type package_lb_type(const struct pkg_info *info)
+HAPI const enum dynamicbox_dbox_type package_dbox_type(const struct pkg_info *info)
 {
-       return info ? info->lb.type : LB_TYPE_NONE;
+    return info ? info->dbox.type : DBOX_TYPE_NONE;
 }
 
-HAPI void package_set_lb_type(struct pkg_info *info, enum lb_type type)
+HAPI void package_set_dbox_type(struct pkg_info *info, enum dynamicbox_dbox_type type)
 {
-       info->lb.type = type;
+    info->dbox.type = type;
 }
 
 HAPI const char * const package_libexec(struct pkg_info *info)
 {
-       return info->lb.libexec;
+    return info->dbox.libexec;
 }
 
 HAPI int package_set_libexec(struct pkg_info *info, const char *libexec)
 {
-       char *tmp;
+    char *tmp;
 
-       tmp = strdup(libexec);
-       if (!tmp) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    tmp = strdup(libexec);
+    if (!tmp) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       DbgFree(info->lb.libexec);
-       info->lb.libexec = tmp;
-       return LB_STATUS_SUCCESS;
+    DbgFree(info->dbox.libexec);
+    info->dbox.libexec = tmp;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int package_network(struct pkg_info *info)
 {
-       return info->network;
+    return info->network;
 }
 
 HAPI void package_set_network(struct pkg_info *info, int network)
 {
-       info->network = network;
+    info->network = network;
 }
 
-HAPI const enum pd_type const package_pd_type(const struct pkg_info *info)
+HAPI const enum dynamicbox_gbar_type const package_gbar_type(const struct pkg_info *info)
 {
-       return info ? info->pd.type : PD_TYPE_NONE;
+    return info ? info->gbar.type : GBAR_TYPE_NONE;
 }
 
-HAPI void package_set_pd_type(struct pkg_info *info, enum pd_type type)
+HAPI void package_set_gbar_type(struct pkg_info *info, enum dynamicbox_gbar_type type)
 {
-       info->pd.type = type;
+    info->gbar.type = type;
 }
 
 /*!
@@ -1069,405 +1060,392 @@ HAPI void package_set_pd_type(struct pkg_info *info, enum pd_type type)
  * Add the instance to the package info.
  * If a package has no slave, assign a new slave.
  */
-static inline int assign_new_slave(struct pkg_info *info)
+static inline int assign_new_slave(const char *slave_pkgname, struct pkg_info *info)
 {
-       char *s_name;
-       char *s_pkgname;
-       const char *tmp;
+    char *s_name;
 
-       s_name = util_slavename();
-       if (!s_name) {
-               ErrPrint("Failed to get a new slave name\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    s_name = util_slavename();
+    if (!s_name) {
+       ErrPrint("Failed to get a new slave name\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       tmp = abi_find_slave(info->abi);
-       if (!tmp) {
-               DbgFree(s_name);
-               ErrPrint("Failed to find a proper pkgname of a slave\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    DbgPrint("New slave[%s] is assigned for %s (using %s / abi[%s])\n", s_name, info->dbox_id, slave_pkgname, info->abi);
+    info->slave = slave_create(s_name, info->secured, info->abi, slave_pkgname, info->network);
 
-       s_pkgname = util_replace_string(tmp, REPLACE_TAG_APPID, info->lbid);
-       if (!s_pkgname) {
-               DbgPrint("Failed to get replaced string\n");
-               s_pkgname = strdup(tmp);
-               if (!s_pkgname) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       DbgFree(s_name);
-                       return LB_STATUS_ERROR_MEMORY;
-               }
-       }
+    DbgFree(s_name);
 
-       DbgPrint("New slave[%s] is assigned for %s (using %s / abi[%s])\n", s_name, info->lbid, s_pkgname, info->abi);
-       info->slave = slave_create(s_name, info->secured, info->abi, s_pkgname, info->network);
-
-       DbgFree(s_name);
-       DbgFree(s_pkgname);
-
-       if (!info->slave) {
-               /*!
-                * \note
-                * package_destroy will try to remove "info" from the pkg_list.
-                * but we didn't add this to it yet.
-                * If the list method couldn't find an "info" from the list,
-                * it just do nothing so I'll leave this.
-                */
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (!info->slave) {
        /*!
         * \note
-        * Slave is not activated yet.
+        * package_destroy will try to remove "info" from the pkg_list.
+        * but we didn't add this to it yet.
+        * If the list method couldn't find an "info" from the list,
+        * it just do nothing so I'll leave this.
         */
-       return LB_STATUS_SUCCESS;
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+    /*!
+     * \note
+     * Slave is not activated yet.
+     */
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int package_add_instance(struct pkg_info *info, struct inst_info *inst)
 {
-       if (!info->inst_list) {
-               info->slave = slave_find_available(info->abi, info->secured, info->network);
+    if (!info->inst_list) {
+       char *slave_pkgname;
 
-               if (!info->slave) {
-                       int ret;
+       slave_pkgname = slave_package_name(info->abi, info->dbox_id);
+       if (!slave_pkgname) {
+           return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+       }
 
-                       ret = assign_new_slave(info);
-                       if (ret < 0) {
-                               return ret;
-                       }
-               } else {
-                       DbgPrint("Slave %s is used for %s\n", slave_name(info->slave), info->lbid);
-               }
+       info->slave = slave_find_available(slave_pkgname, info->abi, info->secured, info->network);
+       if (!info->slave) {
+           int ret;
 
-               (void)slave_ref(info->slave);
-               slave_load_package(info->slave);
-               (void)slave_event_callback_add(info->slave, SLAVE_EVENT_DEACTIVATE, slave_deactivated_cb, info);
-               (void)slave_event_callback_add(info->slave, SLAVE_EVENT_ACTIVATE, slave_activated_cb, info);
-               (void)slave_event_callback_add(info->slave, SLAVE_EVENT_FAULT, slave_fault_cb, info);
+           ret = assign_new_slave(slave_pkgname, info);
+           DbgFree(slave_pkgname);
+           if (ret < 0) {
+               return ret;
+           }
+       } else {
+           DbgFree(slave_pkgname);
+           DbgPrint("Slave %s is used for %s\n", slave_name(info->slave), info->dbox_id);
+       }
 
-               if (info->secured) {
-                       (void)slave_event_callback_add(info->slave, SLAVE_EVENT_PAUSE, slave_paused_cb, info);
-                       (void)slave_event_callback_add(info->slave, SLAVE_EVENT_RESUME, slave_resumed_cb, info);
+       (void)slave_ref(info->slave);
+       slave_load_package(info->slave);
+       (void)slave_event_callback_add(info->slave, SLAVE_EVENT_DEACTIVATE, slave_deactivated_cb, info);
+       (void)slave_event_callback_add(info->slave, SLAVE_EVENT_ACTIVATE, slave_activated_cb, info);
+       (void)slave_event_callback_add(info->slave, SLAVE_EVENT_FAULT, slave_fault_cb, info);
 
-                       /*!
-                        * \note
-                        * In case of the slave is terminated because of expired TTL timer,
-                        * Master should freeze the all update time.
-                        * But the callback should check the slave's state to prevent from duplicated freezing.
-                        *
-                        * This callback will freeze the timer only if a slave doesn't running.
-                        */
-                       (void)xmonitor_add_event_callback(XMONITOR_PAUSED, xmonitor_paused_cb, info);
-                       (void)xmonitor_add_event_callback(XMONITOR_RESUMED, xmonitor_resumed_cb, info);
-               }
+       if (info->secured) {
+           (void)slave_event_callback_add(info->slave, SLAVE_EVENT_PAUSE, slave_paused_cb, info);
+           (void)slave_event_callback_add(info->slave, SLAVE_EVENT_RESUME, slave_resumed_cb, info);
+
+           /*!
+            * \note
+            * In case of the slave is terminated because of expired TTL timer,
+            * Master should freeze the all update time.
+            * But the callback should check the slave's state to prevent from duplicated freezing.
+            *
+            * This callback will freeze the timer only if a slave doesn't running.
+            */
+           (void)xmonitor_add_event_callback(XMONITOR_PAUSED, xmonitor_paused_cb, info);
+           (void)xmonitor_add_event_callback(XMONITOR_RESUMED, xmonitor_resumed_cb, info);
        }
+    }
 
-       info->inst_list = eina_list_append(info->inst_list, inst);
-       return LB_STATUS_SUCCESS;
+    info->inst_list = eina_list_append(info->inst_list, inst);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int package_del_instance(struct pkg_info *info, struct inst_info *inst)
 {
-       info->inst_list = eina_list_remove(info->inst_list, inst);
+    info->inst_list = eina_list_remove(info->inst_list, inst);
 
-       if (info->inst_list) {
-               return LB_STATUS_SUCCESS;
-       }
+    if (info->inst_list) {
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
-       if (info->slave) {
-               slave_unload_package(info->slave);
+    if (info->slave) {
+       slave_unload_package(info->slave);
 
-               slave_event_callback_del(info->slave, SLAVE_EVENT_FAULT, slave_fault_cb, info);
-               slave_event_callback_del(info->slave, SLAVE_EVENT_DEACTIVATE, slave_deactivated_cb, info);
-               slave_event_callback_del(info->slave, SLAVE_EVENT_ACTIVATE, slave_activated_cb, info);
+       slave_event_callback_del(info->slave, SLAVE_EVENT_FAULT, slave_fault_cb, info);
+       slave_event_callback_del(info->slave, SLAVE_EVENT_DEACTIVATE, slave_deactivated_cb, info);
+       slave_event_callback_del(info->slave, SLAVE_EVENT_ACTIVATE, slave_activated_cb, info);
 
-               if (info->secured) {
-                       slave_event_callback_del(info->slave, SLAVE_EVENT_PAUSE, slave_paused_cb, info);
-                       slave_event_callback_del(info->slave, SLAVE_EVENT_RESUME, slave_resumed_cb, info);
+       if (info->secured) {
+           slave_event_callback_del(info->slave, SLAVE_EVENT_PAUSE, slave_paused_cb, info);
+           slave_event_callback_del(info->slave, SLAVE_EVENT_RESUME, slave_resumed_cb, info);
 
-                       xmonitor_del_event_callback(XMONITOR_PAUSED, xmonitor_paused_cb, info);
-                       xmonitor_del_event_callback(XMONITOR_RESUMED, xmonitor_resumed_cb, info);
-               }
-
-               slave_unref(info->slave);
-               info->slave = NULL;
+           xmonitor_del_event_callback(XMONITOR_PAUSED, xmonitor_paused_cb, info);
+           xmonitor_del_event_callback(XMONITOR_RESUMED, xmonitor_resumed_cb, info);
        }
 
-       if (info->is_uninstalled) {
-               package_destroy(info);
-       }
+       slave_unref(info->slave);
+       info->slave = NULL;
+    }
 
-       return LB_STATUS_SUCCESS;
+    if (info->is_uninstalled) {
+       package_destroy(info);
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI Eina_List *package_instance_list(struct pkg_info *info)
 {
-       return info->inst_list;
+    return info->inst_list;
 }
 
 static int client_created_cb(struct client_node *client, void *data)
 {
-       struct pkg_info *info;
-       Eina_List *l;
+    struct pkg_info *info;
+    Eina_List *l;
 
-       struct inst_info *inst;
-       Eina_List *i_l;
+    struct inst_info *inst;
+    Eina_List *i_l;
 
-       EINA_LIST_FOREACH(s_info.pkg_list, l, info) {
-               if (info->fault_info) {
-                       fault_unicast_info(client, info->lbid, info->fault_info->filename, info->fault_info->function);
-                       continue;
-               }
-
-               EINA_LIST_FOREACH(info->inst_list, i_l, inst) {
-                       switch (instance_state(inst)) {
-                       case INST_INIT:
-                               /* Will be send a created event after the instance gets created event */
-                               break;
-                       case INST_ACTIVATED: /*!< This instance is actiavted, and used */
-                       case INST_REQUEST_TO_REACTIVATE: /*!< This instance will be reactivated soon */
-                       case INST_REQUEST_TO_DESTROY: /*!< This instance will be destroy soon */
-                               if (instance_client(inst) == client) {
-                                       instance_unicast_created_event(inst, client);
-                               } else if (instance_client(inst) == NULL) {
-                                       /*!
-                                        * \note
-                                        * Instances are lives in the system cluster/sub-cluster
-                                        */
-                                       if (client_is_subscribed(client, instance_cluster(inst), instance_category(inst))) {
-                                               instance_unicast_created_event(inst, client);
-                                               DbgPrint("(Subscribed) Created package: %s\n", info->lbid);
-                                       }
-                               }
-
-                               break;
-                       default:
-                               DbgPrint("%s(%s) is not activated (%d)\n",
-                                               package_name(info), instance_id(inst), instance_state(inst));
-                               break;
+    EINA_LIST_FOREACH(s_info.pkg_list, l, info) {
+       if (info->fault_info) {
+           fault_unicast_info(client, info->dbox_id, info->fault_info->filename, info->fault_info->function);
+           continue;
+       }
+
+       EINA_LIST_FOREACH(info->inst_list, i_l, inst) {
+           switch (instance_state(inst)) {
+               case INST_INIT:
+                   /* Will be send a created event after the instance gets created event */
+                   break;
+               case INST_ACTIVATED: /*!< This instance is actiavted, and used */
+               case INST_REQUEST_TO_REACTIVATE: /*!< This instance will be reactivated soon */
+               case INST_REQUEST_TO_DESTROY: /*!< This instance will be destroy soon */
+                   if (instance_client(inst) == client) {
+                       instance_unicast_created_event(inst, client);
+                   } else if (instance_client(inst) == NULL) {
+                       /*!
+                        * \note
+                        * Instances are lives in the system cluster/sub-cluster
+                        */
+                       if (client_is_subscribed(client, instance_cluster(inst), instance_category(inst))) {
+                           instance_unicast_created_event(inst, client);
+                           DbgPrint("(Subscribed) Created package: %s\n", info->dbox_id);
                        }
-               }
+                   }
+
+                   break;
+               default:
+                   DbgPrint("%s(%s) is not activated (%d)\n",
+                           package_name(info), instance_id(inst), instance_state(inst));
+                   break;
+           }
        }
+    }
 
-       return 0;
+    return 0;
 }
 
-static int io_uninstall_cb(const char *pkgid, const char *lbid, int prime, void *data)
+static int io_uninstall_cb(const char *pkgid, const char *dbox_id, int prime, void *data)
 {
-       struct pkg_info *info;
-       Eina_List *l;
-       Eina_List *n;
-       struct inst_info *inst;
-
-       DbgPrint("Package %s is uninstalled\n", lbid);
-       info = package_find(lbid);
-       if (!info) {
-               DbgPrint("%s is not yet loaded\n", lbid);
-               return 0;
-       }
+    struct pkg_info *info;
+    Eina_List *l;
+    Eina_List *n;
+    struct inst_info *inst;
 
-       info->is_uninstalled = 1;
+    DbgPrint("Package %s is uninstalled\n", dbox_id);
+    info = package_find(dbox_id);
+    if (!info) {
+       DbgPrint("%s is not yet loaded\n", dbox_id);
+       return 0;
+    }
 
-       /*!
-        * \NOTE
-        * Don't delete an item from the inst_list.
-        * destroy callback will use this list again.
-        * So, Don't touch it from here.
-        */
-       if (info->inst_list) {
-               EINA_LIST_FOREACH_SAFE(info->inst_list, l, n, inst) {
-                       instance_destroy(inst, INSTANCE_DESTROY_UNINSTALL);
-               }
-       } else {
-               package_destroy(info);
+    info->is_uninstalled = 1;
+
+    /*!
+     * \NOTE
+     * Don't delete an item from the inst_list.
+     * destroy callback will use this list again.
+     * So, Don't touch it from here.
+     */
+    if (info->inst_list) {
+       EINA_LIST_FOREACH_SAFE(info->inst_list, l, n, inst) {
+           instance_destroy(inst, DBOX_DESTROY_TYPE_UNINSTALL);
        }
+    } else {
+       package_destroy(info);
+    }
 
-       return 0;
+    return 0;
 }
 
 static inline void reload_package_info(struct pkg_info *info)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct inst_info *inst;
-       unsigned int size_type;
-       int width;
-       int height;
-       double old_period;
-
-       DbgPrint("Already exists, try to update it\n");
-
-       old_period = info->lb.period;
-
-       group_del_livebox(info->lbid);
-       package_clear_fault(info);
-
-       /*!
-        * \NOTE:
-        * Nested DB I/O
-        */
-       io_load_package_db(info);
-
-       /*!
-        * \note
-        * Without "is_uninstalled", the package will be kept
-        */
-       EINA_LIST_FOREACH_SAFE(info->inst_list, l, n, inst) {
-               width = instance_lb_width(inst);
-               height = instance_lb_height(inst);
-               size_type = livebox_service_size_type(width, height);
-               if (info->lb.size_list & size_type) {
-                       if (instance_period(inst) == old_period) {
-                               instance_reload_period(inst, package_period(info));
-                       }
-                       instance_reload(inst, INSTANCE_DESTROY_UPGRADE);
-               } else {
-                       instance_destroy(inst, INSTANCE_DESTROY_UNINSTALL);
-               }
+    Eina_List *l;
+    Eina_List *n;
+    struct inst_info *inst;
+    unsigned int size_type;
+    int width;
+    int height;
+    double old_period;
+
+    DbgPrint("Already exists, try to update it\n");
+
+    old_period = info->dbox.period;
+
+    group_del_dynamicbox(info->dbox_id);
+    package_clear_fault(info);
+
+    /*!
+     * \NOTE:
+     * Nested DB I/O
+     */
+    io_load_package_db(info);
+
+    /*!
+     * \note
+     * Without "is_uninstalled", the package will be kept
+     */
+    EINA_LIST_FOREACH_SAFE(info->inst_list, l, n, inst) {
+       width = instance_dbox_width(inst);
+       height = instance_dbox_height(inst);
+       size_type = dynamicbox_service_size_type(width, height);
+       if (info->dbox.size_list & size_type) {
+           if (instance_period(inst) == old_period) {
+               instance_reload_period(inst, package_period(info));
+           }
+           instance_reload(inst, DBOX_DESTROY_TYPE_UPGRADE);
+       } else {
+           instance_destroy(inst, DBOX_DESTROY_TYPE_UNINSTALL);
        }
+    }
 }
 
-static int io_install_cb(const char *pkgid, const char *lbid, int prime, void *data)
+static int io_install_cb(const char *pkgid, const char *dbox_id, int prime, void *data)
 {
-       struct pkg_info *info;
+    struct pkg_info *info;
 
-       info = package_find(lbid);
-       if (info) {
-               /*!
-                * Already exists. skip to create this.
-                */
-               return 0;
-       }
+    info = package_find(dbox_id);
+    if (info) {
+       /*!
+        * Already exists. skip to create this.
+        */
+       return 0;
+    }
 
-       info = package_create(pkgid, lbid);
-       if (!info) {
-               ErrPrint("Failed to build an info %s\n", lbid);
-       } else {
-               DbgPrint("Livebox %s is built\n", lbid);
-       }
+    info = package_create(pkgid, dbox_id);
+    if (!info) {
+       ErrPrint("Failed to build an info %s\n", dbox_id);
+    } else {
+       DbgPrint("Dynamicbox %s is built\n", dbox_id);
+    }
 
-       return 0;
+    return 0;
 }
 
 static int uninstall_cb(const char *pkgname, enum pkgmgr_status status, double value, void *data)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct pkg_info *info;
+    Eina_List *l;
+    Eina_List *n;
+    struct pkg_info *info;
 
-       if (status != PKGMGR_STATUS_END) {
-               return 0;
-       }
+    if (status != PKGMGR_STATUS_END) {
+       return 0;
+    }
 
-       EINA_LIST_FOREACH_SAFE(s_info.pkg_list, l, n, info) {
-               if (!strcmp(info->pkgid, pkgname)) {
-                       io_uninstall_cb(pkgname, info->lbid, -1, NULL);
-               }
+    EINA_LIST_FOREACH_SAFE(s_info.pkg_list, l, n, info) {
+       if (!strcmp(info->pkgid, pkgname)) {
+           io_uninstall_cb(pkgname, info->dbox_id, -1, NULL);
        }
+    }
 
-       return 0;
+    return 0;
 }
 
 static int update_cb(const char *pkgname, enum pkgmgr_status status, double value, void *data)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct pkg_info *info;
+    Eina_List *l;
+    Eina_List *n;
+    struct pkg_info *info;
 
-       if (status != PKGMGR_STATUS_END) {
-               return 0;
-       }
+    if (status != PKGMGR_STATUS_END) {
+       return 0;
+    }
 
-       EINA_LIST_FOREACH_SAFE(s_info.pkg_list, l, n, info) {
-               if (!strcmp(info->pkgid, pkgname)) {
-                       DbgPrint("Update lbid: %s\n", info->lbid);
-                       if (io_is_exists(info->lbid) == 1) {
-                               reload_package_info(info);
-                       } else {
-                               io_uninstall_cb(pkgname, info->lbid, -1, NULL);
-                       }
-               }
+    EINA_LIST_FOREACH_SAFE(s_info.pkg_list, l, n, info) {
+       if (!strcmp(info->pkgid, pkgname)) {
+           DbgPrint("Update dbox_id: %s\n", info->dbox_id);
+           if (io_is_exists(info->dbox_id) == 1) {
+               reload_package_info(info);
+           } else {
+               io_uninstall_cb(pkgname, info->dbox_id, -1, NULL);
+           }
        }
+    }
 
-       (void)io_update_livebox_package(pkgname, io_install_cb, NULL);
-       return 0;
+    (void)io_update_dynamicbox_package(pkgname, io_install_cb, NULL);
+    return 0;
 }
 
-static int crawling_liveboxes(const char *pkgid, const char *lbid, int prime, void *data)
+static int crawling_dynamicboxes(const char *pkgid, const char *dbox_id, int prime, void *data)
 {
-       if (package_find(lbid)) {
-               ErrPrint("Information of %s is already built\n", lbid);
-       } else {
-               struct pkg_info *info;
-               info = package_create(pkgid, lbid);
-               if (info) {
-                       DbgPrint("[%s] information is built prime(%d)\n", lbid, prime);
-               }
+    if (package_find(dbox_id)) {
+       ErrPrint("Information of %s is already built\n", dbox_id);
+    } else {
+       struct pkg_info *info;
+       info = package_create(pkgid, dbox_id);
+       if (info) {
+           DbgPrint("[%s] information is built prime(%d)\n", dbox_id, prime);
        }
+    }
 
-       return 0;
+    return 0;
 }
 
 HAPI int package_init(void)
 {
-       client_global_event_handler_add(CLIENT_GLOBAL_EVENT_CREATE, client_created_cb, NULL);
-       pkgmgr_init();
+    client_global_event_handler_add(CLIENT_GLOBAL_EVENT_CREATE, client_created_cb, NULL);
+    pkgmgr_init();
 
-       pkgmgr_add_event_callback(PKGMGR_EVENT_INSTALL, update_cb, NULL);
-       pkgmgr_add_event_callback(PKGMGR_EVENT_UNINSTALL, uninstall_cb, NULL);
-       pkgmgr_add_event_callback(PKGMGR_EVENT_UPDATE, update_cb, NULL);
+    pkgmgr_add_event_callback(PKGMGR_EVENT_INSTALL, update_cb, NULL);
+    pkgmgr_add_event_callback(PKGMGR_EVENT_UNINSTALL, uninstall_cb, NULL);
+    pkgmgr_add_event_callback(PKGMGR_EVENT_UPDATE, update_cb, NULL);
 
-       io_crawling_liveboxes(crawling_liveboxes, NULL);
-       return 0;
+    io_crawling_dynamicboxes(crawling_dynamicboxes, NULL);
+    return 0;
 }
 
 HAPI int package_fini(void)
 {
-       Eina_List *p_l;
-       Eina_List *p_n;
-       Eina_List *i_l;
-       Eina_List *i_n;
-       struct pkg_info *info;
-       struct inst_info *inst;
-
-       pkgmgr_del_event_callback(PKGMGR_EVENT_INSTALL, update_cb, NULL);
-       pkgmgr_del_event_callback(PKGMGR_EVENT_UNINSTALL, uninstall_cb, NULL);
-       pkgmgr_del_event_callback(PKGMGR_EVENT_UPDATE, update_cb, NULL);
-       pkgmgr_fini();
-       client_global_event_handler_del(CLIENT_GLOBAL_EVENT_CREATE, client_created_cb, NULL);
-
-       EINA_LIST_FOREACH_SAFE(s_info.pkg_list, p_l, p_n, info) {
-               EINA_LIST_FOREACH_SAFE(info->inst_list, i_l, i_n, inst) {
-                       instance_state_reset(inst);
-                       instance_destroy(inst, INSTANCE_DESTROY_TERMINATE);
-               }
+    Eina_List *p_l;
+    Eina_List *p_n;
+    Eina_List *i_l;
+    Eina_List *i_n;
+    struct pkg_info *info;
+    struct inst_info *inst;
 
-               package_destroy(info);
+    pkgmgr_del_event_callback(PKGMGR_EVENT_INSTALL, update_cb, NULL);
+    pkgmgr_del_event_callback(PKGMGR_EVENT_UNINSTALL, uninstall_cb, NULL);
+    pkgmgr_del_event_callback(PKGMGR_EVENT_UPDATE, update_cb, NULL);
+    pkgmgr_fini();
+    client_global_event_handler_del(CLIENT_GLOBAL_EVENT_CREATE, client_created_cb, NULL);
+
+    EINA_LIST_FOREACH_SAFE(s_info.pkg_list, p_l, p_n, info) {
+       EINA_LIST_FOREACH_SAFE(info->inst_list, i_l, i_n, inst) {
+           instance_state_reset(inst);
+           instance_destroy(inst, DBOX_DESTROY_TYPE_TERMINATE);
        }
 
-       return 0;
+       package_destroy(info);
+    }
+
+    return 0;
 }
 
 HAPI const char *package_find_by_secured_slave(struct slave_node *slave)
 {
-       Eina_List *l;
-       struct pkg_info *info;
+    Eina_List *l;
+    struct pkg_info *info;
 
-       if (!slave_is_secured(slave)) {
-               return NULL;
-       }
+    if (!slave_is_secured(slave)) {
+       return NULL;
+    }
 
-       EINA_LIST_FOREACH(s_info.pkg_list, l, info) {
-               if (info->slave == slave) {
-                       return info->lbid;
-               }
+    EINA_LIST_FOREACH(s_info.pkg_list, l, info) {
+       if (info->slave == slave) {
+           return info->dbox_id;
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
 HAPI const char * const package_name(const struct pkg_info *info)
 {
-       return info->lbid;
+    return info->dbox_id;
 }
 
 /*!
@@ -1475,135 +1453,136 @@ HAPI const char * const package_name(const struct pkg_info *info)
  */
 HAPI int package_alter_instances_to_client(struct client_node *client, enum alter_type alter)
 {
-       struct pkg_info *info;
-       Eina_List *l;
-
-       struct inst_info *inst;
-       Eina_List *i_l;
-
-       EINA_LIST_FOREACH(s_info.pkg_list, l, info) {
-               EINA_LIST_FOREACH(info->inst_list, i_l, inst) {
-                       if (instance_client(inst)) {
-                               continue;
-                       }
-
-                       if (!client_is_subscribed(client, instance_cluster(inst), instance_category(inst))) {
-                               continue;
-                       }
-
-                       switch (instance_state(inst)) {
-                       case INST_INIT:
-                       case INST_REQUEST_TO_ACTIVATE:
-                               /* Will be send a created event after the instance gets created event */
-                               switch (alter) {
-                               case ALTER_CREATE:
-                                       if (!instance_has_client(inst, client)) {
-                                               instance_add_client(inst, client);
-                                       }
-                                       break;
-                               case ALTER_DESTROY:
-                                       if (instance_has_client(inst, client)) {
-                                               instance_del_client(inst, client);
-                                       }
-                                       break;
-                               default:
-                                       break;
-                               }
-                               break;
-                       case INST_ACTIVATED: /*!< This instance is actiavted, and used */
-                       case INST_REQUEST_TO_REACTIVATE: /*!< This instance will be reactivated soon */
-                       case INST_REQUEST_TO_DESTROY: /*!< This instance will be destroy soon */
-                               /*!
-                                * \note
-                                * Instances are lives in the system cluster/sub-cluster
-                                */
-                               switch (alter) {
-                               case ALTER_CREATE:
-                                       if (!instance_has_client(inst, client)) {
-                                               instance_unicast_created_event(inst, client);
-                                               instance_add_client(inst, client);
-                                               DbgPrint("(Subscribed) Created package: %s\n", info->lbid);
-                                       }
-                                       break;
-                               case ALTER_DESTROY:
-                                       if (instance_has_client(inst, client)) {
-                                               instance_unicast_deleted_event(inst, client, LB_STATUS_SUCCESS);
-                                               instance_del_client(inst, client);
-                                       }
-                                       break;
-                               default:
-                                       break;
-                               }
-
-                               break;
+    struct pkg_info *info;
+    Eina_List *l;
+
+    struct inst_info *inst;
+    Eina_List *i_l;
+
+    EINA_LIST_FOREACH(s_info.pkg_list, l, info) {
+       EINA_LIST_FOREACH(info->inst_list, i_l, inst) {
+           if (instance_client(inst)) {
+               continue;
+           }
+
+           if (!client_is_subscribed(client, instance_cluster(inst), instance_category(inst))) {
+               continue;
+           }
+
+           switch (instance_state(inst)) {
+               case INST_INIT:
+               case INST_REQUEST_TO_ACTIVATE:
+                   /* Will be send a created event after the instance gets created event */
+                   switch (alter) {
+                       case ALTER_CREATE:
+                           if (!instance_has_client(inst, client)) {
+                               instance_add_client(inst, client);
+                           }
+                           break;
+                       case ALTER_DESTROY:
+                           if (instance_has_client(inst, client)) {
+                               instance_del_client(inst, client);
+                           }
+                           break;
                        default:
-                               DbgPrint("%s(%s) is not activated (%d)\n",
-                                               package_name(info), instance_id(inst), instance_state(inst));
-                               break;
-                       }
-               }
+                           break;
+                   }
+                   break;
+               case INST_ACTIVATED: /*!< This instance is actiavted, and used */
+               case INST_REQUEST_TO_REACTIVATE: /*!< This instance will be reactivated soon */
+               case INST_REQUEST_TO_DESTROY: /*!< This instance will be destroy soon */
+                   /*!
+                    * \note
+                    * Instances are lives in the system cluster/sub-cluster
+                    */
+                   switch (alter) {
+                       case ALTER_CREATE:
+                           if (!instance_has_client(inst, client)) {
+                               instance_unicast_created_event(inst, client);
+                               instance_add_client(inst, client);
+                               DbgPrint("(Subscribed) Created package: %s\n", info->dbox_id);
+                           }
+                           break;
+                       case ALTER_DESTROY:
+                           if (instance_has_client(inst, client)) {
+                               instance_unicast_deleted_event(inst, client, DBOX_STATUS_ERROR_NONE);
+                               instance_del_client(inst, client);
+                           }
+                           break;
+                       default:
+                           break;
+                   }
+
+                   break;
+               default:
+                   DbgPrint("%s(%s) is not activated (%d)\n",
+                           package_name(info), instance_id(inst), instance_state(inst));
+                   break;
+           }
        }
+    }
 
-       return 0;
+    return 0;
 }
 
 HAPI const Eina_List *package_list(void)
 {
-       return s_info.pkg_list;
+    return s_info.pkg_list;
 }
 
 HAPI int const package_fault_count(struct pkg_info *info)
 {
-       return info ? info->fault_count : 0;
+    return info ? info->fault_count : 0;
 }
 
 HAPI int package_is_enabled(const char *appid)
 {
-       ail_appinfo_h ai;
-       bool enabled;
-       int ret;
-
-       ret = ail_get_appinfo(appid, &ai);
-       if (ret != AIL_ERROR_OK) {
-               ErrPrint("Unable to get appinfo: %d\n", ret);
-               return 0;
-       }
+    pkgmgrinfo_appinfo_h handle;
+    bool enabled;
+    int ret;
 
-       if (ail_appinfo_get_bool(ai, AIL_PROP_X_SLP_ENABLED_BOOL, &enabled) != AIL_ERROR_OK) {
-               enabled = false;
-       }
+    ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+    if (ret != PMINFO_R_OK) {
+       ErrPrint("Failed to get info\n");
+       return 0;
+    }
 
-       ail_destroy_appinfo(ai);
+    ret = pkgmgrinfo_appinfo_is_enabled(handle, &enabled);
+    if (ret != PMINFO_R_OK) {
+       ErrPrint("Failed to get info\n");
+       enabled = false;
+    }
 
-       return enabled == true;
+    pkgmgrinfo_appinfo_destroy_appinfo(handle);
+    return enabled == true;
 }
 
 HAPI int package_faulted(struct pkg_info *pkg, int broadcast)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct slave_node *slave;
-       struct inst_info *inst;
-
-       slave = package_slave(pkg);
-       if (!slave) {
-               ErrPrint("Package has no slave?\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       /* Emulated fault routine */
-       // (void)package_set_fault_info(pkg, util_timestamp(), slave_name(slave), __func__);
-       if (broadcast) {
-               fault_broadcast_info(package_name(pkg), slave_name(slave), __func__);
-       }
-
-       DbgPrint("package: %s (forucely faulted %s)\n", package_name(pkg), slave_name(slave));
-       EINA_LIST_FOREACH_SAFE(pkg->inst_list, l, n, inst) {
-               DbgPrint("Destroy instance %p\n", inst);
-               instance_destroy(inst, INSTANCE_DESTROY_FAULT);
-       }
-
-       return LB_STATUS_SUCCESS;
+    Eina_List *l;
+    Eina_List *n;
+    struct slave_node *slave;
+    struct inst_info *inst;
+
+    slave = package_slave(pkg);
+    if (!slave) {
+       ErrPrint("Package has no slave?\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    /* Emulated fault routine */
+    // (void)package_set_fault_info(pkg, util_timestamp(), slave_name(slave), __func__);
+    if (broadcast) {
+       fault_broadcast_info(package_name(pkg), slave_name(slave), __func__);
+    }
+
+    DbgPrint("package: %s (forucely faulted %s)\n", package_name(pkg), slave_name(slave));
+    EINA_LIST_FOREACH_SAFE(pkg->inst_list, l, n, inst) {
+       DbgPrint("Destroy instance %p\n", inst);
+       instance_destroy(inst, DBOX_DESTROY_TYPE_FAULT);
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 /* End of a file */
index a7633bd..58a667a 100644 (file)
@@ -22,8 +22,9 @@
 #include <Eina.h>
 #include <dlog.h>
 
-#include <livebox-service.h>
-#include <livebox-errno.h>
+#include <dynamicbox_service.h>
+#include <dynamicbox_errno.h>
+#include <dynamicbox_conf.h>
 
 #include "util.h"
 #include "debug.h"
@@ -40,290 +41,290 @@ int errno;
 #endif
 
 struct parser {
-       char *filename;
-       double period;
-       int timeout;
-       int network;
-       char *auto_launch;
-       unsigned int size;
-       unsigned int pd_width;
-       unsigned int pd_height;
-       char *group;
-       int secured;
-
-       char *pd_path;
-       char *pd_group;
-
-       char *lb_path;
-       char *lb_group;
-       int pinup;
-       int text_pd;
-       int text_lb;
-       int buffer_pd;
-       int buffer_lb;
-
-       char *abi;
-
-       char *script;
+    char *filename;
+    double period;
+    int timeout;
+    int network;
+    char *auto_launch;
+    unsigned int size;
+    unsigned int gbar_width;
+    unsigned int gbar_height;
+    char *group;
+    int secured;
+
+    char *gbar_path;
+    char *gbar_group;
+
+    char *dbox_path;
+    char *dbox_group;
+    int pinup;
+    int text_gbar;
+    int text_lb;
+    int buffer_gbar;
+    int buffer_lb;
+
+    char *abi;
+
+    char *script;
 };
 
 HAPI double parser_period(struct parser *handle)
 {
-       return handle->period;
+    return handle->period;
 }
 
 HAPI int parser_network(struct parser *handle)
 {
-       return handle->network;
+    return handle->network;
 }
 
 HAPI int parser_timeout(struct parser *handle)
 {
-       return handle->timeout;
+    return handle->timeout;
 }
 
 HAPI const char *parser_auto_launch(struct parser *handle)
 {
-       return handle->auto_launch;
+    return handle->auto_launch;
 }
 
 HAPI const char *parser_script(struct parser *handle)
 {
-       return handle->script;
+    return handle->script;
 }
 
 HAPI const char *parser_abi(struct parser *handle)
 {
-       return handle->abi;
+    return handle->abi;
 }
 
 HAPI unsigned int parser_size(struct parser *handle)
 {
-       return handle->size;
+    return handle->size;
 }
 
-HAPI const char *parser_lb_path(struct parser *handle)
+HAPI const char *parser_dbox_path(struct parser *handle)
 {
-       return handle->lb_path;
+    return handle->dbox_path;
 }
 
-HAPI const char *parser_lb_group(struct parser *handle)
+HAPI const char *parser_dbox_group(struct parser *handle)
 {
-       return handle->lb_group;
+    return handle->dbox_group;
 }
 
-HAPI const char *parser_pd_path(struct parser *handle)
+HAPI const char *parser_gbar_path(struct parser *handle)
 {
-       return handle->pd_path;
+    return handle->gbar_path;
 }
 
-HAPI const char *parser_pd_group(struct parser *handle)
+HAPI const char *parser_gbar_group(struct parser *handle)
 {
-       return handle->pd_group;
+    return handle->gbar_group;
 }
 
 HAPI const char *parser_group_str(struct parser *handle)
 {
-       return handle->group;
+    return handle->group;
 }
 
 HAPI int parser_secured(struct parser *handle)
 {
-       return handle->secured;
+    return handle->secured;
 }
 
-HAPI void parser_get_pdsize(struct parser *handle, unsigned int *width, unsigned int *height)
+HAPI void parser_get_gbar_size(struct parser *handle, unsigned int *width, unsigned int *height)
 {
-       *width = handle->pd_width;
-       *height = handle->pd_height;
+    *width = handle->gbar_width;
+    *height = handle->gbar_height;
 }
 
 HAPI int parser_pinup(struct parser *handle)
 {
-       return handle->pinup;
+    return handle->pinup;
 }
 
-HAPI int parser_text_lb(struct parser *handle)
+HAPI int parser_text_dbox(struct parser *handle)
 {
-       return handle->text_lb;
+    return handle->text_lb;
 }
 
-HAPI int parser_text_pd(struct parser *handle)
+HAPI int parser_text_gbar(struct parser *handle)
 {
-       return handle->text_pd;
+    return handle->text_gbar;
 }
 
-HAPI int parser_buffer_lb(struct parser *handle)
+HAPI int parser_buffer_dbox(struct parser *handle)
 {
-       return handle->buffer_lb;
+    return handle->buffer_lb;
 }
 
-HAPI int parser_buffer_pd(struct parser *handle)
+HAPI int parser_buffer_gbar(struct parser *handle)
 {
-       return handle->buffer_pd;
+    return handle->buffer_gbar;
 }
 
 HAPI RETURN_TYPE parser_find(const char *pkgname)
 {
-       Eina_List *l;
-       struct parser *item;
-       char *filename;
-       int len;
-       int ret;
+    Eina_List *l;
+    struct parser *item;
+    char *filename;
+    int len;
+    int ret;
 
-       len = strlen(pkgname) * 2 + strlen(CONF_PATH);
+    len = strlen(pkgname) * 2 + strlen(DYNAMICBOX_CONF_CONF_PATH);
 
-       filename = malloc(len);
-       if (!filename) {
-               return (RETURN_TYPE)0;
-       }
+    filename = malloc(len);
+    if (!filename) {
+       return (RETURN_TYPE)0;
+    }
 
-       ret = snprintf(filename, len, CONF_PATH, pkgname, pkgname);
-       if (ret < 0) {
-               DbgFree(filename);
-               return (RETURN_TYPE)0;
-       }
+    ret = snprintf(filename, len, DYNAMICBOX_CONF_CONF_PATH, pkgname, pkgname);
+    if (ret < 0) {
+       DbgFree(filename);
+       return (RETURN_TYPE)0;
+    }
 
-       DbgPrint("Conf file %s for package %s\n", filename, pkgname);
+    DbgPrint("Conf file %s for package %s\n", filename, pkgname);
 
-       EINA_LIST_FOREACH(s_list, l, item) {
-               if (!strcmp(item->filename, filename)) {
-                       DbgFree(filename);
-                       return (RETURN_TYPE)item;
-               }
+    EINA_LIST_FOREACH(s_list, l, item) {
+       if (!strcmp(item->filename, filename)) {
+           DbgFree(filename);
+           return (RETURN_TYPE)item;
        }
+    }
 
-       DbgFree(filename);
-       return (RETURN_TYPE)0;
+    DbgFree(filename);
+    return (RETURN_TYPE)0;
 }
 
 static inline int parse_size(const char *buffer, unsigned int *size)
 {
-       register int i;
-       int w;
-       int h;
-
-       enum {
-               START,
-               WIDTH,
-               DELIM,
-               HEIGHT,
-               ERROR,
-               STOP,
-               END
-       } state;
-
-       *size = 0;
-       state = START;
-       i = 0;
-       w = 0;
-       h = 0;
-
-       while (state != ERROR && state != END) {
-               switch (state) {
-               case START:
-                       switch (buffer[i]) {
-                       case '1'...'9':
-                               state = WIDTH;
-                               break;
-                       case ' ':
-                       case '\t':
-                       case ';':
-                               i++;
-                               break;
-                       case '\0':
-                               state = END;
-                               break;
-                       default:
-                               state = ERROR;
-                               break;
-                       }
-                       break;
-               case WIDTH:
-                       switch (buffer[i]) {
-                       case '0'...'9':
-                               w = (w * 10) + (buffer[i] - '0');
-                               i++;
-                               break;
-                       case 'x':
-                               state = DELIM;
-                               i++;
-                               break;
-                       default:
-                               state = ERROR;
-                               break;
-                       }
-
-                       break;
-               case DELIM:
-                       switch (buffer[i]) {
-                       case '1'...'9':
-                               state = HEIGHT;
-                               break;
-                       case ' ':
-                       case '\t':
-                               i++;
-                               break;
-                       default:
-                               state = ERROR;
-                               break;
-                       }
-                       break;
-               case HEIGHT:
-                       switch (buffer[i]) {
-                       case '0'...'9':
-                               h = (h * 10) + (buffer[i] - '0');
-                               i++;
-                               break;
-                       case ';':
-                       case '\0':
-                               state = STOP;
-                               break;
-                       default:
-                               state = ERROR;
-                               break;
-                       }
-                       break;
-               case STOP:
-                       if (w == 1 && h == 1) {
-                               *size |= LB_SIZE_TYPE_1x1;
-                       } else if (w == 2 && h == 1) {
-                               *size |= LB_SIZE_TYPE_2x1;
-                       } else if (w == 2 && h == 2) {
-                               *size |= LB_SIZE_TYPE_2x2;
-                       } else if (w == 4 && h == 1) {
-                               *size |= LB_SIZE_TYPE_4x1;
-                       } else if (w == 4 && h == 2) {
-                               *size |= LB_SIZE_TYPE_4x2;
-                       } else if (w == 4 && h == 3) {
-                               *size |= LB_SIZE_TYPE_4x3;
-                       } else if (w == 4 && h == 4) {
-                               *size |= LB_SIZE_TYPE_4x4;
-                       } else if (w == 21 && h == 21) {
-                               *size |= LB_SIZE_TYPE_EASY_1x1;
-                       } else if (w == 23 && h == 21) {
-                               *size |= LB_SIZE_TYPE_EASY_3x1;
-                       } else if (w == 23 && h == 23) {
-                               *size |= LB_SIZE_TYPE_EASY_3x3;
-                       } else {
-                               ErrPrint("Invalid size type: %dx%d\n", w, h);
-                       }
-
-                       if (buffer[i] == ';') {
-                               state = START;
-                       } else if (buffer[i] == '\0') {
-                               state = END;
-                       }
-
-                       w = 0;
-                       h = 0;
-                       break;
-               default:
-                       return -1;
-               }
-       }
-
-       return *size ? 0 : -1;
+    register int i;
+    int w;
+    int h;
+
+    enum {
+       START,
+       WIDTH,
+       DELIM,
+       HEIGHT,
+       ERROR,
+       STOP,
+       END
+    } state;
+
+    *size = 0;
+    state = START;
+    i = 0;
+    w = 0;
+    h = 0;
+
+    while (state != ERROR && state != END) {
+       switch (state) {
+       case START:
+           switch (buffer[i]) {
+           case '1'...'9':
+               state = WIDTH;
+               break;
+           case ' ':
+           case '\t':
+           case ';':
+               i++;
+               break;
+           case '\0':
+               state = END;
+               break;
+           default:
+               state = ERROR;
+               break;
+           }
+           break;
+       case WIDTH:
+           switch (buffer[i]) {
+           case '0'...'9':
+               w = (w * 10) + (buffer[i] - '0');
+               i++;
+               break;
+           case 'x':
+               state = DELIM;
+               i++;
+               break;
+           default:
+               state = ERROR;
+               break;
+           }
+
+           break;
+       case DELIM:
+           switch (buffer[i]) {
+           case '1'...'9':
+               state = HEIGHT;
+               break;
+           case ' ':
+           case '\t':
+               i++;
+               break;
+           default:
+               state = ERROR;
+               break;
+           }
+           break;
+       case HEIGHT:
+           switch (buffer[i]) {
+           case '0'...'9':
+               h = (h * 10) + (buffer[i] - '0');
+               i++;
+               break;
+           case ';':
+           case '\0':
+               state = STOP;
+               break;
+           default:
+               state = ERROR;
+               break;
+           }
+           break;
+       case STOP:
+           if (w == 1 && h == 1) {
+               *size |= DBOX_SIZE_TYPE_1x1;
+           } else if (w == 2 && h == 1) {
+               *size |= DBOX_SIZE_TYPE_2x1;
+           } else if (w == 2 && h == 2) {
+               *size |= DBOX_SIZE_TYPE_2x2;
+           } else if (w == 4 && h == 1) {
+               *size |= DBOX_SIZE_TYPE_4x1;
+           } else if (w == 4 && h == 2) {
+               *size |= DBOX_SIZE_TYPE_4x2;
+           } else if (w == 4 && h == 3) {
+               *size |= DBOX_SIZE_TYPE_4x3;
+           } else if (w == 4 && h == 4) {
+               *size |= DBOX_SIZE_TYPE_4x4;
+           } else if (w == 21 && h == 21) {
+               *size |= DBOX_SIZE_TYPE_EASY_1x1;
+           } else if (w == 23 && h == 21) {
+               *size |= DBOX_SIZE_TYPE_EASY_3x1;
+           } else if (w == 23 && h == 23) {
+               *size |= DBOX_SIZE_TYPE_EASY_3x3;
+           } else {
+               ErrPrint("Invalid size type: %dx%d\n", w, h);
+           }
+
+           if (buffer[i] == ';') {
+               state = START;
+           } else if (buffer[i] == '\0') {
+               state = END;
+           }
+
+           w = 0;
+           h = 0;
+           break;
+       default:
+           return -1;
+       }
+    }
+
+    return *size ? 0 : -1;
 }
 
 /*!
@@ -332,20 +333,20 @@ static inline int parse_size(const char *buffer, unsigned int *size)
  */
 static inline const char *rtrim(char *buffer)
 {
-       int len;
+    int len;
 
-       len = strlen(buffer);
-       while (len > 0 && isspace(buffer[len - 1])) {
-               len--;
-       }
+    len = strlen(buffer);
+    while (len > 0 && isspace(buffer[len - 1])) {
+       len--;
+    }
 
-       if (len <= 0) {
-               return NULL;
-       }
+    if (len <= 0) {
+       return NULL;
+    }
 
-       buffer[len] = '\0';
+    buffer[len] = '\0';
 
-       return buffer;
+    return buffer;
 }
 
 /*!
@@ -354,538 +355,538 @@ static inline const char *rtrim(char *buffer)
  */
 static inline char *dup_rtrim(char *buffer)
 {
-       char *ret;
+    char *ret;
 
-       if (!rtrim(buffer)) {
-               return NULL;
-       }
+    if (!rtrim(buffer)) {
+       return NULL;
+    }
 
-       ret = strdup(buffer);
-       if (!ret) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return NULL;
-       }
+    ret = strdup(buffer);
+    if (!ret) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
 
-       return ret;
+    return ret;
 }
 
 static void period_handler(struct parser *item, char *buffer)
 {
-       char *tmp = NULL;
+    char *tmp = NULL;
 
-       if (!rtrim(buffer)) {
-               return;
-       }
+    if (!rtrim(buffer)) {
+       return;
+    }
 
-       item->period = strtod(buffer, &tmp);
+    item->period = strtod(buffer, &tmp);
 }
 
 static void timeout_handler(struct parser *item, char *buffer)
 {
-       if (!rtrim(buffer)) {
-               return;
-       }
+    if (!rtrim(buffer)) {
+       return;
+    }
 
-       item->timeout = atoi(buffer);
+    item->timeout = atoi(buffer);
 }
 
 static void network_handler(struct parser *item, char *buffer)
 {
-       if (!rtrim(buffer)) {
-               return;
-       }
+    if (!rtrim(buffer)) {
+       return;
+    }
 
-       item->network = !!atoi(buffer);
+    item->network = !!atoi(buffer);
 }
 
 static void auto_launch_handler(struct parser *item, char *buffer)
 {
-       if (!rtrim(buffer)) {
-               return;
-       }
+    if (!rtrim(buffer)) {
+       return;
+    }
 
-       item->auto_launch = strdup(buffer);
-       if (!item->auto_launch) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return;
-       }
+    item->auto_launch = strdup(buffer);
+    if (!item->auto_launch) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return;
+    }
 }
 
 static void size_handler(struct parser *item, char *buffer)
 {
-       if (parse_size(buffer, &item->size) == -1) {
-               ErrPrint("Failed to get size\n");
-               item->size = 0x00000001;
-       }
+    if (parse_size(buffer, &item->size) == -1) {
+       ErrPrint("Failed to get size\n");
+       item->size = 0x00000001;
+    }
 }
 
-static void pd_size_handler(struct parser *item, char *buffer)
+static void gbar_size_handler(struct parser *item, char *buffer)
 {
-       if (sscanf(buffer, "%ux%u", &item->pd_width, &item->pd_height) != 2) {
-               ErrPrint("parse pd size\n");
-       }
+    if (sscanf(buffer, "%ux%u", &item->gbar_width, &item->gbar_height) != 2) {
+       ErrPrint("parse pd size\n");
+    }
 }
 
-static void text_lb_handler(struct parser *item, char *buffer)
+static void text_dbox_handler(struct parser *item, char *buffer)
 {
-       if (!rtrim(buffer)) {
-               return;
-       }
+    if (!rtrim(buffer)) {
+       return;
+    }
 
-       item->text_lb = !!atoi(buffer);
+    item->text_lb = !!atoi(buffer);
 }
 
 static void abi_handler(struct parser *item, char *buffer)
 {
-       item->abi = dup_rtrim(buffer);
+    item->abi = dup_rtrim(buffer);
 }
 
 static void script_handler(struct parser *item, char *buffer)
 {
-       item->script = dup_rtrim(buffer);
+    item->script = dup_rtrim(buffer);
 }
 
-static void buffer_pd_handler(struct parser *item, char *buffer)
+static void buffer_gbar_handler(struct parser *item, char *buffer)
 {
-       if (!rtrim(buffer)) {
-               return;
-       }
+    if (!rtrim(buffer)) {
+       return;
+    }
 
-       item->buffer_pd = !!atoi(buffer);
+    item->buffer_gbar = !!atoi(buffer);
 }
 
-static void buffer_lb_handler(struct parser *item, char *buffer)
+static void buffer_dbox_handler(struct parser *item, char *buffer)
 {
-       if (!rtrim(buffer)) {
-               return;
-       }
+    if (!rtrim(buffer)) {
+       return;
+    }
 
-       item->buffer_lb = !!atoi(buffer);
+    item->buffer_lb = !!atoi(buffer);
 }
 
-static void text_pd_handler(struct parser *item, char *buffer)
+static void text_gbar_handler(struct parser *item, char *buffer)
 {
-       if (!rtrim(buffer)) {
-               return;
-       }
+    if (!rtrim(buffer)) {
+       return;
+    }
 
-       item->text_pd = !!atoi(buffer);
+    item->text_gbar = !!atoi(buffer);
 }
 
 static void pinup_handler(struct parser *item, char *buffer)
 {
-       if (!rtrim(buffer)) {
-               return;
-       }
+    if (!rtrim(buffer)) {
+       return;
+    }
 
-       item->pinup = !!atoi(buffer);
+    item->pinup = !!atoi(buffer);
 }
 
-static void lb_path_handler(struct parser *item, char *buffer)
+static void dbox_path_handler(struct parser *item, char *buffer)
 {
-       if (item->lb_path) {
-               DbgFree(item->lb_path);
-       }
+    if (item->dbox_path) {
+       DbgFree(item->dbox_path);
+    }
 
-       item->lb_path = dup_rtrim(buffer);
-       if (!item->lb_path) {
-               ErrPrint("Error: %s\n", strerror(errno));
-       }
+    item->dbox_path = dup_rtrim(buffer);
+    if (!item->dbox_path) {
+       ErrPrint("Error: %s\n", strerror(errno));
+    }
 }
 
 static void group_handler(struct parser *item, char *buffer)
 {
-       if (item->group) {
-               DbgFree(item->group);
-       }
+    if (item->group) {
+       DbgFree(item->group);
+    }
 
-       item->group = dup_rtrim(buffer);
-       if (!item->group) {
-               ErrPrint("Error: %s\n", strerror(errno));
-       }
+    item->group = dup_rtrim(buffer);
+    if (!item->group) {
+       ErrPrint("Error: %s\n", strerror(errno));
+    }
 }
 
 static void secured_handler(struct parser *item, char *buffer)
 {
-       if (!rtrim(buffer)) {
-               return;
-       }
+    if (!rtrim(buffer)) {
+       return;
+    }
 
-       item->secured = !!atoi(buffer);
+    item->secured = !!atoi(buffer);
 }
 
-static void lb_group_handler(struct parser *item, char *buffer)
+static void dbox_group_handler(struct parser *item, char *buffer)
 {
-       if (item->lb_group) {
-               DbgFree(item->lb_group);
-       }
+    if (item->dbox_group) {
+       DbgFree(item->dbox_group);
+    }
 
-       item->lb_group = dup_rtrim(buffer);
-       if (!item->lb_group) {
-               ErrPrint("Error: %s\n", strerror(errno));
-       }
+    item->dbox_group = dup_rtrim(buffer);
+    if (!item->dbox_group) {
+       ErrPrint("Error: %s\n", strerror(errno));
+    }
 }
 
-static void pd_path_handler(struct parser *item, char *buffer)
+static void gbar_path_handler(struct parser *item, char *buffer)
 {
-       if (item->pd_path) {
-               DbgFree(item->pd_path);
-       }
+    if (item->gbar_path) {
+       DbgFree(item->gbar_path);
+    }
 
-       item->pd_path = dup_rtrim(buffer);
-       if (!item->pd_path) {
-               ErrPrint("Error: %s\n", strerror(errno));
-       }
+    item->gbar_path = dup_rtrim(buffer);
+    if (!item->gbar_path) {
+       ErrPrint("Error: %s\n", strerror(errno));
+    }
 }
 
-static void pd_group_handler(struct parser *item, char *buffer)
+static void gbar_group_handler(struct parser *item, char *buffer)
 {
-       if (item->pd_group) {
-               DbgFree(item->pd_group);
-       }
+    if (item->gbar_group) {
+       DbgFree(item->gbar_group);
+    }
 
-       item->pd_group = dup_rtrim(buffer);
-       if (!item->pd_group) {
-               ErrPrint("Error: %s\n", strerror(errno));
-       }
+    item->gbar_group = dup_rtrim(buffer);
+    if (!item->gbar_group) {
+       ErrPrint("Error: %s\n", strerror(errno));
+    }
 }
 
 HAPI struct parser *parser_load(const char *pkgname)
 {
-       struct parser *item;
-       FILE *fp;
-       int c;
-       enum state {
-               START,
-               SPACE,
-               TOKEN,
-               VALUE,
-               ERROR,
-               COMMENT,
-               END
-       } state;
-       int ch_idx;
-       int token_idx;
-       int buffer_idx;
-       int quote;
-       int len;
-       int linelen;
-       char buffer[256];
-       static const struct token_parser {
-               const char *name;
-               void (*handler)(struct parser *, char *buffer);
-       } token_handler[] = {
-               {
-                       .name = "period",
-                       .handler = period_handler,
-               },
-               {
-                       .name = "timeout",
-                       .handler = timeout_handler,
-               },
-               {
-                       .name = "network",
-                       .handler = network_handler,
-               },
-               {
-                       .name = "auto_launch",
-                       .handler = auto_launch_handler,
-               },
-               {
-                       .name = "size",
-                       .handler = size_handler,
-               },
-               {
-                       .name = "group",
-                       .handler = group_handler,
-               },
-               {
-                       .name = "secured",
-                       .handler = secured_handler,
-               },
-               {
-                       .name = "livebox_path",
-                       .handler = lb_path_handler,
-               },
-               {
-                       .name = "livebox_group",
-                       .handler = lb_group_handler,
-               },
-               {
-                       .name = "pd_path",
-                       .handler = pd_path_handler,
-               },
-               {
-                       .name = "pd_group",
-                       .handler = pd_group_handler,
-               },
-               {
-                       .name = "pd_size",
-                       .handler = pd_size_handler,
-               },
-               {
-                       .name = "pinup",
-                       .handler = pinup_handler,
-               },
-               {
-                       .name = "text_livebox",
-                       .handler = text_lb_handler,
-               },
-               {
-                       .name = "text_pd",
-                       .handler = text_pd_handler,
-               },
-               {
-                       .name = "buffer_livebox",
-                       .handler = buffer_lb_handler,
-               },
-               {
-                       .name = "buffer_pd",
-                       .handler = buffer_pd_handler,
-               },
-               {
-                       .name = "script",
-                       .handler = script_handler,
-               },
-               {
-                       .name = "abi",
-                       .handler = abi_handler,
-               },
-               {
-                       .name = NULL,
-                       .handler = NULL,
-               },
-       };
-       int ret;
-
-       item = calloc(1, sizeof(*item));
-       if (!item) {
-               return 0;
-       }
-
-       /* live-, .conf */
-       len = strlen(CONF_PATH) + strlen(pkgname) * 2;
-       item->filename = malloc(len);
-       if (!item->filename) {
-               ErrPrint("Error: %s\n", strerror(errno));
-               DbgFree(item);
-               return 0;
-       }
-
-       ret = snprintf(item->filename, len, CONF_PATH, pkgname, pkgname);
-       if (ret < 0) {
-               ErrPrint("Error: %s\n", strerror(errno));
-               DbgFree(item->filename);
-               DbgFree(item);
-               return 0;
-       }
-
-       item->lb_path = NULL;
-       item->lb_group = NULL;
-       item->pd_width = 0;
-       item->pd_height = 0;
-       item->auto_launch = NULL;
-       item->size = 0x00000001;
-       item->group = NULL;
-       item->secured = 0;
-       item->pinup = 0;
-
-       fp = fopen(item->filename, "rt");
-       if (!fp) {
-               DbgFree(item->filename);
-               DbgFree(item);
-               return 0;
-       }
+    struct parser *item;
+    FILE *fp;
+    int c;
+    enum state {
+       START,
+       SPACE,
+       TOKEN,
+       VALUE,
+       ERROR,
+       COMMENT,
+       END
+    } state;
+    int ch_idx;
+    int token_idx;
+    int buffer_idx;
+    int quote;
+    int len;
+    int linelen;
+    char buffer[256];
+    static const struct token_parser {
+       const char *name;
+       void (*handler)(struct parser *, char *buffer);
+    } token_handler[] = {
+       {
+           .name = "period",
+           .handler = period_handler,
+       },
+       {
+           .name = "timeout",
+           .handler = timeout_handler,
+       },
+       {
+           .name = "network",
+           .handler = network_handler,
+       },
+       {
+           .name = "auto_launch",
+           .handler = auto_launch_handler,
+       },
+       {
+           .name = "size",
+           .handler = size_handler,
+       },
+       {
+           .name = "group",
+           .handler = group_handler,
+       },
+       {
+           .name = "secured",
+           .handler = secured_handler,
+       },
+       {
+           .name = "dynamicbox_path",
+           .handler = dbox_path_handler,
+       },
+       {
+           .name = "dynamicbox_group",
+           .handler = dbox_group_handler,
+       },
+       {
+           .name = "gbar_path",
+           .handler = gbar_path_handler,
+       },
+       {
+           .name = "gbar_group",
+           .handler = gbar_group_handler,
+       },
+       {
+           .name = "gbar_size",
+           .handler = gbar_size_handler,
+       },
+       {
+           .name = "pinup",
+           .handler = pinup_handler,
+       },
+       {
+           .name = "text_dynamicbox",
+           .handler = text_dbox_handler,
+       },
+       {
+           .name = "text_gbar",
+           .handler = text_gbar_handler,
+       },
+       {
+           .name = "buffer_dynamicbox",
+           .handler = buffer_dbox_handler,
+       },
+       {
+           .name = "buffer_gbar",
+           .handler = buffer_gbar_handler,
+       },
+       {
+           .name = "script",
+           .handler = script_handler,
+       },
+       {
+           .name = "abi",
+           .handler = abi_handler,
+       },
+       {
+           .name = NULL,
+           .handler = NULL,
+       },
+    };
+    int ret;
+
+    item = calloc(1, sizeof(*item));
+    if (!item) {
+       return 0;
+    }
+
+    /* live-, .conf */
+    len = strlen(DYNAMICBOX_CONF_CONF_PATH) + strlen(pkgname) * 2;
+    item->filename = malloc(len);
+    if (!item->filename) {
+       ErrPrint("Error: %s\n", strerror(errno));
+       DbgFree(item);
+       return 0;
+    }
 
-       state = START;
-       ch_idx = 0;
-       token_idx = -1;
-       buffer_idx = 0;
-       quote = 0;
-       linelen = 0;
-       do {
-               c = getc(fp);
-               if ((c == EOF) && (state == VALUE)) {
-                       state = END;
+    ret = snprintf(item->filename, len, DYNAMICBOX_CONF_CONF_PATH, pkgname, pkgname);
+    if (ret < 0) {
+       ErrPrint("Error: %s\n", strerror(errno));
+       DbgFree(item->filename);
+       DbgFree(item);
+       return 0;
+    }
+
+    item->dbox_path = NULL;
+    item->dbox_group = NULL;
+    item->gbar_width = 0;
+    item->gbar_height = 0;
+    item->auto_launch = NULL;
+    item->size = 0x00000001;
+    item->group = NULL;
+    item->secured = 0;
+    item->pinup = 0;
+
+    fp = fopen(item->filename, "rt");
+    if (!fp) {
+       DbgFree(item->filename);
+       DbgFree(item);
+       return 0;
+    }
+
+    state = START;
+    ch_idx = 0;
+    token_idx = -1;
+    buffer_idx = 0;
+    quote = 0;
+    linelen = 0;
+    do {
+       c = getc(fp);
+       if ((c == EOF) && (state == VALUE)) {
+           state = END;
+       }
+
+       switch (state) {
+       case COMMENT:
+           if (c == CR || c == LF || c == EOF) {
+               buffer[buffer_idx] = '\0';
+
+               state = START;
+               token_idx = -1;
+               ch_idx = 0;
+               buffer_idx = 0;
+               linelen = -1; /* Will be ZERO by follwing increment code */
+               quote = 0;
+           } else {
+               buffer[buffer_idx++] = c;
+               if (buffer_idx == (sizeof(buffer) - 1)) {
+                   buffer[buffer_idx] = '\0';
+                   buffer_idx = 0;
+               }
+           }
+           break;
+       case START:
+           if (linelen == 0 && c == '#') {
+               state = COMMENT;
+           } else if (isspace(c)) {
+               /* Ignore empty space */
+           } else {
+               state = TOKEN;
+               ungetc(c, fp);
+           }
+           break;
+       case SPACE:
+           if (c == '=') {
+               state = VALUE;
+           } else if (!isspace(c)) {
+               state = ERROR;
+           }
+           break;
+       case VALUE:
+           if (c == '"') {
+               if (quote == 1) {
+                   buffer[buffer_idx] = '\0';
+                   state = END;
+               } else if (buffer_idx != 0) {
+                   buffer[buffer_idx++] = c;
+                   if (buffer_idx >= sizeof(buffer)) {
+                       state = ERROR;
+                   }
+               } else {
+                   quote = 1;
+               }
+           } else if (isspace(c)) {
+               if (buffer_idx == 0) {
+                   /* Ignore */
+               } else if (quote == 1) {
+                   buffer[buffer_idx++] = c;
+                   if (buffer_idx >= sizeof(buffer)) {
+                       state = ERROR;
+                   }
+               } else {
+                   buffer[buffer_idx] = '\0';
+                   ungetc(c, fp);
+                   state = END;
+               }
+           } else {
+               buffer[buffer_idx++] = c;
+               if (buffer_idx >= sizeof(buffer)) {
+                   state = ERROR;
+               }
+           }
+           break;
+       case TOKEN:
+           if (c == '=') {
+               if (token_idx < 0) {
+                   state = ERROR;
+               } else {
+                   state = VALUE;
+               }
+           } else if (isspace(c)) {
+               if (token_idx < 0) {
+                   break;
                }
 
-               switch (state) {
-               case COMMENT:
-                       if (c == CR || c == LF || c == EOF) {
-                               buffer[buffer_idx] = '\0';
-
-                               state = START;
-                               token_idx = -1;
-                               ch_idx = 0;
-                               buffer_idx = 0;
-                               linelen = -1; /* Will be ZERO by follwing increment code */
-                               quote = 0;
-                       } else {
-                               buffer[buffer_idx++] = c;
-                               if (buffer_idx == (sizeof(buffer) - 1)) {
-                                       buffer[buffer_idx] = '\0';
-                                       buffer_idx = 0;
-                               }
-                       }
-                       break;
-               case START:
-                       if (linelen == 0 && c == '#') {
-                               state = COMMENT;
-                       } else if (isspace(c)) {
-                               /* Ignore empty space */
-                       } else {
-                               state = TOKEN;
-                               ungetc(c, fp);
-                       }
-                       break;
-               case SPACE:
-                       if (c == '=') {
-                               state = VALUE;
-                       } else if (!isspace(c)) {
-                               state = ERROR;
-                       }
-                       break;
-               case VALUE:
-                       if (c == '"') {
-                               if (quote == 1) {
-                                       buffer[buffer_idx] = '\0';
-                                       state = END;
-                               } else if (buffer_idx != 0) {
-                                       buffer[buffer_idx++] = c;
-                                       if (buffer_idx >= sizeof(buffer)) {
-                                               state = ERROR;
-                                       }
-                               } else {
-                                       quote = 1;
-                               }
-                       } else if (isspace(c)) {
-                               if (buffer_idx == 0) {
-                                       /* Ignore */
-                               } else if (quote == 1) {
-                                       buffer[buffer_idx++] = c;
-                                       if (buffer_idx >= sizeof(buffer)) {
-                                               state = ERROR;
-                                       }
-                               } else {
-                                       buffer[buffer_idx] = '\0';
-                                       ungetc(c, fp);
-                                       state = END;
-                               }
-                       } else {
-                               buffer[buffer_idx++] = c;
-                               if (buffer_idx >= sizeof(buffer)) {
-                                       state = ERROR;
-                               }
-                       }
-                       break;
-               case TOKEN:
-                       if (c == '=') {
-                               if (token_idx < 0) {
-                                       state = ERROR;
-                               } else {
-                                       state = VALUE;
-                               }
-                       } else if (isspace(c)) {
-                               if (token_idx < 0) {
-                                       break;
-                               }
-
-                               if (token_handler[token_idx].name[ch_idx] != '\0') {
-                                       state = ERROR;
-                               } else {
-                                       state = SPACE;
-                               }
-                       } else  {
-                               if (token_idx < 0) {
-                                       /* Now start to find a token! */
-                                       token_idx = 0;
-                               }
-
-                               if (token_handler[token_idx].name[ch_idx] == c) {
-                                       ch_idx++;
-                               } else {
-                                       ungetc(c, fp);
-                                       while (ch_idx-- > 0) {
-                                               ungetc(token_handler[token_idx].name[ch_idx], fp);
-                                       }
-
-                                       token_idx++;
-
-                                       if (token_handler[token_idx].name == NULL) {
-                                               state = ERROR;
-                                       } else {
-                                               ch_idx = 0;
-                                       }
-                               }
-                       }
-                       break;
-               case ERROR:
-                       if (c == CR || c == LF || c == EOF) {
-                               state = START;
-                               token_idx = -1;
-                               buffer_idx = 0;
-                               ch_idx = 0;
-                               linelen = -1;
-                               quote = 0;
-                       }
-                       break;
-               case END:
-                       if (c == LF || c == CR || c == EOF) {
-                               state = START;
-
-                               /*!
-                                * \NOTE
-                                * Make the string terminator
-                                */
-                               buffer[buffer_idx] = '\0';
-
-                               if (token_idx >= 0 && token_handler[token_idx].handler) {
-                                       token_handler[token_idx].handler(item, buffer);
-                               }
-
-                               token_idx = -1;
-                               ch_idx = 0;
-                               buffer_idx = 0;
-                               linelen = -1;
-                               quote = 0;
-                               /* Finish */
-                       } else if (isspace(c)) {
-                               /* ignore */
-                       } else {
-                               state = ERROR;
-                       }
-                       break;
-               default:
-                       /* ?? */
-                       break;
+               if (token_handler[token_idx].name[ch_idx] != '\0') {
+                   state = ERROR;
+               } else {
+                   state = SPACE;
+               }
+           } else  {
+               if (token_idx < 0) {
+                   /* Now start to find a token! */
+                   token_idx = 0;
                }
 
-               linelen++;
-        } while (c != EOF);
+               if (token_handler[token_idx].name[ch_idx] == c) {
+                   ch_idx++;
+               } else {
+                   ungetc(c, fp);
+                   while (ch_idx-- > 0) {
+                       ungetc(token_handler[token_idx].name[ch_idx], fp);
+                   }
+
+                   token_idx++;
+
+                   if (token_handler[token_idx].name == NULL) {
+                       state = ERROR;
+                   } else {
+                       ch_idx = 0;
+                   }
+               }
+           }
+           break;
+       case ERROR:
+           if (c == CR || c == LF || c == EOF) {
+               state = START;
+               token_idx = -1;
+               buffer_idx = 0;
+               ch_idx = 0;
+               linelen = -1;
+               quote = 0;
+           }
+           break;
+       case END:
+           if (c == LF || c == CR || c == EOF) {
+               state = START;
+
+               /*!
+                * \NOTE
+                * Make the string terminator
+                */
+               buffer[buffer_idx] = '\0';
+
+               if (token_idx >= 0 && token_handler[token_idx].handler) {
+                   token_handler[token_idx].handler(item, buffer);
+               }
 
-       if (fclose(fp) != 0) {
-               ErrPrint("fclose: %s\n", strerror(errno));
+               token_idx = -1;
+               ch_idx = 0;
+               buffer_idx = 0;
+               linelen = -1;
+               quote = 0;
+               /* Finish */
+           } else if (isspace(c)) {
+               /* ignore */
+           } else {
+               state = ERROR;
+           }
+           break;
+       default:
+           /* ?? */
+           break;
        }
 
-       s_list = eina_list_append(s_list, item);
-       return item;
+       linelen++;
+    } while (c != EOF);
+
+    if (fclose(fp) != 0) {
+       ErrPrint("fclose: %s\n", strerror(errno));
+    }
+
+    s_list = eina_list_append(s_list, item);
+    return item;
 }
 
 HAPI int parser_unload(struct parser *item)
 {
-       s_list = eina_list_remove(s_list, item);
-
-       DbgFree(item->auto_launch);
-       DbgFree(item->abi);
-       DbgFree(item->script);
-       DbgFree(item->group);
-       DbgFree(item->pd_group);
-       DbgFree(item->pd_path);
-       DbgFree(item->lb_group);
-       DbgFree(item->lb_path);
-       DbgFree(item->filename);
-       DbgFree(item);
-       return LB_STATUS_SUCCESS;
+    s_list = eina_list_remove(s_list, item);
+
+    DbgFree(item->auto_launch);
+    DbgFree(item->abi);
+    DbgFree(item->script);
+    DbgFree(item->group);
+    DbgFree(item->gbar_group);
+    DbgFree(item->gbar_path);
+    DbgFree(item->dbox_group);
+    DbgFree(item->dbox_path);
+    DbgFree(item->filename);
+    DbgFree(item);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 /* End of a file */
index 92f30d8..394a08a 100644 (file)
@@ -20,7 +20,7 @@
 
 #include <dlog.h>
 #include <package-manager.h>
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
 
 #include <Ecore.h>
 #include "util.h"
 #include "conf.h"
 
 struct item {
-       char *pkgname;
-       char *icon;
+    char *pkgname;
+    char *icon;
 
-       enum pkgmgr_event_type type;
-       enum pkgmgr_status status;
+    enum pkgmgr_event_type type;
+    enum pkgmgr_status status;
 };
 
 static struct {
-       pkgmgr_client *listen_pc;
-       Eina_List *item_list;
-
-       Eina_List *install_event;
-       Eina_List *uninstall_event;
-       Eina_List *update_event;
-       Eina_List *download_event;
-       Eina_List *recover_event;
+    pkgmgr_client *listen_pc;
+    Eina_List *item_list;
+
+    Eina_List *install_event;
+    Eina_List *uninstall_event;
+    Eina_List *update_event;
+    Eina_List *download_event;
+    Eina_List *recover_event;
 } s_info = {
-       .listen_pc = NULL,
-       .item_list = NULL,
-
-       .install_event = NULL,
-       .uninstall_event = NULL,
-       .update_event = NULL,
-       .download_event = NULL,
-       .recover_event = NULL,
+    .listen_pc = NULL,
+    .item_list = NULL,
+
+    .install_event = NULL,
+    .uninstall_event = NULL,
+    .update_event = NULL,
+    .download_event = NULL,
+    .recover_event = NULL,
 };
 
 struct event_item {
-       int (*cb)(const char *pkgname, enum pkgmgr_status status, double value, void *data);
-       void *data;
+    int (*cb)(const char *pkgname, enum pkgmgr_status status, double value, void *data);
+    void *data;
 };
 
 static inline void invoke_install_event_handler(const char *pkgname, enum pkgmgr_status status, double value)
 {
-       Eina_List *l;
-       struct event_item *item;
+    Eina_List *l;
+    struct event_item *item;
 
-       EINA_LIST_FOREACH(s_info.install_event, l, item) {
-               if (item->cb) {
-                       item->cb(pkgname, status, value, item->data);
-               }
+    EINA_LIST_FOREACH(s_info.install_event, l, item) {
+       if (item->cb) {
+           item->cb(pkgname, status, value, item->data);
        }
+    }
 }
 
 static inline void invoke_uninstall_event_handler(const char *pkgname, enum pkgmgr_status status, double value)
 {
-       Eina_List *l;
-       struct event_item *item;
+    Eina_List *l;
+    struct event_item *item;
 
-       EINA_LIST_FOREACH(s_info.uninstall_event, l, item) {
-               if (item->cb) {
-                       item->cb(pkgname, status, value, item->data);
-               }
+    EINA_LIST_FOREACH(s_info.uninstall_event, l, item) {
+       if (item->cb) {
+           item->cb(pkgname, status, value, item->data);
        }
+    }
 }
 
 static inline void invoke_update_event_handler(const char *pkgname, enum pkgmgr_status status, double value)
 {
-       Eina_List *l;
-       struct event_item *item;
+    Eina_List *l;
+    struct event_item *item;
 
-       EINA_LIST_FOREACH(s_info.update_event, l, item) {
-               if (item->cb) {
-                       item->cb(pkgname, status, value, item->data);
-               }
+    EINA_LIST_FOREACH(s_info.update_event, l, item) {
+       if (item->cb) {
+           item->cb(pkgname, status, value, item->data);
        }
+    }
 }
 
 static inline void invoke_download_event_handler(const char *pkgname, enum pkgmgr_status status, double value)
 {
-       Eina_List *l;
-       struct event_item *item;
+    Eina_List *l;
+    struct event_item *item;
 
-       EINA_LIST_FOREACH(s_info.download_event, l, item) {
-               if (item->cb) {
-                       item->cb(pkgname, status, value, item->data);
-               }
+    EINA_LIST_FOREACH(s_info.download_event, l, item) {
+       if (item->cb) {
+           item->cb(pkgname, status, value, item->data);
        }
+    }
 }
 
 static inline void invoke_recover_event_handler(const char *pkgname, enum pkgmgr_status status, double value)
 {
-       Eina_List *l;
-       struct event_item *item;
+    Eina_List *l;
+    struct event_item *item;
 
-       EINA_LIST_FOREACH(s_info.recover_event, l, item) {
-               if (item->cb) {
-                       item->cb(pkgname, status, value, item->data);
-               }
+    EINA_LIST_FOREACH(s_info.recover_event, l, item) {
+       if (item->cb) {
+           item->cb(pkgname, status, value, item->data);
        }
+    }
 }
 
 static inline void invoke_callback(const char *pkgname, struct item *item, double value)
 {
-       switch (item->type) {
+    switch (item->type) {
        case PKGMGR_EVENT_DOWNLOAD:
-               invoke_download_event_handler(pkgname, item->status, value);
-               break;
+           invoke_download_event_handler(pkgname, item->status, value);
+           break;
        case PKGMGR_EVENT_UNINSTALL:
-               invoke_uninstall_event_handler(pkgname, item->status, value);
-               break;
+           invoke_uninstall_event_handler(pkgname, item->status, value);
+           break;
        case PKGMGR_EVENT_INSTALL:
-               invoke_install_event_handler(pkgname, item->status, value);
-               break;
+           invoke_install_event_handler(pkgname, item->status, value);
+           break;
        case PKGMGR_EVENT_UPDATE:
-               invoke_update_event_handler(pkgname, item->status, value);
-               break;
+           invoke_update_event_handler(pkgname, item->status, value);
+           break;
        case PKGMGR_EVENT_RECOVER:
-               invoke_recover_event_handler(pkgname, item->status, value);
-               break;
+           invoke_recover_event_handler(pkgname, item->status, value);
+           break;
        default:
-               ErrPrint("Unknown type: %d\n", item->type);
-               break;
-       }
+           ErrPrint("Unknown type: %d\n", item->type);
+           break;
+    }
 }
 
 static inline int is_valid_status(struct item *item, const char *status)
 {
-       const char *expected_status;
+    const char *expected_status;
 
-       switch (item->type) {
+    switch (item->type) {
        case PKGMGR_EVENT_DOWNLOAD:
-               expected_status = "download";
-               break;
+           expected_status = "download";
+           break;
        case PKGMGR_EVENT_UNINSTALL:
-               expected_status = "uninstall";
-               break;
+           expected_status = "uninstall";
+           break;
        case PKGMGR_EVENT_INSTALL:
-               expected_status = "install";
-               break;
+           expected_status = "install";
+           break;
        case PKGMGR_EVENT_UPDATE:
-               expected_status = "update";
-               break;
+           expected_status = "update";
+           break;
        case PKGMGR_EVENT_RECOVER:
-               expected_status = "recover";
-               break;
+           expected_status = "recover";
+           break;
        default:
-               return 0;
-       }
+           return 0;
+    }
 
-       return !strcasecmp(status, expected_status);
+    return !strcasecmp(status, expected_status);
 }
 
 static struct item *find_item(const char *pkgname)
 {
-       Eina_List *l;
-       struct item *item;
-
-       if (!pkgname) {
-               ErrPrint("Package name is not valid\n");
-               return NULL;
-       }
+    Eina_List *l;
+    struct item *item;
 
-       EINA_LIST_FOREACH(s_info.item_list, l, item) {
-               if (strcmp(item->pkgname, pkgname)) {
-                       continue;
-               }
+    if (!pkgname) {
+       ErrPrint("Package name is not valid\n");
+       return NULL;
+    }
 
-               return item;
+    EINA_LIST_FOREACH(s_info.item_list, l, item) {
+       if (strcmp(item->pkgname, pkgname)) {
+           continue;
        }
 
-       DbgPrint("Package %s is not found\n", pkgname);
-       return NULL;
+       return item;
+    }
+
+    DbgPrint("Package %s is not found\n", pkgname);
+    return NULL;
 }
 
 static int start_cb(const char *pkgname, const char *val, void *data)
 {
-       struct item *item;
-
-       DbgPrint("[%s] %s\n", pkgname, val);
+    struct item *item;
 
-       item = calloc(1, sizeof(*item));
-       if (!item) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    DbgPrint("[%s] %s\n", pkgname, val);
 
-       item->pkgname = strdup(pkgname);
-       if (!item->pkgname) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(item);
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    item = calloc(1, sizeof(*item));
+    if (!item) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       item->status = PKGMGR_STATUS_START;
-
-       if (!strcasecmp(val, "download")) {
-               item->type = PKGMGR_EVENT_DOWNLOAD;
-       } else if (!strcasecmp(val, "uninstall")) {
-               item->type = PKGMGR_EVENT_UNINSTALL;
-       } else if (!strcasecmp(val, "install")) {
-               item->type = PKGMGR_EVENT_INSTALL;
-       } else if (!strcasecmp(val, "update")) {
-               item->type = PKGMGR_EVENT_UPDATE;
-       } else if (!strcasecmp(val, "recover")) {
-               item->type = PKGMGR_EVENT_RECOVER;
-       } else {
-               DbgFree(item->pkgname);
-               DbgFree(item);
-               ErrPrint("Invalid val: %s\n", val);
-               return LB_STATUS_ERROR_INVALID;
-       }
+    item->pkgname = strdup(pkgname);
+    if (!item->pkgname) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(item);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    item->status = PKGMGR_STATUS_START;
+
+    if (!strcasecmp(val, "download")) {
+       item->type = PKGMGR_EVENT_DOWNLOAD;
+    } else if (!strcasecmp(val, "uninstall")) {
+       item->type = PKGMGR_EVENT_UNINSTALL;
+    } else if (!strcasecmp(val, "install")) {
+       item->type = PKGMGR_EVENT_INSTALL;
+    } else if (!strcasecmp(val, "update")) {
+       item->type = PKGMGR_EVENT_UPDATE;
+    } else if (!strcasecmp(val, "recover")) {
+       item->type = PKGMGR_EVENT_RECOVER;
+    } else {
+       DbgFree(item->pkgname);
+       DbgFree(item);
+       ErrPrint("Invalid val: %s\n", val);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       s_info.item_list = eina_list_append(s_info.item_list, item);
+    s_info.item_list = eina_list_append(s_info.item_list, item);
 
-       invoke_callback(pkgname, item, 0.0f);
-       return LB_STATUS_SUCCESS;
+    invoke_callback(pkgname, item, 0.0f);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static int icon_path_cb(const char *pkgname, const char *val, void *data)
 {
-       struct item *item;
+    struct item *item;
 
-       DbgPrint("[%s] %s\n", pkgname, val);
+    DbgPrint("[%s] %s\n", pkgname, val);
 
-       item = find_item(pkgname);
-       if (!item) {
-               return LB_STATUS_ERROR_NOT_EXIST;
-       }
+    item = find_item(pkgname);
+    if (!item) {
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
 
-       if (item->icon) {
-               DbgFree(item->icon);
-       }
+    if (item->icon) {
+       DbgFree(item->icon);
+    }
 
-       item->icon = strdup(val);
-       if (!item->icon) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    item->icon = strdup(val);
+    if (!item->icon) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static int command_cb(const char *pkgname, const char *val, void *data)
 {
-       struct item *item;
+    struct item *item;
 
-       DbgPrint("[%s] %s\n", pkgname, val);
+    DbgPrint("[%s] %s\n", pkgname, val);
 
-       item = find_item(pkgname);
-       if (!item) {
-               return LB_STATUS_ERROR_NOT_EXIST;
-       }
+    item = find_item(pkgname);
+    if (!item) {
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
 
-       if (!is_valid_status(item, val)) {
-               DbgPrint("Invalid status: %d, %s\n", item->type, val);
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!is_valid_status(item, val)) {
+       DbgPrint("Invalid status: %d, %s\n", item->type, val);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       item->status = PKGMGR_STATUS_COMMAND;
-       invoke_callback(pkgname, item, 0.0f);
-       return LB_STATUS_SUCCESS;
+    item->status = PKGMGR_STATUS_COMMAND;
+    invoke_callback(pkgname, item, 0.0f);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static int error_cb(const char *pkgname, const char *val, void *data)
 {
-       /* val = error */
-       struct item *item;
+    /* val = error */
+    struct item *item;
 
-       DbgPrint("[%s] %s\n", pkgname, val);
+    DbgPrint("[%s] %s\n", pkgname, val);
 
-       item = find_item(pkgname);
-       if (!item) {
-               return LB_STATUS_ERROR_NOT_EXIST;
-       }
+    item = find_item(pkgname);
+    if (!item) {
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
 
-       item->status = PKGMGR_STATUS_ERROR;
-       invoke_callback(pkgname, item, 0.0f);
-       return LB_STATUS_SUCCESS;
+    item->status = PKGMGR_STATUS_ERROR;
+    invoke_callback(pkgname, item, 0.0f);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static int change_pkgname_cb(const char *pkgname, const char *val, void *data)
 {
-       struct item *item;
-       char *new_pkgname;
+    struct item *item;
+    char *new_pkgname;
 
-       DbgPrint("[%s] %s\n", pkgname, val);
+    DbgPrint("[%s] %s\n", pkgname, val);
 
-       item = find_item(pkgname);
-       if (!item) {
-               return LB_STATUS_ERROR_NOT_EXIST;
-       }
+    item = find_item(pkgname);
+    if (!item) {
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
 
-       new_pkgname = strdup(val);
-       if (!new_pkgname) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    new_pkgname = strdup(val);
+    if (!new_pkgname) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       DbgFree(item->pkgname);
-       item->pkgname = new_pkgname;
-       return LB_STATUS_SUCCESS;
+    DbgFree(item->pkgname);
+    item->pkgname = new_pkgname;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static int download_cb(const char *pkgname, const char *val, void *data)
 {
-       /* val = integer */
-       struct item *item;
-       double value;
+    /* val = integer */
+    struct item *item;
+    double value;
 
-       DbgPrint("[%s] %s\n", pkgname, val);
+    DbgPrint("[%s] %s\n", pkgname, val);
 
-       item = find_item(pkgname);
-       if (!item) {
-               DbgPrint("ITEM is not started from the start_cb\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    item = find_item(pkgname);
+    if (!item) {
+       DbgPrint("ITEM is not started from the start_cb\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (item->type != PKGMGR_EVENT_DOWNLOAD) {
-               DbgPrint("TYPE is not \"download\" : %d\n", item->type);
-               item->type = PKGMGR_EVENT_DOWNLOAD;
-       }
+    if (item->type != PKGMGR_EVENT_DOWNLOAD) {
+       DbgPrint("TYPE is not \"download\" : %d\n", item->type);
+       item->type = PKGMGR_EVENT_DOWNLOAD;
+    }
 
-       switch (item->status) {
+    switch (item->status) {
        case PKGMGR_STATUS_START:
        case PKGMGR_STATUS_COMMAND:
-               item->status = PKGMGR_STATUS_PROCESSING;
+           item->status = PKGMGR_STATUS_PROCESSING;
        case PKGMGR_STATUS_PROCESSING:
-               break;
+           break;
        default:
-               ErrPrint("Invalid state [%s, %s]\n", pkgname, val);
-               return LB_STATUS_ERROR_INVALID;
-       }
+           ErrPrint("Invalid state [%s, %s]\n", pkgname, val);
+           return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (val) {
-               if (sscanf(val, "%lf", &value) != 1) {
-                       value = (double)LB_STATUS_ERROR_INVALID;
-               }
-       } else {
-               value = (double)LB_STATUS_ERROR_INVALID;
+    if (val) {
+       if (sscanf(val, "%lf", &value) != 1) {
+           value = (double)DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
+    } else {
+       value = (double)DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       invoke_download_event_handler(pkgname, item->status, value);
-       return LB_STATUS_SUCCESS;
+    invoke_download_event_handler(pkgname, item->status, value);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static int progress_cb(const char *pkgname, const char *val, void *data)
 {
-       /* val = integer */
-       struct item *item;
-       double value;
+    /* val = integer */
+    struct item *item;
+    double value;
 
-       DbgPrint("[%s] %s\n", pkgname, val);
+    DbgPrint("[%s] %s\n", pkgname, val);
 
-       item = find_item(pkgname);
-       if (!item) {
-               ErrPrint("ITEM is not started from the start_cb\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    item = find_item(pkgname);
+    if (!item) {
+       ErrPrint("ITEM is not started from the start_cb\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       switch (item->status) {
+    switch (item->status) {
        case PKGMGR_STATUS_START:
        case PKGMGR_STATUS_COMMAND:
-               item->status = PKGMGR_STATUS_PROCESSING;
+           item->status = PKGMGR_STATUS_PROCESSING;
        case PKGMGR_STATUS_PROCESSING:
-               break;
+           break;
        default:
-               ErrPrint("Invalid state [%s, %s]\n", pkgname, val);
-               return LB_STATUS_ERROR_INVALID;
-       }
+           ErrPrint("Invalid state [%s, %s]\n", pkgname, val);
+           return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (val) {
-               if (sscanf(val, "%lf", &value) != 1) {
-                       value = (double)LB_STATUS_ERROR_INVALID;
-               }
-       } else {
-               value = (double)LB_STATUS_ERROR_INVALID;
+    if (val) {
+       if (sscanf(val, "%lf", &value) != 1) {
+           value = (double)DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
+    } else {
+       value = (double)DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       invoke_callback(pkgname, item, value);
-       return LB_STATUS_SUCCESS;
+    invoke_callback(pkgname, item, value);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static int end_cb(const char *pkgname, const char *val, void *data)
 {
-       struct item *item;
+    struct item *item;
 
-       DbgPrint("[%s] %s\n", pkgname, val);
+    DbgPrint("[%s] %s\n", pkgname, val);
 
-       item = find_item(pkgname);
-       if (!item) {
-               return LB_STATUS_ERROR_NOT_EXIST;
-       }
+    item = find_item(pkgname);
+    if (!item) {
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
 
-       item->status = !strcasecmp(val, "ok") ? PKGMGR_STATUS_END : PKGMGR_STATUS_ERROR;
+    item->status = !strcasecmp(val, "ok") ? PKGMGR_STATUS_END : PKGMGR_STATUS_ERROR;
 
-       invoke_callback(pkgname, item, 0.0f);
+    invoke_callback(pkgname, item, 0.0f);
 
-       s_info.item_list = eina_list_remove(s_info.item_list, item);
-       DbgFree(item->icon);
-       DbgFree(item->pkgname);
-       DbgFree(item);
-       return LB_STATUS_SUCCESS;
+    s_info.item_list = eina_list_remove(s_info.item_list, item);
+    DbgFree(item->icon);
+    DbgFree(item->pkgname);
+    DbgFree(item);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static struct pkgmgr_handler {
-       const char *key;
-       int (*func)(const char *package, const char *val, void *data);
+    const char *key;
+    int (*func)(const char *package, const char *val, void *data);
 } handler[] = {
-       { "install_percent", progress_cb },
-       { "download_percent", download_cb },
-       { "start", start_cb },
-       { "end", end_cb },
-       { "change_pkg_name", change_pkgname_cb },
-       { "icon_path", icon_path_cb },
-       { "command", command_cb },
-       { "error", error_cb },
-       { NULL, NULL },
+    { "install_percent", progress_cb },
+    { "download_percent", download_cb },
+    { "start", start_cb },
+    { "end", end_cb },
+    { "change_pkg_name", change_pkgname_cb },
+    { "icon_path", icon_path_cb },
+    { "command", command_cb },
+    { "error", error_cb },
+    { NULL, NULL },
 };
 
 static int pkgmgr_cb(int req_id, const char *type, const char *pkgname, const char *key, const char *val, const void *pmsg, void *data)
 {
-       register int i;
-       int ret;
+    register int i;
+    int ret;
 
-       for (i = 0; handler[i].key; i++) {
-               if (strcasecmp(key, handler[i].key)) {
-                       continue;
-               }
+    for (i = 0; handler[i].key; i++) {
+       if (strcasecmp(key, handler[i].key)) {
+           continue;
+       }
 
-               ret = handler[i].func(pkgname, val, data);
-               if (ret < 0) {
-                       DbgPrint("REQ[%d] pkgname[%s], type[%s], key[%s], val[%s], ret = %d\n",
-                                               req_id, pkgname, type, key, val, ret);
-               }
+       ret = handler[i].func(pkgname, val, data);
+       if (ret < 0) {
+           DbgPrint("REQ[%d] pkgname[%s], type[%s], key[%s], val[%s], ret = %d\n",
+                   req_id, pkgname, type, key, val, ret);
        }
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int pkgmgr_init(void)
 {
-       if (s_info.listen_pc) {
-               return LB_STATUS_ERROR_ALREADY;
-       }
+    if (s_info.listen_pc) {
+       return DBOX_STATUS_ERROR_ALREADY;
+    }
 
-       s_info.listen_pc = pkgmgr_client_new(PC_LISTENING);
-       if (!s_info.listen_pc) {
-               return LB_STATUS_ERROR_FAULT;
-       }
+    s_info.listen_pc = pkgmgr_client_new(PC_LISTENING);
+    if (!s_info.listen_pc) {
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       if (pkgmgr_client_listen_status(s_info.listen_pc, pkgmgr_cb, NULL) != PKGMGR_R_OK) {
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (pkgmgr_client_listen_status(s_info.listen_pc, pkgmgr_cb, NULL) != PKGMGR_R_OK) {
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int pkgmgr_fini(void)
 {
-       struct event_item *item;
-       struct item *ctx;
+    struct event_item *item;
+    struct item *ctx;
 
-       if (!s_info.listen_pc) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!s_info.listen_pc) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (pkgmgr_client_free(s_info.listen_pc) != PKGMGR_R_OK) {
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (pkgmgr_client_free(s_info.listen_pc) != PKGMGR_R_OK) {
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       s_info.listen_pc = NULL;
+    s_info.listen_pc = NULL;
 
-       EINA_LIST_FREE(s_info.download_event, item) {
-               DbgFree(item);
-       }
+    EINA_LIST_FREE(s_info.download_event, item) {
+       DbgFree(item);
+    }
 
-       EINA_LIST_FREE(s_info.uninstall_event, item) {
-               DbgFree(item);
-       }
+    EINA_LIST_FREE(s_info.uninstall_event, item) {
+       DbgFree(item);
+    }
 
-       EINA_LIST_FREE(s_info.install_event, item) {
-               DbgFree(item);
-       }
+    EINA_LIST_FREE(s_info.install_event, item) {
+       DbgFree(item);
+    }
 
-       EINA_LIST_FREE(s_info.update_event, item) {
-               DbgFree(item);
-       }
+    EINA_LIST_FREE(s_info.update_event, item) {
+       DbgFree(item);
+    }
 
-       EINA_LIST_FREE(s_info.recover_event, item) {
-               DbgFree(item);
-       }
+    EINA_LIST_FREE(s_info.recover_event, item) {
+       DbgFree(item);
+    }
 
-       EINA_LIST_FREE(s_info.item_list, ctx) {
-               DbgFree(ctx->pkgname);
-               DbgFree(ctx->icon);
-               DbgFree(ctx);
-       }
+    EINA_LIST_FREE(s_info.item_list, ctx) {
+       DbgFree(ctx->pkgname);
+       DbgFree(ctx->icon);
+       DbgFree(ctx);
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int pkgmgr_add_event_callback(enum pkgmgr_event_type type, int (*cb)(const char *pkgname, enum pkgmgr_status status, double value, void *data), void *data)
 {
-       struct event_item *item;
+    struct event_item *item;
 
-       item = calloc(1, sizeof(*item));
-       if (!item) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    item = calloc(1, sizeof(*item));
+    if (!item) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       item->cb = cb;
-       item->data = data;
+    item->cb = cb;
+    item->data = data;
 
-       switch (type) {
+    switch (type) {
        case PKGMGR_EVENT_DOWNLOAD:
-               s_info.download_event = eina_list_prepend(s_info.download_event, item);
-               break;
+           s_info.download_event = eina_list_prepend(s_info.download_event, item);
+           break;
        case PKGMGR_EVENT_UNINSTALL:
-               s_info.uninstall_event = eina_list_prepend(s_info.uninstall_event, item);
-               break;
+           s_info.uninstall_event = eina_list_prepend(s_info.uninstall_event, item);
+           break;
        case PKGMGR_EVENT_INSTALL:
-               s_info.install_event = eina_list_prepend(s_info.install_event, item);
-               break;
+           s_info.install_event = eina_list_prepend(s_info.install_event, item);
+           break;
        case PKGMGR_EVENT_UPDATE:
-               s_info.update_event = eina_list_prepend(s_info.update_event, item);
-               break;
+           s_info.update_event = eina_list_prepend(s_info.update_event, item);
+           break;
        case PKGMGR_EVENT_RECOVER:
-               s_info.recover_event = eina_list_prepend(s_info.recover_event, item);
-               break;
+           s_info.recover_event = eina_list_prepend(s_info.recover_event, item);
+           break;
        default:
-               DbgFree(item);
-               return LB_STATUS_ERROR_INVALID;
-       }
+           DbgFree(item);
+           return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI void *pkgmgr_del_event_callback(enum pkgmgr_event_type type, int (*cb)(const char *pkgname, enum pkgmgr_status status, double value, void *data), void *data)
 {
-       struct event_item *item;
-       Eina_List *l;
-       void *cbdata = NULL;
+    struct event_item *item;
+    Eina_List *l;
+    void *cbdata = NULL;
 
-       switch (type) {
+    switch (type) {
        case PKGMGR_EVENT_DOWNLOAD:
-               EINA_LIST_FOREACH(s_info.download_event, l, item) {
-                       if (item->cb == cb && item->data == data) {
-                               s_info.download_event = eina_list_remove(s_info.download_event, item);
-                               cbdata = item->data;
-                               DbgFree(item);
-                               break;
-                       }
+           EINA_LIST_FOREACH(s_info.download_event, l, item) {
+               if (item->cb == cb && item->data == data) {
+                   s_info.download_event = eina_list_remove(s_info.download_event, item);
+                   cbdata = item->data;
+                   DbgFree(item);
+                   break;
                }
-               break;
+           }
+           break;
        case PKGMGR_EVENT_UNINSTALL:
-               EINA_LIST_FOREACH(s_info.uninstall_event, l, item) {
-                       if (item->cb == cb && item->data == data) {
-                               s_info.uninstall_event = eina_list_remove(s_info.uninstall_event, item);
-                               cbdata = item->data;
-                               DbgFree(item);
-                               break;
-                       }
+           EINA_LIST_FOREACH(s_info.uninstall_event, l, item) {
+               if (item->cb == cb && item->data == data) {
+                   s_info.uninstall_event = eina_list_remove(s_info.uninstall_event, item);
+                   cbdata = item->data;
+                   DbgFree(item);
+                   break;
                }
-               break;
+           }
+           break;
        case PKGMGR_EVENT_INSTALL:
-               EINA_LIST_FOREACH(s_info.install_event, l, item) {
-                       if (item->cb == cb && item->data == data) {
-                               s_info.install_event = eina_list_remove(s_info.install_event, item);
-                               cbdata = item->data;
-                               DbgFree(item);
-                               break;
-                       }
+           EINA_LIST_FOREACH(s_info.install_event, l, item) {
+               if (item->cb == cb && item->data == data) {
+                   s_info.install_event = eina_list_remove(s_info.install_event, item);
+                   cbdata = item->data;
+                   DbgFree(item);
+                   break;
                }
-               break;
+           }
+           break;
        case PKGMGR_EVENT_UPDATE:
-               EINA_LIST_FOREACH(s_info.update_event, l, item) {
-                       if (item->cb == cb && item->data == data) {
-                               s_info.update_event = eina_list_remove(s_info.update_event, item);
-                               cbdata = item->data;
-                               DbgFree(item);
-                               break;
-                       }
+           EINA_LIST_FOREACH(s_info.update_event, l, item) {
+               if (item->cb == cb && item->data == data) {
+                   s_info.update_event = eina_list_remove(s_info.update_event, item);
+                   cbdata = item->data;
+                   DbgFree(item);
+                   break;
                }
-               break;
+           }
+           break;
        case PKGMGR_EVENT_RECOVER:
-               EINA_LIST_FOREACH(s_info.recover_event, l, item) {
-                       if (item->cb == cb && item->data == data) {
-                               s_info.recover_event = eina_list_remove(s_info.recover_event, item);
-                               cbdata = item->data;
-                               DbgFree(item);
-                               break;
-                       }
+           EINA_LIST_FOREACH(s_info.recover_event, l, item) {
+               if (item->cb == cb && item->data == data) {
+                   s_info.recover_event = eina_list_remove(s_info.recover_event, item);
+                   cbdata = item->data;
+                   DbgFree(item);
+                   break;
                }
-               break;
+           }
+           break;
        default:
-               ErrPrint("Invalid type\n");
-               break;
-       }
+           ErrPrint("Invalid type\n");
+           break;
+    }
 
-       return cbdata;
+    return cbdata;
 }
 
 /* End of a file */
index 0d973f8..6543777 100644 (file)
@@ -32,7 +32,9 @@
 
 #include <dlog.h>
 #include <packet.h>
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
+#include <dynamicbox_service.h>
+#include <dynamicbox_conf.h>
 
 #include "slave_life.h"
 #include "slave_rpc.h"
 #define INFO_CATEGORY "category"
 
 static const char *type_list[] = {
-       "access",
-       "access,operation",
-       "color",
-       "drag",
-       "image",
-       "info",
-       "script",
-       "signal",
-       "text",
-       NULL
+    "access",
+    "access,operation",
+    "color",
+    "drag",
+    "image",
+    "info",
+    "script",
+    "signal",
+    "text",
+    NULL
 };
 
 static const char *field_list[] = {
-       "type",
-       "part",
-       "data",
-       "option",
-       "id",
-       "target",
-       "file",
-       NULL
+    "type",
+    "part",
+    "data",
+    "option",
+    "id",
+    "target",
+    "file",
+    NULL
 };
 
 int errno;
 
 static struct info {
-       Eina_List *script_port_list;
-       enum buffer_type env_buf_type;
+    Eina_List *script_port_list;
+    enum dynamicbox_fb_type env_buf_type;
 } s_info = {
-       .script_port_list = NULL,
-       .env_buf_type = BUFFER_TYPE_FILE,
+    .script_port_list = NULL,
+    .env_buf_type = DBOX_FB_TYPE_FILE,
 };
 
 struct script_port {
-       void *handle;
-
-       const char *(*magic_id)(void);
-       int (*update_color)(void *handle, const char *id, const char *part, const char *rgba);
-       int (*update_text)(void *handle, const char *id, const char *part, const char *text);
-       int (*update_image)(void *handle, const char *id, const char *part, const char *path, const char *option);
-       int (*update_access)(void *handle, const char *id, const char *part, const char *text, const char *option);
-       int (*operate_access)(void *handle, const char *id, const char *part, const char *operation, const char *option);
-       int (*update_script)(void *handle, const char *src_id, const char *target_id, const char *part, const char *path, const char *option);
-       int (*update_signal)(void *handle, const char *id, const char *part, const char *signal);
-       int (*update_drag)(void *handle, const char *id, const char *part, double x, double y);
-       int (*update_size)(void *handle, const char *id, int w, int h);
-       int (*update_category)(void *handle, const char *id, const char *category);
-       int (*feed_event)(void *handle, int event_type, int x, int y, int down, unsigned int keycode, double timestamp);
-
-       void *(*create)(void *buffer_info, const char *file, const char *option);
-       int (*destroy)(void *handle);
-
-       int (*load)(void *handle, int (*render_pre)(void *buffer_info, void *data), int (*render_post)(void *buffer_info, void *data), void *data);
-       int (*unload)(void *handle);
-
-       int (*init)(double scale, int premultiplied);
-       int (*fini)(void);
+    void *handle;
+
+    const char *(*magic_id)(void);
+    int (*update_color)(void *handle, const char *id, const char *part, const char *rgba);
+    int (*update_text)(void *handle, const char *id, const char *part, const char *text);
+    int (*update_image)(void *handle, const char *id, const char *part, const char *path, const char *option);
+    int (*update_access)(void *handle, const char *id, const char *part, const char *text, const char *option);
+    int (*operate_access)(void *handle, const char *id, const char *part, const char *operation, const char *option);
+    int (*update_script)(void *handle, const char *src_id, const char *target_id, const char *part, const char *path, const char *option);
+    int (*update_signal)(void *handle, const char *id, const char *part, const char *signal);
+    int (*update_drag)(void *handle, const char *id, const char *part, double x, double y);
+    int (*update_size)(void *handle, const char *id, int w, int h);
+    int (*update_category)(void *handle, const char *id, const char *category);
+    int (*feed_event)(void *handle, int event_type, int x, int y, int down, unsigned int keycode, double timestamp);
+
+    void *(*create)(void *buffer_info, const char *file, const char *option);
+    int (*destroy)(void *handle);
+
+    int (*load)(void *handle, int (*render_pre)(void *buffer_info, void *data), int (*render_post)(void *buffer_info, void *data), void *data);
+    int (*unload)(void *handle);
+
+    int (*init)(double scale, int premultiplied);
+    int (*fini)(void);
 };
 
 enum block_type {
-       TYPE_ACCESS,
-       TYPE_ACCESS_OP,
-       TYPE_COLOR,
-       TYPE_DRAG,
-       TYPE_IMAGE,
-       TYPE_INFO,
-       TYPE_SCRIPT,
-       TYPE_SIGNAL,
-       TYPE_TEXT,
-       TYPE_MAX
+    TYPE_ACCESS,
+    TYPE_ACCESS_OP,
+    TYPE_COLOR,
+    TYPE_DRAG,
+    TYPE_IMAGE,
+    TYPE_INFO,
+    TYPE_SCRIPT,
+    TYPE_SIGNAL,
+    TYPE_TEXT,
+    TYPE_MAX
 };
 
 enum field_type {
-       FIELD_TYPE,
-       FIELD_PART,
-       FIELD_DATA,
-       FIELD_OPTION,
-       FIELD_ID,
-       FIELD_TARGET,
-       FIELD_FILE
+    FIELD_TYPE,
+    FIELD_PART,
+    FIELD_DATA,
+    FIELD_OPTION,
+    FIELD_ID,
+    FIELD_TARGET,
+    FIELD_FILE
 };
 
 struct block {
-       enum block_type type;
-       char *part;
-       char *data;
-       char *option;
-       char *id;
-       char *target;
-       char *file;
-
-       /* Should be released */
-       char *filebuf;
-       const char *filename;
+    enum block_type type;
+    char *part;
+    char *data;
+    char *option;
+    char *id;
+    char *target;
+    char *file;
+
+    /* Should be released */
+    char *filebuf;
+    const char *filename;
 };
 
 struct script_info {
-       struct buffer_info *buffer_handle; 
-       int loaded;
+    struct buffer_info *buffer_handle; 
+    int loaded;
 
-       int w;
-       int h;
+    int w;
+    int h;
 
-       int x;
-       int y;
-       int down;
+    int x;
+    int y;
+    int down;
 
-       unsigned int keycode;
+    unsigned int keycode;
 
-       struct script_port *port;
-       void *port_data;
+    struct script_port *port;
+    void *port_data;
 
-       Eina_List *cached_blocks;
+    Eina_List *cached_blocks;
 };
 
 static inline void consuming_parsed_block(struct inst_info *inst, int is_pd, struct block *block);
 
 static int load_all_ports(void)
 {
-       struct script_port *item;
-       struct dirent *ent;
-       DIR *dir;
-       char *path;
-       int pathlen;
-
-       dir = opendir(SCRIPT_PORT_PATH);
-       if (!dir) {
-               ErrPrint("Error: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_IO;
+    struct script_port *item;
+    struct dirent *ent;
+    DIR *dir;
+    char *path;
+    int pathlen;
+
+    dir = opendir(DYNAMICBOX_CONF_SCRIPT_PORT_PATH);
+    if (!dir) {
+       ErrPrint("Error: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
+
+    while ((ent = readdir(dir))) {
+       if (ent->d_name[0] == '.') {
+           continue;
+       }
+
+       pathlen = strlen(ent->d_name) + strlen(DYNAMICBOX_CONF_SCRIPT_PORT_PATH) + 1;
+       path = malloc(pathlen);
+       if (!path) {
+           ErrPrint("Heap: %s %d\n", strerror(errno), pathlen);
+           if (closedir(dir) < 0) {
+               ErrPrint("closedir: %s\n", strerror(errno));
+           }
+           return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
        }
 
-       while ((ent = readdir(dir))) {
-               if (ent->d_name[0] == '.') {
-                       continue;
-               }
-
-               pathlen = strlen(ent->d_name) + strlen(SCRIPT_PORT_PATH) + 1;
-               path = malloc(pathlen);
-               if (!path) {
-                       ErrPrint("Heap: %s %d\n", strerror(errno), pathlen);
-                       if (closedir(dir) < 0) {
-                               ErrPrint("closedir: %s\n", strerror(errno));
-                       }
-                       return LB_STATUS_ERROR_MEMORY;
-               }
-
-               snprintf(path, pathlen, "%s%s", SCRIPT_PORT_PATH, ent->d_name);
-
-               item = malloc(sizeof(*item));
-               if (!item) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       DbgFree(path);
-                       if (closedir(dir) < 0) {
-                               ErrPrint("closedir: %s\n", strerror(errno));
-                       }
-                       return LB_STATUS_ERROR_MEMORY;
-               }
+       snprintf(path, pathlen, "%s%s", DYNAMICBOX_CONF_SCRIPT_PORT_PATH, ent->d_name);
 
-               DbgPrint("Open SCRIPT PORT: %s\n", path);
-               item->handle = dlopen(path, RTLD_GLOBAL | RTLD_NOW | RTLD_DEEPBIND);
-               DbgFree(path);
-               if (!item->handle) {
-                       ErrPrint("Error: %s\n", dlerror());
-                       DbgFree(item);
-                       if (closedir(dir) < 0) {
-                               ErrPrint("closedir: %s\n", strerror(errno));
-                       }
-                       return LB_STATUS_ERROR_FAULT;
-               }
-
-               item->magic_id = dlsym(item->handle, "script_magic_id");
-               if (!item->magic_id) {
-                       goto errout;
-               }
+       item = malloc(sizeof(*item));
+       if (!item) {
+           ErrPrint("Heap: %s\n", strerror(errno));
+           DbgFree(path);
+           if (closedir(dir) < 0) {
+               ErrPrint("closedir: %s\n", strerror(errno));
+           }
+           return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+       }
 
-               DbgPrint("SCRIPT PORT magic id: %s\n", item->magic_id());
+       DbgPrint("Open SCRIPT PORT: %s\n", path);
+       item->handle = dlopen(path, RTLD_GLOBAL | RTLD_NOW | RTLD_DEEPBIND);
+       DbgFree(path);
+       if (!item->handle) {
+           ErrPrint("Error: %s\n", dlerror());
+           DbgFree(item);
+           if (closedir(dir) < 0) {
+               ErrPrint("closedir: %s\n", strerror(errno));
+           }
+           return DBOX_STATUS_ERROR_FAULT;
+       }
 
-               item->update_color = dlsym(item->handle, "script_update_color");
-               if (!item->update_color) {
-                       goto errout;
-               }
+       item->magic_id = dlsym(item->handle, "script_magic_id");
+       if (!item->magic_id) {
+           goto errout;
+       }
 
-               item->update_text = dlsym(item->handle, "script_update_text");
-               if (!item->update_text) {
-                       goto errout;
-               }
+       DbgPrint("SCRIPT PORT magic id: %s\n", item->magic_id());
 
-               item->update_image = dlsym(item->handle, "script_update_image");
-               if (!item->update_image) {
-                       goto errout;
-               }
+       item->update_color = dlsym(item->handle, "script_update_color");
+       if (!item->update_color) {
+           goto errout;
+       }
 
-               item->update_access = dlsym(item->handle, "script_update_access");
-               if (!item->update_access) {
-                       goto errout;
-               }
+       item->update_text = dlsym(item->handle, "script_update_text");
+       if (!item->update_text) {
+           goto errout;
+       }
 
-               item->operate_access = dlsym(item->handle, "script_operate_access");
-               if (!item->operate_access) {
-                       goto errout;
-               }
+       item->update_image = dlsym(item->handle, "script_update_image");
+       if (!item->update_image) {
+           goto errout;
+       }
 
-               item->update_script = dlsym(item->handle, "script_update_script");
-               if (!item->update_script) {
-                       goto errout;
-               }
+       item->update_access = dlsym(item->handle, "script_update_access");
+       if (!item->update_access) {
+           goto errout;
+       }
 
-               item->update_signal = dlsym(item->handle, "script_update_signal");
-               if (!item->update_signal) {
-                       goto errout;
-               }
+       item->operate_access = dlsym(item->handle, "script_operate_access");
+       if (!item->operate_access) {
+           goto errout;
+       }
 
-               item->update_drag = dlsym(item->handle, "script_update_drag");
-               if (!item->update_drag) {
-                       goto errout;
-               }
+       item->update_script = dlsym(item->handle, "script_update_script");
+       if (!item->update_script) {
+           goto errout;
+       }
 
-               item->update_size = dlsym(item->handle, "script_update_size");
-               if (!item->update_size) {
-                       goto errout;
-               }
+       item->update_signal = dlsym(item->handle, "script_update_signal");
+       if (!item->update_signal) {
+           goto errout;
+       }
 
-               item->update_category = dlsym(item->handle, "script_update_category");
-               if (!item->update_category) {
-                       goto errout;
-               }
+       item->update_drag = dlsym(item->handle, "script_update_drag");
+       if (!item->update_drag) {
+           goto errout;
+       }
 
-               item->create = dlsym(item->handle, "script_create");
-               if (!item->create) {
-                       goto errout;
-               }
+       item->update_size = dlsym(item->handle, "script_update_size");
+       if (!item->update_size) {
+           goto errout;
+       }
 
-               item->destroy = dlsym(item->handle, "script_destroy");
-               if (!item->destroy) {
-                       goto errout;
-               }
+       item->update_category = dlsym(item->handle, "script_update_category");
+       if (!item->update_category) {
+           goto errout;
+       }
 
-               item->load = dlsym(item->handle, "script_load");
-               if (!item->load) {
-                       goto errout;
-               }
+       item->create = dlsym(item->handle, "script_create");
+       if (!item->create) {
+           goto errout;
+       }
 
-               item->unload = dlsym(item->handle, "script_unload");
-               if (!item->unload) {
-                       goto errout;
-               }
+       item->destroy = dlsym(item->handle, "script_destroy");
+       if (!item->destroy) {
+           goto errout;
+       }
 
-               item->init = dlsym(item->handle, "script_init");
-               if (!item->init) {
-                       goto errout;
-               }
+       item->load = dlsym(item->handle, "script_load");
+       if (!item->load) {
+           goto errout;
+       }
 
-               item->fini = dlsym(item->handle, "script_fini");
-               if (!item->fini) {
-                       goto errout;
-               }
+       item->unload = dlsym(item->handle, "script_unload");
+       if (!item->unload) {
+           goto errout;
+       }
 
-               item->feed_event = dlsym(item->handle, "script_feed_event");
-               if (!item->feed_event) {
-                       goto errout;
-               }
+       item->init = dlsym(item->handle, "script_init");
+       if (!item->init) {
+           goto errout;
+       }
 
-               if (item->init(SCALE_WIDTH_FACTOR, PREMULTIPLIED_COLOR) < 0) {
-                       ErrPrint("Failed to initialize script engine\n");
-                       goto errout;
-               }
+       item->fini = dlsym(item->handle, "script_fini");
+       if (!item->fini) {
+           goto errout;
+       }
 
-               s_info.script_port_list = eina_list_append(s_info.script_port_list, item);
+       item->feed_event = dlsym(item->handle, "script_feed_event");
+       if (!item->feed_event) {
+           goto errout;
        }
 
-       if (closedir(dir) < 0) {
-               ErrPrint("closedir: %s\n", strerror(errno));
+       if (item->init(DYNAMICBOX_CONF_SCALE_WIDTH_FACTOR, DYNAMICBOX_CONF_PREMULTIPLIED_COLOR) < 0) {
+           ErrPrint("Failed to initialize script engine\n");
+           goto errout;
        }
 
-       return LB_STATUS_SUCCESS;
+       s_info.script_port_list = eina_list_append(s_info.script_port_list, item);
+    }
+
+    if (closedir(dir) < 0) {
+       ErrPrint("closedir: %s\n", strerror(errno));
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
 
 errout:
-       ErrPrint("Error: %s\n", dlerror());
-       if (dlclose(item->handle) != 0) {
-               ErrPrint("dlclose: %s\n", strerror(errno));
-       }
-       DbgFree(item);
-       if (closedir(dir) < 0) {
-               ErrPrint("closedir: %s\n", strerror(errno));
-       }
-       return LB_STATUS_ERROR_FAULT;
+    ErrPrint("Error: %s\n", dlerror());
+    if (dlclose(item->handle) != 0) {
+       ErrPrint("dlclose: %s\n", strerror(errno));
+    }
+    DbgFree(item);
+    if (closedir(dir) < 0) {
+       ErrPrint("closedir: %s\n", strerror(errno));
+    }
+    return DBOX_STATUS_ERROR_FAULT;
 }
 
 static inline struct script_port *find_port(const char *magic_id)
 {
-       Eina_List *l;
-       struct script_port *item;
+    Eina_List *l;
+    struct script_port *item;
 
-       if (!s_info.script_port_list) {
-               int ret;
+    if (!s_info.script_port_list) {
+       int ret;
 
-               ret = load_all_ports();
-               if (ret < 0) {
-                       ErrPrint("load_all_ports: %d\n", ret);
-               }
+       ret = load_all_ports();
+       if (ret < 0) {
+           ErrPrint("load_all_ports: %d\n", ret);
        }
+    }
 
-       EINA_LIST_FOREACH(s_info.script_port_list, l, item) {
-               if (!strcmp(item->magic_id(), magic_id)) {
-                       return item;
-               }
+    EINA_LIST_FOREACH(s_info.script_port_list, l, item) {
+       if (!strcmp(item->magic_id(), magic_id)) {
+           return item;
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
 static inline void delete_block(struct block *block)
 {
-       DbgFree(block->filebuf);
-       DbgFree(block);
+    DbgFree(block->filebuf);
+    DbgFree(block);
 }
 
 static int render_post_cb(void *_buffer_handle, void *data)
 {
-       PERF_INIT();
-       PERF_BEGIN();
-       struct inst_info *inst;
-       struct buffer_info *buffer_handle = _buffer_handle;
-       struct script_info *info;
-
-       inst = buffer_handler_instance(buffer_handle);
-       if (!inst) {
-               goto out;
-       }
-
-       if (instance_state(inst) != INST_ACTIVATED) {
-               ErrPrint("Render post invoked but instance is not activated\n");
-               PERF_MARK(__func__);
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       info = instance_lb_script(inst);
-       if (info && info == data) {
-               buffer_handler_flush(buffer_handle);
-               instance_lb_updated_by_instance(inst, NULL);
-               PERF_MARK("lb,update");
-               return LB_STATUS_SUCCESS;
-       }
-
-       info = instance_pd_script(inst);
-       if (info && info == data) {
-               buffer_handler_flush(buffer_handle);
-               instance_pd_updated_by_instance(inst, NULL);
-               PERF_MARK("pd,update");
-               return LB_STATUS_SUCCESS;
-       }
+    PERF_INIT();
+    PERF_BEGIN();
+    struct inst_info *inst;
+    struct buffer_info *buffer_handle = _buffer_handle;
+    struct script_info *info;
+
+    inst = buffer_handler_instance(buffer_handle);
+    if (!inst) {
+       goto out;
+    }
+
+    if (instance_state(inst) != INST_ACTIVATED) {
+       ErrPrint("Render post invoked but instance is not activated\n");
+       PERF_MARK(__func__);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    info = instance_dbox_script(inst);
+    if (info && info == data) {
+       buffer_handler_flush(buffer_handle);
+       instance_dbox_updated_by_instance(inst, NULL, info->x, info->y, info->w, info->h);
+       PERF_MARK("lb,update");
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    info = instance_gbar_script(inst);
+    if (info && info == data) {
+       buffer_handler_flush(buffer_handle);
+       instance_gbar_updated_by_instance(inst, NULL, info->x, info->y, info->w, info->h);
+       PERF_MARK("pd,update");
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
 out:
-       ErrPrint("Failed to sync\n");
-       PERF_MARK(__func__);
-       return LB_STATUS_ERROR_FAULT;
+    ErrPrint("Failed to sync\n");
+    PERF_MARK(__func__);
+    return DBOX_STATUS_ERROR_FAULT;
 }
 
 /*!
@@ -413,1099 +415,1098 @@ out:
  */
 EAPI int script_signal_emit(void *buffer_handle, const char *part, const char *signal, double sx, double sy, double ex, double ey)
 {
-       struct script_info *info;
-       struct inst_info *inst;
-       int w;
-       int h;
-       double fx;
-       double fy;
-
-       if (!buffer_handle) {
-               ErrPrint("Invalid handle\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       info = buffer_handler_data(buffer_handle);
-       if (!info) {
-               ErrPrint("Invalid handle\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       inst = buffer_handler_instance(buffer_handle);
-       if (!inst) {
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       if (!signal || strlen(signal) == 0) {
-               signal = "";
-       }
-
-       if (!part || strlen(part) == 0) {
-               part = "";
-       }
-
-       buffer_handler_get_size(buffer_handle, &w, &h);
-
-       fx = (double)info->x / (double)w;
-       fy = (double)info->y / (double)h;
-
-       return instance_signal_emit(inst, signal, part, sx, sy, ex, ey, fx, fy, info->down);
+    struct script_info *info;
+    struct inst_info *inst;
+    int w;
+    int h;
+    double fx;
+    double fy;
+
+    if (!buffer_handle) {
+       ErrPrint("Invalid handle\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    info = buffer_handler_data(buffer_handle);
+    if (!info) {
+       ErrPrint("Invalid handle\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    inst = buffer_handler_instance(buffer_handle);
+    if (!inst) {
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    if (!signal || strlen(signal) == 0) {
+       signal = "";
+    }
+
+    if (!part || strlen(part) == 0) {
+       part = "";
+    }
+
+    buffer_handler_get_size(buffer_handle, &w, &h);
+
+    fx = (double)info->x / (double)w;
+    fy = (double)info->y / (double)h;
+
+    return instance_signal_emit(inst, signal, part, sx, sy, ex, ey, fx, fy, info->down);
 }
 
 static inline void flushing_cached_block(struct script_info *info)
 {
-       struct block *block;
-       struct inst_info *inst;
-       int is_pd;
-
-       inst = buffer_handler_instance(info->buffer_handle);
-       if (!inst) {
-               ErrPrint("Instance is not valid\n");
-               EINA_LIST_FREE(info->cached_blocks, block) {
-                       delete_block(block);
-               }
-               return;
-       }
-
-       is_pd = instance_pd_script(inst) == info;
+    struct block *block;
+    struct inst_info *inst;
+    int is_pd;
 
+    inst = buffer_handler_instance(info->buffer_handle);
+    if (!inst) {
+       ErrPrint("Instance is not valid\n");
        EINA_LIST_FREE(info->cached_blocks, block) {
-               consuming_parsed_block(inst, is_pd, block);
+           delete_block(block);
        }
+       return;
+    }
+
+    is_pd = instance_gbar_script(inst) == info;
+
+    EINA_LIST_FREE(info->cached_blocks, block) {
+       consuming_parsed_block(inst, is_pd, block);
+    }
 }
 
 HAPI int script_handler_load(struct script_info *info, int is_pd)
 {
-       struct inst_info *inst;
-
-       if (!info || !info->port) {
-               ErrPrint("Script handler is not created\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       if (info->loaded > 0) {
-               info->loaded++;
-               return LB_STATUS_SUCCESS;
-       }
-
-       if (info->port->load(info->port_data, NULL, render_post_cb, info) < 0) {
-               ErrPrint("Unable to load the script\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       info->loaded = 1;
-       flushing_cached_block(info);
-
-       inst = buffer_handler_instance(info->buffer_handle);
-       if (inst) {
-               script_signal_emit(info->buffer_handle, instance_id(inst),
-                               is_pd ? "pd,show" : "lb,show", 0.0f, 0.0f, 0.0f, 0.0f);
-       }
-       buffer_handler_flush(info->buffer_handle);
-       return LB_STATUS_SUCCESS;
+    struct inst_info *inst;
+
+    if (!info || !info->port) {
+       ErrPrint("Script handler is not created\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    if (info->loaded > 0) {
+       info->loaded++;
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    if (info->port->load(info->port_data, NULL, render_post_cb, info) < 0) {
+       ErrPrint("Unable to load the script\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    info->loaded = 1;
+    flushing_cached_block(info);
+
+    inst = buffer_handler_instance(info->buffer_handle);
+    if (inst) {
+       script_signal_emit(info->buffer_handle, instance_id(inst),
+               is_pd ? "gbar,show" : "dbox,show", 0.0f, 0.0f, 0.0f, 0.0f);
+    }
+    buffer_handler_flush(info->buffer_handle);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int script_handler_unload(struct script_info *info, int is_pd)
 {
-       struct inst_info *inst;
+    struct inst_info *inst;
 
-       if (!info || !info->port) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!info || !info->port) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       info->loaded--;
-       if (info->loaded > 0) {
-               return LB_STATUS_ERROR_BUSY;
-       }
+    info->loaded--;
+    if (info->loaded > 0) {
+       return DBOX_STATUS_ERROR_BUSY;
+    }
 
-       if (info->loaded < 0) {
-               info->loaded = 0;
-               return LB_STATUS_ERROR_ALREADY;
-       }
+    if (info->loaded < 0) {
+       info->loaded = 0;
+       return DBOX_STATUS_ERROR_ALREADY;
+    }
 
-       inst = buffer_handler_instance(info->buffer_handle);
-       if (inst) {
-               script_signal_emit(info->buffer_handle, instance_id(inst),
-                               is_pd ? "pd,hide" : "lb,hide", 0.0f, 0.0f, 0.0f, 0.0f);
-       }
+    inst = buffer_handler_instance(info->buffer_handle);
+    if (inst) {
+       script_signal_emit(info->buffer_handle, instance_id(inst),
+               is_pd ? "gbar,hide" : "dbox,hide", 0.0f, 0.0f, 0.0f, 0.0f);
+    }
 
-       if (info->port->unload(info->port_data) < 0) {
-               ErrPrint("Failed to unload script object. but go ahead\n");
-       }
+    if (info->port->unload(info->port_data) < 0) {
+       ErrPrint("Failed to unload script object. but go ahead\n");
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI struct script_info *script_handler_create(struct inst_info *inst, const char *file, const char *option, int w, int h)
 {
-       struct script_info *info;
+    struct script_info *info;
 
-       DbgPrint("Create script: %s (%s) %dx%d\n", file, option, w, h);
+    DbgPrint("Create script: %s (%s) %dx%d\n", file, option, w, h);
 
-       if (!file) {
-               return NULL;
-       }
+    if (!file) {
+       return NULL;
+    }
 
-       info = calloc(1, sizeof(*info));
-       if (!info) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return NULL;
-       }
+    info = calloc(1, sizeof(*info));
+    if (!info) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
 
-       info->buffer_handle = buffer_handler_create(inst, s_info.env_buf_type, w, h, DEFAULT_PIXELS);
-       if (!info->buffer_handle) {
-               /* buffer_handler_create will prints some log */
-               DbgFree(info);
-               return NULL;
-       }
+    info->buffer_handle = buffer_handler_create(inst, s_info.env_buf_type, w, h, DYNAMICBOX_CONF_DEFAULT_PIXELS);
+    if (!info->buffer_handle) {
+       /* buffer_handler_create will prints some log */
+       DbgFree(info);
+       return NULL;
+    }
 
-       (void)buffer_handler_set_data(info->buffer_handle, info);
+    (void)buffer_handler_set_data(info->buffer_handle, info);
 
-       info->port = find_port(package_script(instance_package(inst)));
-       if (!info->port) {
-               ErrPrint("Failed to find a proper port for [%s]%s\n",
-                                       instance_package(inst), package_script(instance_package(inst)));
-               buffer_handler_destroy(info->buffer_handle);
-               DbgFree(info);
-               return NULL;
-       }
+    info->port = find_port(package_script(instance_package(inst)));
+    if (!info->port) {
+       ErrPrint("Failed to find a proper port for [%s]%s\n",
+               instance_package(inst), package_script(instance_package(inst)));
+       buffer_handler_destroy(info->buffer_handle);
+       DbgFree(info);
+       return NULL;
+    }
 
-       info->port_data = info->port->create(info->buffer_handle, file, option);
-       if (!info->port_data) {
-               ErrPrint("Failed to create a port (%s - %s)\n", file, option);
-               buffer_handler_destroy(info->buffer_handle);
-               DbgFree(info);
-               return NULL;
-       }
+    info->port_data = info->port->create(info->buffer_handle, file, option);
+    if (!info->port_data) {
+       ErrPrint("Failed to create a port (%s - %s)\n", file, option);
+       buffer_handler_destroy(info->buffer_handle);
+       DbgFree(info);
+       return NULL;
+    }
 
-       return info;
+    return info;
 }
 
 HAPI int script_handler_destroy(struct script_info *info)
 {
-       struct block *block;
-       int ret;
+    struct block *block;
+    int ret;
 
-       if (!info || !info->port) {
-               ErrPrint("port is not valid\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!info || !info->port) {
+       ErrPrint("port is not valid\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (info->loaded != 0) {
-               ErrPrint("Script handler is not unloaded\n");
-               return LB_STATUS_ERROR_BUSY;
-       }
+    if (info->loaded != 0) {
+       ErrPrint("Script handler is not unloaded\n");
+       return DBOX_STATUS_ERROR_BUSY;
+    }
 
-       ret = info->port->destroy(info->port_data);
-       if (ret < 0) {
-               ErrPrint("Failed to destroy port, but go ahead: %d\n", ret);
-       }
+    ret = info->port->destroy(info->port_data);
+    if (ret < 0) {
+       ErrPrint("Failed to destroy port, but go ahead: %d\n", ret);
+    }
 
-       (void)buffer_handler_destroy(info->buffer_handle);
+    (void)buffer_handler_destroy(info->buffer_handle);
 
-       EINA_LIST_FREE(info->cached_blocks, block) {
-               delete_block(block);
-       }
+    EINA_LIST_FREE(info->cached_blocks, block) {
+       delete_block(block);
+    }
 
-       DbgFree(info);
-       return LB_STATUS_SUCCESS;
+    DbgFree(info);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int script_handler_is_loaded(struct script_info *info)
 {
-       return info ? info->loaded > 0 : 0;
+    return info ? info->loaded > 0 : 0;
 }
 
 HAPI struct buffer_info *script_handler_buffer_info(struct script_info *info)
 {
-       if (!info) {
-               return NULL;
-       }
+    if (!info) {
+       return NULL;
+    }
 
-       return info->buffer_handle;
+    return info->buffer_handle;
 }
 
 static int update_script_color(struct inst_info *inst, struct block *block, int is_pd)
 {
-       PERF_INIT();
-       PERF_BEGIN();
-       struct script_info *info;
-       int ret;
+    PERF_INIT();
+    PERF_BEGIN();
+    struct script_info *info;
+    int ret;
 
-       if (!block || !block->part || !block->data) {
-               ErrPrint("Block or part or data is not valid\n");
-               PERF_MARK("color");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       info = is_pd ? instance_pd_script(inst) : instance_lb_script(inst);
-       if (!info) {
-               ErrPrint("info is NIL (%d, %s)\n", is_pd, instance_id(inst));
-               PERF_MARK("color");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (!block || !block->part || !block->data) {
+       ErrPrint("Block or part or data is not valid\n");
+       PERF_MARK("color");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (!info->port) {
-               ErrPrint("info->port is NIL (%d, %s)\n", is_pd, instance_id(inst));
-               PERF_MARK("color");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    info = is_pd ? instance_gbar_script(inst) : instance_dbox_script(inst);
+    if (!info) {
+       ErrPrint("info is NIL (%d, %s)\n", is_pd, instance_id(inst));
+       PERF_MARK("color");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       ret = info->port->update_color(info->port_data, block->id, block->part, block->data);
+    if (!info->port) {
+       ErrPrint("info->port is NIL (%d, %s)\n", is_pd, instance_id(inst));
        PERF_MARK("color");
-       return ret;
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    ret = info->port->update_color(info->port_data, block->id, block->part, block->data);
+    PERF_MARK("color");
+    return ret;
 }
 
 static int update_script_text(struct inst_info *inst, struct block *block, int is_pd)
 {
-       PERF_INIT();
-       PERF_BEGIN();
-       struct script_info *info;
-       int ret;
+    PERF_INIT();
+    PERF_BEGIN();
+    struct script_info *info;
+    int ret;
 
-       if (!block || !block->part || !block->data) {
-               ErrPrint("Block or part or data is not valid\n");
-               PERF_MARK("text");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       info = is_pd ? instance_pd_script(inst) : instance_lb_script(inst);
-       if (!info) {
-               ErrPrint("info is NIL (%d, %s)\n", is_pd, instance_id(inst));
-               PERF_MARK("text");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (!block || !block->part || !block->data) {
+       ErrPrint("Block or part or data is not valid\n");
+       PERF_MARK("text");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (!info->port) {
-               ErrPrint("info->port is NIL\n");
-               PERF_MARK("text");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    info = is_pd ? instance_gbar_script(inst) : instance_dbox_script(inst);
+    if (!info) {
+       ErrPrint("info is NIL (%d, %s)\n", is_pd, instance_id(inst));
+       PERF_MARK("text");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       DbgPrint("[%s] %s (%s)\n", block->id, block->part, block->data);
-       ret = info->port->update_text(info->port_data, block->id, block->part, block->data);
-       
+    if (!info->port) {
+       ErrPrint("info->port is NIL\n");
        PERF_MARK("text");
-       return ret;
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    DbgPrint("[%s] %s (%s)\n", block->id, block->part, block->data);
+    ret = info->port->update_text(info->port_data, block->id, block->part, block->data);
+
+    PERF_MARK("text");
+    return ret;
 }
 
 static int update_script_image(struct inst_info *inst, struct block *block, int is_pd)
 {
-       PERF_INIT();
-       PERF_BEGIN();
-       struct script_info *info;
-       int ret;
+    PERF_INIT();
+    PERF_BEGIN();
+    struct script_info *info;
+    int ret;
 
-       if (!block || !block->part) {
-               ErrPrint("Block or part is not valid\n");
-               PERF_MARK("image");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       info = is_pd ? instance_pd_script(inst) : instance_lb_script(inst);
-       if (!info) {
-               ErrPrint("info is NIL (%d, %s)\n", is_pd, instance_id(inst));
-               PERF_MARK("image");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (!block || !block->part) {
+       ErrPrint("Block or part is not valid\n");
+       PERF_MARK("image");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (!info->port) {
-               ErrPrint("info->port is NIL\n");
-               PERF_MARK("image");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    info = is_pd ? instance_gbar_script(inst) : instance_dbox_script(inst);
+    if (!info) {
+       ErrPrint("info is NIL (%d, %s)\n", is_pd, instance_id(inst));
+       PERF_MARK("image");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       DbgPrint("[%s] %s (%s)\n", block->id, block->part, block->data);
-       ret = info->port->update_image(info->port_data, block->id, block->part, block->data, block->option);
+    if (!info->port) {
+       ErrPrint("info->port is NIL\n");
        PERF_MARK("image");
-       return ret;
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    DbgPrint("[%s] %s (%s)\n", block->id, block->part, block->data);
+    ret = info->port->update_image(info->port_data, block->id, block->part, block->data, block->option);
+    PERF_MARK("image");
+    return ret;
 }
 
 static int update_access(struct inst_info *inst, struct block *block, int is_pd)
 {
-       PERF_INIT();
-       PERF_BEGIN();
-       struct script_info *info;
-       int ret;
+    PERF_INIT();
+    PERF_BEGIN();
+    struct script_info *info;
+    int ret;
 
-       if (!block || !block->part) {
-               ErrPrint("Block or block->part is NIL\n");
-               PERF_MARK("access");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       info = is_pd ? instance_pd_script(inst) : instance_lb_script(inst);
-       if (!info) {
-               ErrPrint("info is NIL (%d, %s)\n", is_pd, instance_id(inst));
-               PERF_MARK("access");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (!block || !block->part) {
+       ErrPrint("Block or block->part is NIL\n");
+       PERF_MARK("access");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (!info->port) {
-               ErrPrint("info->port is NIL\n");
-               PERF_MARK("access");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    info = is_pd ? instance_gbar_script(inst) : instance_dbox_script(inst);
+    if (!info) {
+       ErrPrint("info is NIL (%d, %s)\n", is_pd, instance_id(inst));
+       PERF_MARK("access");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       ret = info->port->update_access(info->port_data, block->id, block->part, block->data, block->option);
+    if (!info->port) {
+       ErrPrint("info->port is NIL\n");
        PERF_MARK("access");
-       return ret;
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    ret = info->port->update_access(info->port_data, block->id, block->part, block->data, block->option);
+    PERF_MARK("access");
+    return ret;
 }
 
 static int operate_access(struct inst_info *inst, struct block *block, int is_pd)
 {
-       PERF_INIT();
-       PERF_BEGIN();
-       struct script_info *info;
-       int ret;
+    PERF_INIT();
+    PERF_BEGIN();
+    struct script_info *info;
+    int ret;
 
-       if (!block || !block->part) {
-               ErrPrint("Block or block->part is NIL\n");
-               PERF_MARK("operate_access");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       info = is_pd ? instance_pd_script(inst) : instance_lb_script(inst);
-       if (!info) {
-               ErrPrint("info is NIL (%d, %s)\n", is_pd, instance_id(inst));
-               PERF_MARK("operate_access");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (!block || !block->part) {
+       ErrPrint("Block or block->part is NIL\n");
+       PERF_MARK("operate_access");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (!info->port) {
-               ErrPrint("info->port is NIL\n");
-               PERF_MARK("operate_access");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    info = is_pd ? instance_gbar_script(inst) : instance_dbox_script(inst);
+    if (!info) {
+       ErrPrint("info is NIL (%d, %s)\n", is_pd, instance_id(inst));
+       PERF_MARK("operate_access");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       ret = info->port->operate_access(info->port_data, block->id, block->part, block->data, block->option);
+    if (!info->port) {
+       ErrPrint("info->port is NIL\n");
        PERF_MARK("operate_access");
-       return ret;
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    ret = info->port->operate_access(info->port_data, block->id, block->part, block->data, block->option);
+    PERF_MARK("operate_access");
+    return ret;
 }
 
 static int update_script_script(struct inst_info *inst, struct block *block, int is_pd)
 {
-       PERF_INIT();
-       PERF_BEGIN();
-       struct script_info *info;
-       int ret;
+    PERF_INIT();
+    PERF_BEGIN();
+    struct script_info *info;
+    int ret;
 
-       if (!block || !block->part) {
-               ErrPrint("Block or part is NIL\n");
-               PERF_MARK("script");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       info = is_pd ? instance_pd_script(inst) : instance_lb_script(inst);
-       if (!info) {
-               ErrPrint("info is NIL (%d, %s)\n", is_pd, instance_id(inst));
-               PERF_MARK("script");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (!block || !block->part) {
+       ErrPrint("Block or part is NIL\n");
+       PERF_MARK("script");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (!info->port) {
-               ErrPrint("info->port is NIL\n");
-               PERF_MARK("script");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    info = is_pd ? instance_gbar_script(inst) : instance_dbox_script(inst);
+    if (!info) {
+       ErrPrint("info is NIL (%d, %s)\n", is_pd, instance_id(inst));
+       PERF_MARK("script");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       ret = info->port->update_script(info->port_data, block->id, block->target, block->part, block->data, block->option);
+    if (!info->port) {
+       ErrPrint("info->port is NIL\n");
        PERF_MARK("script");
-       return ret;
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    ret = info->port->update_script(info->port_data, block->id, block->target, block->part, block->data, block->option);
+    PERF_MARK("script");
+    return ret;
 }
 
 static int update_script_signal(struct inst_info *inst, struct block *block, int is_pd)
 {
-       PERF_INIT();
-       PERF_BEGIN();
-       struct script_info *info;
-       int ret;
-
-       if (!block) {
-               ErrPrint("block is NIL\n");
-               PERF_MARK("signal");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    PERF_INIT();
+    PERF_BEGIN();
+    struct script_info *info;
+    int ret;
 
-       info = is_pd ? instance_pd_script(inst) : instance_lb_script(inst);
-       if (!info) {
-               ErrPrint("info is NIL (%d, %s)\n", is_pd, instance_id(inst));
-               PERF_MARK("signal");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (!block) {
+       ErrPrint("block is NIL\n");
+       PERF_MARK("signal");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (!info->port) {
-               ErrPrint("info->port is NIL\n");
-               PERF_MARK("signal");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    info = is_pd ? instance_gbar_script(inst) : instance_dbox_script(inst);
+    if (!info) {
+       ErrPrint("info is NIL (%d, %s)\n", is_pd, instance_id(inst));
+       PERF_MARK("signal");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       ret = info->port->update_signal(info->port_data, block->id, block->part, block->data);
+    if (!info->port) {
+       ErrPrint("info->port is NIL\n");
        PERF_MARK("signal");
-       return ret;
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    ret = info->port->update_signal(info->port_data, block->id, block->part, block->data);
+    PERF_MARK("signal");
+    return ret;
 }
 
 static int update_script_drag(struct inst_info *inst, struct block *block, int is_pd)
 {
-       PERF_INIT();
-       PERF_BEGIN();
-       struct script_info *info;
-       double dx, dy;
-       int ret;
-
-       if (!block || !block->data || !block->part) {
-               ErrPrint("block or block->data or block->part is NIL\n");
-               PERF_MARK("drag");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       info = is_pd ? instance_pd_script(inst) : instance_lb_script(inst);
-       if (!info) {
-               ErrPrint("info is NIL (%d, %s)\n", is_pd, instance_id(inst));
-               PERF_MARK("drag");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    PERF_INIT();
+    PERF_BEGIN();
+    struct script_info *info;
+    double dx, dy;
+    int ret;
+
+    if (!block || !block->data || !block->part) {
+       ErrPrint("block or block->data or block->part is NIL\n");
+       PERF_MARK("drag");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (sscanf(block->data, "%lfx%lf", &dx, &dy) != 2) {
-               ErrPrint("Invalid format of data (DRAG data [%s])\n", block->data);
-               PERF_MARK("drag");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    info = is_pd ? instance_gbar_script(inst) : instance_dbox_script(inst);
+    if (!info) {
+       ErrPrint("info is NIL (%d, %s)\n", is_pd, instance_id(inst));
+       PERF_MARK("drag");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       if (!info->port) {
-               ErrPrint("info->port is NIL\n");
-               PERF_MARK("drag");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (sscanf(block->data, "%lfx%lf", &dx, &dy) != 2) {
+       ErrPrint("Invalid format of data (DRAG data [%s])\n", block->data);
+       PERF_MARK("drag");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       ret = info->port->update_drag(info->port_data, block->id, block->part, dx, dy);
+    if (!info->port) {
+       ErrPrint("info->port is NIL\n");
        PERF_MARK("drag");
-       return ret;
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    ret = info->port->update_drag(info->port_data, block->id, block->part, dx, dy);
+    PERF_MARK("drag");
+    return ret;
 }
 
 static void update_size_for_script(struct script_info *info, struct inst_info *inst, int w, int h)
 {
-       /*!
-        * \note
-        * After update the buffer size,
-        * If it required to be unload and load.
-        * New size of buffer will be allocated
-        */
-       buffer_handler_update_size(info->buffer_handle, w, h);
-
-       if (info->port->update_size) {
-               (void)info->port->update_size(info->port_data, NULL, w, h);
-       }
-
-       if (instance_lb_script(inst) == info) {
-               instance_set_lb_size(inst, w, h);
-       } else if (instance_pd_script(inst) == info) {
-               instance_set_pd_size(inst, w, h);
-       } else {
-               ErrPrint("Unknown script\n");
-       }
+    /*!
+     * \note
+     * After update the buffer size,
+     * If it required to be unload and load.
+     * New size of buffer will be allocated
+     */
+    buffer_handler_update_size(info->buffer_handle, w, h);
+
+    if (info->port->update_size) {
+       (void)info->port->update_size(info->port_data, NULL, w, h);
+    }
+
+    if (instance_dbox_script(inst) == info) {
+       instance_set_dbox_size(inst, w, h);
+    } else if (instance_gbar_script(inst) == info) {
+       instance_set_gbar_size(inst, w, h);
+    } else {
+       ErrPrint("Unknown script\n");
+    }
 }
 
 HAPI int script_handler_resize(struct script_info *info, int w, int h)
 {
-       PERF_INIT();
-       PERF_BEGIN();
-       struct inst_info *inst;
-
-       if (!info) {
-               ErrPrint("info[%p] resize is ignored\n", info);
-               PERF_MARK("resize");
-               return LB_STATUS_SUCCESS;
-       }
+    PERF_INIT();
+    PERF_BEGIN();
+    struct inst_info *inst;
 
-       inst = buffer_handler_instance(info->buffer_handle);
-       if (!inst) {
-               ErrPrint("Instance is not valid\n");
-               PERF_MARK("resize");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       update_size_for_script(info, inst, w, h);
+    if (!info) {
+       ErrPrint("info[%p] resize is ignored\n", info);
+       PERF_MARK("resize");
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
+    inst = buffer_handler_instance(info->buffer_handle);
+    if (!inst) {
+       ErrPrint("Instance is not valid\n");
        PERF_MARK("resize");
-       return LB_STATUS_SUCCESS;
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    update_size_for_script(info, inst, w, h);
+
+    PERF_MARK("resize");
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI const char *script_handler_buffer_id(struct script_info *info)
 {
-       if (!info || !info->buffer_handle) {
-               ErrPrint("Invalid info\n");
-               return "";
-       }
+    if (!info || !info->buffer_handle) {
+       ErrPrint("Invalid info\n");
+       return "";
+    }
 
-       return buffer_handler_id(info->buffer_handle);
+    return buffer_handler_id(info->buffer_handle);
 }
 
 static int update_info(struct inst_info *inst, struct block *block, int is_pd)
 {
-       PERF_INIT();
-       PERF_BEGIN();
-       struct script_info *info;
-
-       if (!block || !block->part || !block->data) {
-               ErrPrint("block or block->part or block->data is NIL\n");
-               PERF_MARK("info");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    PERF_INIT();
+    PERF_BEGIN();
+    struct script_info *info;
 
-       info = is_pd ? instance_pd_script(inst) : instance_lb_script(inst);
-       if (!info) {
-               ErrPrint("info is NIL (%d, %s)\n", is_pd, instance_id(inst));
-               PERF_MARK("info");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (!block || !block->part || !block->data) {
+       ErrPrint("block or block->part or block->data is NIL\n");
+       PERF_MARK("info");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (!info->port) {
-               ErrPrint("info->port is NIL\n");
-               PERF_MARK("info");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    info = is_pd ? instance_gbar_script(inst) : instance_dbox_script(inst);
+    if (!info) {
+       ErrPrint("info is NIL (%d, %s)\n", is_pd, instance_id(inst));
+       PERF_MARK("info");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       if (!strcasecmp(block->part, INFO_SIZE)) {
-               int w, h;
+    if (!info->port) {
+       ErrPrint("info->port is NIL\n");
+       PERF_MARK("info");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-               if (sscanf(block->data, "%dx%d", &w, &h) != 2) {
-                       ErrPrint("Invalid format for SIZE(%s)\n", block->data);
-                       PERF_MARK("info");
-                       return LB_STATUS_ERROR_INVALID;
-               }
+    if (!strcasecmp(block->part, INFO_SIZE)) {
+       int w, h;
 
-               if (!block->id) {
-                       update_size_for_script(info, inst, w, h);
-               } else {
-                       (void)info->port->update_size(info->port_data, block->id, w, h);
-               }
-       } else if (!strcasecmp(block->part, INFO_CATEGORY)) {
-               (void)info->port->update_category(info->port_data, block->id, block->data);
+       if (sscanf(block->data, "%dx%d", &w, &h) != 2) {
+           ErrPrint("Invalid format for SIZE(%s)\n", block->data);
+           PERF_MARK("info");
+           return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
-       PERF_MARK("info");
 
-       return LB_STATUS_SUCCESS;
+       if (!block->id) {
+           update_size_for_script(info, inst, w, h);
+       } else {
+           (void)info->port->update_size(info->port_data, block->id, w, h);
+       }
+    } else if (!strcasecmp(block->part, INFO_CATEGORY)) {
+       (void)info->port->update_category(info->port_data, block->id, block->data);
+    }
+    PERF_MARK("info");
+
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static inline void consuming_parsed_block(struct inst_info *inst, int is_pd, struct block *block)
 {
-       struct script_info *info;
-       typedef int (*update_function_t)(struct inst_info *inst, struct block *block, int is_pd);
-       update_function_t updators[] = {
-               update_access,
-               operate_access,
-               update_script_color,
-               update_script_drag,
-               update_script_image,
-               update_info,
-               update_script_script,
-               update_script_signal,
-               update_script_text,
-               NULL
-       };
-
-       info = is_pd ? instance_pd_script(inst) : instance_lb_script(inst);
-       if (!info) {
-               ErrPrint("info is NIL (%d, %s)\n", is_pd, instance_id(inst));
-               goto free_out;
-       }
+    struct script_info *info;
+    typedef int (*update_function_t)(struct inst_info *inst, struct block *block, int is_pd);
+    update_function_t updators[] = {
+       update_access,
+       operate_access,
+       update_script_color,
+       update_script_drag,
+       update_script_image,
+       update_info,
+       update_script_script,
+       update_script_signal,
+       update_script_text,
+       NULL
+    };
 
-       if (script_handler_is_loaded(info)) {
-               if (block->type >= 0 || block->type < TYPE_MAX) {
-                       (void)updators[block->type](inst, block, is_pd);
-               } else {
-                       ErrPrint("Block type[%d] is not valid\n", block->type);
-               }
+    info = is_pd ? instance_gbar_script(inst) : instance_dbox_script(inst);
+    if (!info) {
+       ErrPrint("info is NIL (%d, %s)\n", is_pd, instance_id(inst));
+       goto free_out;
+    }
+
+    if (script_handler_is_loaded(info)) {
+       if (block->type >= 0 || block->type < TYPE_MAX) {
+           (void)updators[block->type](inst, block, is_pd);
        } else {
-               info->cached_blocks = eina_list_append(info->cached_blocks, block);
-               DbgPrint("Block is cached (%p), %d, %s\n", block, eina_list_count(info->cached_blocks), instance_id(inst));
-               return;
+           ErrPrint("Block type[%d] is not valid\n", block->type);
        }
+    } else {
+       info->cached_blocks = eina_list_append(info->cached_blocks, block);
+       DbgPrint("Block is cached (%p), %d, %s\n", block, eina_list_count(info->cached_blocks), instance_id(inst));
+       return;
+    }
 
 free_out:
-       delete_block(block);
+    delete_block(block);
 }
 
 HAPI int script_init(void)
 {
-       if (!strcasecmp(PROVIDER_METHOD, "shm")) {
-               s_info.env_buf_type = BUFFER_TYPE_SHM;
-       } else if (!strcasecmp(PROVIDER_METHOD, "pixmap")) {
-               s_info.env_buf_type = BUFFER_TYPE_PIXMAP;
-       }
+    if (!strcasecmp(DYNAMICBOX_CONF_PROVIDER_METHOD, "shm")) {
+       s_info.env_buf_type = DBOX_FB_TYPE_SHM;
+    } else if (!strcasecmp(DYNAMICBOX_CONF_PROVIDER_METHOD, "pixmap")) {
+       s_info.env_buf_type = DBOX_FB_TYPE_PIXMAP;
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int script_fini(void)
 {
-       struct script_port *item;
-       /*!
-        * \TODO: Release all handles
-        */
-       EINA_LIST_FREE(s_info.script_port_list, item) {
-               item->fini();
-               if (dlclose(item->handle) != 0) {
-                       ErrPrint("dlclose: %s\n", strerror(errno));
-               }
-               DbgFree(item);
+    struct script_port *item;
+    /*!
+     * \TODO: Release all handles
+     */
+    EINA_LIST_FREE(s_info.script_port_list, item) {
+       item->fini();
+       if (dlclose(item->handle) != 0) {
+           ErrPrint("dlclose: %s\n", strerror(errno));
        }
+       DbgFree(item);
+    }
 
-       return 0;
+    return 0;
 }
 
 HAPI int script_handler_update_pointer(struct script_info *info, int x, int y, int down)
 {
-       if (!info) {
-               return LB_STATUS_SUCCESS;
-       }
+    if (!info) {
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
-       info->x = x;
-       info->y = y;
+    info->x = x;
+    info->y = y;
 
-       if (down == 0) {
-               info->down = 0;
-       } else if (down == 1) {
-               info->down = 1;
-       }
+    if (down == 0) {
+       info->down = 0;
+    } else if (down == 1) {
+       info->down = 1;
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int script_handler_update_keycode(struct script_info *info, unsigned int keycode)
 {
-       if (!info) {
-               return LB_STATUS_SUCCESS;
-       }
+    if (!info) {
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
-       info->keycode = keycode;
+    info->keycode = keycode;
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int script_handler_feed_event(struct script_info *info, int event, double timestamp)
 {
-       int ret;
+    int ret;
 
-       if (!info->port) {
-               ErrPrint("info->port is NIL\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!info->port) {
+       ErrPrint("info->port is NIL\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       ret = info->port->feed_event(info->port_data, event, info->x, info->y, info->down, info->keycode, timestamp);
-       return ret;
+    ret = info->port->feed_event(info->port_data, event, info->x, info->y, info->down, info->keycode, timestamp);
+    return ret;
 }
 
 static inline char *load_file(const char *filename)
 {
-       char *filebuf = NULL;
-       int fd;
-       off_t filesize;
-       int ret;
-       size_t readsize = 0;
-
-       fd = open(filename, O_RDONLY);
-       if (fd < 0) {
-               ErrPrint("open: %s\n", strerror(errno));
-               return NULL;
-       }
-
-       filesize = lseek(fd, 0L, SEEK_END);
-       if (filesize == (off_t)-1) {
-               ErrPrint("lseek: %s\n", strerror(errno));
-               goto errout;
-       }
-
-       if (lseek(fd, 0L, SEEK_SET) < 0) {
-               ErrPrint("lseek: %s\n", strerror(errno));
-               goto errout;
-       }
+    char *filebuf = NULL;
+    int fd;
+    off_t filesize;
+    int ret;
+    size_t readsize = 0;
+
+    fd = open(filename, O_RDONLY);
+    if (fd < 0) {
+       ErrPrint("open: %s\n", strerror(errno));
+       return NULL;
+    }
+
+    filesize = lseek(fd, 0L, SEEK_END);
+    if (filesize == (off_t)-1) {
+       ErrPrint("lseek: %s\n", strerror(errno));
+       goto errout;
+    }
+
+    if (lseek(fd, 0L, SEEK_SET) < 0) {
+       ErrPrint("lseek: %s\n", strerror(errno));
+       goto errout;
+    }
+
+    filebuf = malloc(filesize + 1);
+    if (!filebuf) {
+       ErrPrint("malloc: %s\n", strerror(errno));
+       goto errout;
+    }
+
+    while (readsize < filesize) {
+       ret = read(fd, filebuf + readsize, (size_t)filesize - readsize);
+       if (ret < 0) {
+           if (errno == EINTR) {
+               DbgPrint("Read is interrupted\n");
+               continue;
+           }
 
-       filebuf = malloc(filesize + 1);
-       if (!filebuf) {
-               ErrPrint("malloc: %s\n", strerror(errno));
-               goto errout;
+           ErrPrint("read: %s\n", strerror(errno));
+           free(filebuf);
+           filebuf = NULL;
+           break;
        }
 
-       while (readsize < filesize) {
-               ret = read(fd, filebuf + readsize, (size_t)filesize - readsize);
-               if (ret < 0) {
-                       if (errno == EINTR) {
-                               DbgPrint("Read is interrupted\n");
-                               continue;
-                       }
-
-                       ErrPrint("read: %s\n", strerror(errno));
-                       free(filebuf);
-                       filebuf = NULL;
-                       break;
-               }
-
-               readsize += ret;
-       }
+       readsize += ret;
+    }
 
-       if (filebuf) {
-               filebuf[readsize] = '\0';
-       }
+    if (filebuf) {
+       filebuf[readsize] = '\0';
+    }
 
-       /*!
-        * \note
-        * Now, we are ready to parse the filebuf.
-        */
+    /*!
+     * \note
+     * Now, we are ready to parse the filebuf.
+     */
 
 errout:
-       if (close(fd) < 0) {
-               ErrPrint("close: %s\n", strerror(errno));
-       }
+    if (close(fd) < 0) {
+       ErrPrint("close: %s\n", strerror(errno));
+    }
 
-       return filebuf;
+    return filebuf;
 }
 
 #if defined(_APPLY_SCRIPT_ASYNC_UPDATE)
 struct apply_data {
-       struct inst_info *inst;
-       Eina_List *block_list;
-       int is_pd;
+    struct inst_info *inst;
+    Eina_List *block_list;
+    int is_pd;
 };
 
 static Eina_Bool apply_changes_cb(void *_data)
 {
-       struct apply_data *data = _data;
-       struct block *block;
+    struct apply_data *data = _data;
+    struct block *block;
 
-       block = eina_list_nth(data->block_list, 0);
-       data->block_list = eina_list_remove(data->block_list, block);
-       consuming_parsed_block(data->inst, data->is_pd, block);
+    block = eina_list_nth(data->block_list, 0);
+    data->block_list = eina_list_remove(data->block_list, block);
+    consuming_parsed_block(data->inst, data->is_pd, block);
 
-       if (!data->block_list) {
-               free(data);
-               return ECORE_CALLBACK_CANCEL;
-       }
+    if (!data->block_list) {
+       free(data);
+       return ECORE_CALLBACK_CANCEL;
+    }
 
-       return ECORE_CALLBACK_RENEW;
+    return ECORE_CALLBACK_RENEW;
 }
 #endif
 
-
 HAPI int script_handler_parse_desc(struct inst_info *inst, const char *filename, int is_pd)
 {
-       PERF_INIT();
-       PERF_BEGIN();
-       int type_idx = 0;
-       int type_len = 0;
-       int field_idx = 0;
-       int field_len = 0;
-       char *filebuf;
-       char *fileptr;
-       char *ptr = NULL;
-       struct block *block = NULL;
-       Eina_List *block_list = NULL;
-       enum state {
-               BEGIN,
-               FIELD,
-               DATA,
-               END,
-               DONE,
-               ERROR,
-       } state;
-
-       filebuf = load_file(filename);
-       if (!filebuf) {
-               return LB_STATUS_ERROR_IO;
-       }
-
-       fileptr = filebuf;
-
-       state = BEGIN;
-       while (*fileptr && state != ERROR) {
-               switch (state) {
-               case BEGIN:
-                       if (*fileptr == '{') {
-                               block = calloc(1, sizeof(*block));
-                               if (!block) {
-                                       ErrPrint("calloc: %s\n", strerror(errno));
-                                       state = ERROR;
-                                       continue;
-                               }
-                               state = FIELD;
-                               ptr = NULL;
+    PERF_INIT();
+    PERF_BEGIN();
+    int type_idx = 0;
+    int type_len = 0;
+    int field_idx = 0;
+    int field_len = 0;
+    char *filebuf;
+    char *fileptr;
+    char *ptr = NULL;
+    struct block *block = NULL;
+    Eina_List *block_list = NULL;
+    enum state {
+       BEGIN,
+       FIELD,
+       DATA,
+       END,
+       DONE,
+       ERROR,
+    } state;
+
+    filebuf = load_file(filename);
+    if (!filebuf) {
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
+
+    fileptr = filebuf;
+
+    state = BEGIN;
+    while (*fileptr && state != ERROR) {
+       switch (state) {
+           case BEGIN:
+               if (*fileptr == '{') {
+                   block = calloc(1, sizeof(*block));
+                   if (!block) {
+                       ErrPrint("calloc: %s\n", strerror(errno));
+                       state = ERROR;
+                       continue;
+                   }
+                   state = FIELD;
+                   ptr = NULL;
+               }
+               break;
+           case FIELD:
+               if (isspace(*fileptr)) {
+                   if (ptr != NULL) {
+                       *fileptr = '\0';
+                   }
+               } else if (*fileptr == '=') {
+                   *fileptr = '\0';
+                   ptr = NULL;
+                   state = DATA;
+               } else if (ptr == NULL) {
+                   ptr = fileptr;
+                   field_idx = 0;
+                   field_len = 0;
+
+                   while (field_list[field_idx]) {
+                       if (field_list[field_idx][field_len] == *fileptr) {
+                           break;
                        }
-                       break;
-               case FIELD:
-                       if (isspace(*fileptr)) {
-                               if (ptr != NULL) {
-                                       *fileptr = '\0';
-                               }
-                       } else if (*fileptr == '=') {
-                               *fileptr = '\0';
-                               ptr = NULL;
-                               state = DATA;
-                       } else if (ptr == NULL) {
-                               ptr = fileptr;
-                               field_idx = 0;
-                               field_len = 0;
-
-                               while (field_list[field_idx]) {
-                                       if (field_list[field_idx][field_len] == *fileptr) {
-                                               break;
-                                       }
-                                       field_idx++;
-                               }
-
-                               if (!field_list[field_idx]) {
-                                       ErrPrint("Invalid field\n");
-                                       state = ERROR;
-                                       continue;
-                               }
+                       field_idx++;
+                   }
 
-                               field_len++;
-                       } else {
-                               if (field_list[field_idx][field_len] != *fileptr) {
-                                       field_idx++;
-                                       while (field_list[field_idx]) {
-                                               if (!strncmp(field_list[field_idx], fileptr - field_len, field_len)) {
-                                                       break;
-                                               } else {
-                                                       field_idx++;
-                                               }
-                                       }
-
-                                       if (!field_list[field_idx]) {
-                                               state = ERROR;
-                                               ErrPrint("field is not valid\n");
-                                               continue;
-                                       }
-                               }
+                   if (!field_list[field_idx]) {
+                       ErrPrint("Invalid field\n");
+                       state = ERROR;
+                       continue;
+                   }
 
-                               field_len++;
+                   field_len++;
+               } else {
+                   if (field_list[field_idx][field_len] != *fileptr) {
+                       field_idx++;
+                       while (field_list[field_idx]) {
+                           if (!strncmp(field_list[field_idx], fileptr - field_len, field_len)) {
+                               break;
+                           } else {
+                               field_idx++;
+                           }
                        }
-                       break;
-               case DATA:
-                       switch (field_idx) {
-                       case FIELD_TYPE:
-                               if (ptr == NULL) {
-                                       if (isspace(*fileptr)) {
-                                               break;
-                                       }
-
-                                       if (*fileptr == '\0') {
-                                               state = ERROR;
-                                               ErrPrint("Type is not valid\n");
-                                               continue;
-                                       }
-
-                                       ptr = fileptr;
-                                       type_idx = 0;
-                                       type_len = 0;
-                               }
 
-                               if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
-                                       *fileptr = '\0';
-                               }
+                       if (!field_list[field_idx]) {
+                           state = ERROR;
+                           ErrPrint("field is not valid\n");
+                           continue;
+                       }
+                   }
 
-                               if (type_list[type_idx][type_len] != *fileptr) {
-                                       type_idx++;
-                                       while (type_list[type_idx]) {
-                                               if (!strncmp(type_list[type_idx], fileptr - type_len, type_len)) {
-                                                       break;
-                                               } else {
-                                                       type_idx++;
-                                               }
-                                       }
-
-                                       if (!type_list[type_idx]) {
-                                               state = ERROR;
-                                               ErrPrint("type is not valid (%s)\n", fileptr - type_len);
-                                               continue;
-                                       }
-                               }
+                   field_len++;
+               }
+               break;
+           case DATA:
+               switch (field_idx) {
+                   case FIELD_TYPE:
+                       if (ptr == NULL) {
+                           if (isspace(*fileptr)) {
+                               break;
+                           }
 
-                               if (!*fileptr) {
-                                       block->type = type_idx;
-                                       state = DONE;
-                                       ptr = NULL;
-                               }
+                           if (*fileptr == '\0') {
+                               state = ERROR;
+                               ErrPrint("Type is not valid\n");
+                               continue;
+                           }
 
-                               type_len++;
-                               break;
-                       case FIELD_PART:
-                               if (ptr == NULL) {
-                                       ptr = fileptr;
-                               }
+                           ptr = fileptr;
+                           type_idx = 0;
+                           type_len = 0;
+                       }
 
-                               if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
-                                       *fileptr = '\0';
-                               }
+                       if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
+                           *fileptr = '\0';
+                       }
 
-                               if (!*fileptr) {
-                                       block->part = ptr;
-                                       state = DONE;
-                                       ptr = NULL;
-                               }
-                               break;
-                       case FIELD_DATA:
-                               if (ptr == NULL) {
-                                       ptr = fileptr;
+                       if (type_list[type_idx][type_len] != *fileptr) {
+                           type_idx++;
+                           while (type_list[type_idx]) {
+                               if (!strncmp(type_list[type_idx], fileptr - type_len, type_len)) {
+                                   break;
+                               } else {
+                                   type_idx++;
                                }
+                           }
 
-                               if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
-                                       *fileptr = '\0';
-                               }
+                           if (!type_list[type_idx]) {
+                               state = ERROR;
+                               ErrPrint("type is not valid (%s)\n", fileptr - type_len);
+                               continue;
+                           }
+                       }
 
-                               if (!*fileptr) {
-                                       block->data = ptr;
-                                       state = DONE;
-                                       ptr = NULL;
-                               }
-                               break;
-                       case FIELD_OPTION:
-                               if (ptr == NULL) {
-                                       ptr = fileptr;
-                               }
+                       if (!*fileptr) {
+                           block->type = type_idx;
+                           state = DONE;
+                           ptr = NULL;
+                       }
 
-                               if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
-                                       *fileptr = '\0';
-                               }
+                       type_len++;
+                       break;
+                   case FIELD_PART:
+                       if (ptr == NULL) {
+                           ptr = fileptr;
+                       }
 
-                               if (!*fileptr) {
-                                       block->option = ptr;
-                                       state = DONE;
-                                       ptr = NULL;
-                               }
-                               break;
-                       case FIELD_ID:
-                               if (ptr == NULL) {
-                                       ptr = fileptr;
-                               }
+                       if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
+                           *fileptr = '\0';
+                       }
 
-                               if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
-                                       *fileptr = '\0';
-                               }
+                       if (!*fileptr) {
+                           block->part = ptr;
+                           state = DONE;
+                           ptr = NULL;
+                       }
+                       break;
+                   case FIELD_DATA:
+                       if (ptr == NULL) {
+                           ptr = fileptr;
+                       }
 
-                               if (!*fileptr) {
-                                       block->id = ptr;
-                                       state = DONE;
-                                       ptr = NULL;
-                               }
-                               break;
-                       case FIELD_TARGET:
-                               if (ptr == NULL) {
-                                       ptr = fileptr;
-                               }
+                       if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
+                           *fileptr = '\0';
+                       }
 
-                               if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
-                                       *fileptr = '\0';
-                               }
+                       if (!*fileptr) {
+                           block->data = ptr;
+                           state = DONE;
+                           ptr = NULL;
+                       }
+                       break;
+                   case FIELD_OPTION:
+                       if (ptr == NULL) {
+                           ptr = fileptr;
+                       }
 
-                               if (!*fileptr) {
-                                       block->target = ptr;
-                                       state = DONE;
-                                       ptr = NULL;
-                               }
-                               break;
-                       case FIELD_FILE:
-                               if (ptr == NULL) {
-                                       ptr = fileptr;
-                               }
+                       if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
+                           *fileptr = '\0';
+                       }
 
-                               if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
-                                       *fileptr = '\0';
-                               }
+                       if (!*fileptr) {
+                           block->option = ptr;
+                           state = DONE;
+                           ptr = NULL;
+                       }
+                       break;
+                   case FIELD_ID:
+                       if (ptr == NULL) {
+                           ptr = fileptr;
+                       }
 
-                               if (!*fileptr) {
-                                       block->target = ptr;
-                                       state = DONE;
-                                       ptr = NULL;
-                               }
-                       default:
-                               break;
+                       if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
+                           *fileptr = '\0';
                        }
 
+                       if (!*fileptr) {
+                           block->id = ptr;
+                           state = DONE;
+                           ptr = NULL;
+                       }
                        break;
-               case DONE:
-                       if (isspace(*fileptr)) {
-                       } else if (*fileptr == '}') {
-                                       state = BEGIN;
-                                       block->filename = filename;
-                                       block_list = eina_list_append(block_list, block);
-                                       block = NULL;
-                       } else {
-                               state = FIELD;
-                               continue;
+                   case FIELD_TARGET:
+                       if (ptr == NULL) {
+                           ptr = fileptr;
+                       }
+
+                       if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
+                           *fileptr = '\0';
+                       }
+
+                       if (!*fileptr) {
+                           block->target = ptr;
+                           state = DONE;
+                           ptr = NULL;
                        }
                        break;
-               case END:
-               default:
+                   case FIELD_FILE:
+                       if (ptr == NULL) {
+                           ptr = fileptr;
+                       }
+
+                       if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
+                           *fileptr = '\0';
+                       }
+
+                       if (!*fileptr) {
+                           block->target = ptr;
+                           state = DONE;
+                           ptr = NULL;
+                       }
+                   default:
                        break;
                }
 
-               fileptr++;
+               break;
+           case DONE:
+               if (isspace(*fileptr)) {
+               } else if (*fileptr == '}') {
+                   state = BEGIN;
+                   block->filename = filename;
+                   block_list = eina_list_append(block_list, block);
+                   block = NULL;
+               } else {
+                   state = FIELD;
+                   continue;
+               }
+               break;
+           case END:
+           default:
+               break;
        }
 
-       if (state != BEGIN) {
-               ErrPrint("State %d\n", state);
+       fileptr++;
+    }
 
-               free(filebuf);
-               free(block);
+    if (state != BEGIN) {
+       ErrPrint("State %d\n", state);
 
-               EINA_LIST_FREE(block_list, block) {
-                       free(block);
-               }
-
-               PERF_MARK("parser");
-               return LB_STATUS_ERROR_FAULT;
-       }
+       free(filebuf);
+       free(block);
 
-       block = eina_list_data_get(eina_list_last(block_list));
-       if (block) {
-               block->filebuf = filebuf;
-       } else {
-               ErrPrint("Last block is not exists (There is no parsed block)\n");
-               free(filebuf);
+       EINA_LIST_FREE(block_list, block) {
+           free(block);
        }
 
        PERF_MARK("parser");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    block = eina_list_data_get(eina_list_last(block_list));
+    if (block) {
+       block->filebuf = filebuf;
+    } else {
+       ErrPrint("Last block is not exists (There is no parsed block)\n");
+       free(filebuf);
+    }
+
+    PERF_MARK("parser");
 
 #if defined(_APPLY_SCRIPT_ASYNC_UPDATE)
-       struct apply_data *data;
-
-       data = malloc(sizeof(*data));
-       if (data) {
-               data->inst = inst;
-               data->is_pd = is_pd;
-               data->block_list = block_list;
-               if (!ecore_timer_add(0.001f, apply_changes_cb, data)) {
-                       ErrPrint("Failed to add timer\n");
-                       free(data);
-                       EINA_LIST_FREE(block_list, block) {
-                               consuming_parsed_block(inst, is_pd, block);
-                       }
-               }
-       } else {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               EINA_LIST_FREE(block_list, block) {
-                       consuming_parsed_block(inst, is_pd, block);
-               }
-       }
-#else
-       ErrPrint("Begin: Set content for EDJE object\n");
-       EINA_LIST_FREE(block_list, block) {
+    struct apply_data *data;
+
+    data = malloc(sizeof(*data));
+    if (data) {
+       data->inst = inst;
+       data->is_pd = is_pd;
+       data->block_list = block_list;
+       if (!ecore_timer_add(0.001f, apply_changes_cb, data)) {
+           ErrPrint("Failed to add timer\n");
+           free(data);
+           EINA_LIST_FREE(block_list, block) {
                consuming_parsed_block(inst, is_pd, block);
+           }
        }
-       ErrPrint("End: Set content for EDJE object\n");
-
-       /*!
-        * Doesn't need to force to render the contents.
-       struct script_info *info;
-       info = is_pd ? instance_pd_script(inst) : instance_lb_script(inst);
-       if (info && info->ee) {
-               ecore_evas_manual_render(info->ee);
+    } else {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       EINA_LIST_FREE(block_list, block) {
+           consuming_parsed_block(inst, is_pd, block);
        }
-       */
+    }
+#else
+    ErrPrint("Begin: Set content for EDJE object\n");
+    EINA_LIST_FREE(block_list, block) {
+       consuming_parsed_block(inst, is_pd, block);
+    }
+    ErrPrint("End: Set content for EDJE object\n");
+
+    /*!
+     * Doesn't need to force to render the contents.
+     struct script_info *info;
+     info = is_pd ? instance_gbar_script(inst) : instance_dbox_script(inst);
+     if (info && info->ee) {
+     ecore_evas_manual_render(info->ee);
+     }
+     */
 #endif
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 /* End of a file */
index c70ef3b..ed52f9f 100644 (file)
 
 #include <packet.h>
 #include <com-core_packet.h>
-#include <livebox-errno.h>
-#include <livebox-service.h>
+#include <dynamicbox_errno.h>
+#include <dynamicbox_service.h>
+#include <dynamicbox_cmd_list.h>
+#include <dynamicbox_conf.h>
+#include <dynamicbox_script.h>
 
 #include "critical_log.h"
 #include "conf.h"
 #include "io.h"
 #include "event.h"
 
-#define PD_OPEN_MONITOR_TAG "pd,open,monitor"
-#define PD_RESIZE_MONITOR_TAG "pd,resize,monitor"
-#define PD_CLOSE_MONITOR_TAG "pd,close,monitor"
+#define GBAR_OPEN_MONITOR_TAG "gbar,open,monitor"
+#define GBAR_RESIZE_MONITOR_TAG "gbar,resize,monitor"
+#define GBAR_CLOSE_MONITOR_TAG "gbar,close,monitor"
 
-#define LAZY_PD_OPEN_TAG "lazy,pd,open"
-#define LAZY_PD_CLOSE_TAG "lazy,pd,close"
+#define LAZY_GBAR_OPEN_TAG "lazy,gbar,open"
+#define LAZY_GBAR_CLOSE_TAG "lazy,gbar,close"
+
+#define ACCESS_TYPE_DOWN 0
+#define ACCESS_TYPE_MOVE 1
+#define ACCESS_TYPE_UP 2
+#define ACCESS_TYPE_CUR 0
+#define ACCESS_TYPE_NEXT 1
+#define ACCESS_TYPE_PREV 2
+#define ACCESS_TYPE_OFF 3
 
 static struct info {
-       int info_fd;
-       int client_fd;
-       int service_fd;
-       int slave_fd;
-       int remote_client_fd;
+    int info_fd;
+    int client_fd;
+    int service_fd;
+    int slave_fd;
+    int remote_client_fd;
 } s_info = {
-       .info_fd = -1,
-       .client_fd = -1,
-       .service_fd = -1,
-       .slave_fd = -1,
-       .remote_client_fd = -1,
+    .info_fd = -1,
+    .client_fd = -1,
+    .service_fd = -1,
+    .slave_fd = -1,
+    .remote_client_fd = -1,
+};
+
+struct access_info {
+    int x;
+    int y;
+    int type;
 };
 
 /* Share this with provider */
 enum target_type {
-       TYPE_LB,
-       TYPE_PD,
-       TYPE_ERROR
+    TYPE_DBOX,
+    TYPE_GBAR,
+    TYPE_ERROR
 };
 
 struct event_cbdata {
-       int status;
-       struct inst_info *inst;
+    int status;
+    struct inst_info *inst;
 };
 
 struct deleted_item {
-       struct client_node *client;
-       struct inst_info *inst;
+    struct client_node *client;
+    struct inst_info *inst;
 };
 
-static int forward_lb_event_packet(const struct pkg_info *pkg, struct inst_info *inst, const struct packet *packet)
+static Eina_Bool lazy_key_status_cb(void *data)
 {
-       struct buffer_info *buffer;
-       struct slave_node *slave;
-       int ret;
+    struct event_cbdata *cbdata = data;
 
-       buffer = instance_lb_buffer(inst);
-       if (!buffer) {
-               ErrPrint("Instance[%s] has no buffer\n", instance_id(inst));
-               ret = LB_STATUS_ERROR_FAULT;
-               goto out;
-       }
-
-       slave = package_slave(pkg);
-       if (!slave) {
-               ErrPrint("Package[%s] has no slave\n", package_name(pkg));
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
+    if (instance_unref(cbdata->inst)) {
+       instance_send_key_status(cbdata->inst, cbdata->status);
+    } else {
+       DbgPrint("Skip sending key status (%d)\n", cbdata->status);
+    }
+    /*!
+     * If instance_unref returns NULL,
+     * The instance is destroyed. it means, we don't need to send event to the viewer
+     */
+    DbgFree(cbdata);
+    return ECORE_CALLBACK_CANCEL;
+}
 
-       packet_ref((struct packet *)packet);
-       ret = slave_rpc_request_only(slave, package_name(pkg), (struct packet *)packet, 0);
+static Eina_Bool lazy_access_status_cb(void *data)
+{
+    struct event_cbdata *cbdata = data;
 
-out:
-       return ret;
+    if (instance_unref(cbdata->inst)) {
+       instance_send_access_status(cbdata->inst, cbdata->status);
+    } else {
+       DbgPrint("Skip sending access status (%d)\n", cbdata->status);
+    }
+    /*!
+     * If instance_unref returns NULL,
+     * The instance is destroyed. it means, we don't need to send event to the viewer
+     */
+    DbgFree(cbdata);
+    return ECORE_CALLBACK_CANCEL;
 }
 
-static int forward_pd_event_packet(const struct pkg_info *pkg, struct inst_info *inst, const struct packet *packet)
+int send_delayed_key_status(struct inst_info *inst, int ret)
 {
-       struct buffer_info *buffer;
-       struct slave_node *slave;
-       int ret;
+    struct event_cbdata *cbdata;
 
-       buffer = instance_pd_buffer(inst);
-       if (!buffer) {
-               ErrPrint("Instance[%s] has no buffer\n", instance_id(inst));
-               ret = LB_STATUS_ERROR_FAULT;
-               goto out;
-       }
+    cbdata = malloc(sizeof(*cbdata));
+    if (!cbdata) {
+       ret = DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    } else {
+       cbdata->inst = instance_ref(inst);
+       cbdata->status = ret;
 
-       slave = package_slave(pkg);
-       if (!slave) {
-               ErrPrint("Package[%s] has no slave\n", package_name(pkg));
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
+       if (!ecore_timer_add(DELAY_TIME, lazy_key_status_cb, cbdata)) {
+           (void)instance_unref(cbdata->inst);
+           DbgFree(cbdata);
+           ret = DBOX_STATUS_ERROR_FAULT;
+       } else {
+           ret = DBOX_STATUS_ERROR_NONE;
        }
+    }
 
-       packet_ref((struct packet *)packet);
-       ret = slave_rpc_request_only(slave, package_name(pkg), (struct packet *)packet, 0);
-
-out:
-       return ret;
+    return ret;
 }
 
-static int forward_pd_access_packet(const struct pkg_info *pkg, struct inst_info *inst, const char *command, double timestamp, int x, int y)
+int send_delayed_access_status(struct inst_info *inst, int ret)
 {
-       int ret;
-       struct buffer_info *buffer;
-       struct slave_node *slave;
-       struct packet *p;
+    struct event_cbdata *cbdata;
 
-       buffer = instance_pd_buffer(inst);
-       if (!buffer) {
-               ErrPrint("Instance[%s] has no buffer\n", instance_id(inst));
-               ret = LB_STATUS_ERROR_FAULT;
-               goto out;
-       }
+    cbdata = malloc(sizeof(*cbdata));
+    if (!cbdata) {
+       ret = DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    } else {
+       cbdata->inst = instance_ref(inst);
+       cbdata->status = ret;
 
-       slave = package_slave(pkg);
-       if (!slave) {
-               ErrPrint("Package[%s] has no slave\n", package_name(pkg));
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
+       if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
+           (void)instance_unref(cbdata->inst);
+           DbgFree(cbdata);
+           ret = DBOX_STATUS_ERROR_FAULT;
+       } else {
+           ret = DBOX_STATUS_ERROR_NONE;
        }
+    }
 
-       p = packet_create_noack(command, "ssdii", package_name(pkg), instance_id(inst), timestamp, x, y);
-       ret = slave_rpc_request_only(slave, package_name(pkg), p, 0);
+    return ret;
+}
+
+static int forward_dbox_event_packet(const struct pkg_info *pkg, struct inst_info *inst, const struct packet *packet)
+{
+    struct buffer_info *buffer;
+    struct slave_node *slave;
+    int ret;
+
+    buffer = instance_dbox_buffer(inst);
+    if (!buffer) {
+       ErrPrint("Instance[%s] has no buffer\n", instance_id(inst));
+       ret = DBOX_STATUS_ERROR_FAULT;
+       goto out;
+    }
+
+    slave = package_slave(pkg);
+    if (!slave) {
+       ErrPrint("Package[%s] has no slave\n", package_name(pkg));
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    packet_ref((struct packet *)packet);
+    ret = slave_rpc_request_only(slave, package_name(pkg), (struct packet *)packet, 0);
 
 out:
-       return ret;
+    return ret;
 }
 
-static int forward_lb_access_packet(const struct pkg_info *pkg, struct inst_info *inst, const char *command, double timestamp, int x, int y)
+static int forward_gbar_event_packet(const struct pkg_info *pkg, struct inst_info *inst, const struct packet *packet)
 {
-       int ret;
-       struct buffer_info *buffer;
-       struct slave_node *slave;
-       struct packet *p;
+    struct buffer_info *buffer;
+    struct slave_node *slave;
+    int ret;
 
-       buffer = instance_lb_buffer(inst);
-       if (!buffer) {
-               ErrPrint("Instance[%s] has no buffer\n", instance_id(inst));
-               ret = LB_STATUS_ERROR_FAULT;
-               goto out;
-       }
+    buffer = instance_gbar_buffer(inst);
+    if (!buffer) {
+       ErrPrint("Instance[%s] has no buffer\n", instance_id(inst));
+       ret = DBOX_STATUS_ERROR_FAULT;
+       goto out;
+    }
 
-       slave = package_slave(pkg);
-       if (!slave) {
-               ErrPrint("Package[%s] has no slave\n", package_name(pkg));
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
+    slave = package_slave(pkg);
+    if (!slave) {
+       ErrPrint("Package[%s] has no slave\n", package_name(pkg));
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
 
-       p = packet_create_noack(command, "ssdii", package_name(pkg), instance_id(inst), timestamp, x, y);
-       ret = slave_rpc_request_only(slave, package_name(pkg), p, 0);
+    packet_ref((struct packet *)packet);
+    ret = slave_rpc_request_only(slave, package_name(pkg), (struct packet *)packet, 0);
 
 out:
-       return ret;
+    return ret;
 }
 
-static int forward_pd_key_packet(const struct pkg_info *pkg, struct inst_info *inst, const char *command, double timestamp, unsigned int keycode)
+static int forward_gbar_access_packet(const struct pkg_info *pkg, struct inst_info *inst, const char *command, double timestamp, struct access_info *event)
 {
-       int ret;
-       struct buffer_info *buffer;
-       struct slave_node *slave;
-       struct packet *p;
+    int ret;
+    struct buffer_info *buffer;
+    struct slave_node *slave;
+    struct packet *p;
 
-       buffer = instance_lb_buffer(inst);
-       if (!buffer) {
-               ErrPrint("Instance[%s] has no buffer\n", instance_id(inst));
-               ret = LB_STATUS_ERROR_FAULT;
-               goto out;
-       }
+    buffer = instance_gbar_buffer(inst);
+    if (!buffer) {
+       ErrPrint("Instance[%s] has no buffer\n", instance_id(inst));
+       ret = DBOX_STATUS_ERROR_FAULT;
+       goto out;
+    }
 
-       slave = package_slave(pkg);
-       if (!slave) {
-               ErrPrint("Package[%s] has no slave\n", package_name(pkg));
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
+    slave = package_slave(pkg);
+    if (!slave) {
+       ErrPrint("Package[%s] has no slave\n", package_name(pkg));
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
 
-       p = packet_create_noack(command, "ssdi", package_name(pkg), instance_id(inst), timestamp, keycode);
-       ret = slave_rpc_request_only(slave, package_name(pkg), p, 0);
+    p = packet_create_noack(command, "ssdiii", package_name(pkg), instance_id(inst), timestamp, event->x, event->y, event->type);
+    ret = slave_rpc_request_only(slave, package_name(pkg), p, 0);
 
 out:
-       return ret;
+    return ret;
 }
 
-static int forward_lb_key_packet(const struct pkg_info *pkg, struct inst_info *inst, const char *command, double timestamp, unsigned int keycode)
+static int forward_dbox_access_packet(const struct pkg_info *pkg, struct inst_info *inst, const char *command, double timestamp, struct access_info *event)
 {
-       int ret;
-       struct buffer_info *buffer;
-       struct slave_node *slave;
-       struct packet *p;
+    int ret;
+    struct buffer_info *buffer;
+    struct slave_node *slave;
+    struct packet *p;
 
-       buffer = instance_lb_buffer(inst);
-       if (!buffer) {
-               ErrPrint("Instance[%s] has no buffer\n", instance_id(inst));
-               ret = LB_STATUS_ERROR_FAULT;
-               goto out;
-       }
+    buffer = instance_dbox_buffer(inst);
+    if (!buffer) {
+       ErrPrint("Instance[%s] has no buffer\n", instance_id(inst));
+       ret = DBOX_STATUS_ERROR_FAULT;
+       goto out;
+    }
 
-       slave = package_slave(pkg);
-       if (!slave) {
-               ErrPrint("Package[%s] has no slave\n", package_name(pkg));
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
+    slave = package_slave(pkg);
+    if (!slave) {
+       ErrPrint("Package[%s] has no slave\n", package_name(pkg));
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
 
-       p = packet_create_noack(command, "ssdi", package_name(pkg), instance_id(inst), timestamp, keycode);
-       ret = slave_rpc_request_only(slave, package_name(pkg), p, 0);
+    p = packet_create_noack(command, "ssdiii", package_name(pkg), instance_id(inst), timestamp, event->x, event->y, event->type);
+    ret = slave_rpc_request_only(slave, package_name(pkg), p, 0);
 
 out:
-       return ret;
+    return ret;
 }
 
-static Eina_Bool lazy_key_status_cb(void *data)
+static int forward_gbar_key_packet(const struct pkg_info *pkg, struct inst_info *inst, const char *command, double timestamp, unsigned int keycode)
 {
-       struct event_cbdata *cbdata = data;
+    int ret;
+    struct buffer_info *buffer;
+    struct slave_node *slave;
+    struct packet *p;
 
-       if (instance_unref(cbdata->inst)) {
-               instance_send_key_status(cbdata->inst, cbdata->status);
-       } else {
-               DbgPrint("Skip sending key status (%d)\n", cbdata->status);
-       }
-       /*!
-        * If instance_unref returns NULL,
-        * The instance is destroyed. it means, we don't need to send event to the viewer
-        */
-       DbgFree(cbdata);
-       return ECORE_CALLBACK_CANCEL;
+    buffer = instance_dbox_buffer(inst);
+    if (!buffer) {
+       ErrPrint("Instance[%s] has no buffer\n", instance_id(inst));
+       ret = DBOX_STATUS_ERROR_FAULT;
+       goto out;
+    }
+
+    slave = package_slave(pkg);
+    if (!slave) {
+       ErrPrint("Package[%s] has no slave\n", package_name(pkg));
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    p = packet_create_noack(command, "ssdi", package_name(pkg), instance_id(inst), timestamp, keycode);
+    ret = slave_rpc_request_only(slave, package_name(pkg), p, 0);
+
+out:
+    return ret;
 }
 
-static Eina_Bool lazy_access_status_cb(void *data)
+static int forward_dbox_key_packet(const struct pkg_info *pkg, struct inst_info *inst, const char *command, double timestamp, unsigned int keycode)
 {
-       struct event_cbdata *cbdata = data;
+    int ret;
+    struct buffer_info *buffer;
+    struct slave_node *slave;
+    struct packet *p;
 
-       if (instance_unref(cbdata->inst)) {
-               instance_send_access_status(cbdata->inst, cbdata->status);
-       } else {
-               DbgPrint("Skip sending access status (%d)\n", cbdata->status);
-       }
-       /*!
-        * If instance_unref returns NULL,
-        * The instance is destroyed. it means, we don't need to send event to the viewer
-        */
-       DbgFree(cbdata);
-       return ECORE_CALLBACK_CANCEL;
+    buffer = instance_dbox_buffer(inst);
+    if (!buffer) {
+       ErrPrint("Instance[%s] has no buffer\n", instance_id(inst));
+       ret = DBOX_STATUS_ERROR_FAULT;
+       goto out;
+    }
+
+    slave = package_slave(pkg);
+    if (!slave) {
+       ErrPrint("Package[%s] has no slave\n", package_name(pkg));
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    p = packet_create_noack(command, "ssdi", package_name(pkg), instance_id(inst), timestamp, keycode);
+    ret = slave_rpc_request_only(slave, package_name(pkg), p, 0);
+
+out:
+    return ret;
 }
 
 static int slave_fault_open_script_cb(struct slave_node *slave, void *data)
 {
-       Ecore_Timer *timer;
+    Ecore_Timer *timer;
 
-       (void)script_handler_unload(instance_pd_script(data), 1);
-       (void)instance_slave_close_pd(data, instance_pd_owner(data), LB_CLOSE_PD_FAULT);
-       (void)instance_client_pd_created(data, LB_STATUS_ERROR_FAULT);
+    (void)script_handler_unload(instance_gbar_script(data), 1);
+    (void)instance_slave_close_gbar(data, instance_gbar_owner(data), DBOX_CLOSE_GBAR_FAULT);
+    (void)instance_client_gbar_created(data, DBOX_STATUS_ERROR_FAULT);
 
-       timer = instance_del_data(data, LAZY_PD_OPEN_TAG);
-       if (timer) {
-               ecore_timer_del(timer);
-       }
+    timer = instance_del_data(data, LAZY_GBAR_OPEN_TAG);
+    if (timer) {
+       ecore_timer_del(timer);
+    }
 
-       (void)instance_unref(data);
+    (void)instance_unref(data);
 
-       return -1; /* remove this handler */
+    return -1; /* remove this handler */
 }
 
 static int slave_fault_open_buffer_cb(struct slave_node *slave, void *data)
 {
-       Ecore_Timer *timer;
+    Ecore_Timer *timer;
 
-       (void)instance_slave_close_pd(data, instance_pd_owner(data), LB_CLOSE_PD_FAULT);
-       (void)instance_client_pd_created(data, LB_STATUS_ERROR_FAULT);
+    (void)instance_slave_close_gbar(data, instance_gbar_owner(data), DBOX_CLOSE_GBAR_FAULT);
+    (void)instance_client_gbar_created(data, DBOX_STATUS_ERROR_FAULT);
 
-       timer = instance_del_data(data, PD_OPEN_MONITOR_TAG);
-       if (timer) {
-               ecore_timer_del(timer);
-       }
+    timer = instance_del_data(data, GBAR_OPEN_MONITOR_TAG);
+    if (timer) {
+       ecore_timer_del(timer);
+    }
 
-       (void)instance_unref(data);
+    (void)instance_unref(data);
 
-       return -1; /* remove this handler */
+    return -1; /* remove this handler */
 }
 
 static int slave_fault_close_script_cb(struct slave_node *slave, void *data)
 {
-       Ecore_Timer *timer;
+    Ecore_Timer *timer;
 
-       (void)instance_client_pd_destroyed(data, LB_STATUS_ERROR_FAULT);
+    (void)instance_client_gbar_destroyed(data, DBOX_STATUS_ERROR_FAULT);
 
-       timer = instance_del_data(data, LAZY_PD_CLOSE_TAG);
-       if (timer) {
-               ecore_timer_del(timer);
-       }
+    timer = instance_del_data(data, LAZY_GBAR_CLOSE_TAG);
+    if (timer) {
+       ecore_timer_del(timer);
+    }
 
-       (void)instance_unref(data);
+    (void)instance_unref(data);
 
-       return -1; /* remove this handler */
+    return -1; /* remove this handler */
 }
 
 static int slave_fault_close_buffer_cb(struct slave_node *slave, void *data)
 {
-       Ecore_Timer *timer;
+    Ecore_Timer *timer;
 
-       (void)instance_client_pd_destroyed(data, LB_STATUS_ERROR_FAULT);
+    (void)instance_client_gbar_destroyed(data, DBOX_STATUS_ERROR_FAULT);
 
-       timer = instance_del_data(data, LAZY_PD_CLOSE_TAG);
-       if (!timer) {
-               timer = instance_del_data(data, PD_CLOSE_MONITOR_TAG);
-       }
+    timer = instance_del_data(data, LAZY_GBAR_CLOSE_TAG);
+    if (!timer) {
+       timer = instance_del_data(data, GBAR_CLOSE_MONITOR_TAG);
+    }
 
-       if (timer) {
-               ecore_timer_del(timer);
-       }
+    if (timer) {
+       ecore_timer_del(timer);
+    }
 
-       (void)instance_unref(data);
+    (void)instance_unref(data);
 
-       return -1; /* remove this handler */
+    return -1; /* remove this handler */
 }
 
 static int slave_fault_resize_buffer_cb(struct slave_node *slave, void *data)
 {
-       Ecore_Timer *timer;
-
-       (void)instance_slave_close_pd(data, instance_pd_owner(data), LB_CLOSE_PD_FAULT);
-       (void)instance_client_pd_destroyed(data, LB_STATUS_ERROR_FAULT);
+    Ecore_Timer *timer;
+
+    (void)instance_slave_close_gbar(data, instance_gbar_owner(data), DBOX_CLOSE_GBAR_FAULT);
+    (void)instance_client_gbar_destroyed(data, DBOX_STATUS_ERROR_FAULT);
+
+    timer = instance_del_data(data, GBAR_RESIZE_MONITOR_TAG);
+    if (timer) {
+       ecore_timer_del(timer);
+    }
+
+    (void)instance_unref(data);
+
+    return -1; /* remove this handler */
+}
+
+static int key_event_dbox_route_cb(enum event_state state, struct event_data *event_info, void *data)
+{
+    struct inst_info *inst = data;
+    const struct pkg_info *pkg;
+    struct slave_node *slave;
+    struct packet *packet;
+    unsigned int cmd;
+
+    if (!inst) {
+       DbgPrint("Instance is deleted.\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    pkg = instance_package(inst);
+    if (!pkg) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    slave = package_slave(pkg);
+    if (!slave) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    switch (state) {
+    case EVENT_STATE_ACTIVATE:
+       cmd = CMD_DBOX_KEY_DOWN;
+       break;
+    case EVENT_STATE_ACTIVATED:
+       cmd = CMD_DBOX_KEY_DOWN;
+       break;
+    case EVENT_STATE_DEACTIVATE:
+       cmd = CMD_DBOX_KEY_UP;
+       break;
+    default:
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    packet = packet_create_noack((const char *)&cmd, "ssdi", package_name(pkg), instance_id(inst), event_info->tv, event_info->keycode);
+    if (!packet) {
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    return slave_rpc_request_only(slave, package_name(pkg), packet, 0);
+}
+
+static int mouse_event_dbox_route_cb(enum event_state state, struct event_data *event_info, void *data)
+{
+    struct inst_info *inst = data;
+    const struct pkg_info *pkg;
+    struct slave_node *slave;
+    struct packet *packet;
+    unsigned int cmd;
+
+    if (!inst) {
+       DbgPrint("Instance is deleted.\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    pkg = instance_package(inst);
+    if (!pkg) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    slave = package_slave(pkg);
+    if (!slave) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    switch (state) {
+    case EVENT_STATE_ACTIVATE:
+       cmd = CMD_DBOX_MOUSE_DOWN;
+       break;
+    case EVENT_STATE_ACTIVATED:
+       cmd = CMD_DBOX_MOUSE_MOVE;
+       break;
+    case EVENT_STATE_DEACTIVATE:
+       cmd = CMD_DBOX_MOUSE_UP;
+       break;
+    default:
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    packet = packet_create_noack((const char *)&cmd, "ssdii", package_name(pkg), instance_id(inst), event_info->tv, event_info->x, event_info->y);
+    if (!packet) {
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    return slave_rpc_request_only(slave, package_name(pkg), packet, 0);
+}
+
+static int key_event_dbox_consume_cb(enum event_state state, struct event_data *event_info, void *data)
+{
+    struct script_info *script;
+    struct inst_info *inst = data;
+    const struct pkg_info *pkg;
+    double timestamp;
+
+    pkg = instance_package(inst);
+    if (!pkg) {
+       return 0;
+    }
+
+    script = instance_dbox_script(inst);
+    if (!script) {
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    timestamp = event_info->tv;
+
+    switch (state) {
+    case EVENT_STATE_ACTIVATE:
+       script_handler_update_keycode(script, event_info->keycode);
+       (void)script_handler_feed_event(script, DBOX_SCRIPT_KEY_DOWN, timestamp);
+       break;
+    case EVENT_STATE_ACTIVATED:
+       script_handler_update_keycode(script, event_info->keycode);
+       (void)script_handler_feed_event(script, DBOX_SCRIPT_KEY_DOWN, timestamp);
+       break;
+    case EVENT_STATE_DEACTIVATE:
+       script_handler_update_keycode(script, event_info->keycode);
+       (void)script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_UP, timestamp);
+       break;
+    default:
+       ErrPrint("Unknown event\n");
+       break;
+    }
+
+    return 0;
+}
+
+static int mouse_event_dbox_consume_cb(enum event_state state, struct event_data *event_info, void *data)
+{
+    struct script_info *script;
+    struct inst_info *inst = data;
+    const struct pkg_info *pkg;
+    double timestamp;
+
+    pkg = instance_package(inst);
+    if (!pkg) {
+       return 0;
+    }
+
+    script = instance_dbox_script(inst);
+    if (!script) {
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    timestamp = event_info->tv;
+
+    switch (state) {
+    case EVENT_STATE_ACTIVATE:
+       script_handler_update_pointer(script, event_info->x, event_info->y, 1);
+       (void)script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_DOWN, timestamp);
+       break;
+    case EVENT_STATE_ACTIVATED:
+       script_handler_update_pointer(script, event_info->x, event_info->y, -1);
+       (void)script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_MOVE, timestamp);
+       break;
+    case EVENT_STATE_DEACTIVATE:
+       script_handler_update_pointer(script, event_info->x, event_info->y, 0);
+       (void)script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_UP, timestamp);
+       break;
+    default:
+       break;
+    }
+
+    return 0;
+}
+
+static int key_event_gbar_route_cb(enum event_state state, struct event_data *event_info, void *data)
+{
+    struct inst_info *inst = data;
+    const struct pkg_info *pkg;
+    struct slave_node *slave;
+    struct packet *packet;
+    unsigned int cmd;
+
+    if (!inst) {
+       DbgPrint("Instance is deleted.\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    pkg = instance_package(inst);
+    if (!pkg) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    slave = package_slave(pkg);
+    if (!slave) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    switch (state) {
+    case EVENT_STATE_ACTIVATE:
+       cmd = CMD_GBAR_KEY_DOWN;
+       break;
+    case EVENT_STATE_ACTIVATED:
+       cmd = CMD_GBAR_KEY_DOWN;
+       break;
+    case EVENT_STATE_DEACTIVATE:
+       cmd = CMD_GBAR_KEY_UP;
+       break;
+    default:
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    packet = packet_create_noack((const char *)&cmd, "ssdi", package_name(pkg), instance_id(inst), event_info->tv, event_info->keycode);
+    if (!packet) {
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    return slave_rpc_request_only(slave, package_name(pkg), packet, 0);
+}
+
+static int mouse_event_gbar_route_cb(enum event_state state, struct event_data *event_info, void *data)
+{
+    struct inst_info *inst = data;
+    const struct pkg_info *pkg;
+    struct slave_node *slave;
+    struct packet *packet;
+    unsigned int cmd;
+
+    if (!inst) {
+       DbgPrint("Instance is deleted.\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    pkg = instance_package(inst);
+    if (!pkg) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    slave = package_slave(pkg);
+    if (!slave) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    switch (state) {
+    case EVENT_STATE_ACTIVATE:
+       cmd = CMD_GBAR_MOUSE_DOWN;
+       break;
+    case EVENT_STATE_ACTIVATED:
+       cmd = CMD_GBAR_MOUSE_MOVE;
+       break;
+    case EVENT_STATE_DEACTIVATE:
+       cmd = CMD_GBAR_MOUSE_UP;
+       break;
+    default:
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    packet = packet_create_noack((const char *)&cmd, "ssdii", package_name(pkg), instance_id(inst), event_info->tv, event_info->x, event_info->y);
+    if (!packet) {
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    return slave_rpc_request_only(slave, package_name(pkg), packet, 0);
+}
+
+static int key_event_gbar_consume_cb(enum event_state state, struct event_data *event_info, void *data)
+{
+    struct script_info *script;
+    struct inst_info *inst = data;
+    const struct pkg_info *pkg;
+    double timestamp;
+
+    pkg = instance_package(inst);
+    if (!pkg) {
+       return 0;
+    }
+
+    script = instance_gbar_script(inst);
+    if (!script) {
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    timestamp = event_info->tv;
+
+    switch (state) {
+    case EVENT_STATE_ACTIVATE:
+       script_handler_update_keycode(script, event_info->keycode);
+       (void)script_handler_feed_event(script, DBOX_SCRIPT_KEY_DOWN, timestamp);
+       break;
+    case EVENT_STATE_ACTIVATED:
+       script_handler_update_keycode(script, event_info->keycode);
+       (void)script_handler_feed_event(script, DBOX_SCRIPT_KEY_DOWN, timestamp);
+       break;
+    case EVENT_STATE_DEACTIVATE:
+       script_handler_update_keycode(script, event_info->keycode);
+       (void)script_handler_feed_event(script, DBOX_SCRIPT_KEY_UP, timestamp);
+       break;
+    default:
+       ErrPrint("Unknown event\n");
+       break;
+    }
+
+    return 0;
+}
+
+static int mouse_event_gbar_consume_cb(enum event_state state, struct event_data *event_info, void *data)
+{
+    struct script_info *script;
+    struct inst_info *inst = data;
+    const struct pkg_info *pkg;
+    double timestamp;
+
+    pkg = instance_package(inst);
+    if (!pkg) {
+       return 0;
+    }
+
+    script = instance_gbar_script(inst);
+    if (!script) {
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    timestamp = event_info->tv;
+
+    switch (state) {
+    case EVENT_STATE_ACTIVATE:
+       script_handler_update_pointer(script, event_info->x, event_info->y, 1);
+       (void)script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_DOWN, timestamp);
+       break;
+    case EVENT_STATE_ACTIVATED:
+       script_handler_update_pointer(script, event_info->x, event_info->y, -1);
+       (void)script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_MOVE, timestamp);
+       break;
+    case EVENT_STATE_DEACTIVATE:
+       script_handler_update_pointer(script, event_info->x, event_info->y, 0);
+       (void)script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_UP, timestamp);
+       break;
+    default:
+       break;
+    }
+    return 0;
+}
 
-       timer = instance_del_data(data, PD_RESIZE_MONITOR_TAG);
-       if (timer) {
-               ecore_timer_del(timer);
-       }
+static struct packet *client_acquire(pid_t pid, int handle, const struct packet *packet) /*!< timestamp, ret */
+{
+    struct client_node *client;
+    struct packet *result;
+    const char *direct_addr;
+    double timestamp;
+    int ret;
+
+    client = client_find_by_rpc_handle(handle);
+    if (client) {
+       ErrPrint("Client is already exists %d\n", pid);
+       ret = DBOX_STATUS_ERROR_EXIST;
+       goto out;
+    }
+
+    if (packet_get(packet, "ds", &timestamp, &direct_addr) != 2) {
+       ErrPrint("Invalid arguemnt\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = 0;
+    /*!
+     * \note
+     * client_create will invoke the client created callback
+     */
+    client = client_create(pid, handle, direct_addr);
+    if (!client) {
+       ErrPrint("Failed to create a new client for %d\n", pid);
+       ret = DBOX_STATUS_ERROR_FAULT;
+    }
 
-       (void)instance_unref(data);
+out:
+    result = packet_create_reply(packet, "ii", ret, DYNAMICBOX_CONF_EXTRA_BUFFER_COUNT);
+    if (!result) {
+       ErrPrint("Failed to create a packet\n");
+    }
 
-       return -1; /* remove this handler */
+    return result;
 }
 
-static int key_event_lb_route_cb(enum event_state state, struct event_data *event_info, void *data)
+static struct packet *cilent_release(pid_t pid, int handle, const struct packet *packet) /*!< pid, ret */
 {
-       struct inst_info *inst = data;
-       const struct pkg_info *pkg;
-       struct slave_node *slave;
-       struct packet *packet;
-       const char *cmdstr;
-
-       pkg = instance_package(inst);
-       if (!pkg) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    struct client_node *client;
+    struct packet *result;
+    int ret;
 
-       slave = package_slave(pkg);
-       if (!slave) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
 
-       switch (state) {
-       case EVENT_STATE_ACTIVATE:
-               cmdstr = "lb_key_down";
-               break;
-       case EVENT_STATE_ACTIVATED:
-               cmdstr = "lb_key_down";
-               break;
-       case EVENT_STATE_DEACTIVATE:
-               cmdstr = "lb_key_up";
-               break;
-       default:
-               return LB_STATUS_ERROR_INVALID;
-       }
+    client_destroy(client);
+    ret = 0;
 
-       packet = packet_create_noack(cmdstr, "ssdi", package_name(pkg), instance_id(inst), util_timestamp(), event_info->keycode);
-       if (!packet) {
-               return LB_STATUS_ERROR_FAULT;
-       }
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a packet\n");
+    }
 
-       return slave_rpc_request_only(slave, package_name(pkg), packet, 0);
+    return result;
 }
 
-static int mouse_event_lb_route_cb(enum event_state state, struct event_data *event_info, void *data)
+static int validate_request(const char *pkgname, const char *id, struct inst_info **out_inst, const struct pkg_info **out_pkg)
 {
-       struct inst_info *inst = data;
-       const struct pkg_info *pkg;
-       struct slave_node *slave;
-       struct packet *packet;
-       const char *cmdstr;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
 
-       pkg = instance_package(inst);
-       if (!pkg) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    inst = package_find_instance_by_id(pkgname, id);
+    if (!inst) {
+       ErrPrint("Instance is not exists (%s)\n", id);
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
 
-       slave = package_slave(pkg);
-       if (!slave) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    pkg = instance_package(inst);
+    if (!pkg) {
+       ErrPrint("System error - instance has no package?\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       switch (state) {
-       case EVENT_STATE_ACTIVATE:
-               cmdstr = "lb_mouse_down";
-               break;
-       case EVENT_STATE_ACTIVATED:
-               cmdstr = "lb_mouse_move";
-               break;
-       case EVENT_STATE_DEACTIVATE:
-               cmdstr = "lb_mouse_up";
-               break;
-       default:
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (package_is_fault(pkg)) {
+       ErrPrint("Faulted package: %s\n", pkgname);
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       packet = packet_create_noack(cmdstr, "ssdii", package_name(pkg), instance_id(inst), util_timestamp(), event_info->x, event_info->y);
-       if (!packet) {
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (out_inst) {
+       *out_inst = inst;
+    }
 
-       return slave_rpc_request_only(slave, package_name(pkg), packet, 0);
+    if (out_pkg) {
+       *out_pkg = pkg;
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
 }
 
-static int key_event_lb_consume_cb(enum event_state state, struct event_data *event_info, void *data)
+/*!< pid, pkgname, filename, event, timestamp, x, y, ret */
+static struct packet *client_clicked(pid_t pid, int handle, const struct packet *packet)
 {
-       struct script_info *script;
-       struct inst_info *inst = data;
-       const struct pkg_info *pkg;
-       double timestamp;
-
-       pkg = instance_package(inst);
-       if (!pkg) {
-               return 0;
-       }
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    const char *event;
+    double timestamp;
+    double x;
+    double y;
+    int ret;
+    struct inst_info *inst;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       goto out;
+    }
+
+    ret = packet_get(packet, "sssddd", &pkgname, &id, &event, &timestamp, &x, &y);
+    if (ret != 6) {
+       ErrPrint("Parameter is not matched\n");
+       goto out;
+    }
+
+    /*!
+     * \NOTE:
+     * Trust the package name which are sent by the client.
+     * The package has to be a dynamicbox package name.
+     */
+    ret = validate_request(pkgname, id, &inst, NULL);
+    if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+       (void)instance_clicked(inst, event, timestamp, x, y);
+    }
 
-       script = instance_lb_script(inst);
-       if (!script) {
-               return LB_STATUS_ERROR_FAULT;
-       }
+out:
+    /*! \note No reply packet */
+    return NULL;
+}
 
-       timestamp = util_timestamp();
+static struct packet *client_update_mode(pid_t pid, int handle, const struct packet *packet)
+{
+    struct packet *result;
+    struct client_node *client;
+    int active_update;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    struct inst_info *inst;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssi", &pkgname, &id, &active_update);
+    if (ret != 3) {
+       ErrPrint("Invalid argument\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, NULL);
+    if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+       /*!
+        * \note
+        * Send change update mode request to a slave
+        */
+       ret = instance_set_update_mode(inst, active_update);
+    }
 
-       switch (state) {
-       case EVENT_STATE_ACTIVATE:
-               script_handler_update_keycode(script, event_info->keycode);
-               (void)script_handler_feed_event(script, LB_SCRIPT_KEY_DOWN, timestamp);
-               break;
-       case EVENT_STATE_ACTIVATED:
-               script_handler_update_keycode(script, event_info->keycode);
-               (void)script_handler_feed_event(script, LB_SCRIPT_KEY_DOWN, timestamp);
-               break;
-       case EVENT_STATE_DEACTIVATE:
-               script_handler_update_keycode(script, event_info->keycode);
-               (void)script_handler_feed_event(script, LB_SCRIPT_MOUSE_UP, timestamp);
-               break;
-       default:
-               ErrPrint("Unknown event\n");
-               break;
-       }
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a packet\n");
+    }
 
-       return 0;
+    return result;
 }
 
-static int mouse_event_lb_consume_cb(enum event_state state, struct event_data *event_info, void *data)
+/* pid, pkgname, filename, emission, source, s, sy, ex, ey, ret */
+static struct packet *client_text_signal(pid_t pid, int handle, const struct packet *packet)
 {
-       struct script_info *script;
-       struct inst_info *inst = data;
-       const struct pkg_info *pkg;
-       double timestamp;
+    struct client_node *client;
+    struct packet *result;
+    const char *pkgname;
+    const char *id;
+    const char *emission;
+    const char *source;
+    double sx;
+    double sy;
+    double ex;
+    double ey;
+    struct inst_info *inst = NULL;
+    int ret;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssssdddd", &pkgname, &id, &emission, &source, &sx, &sy, &ex, &ey);
+    if (ret != 8) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    /*!
+     * \NOTE:
+     * Trust the package name which are sent by the client.
+     * The package has to be a dynamicbox package name.
+     */
+    ret = validate_request(pkgname, id, &inst, NULL);
+    if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+       ret = instance_text_signal_emit(inst, emission, source, sx, sy, ex, ey);
+    }
 
-       pkg = instance_package(inst);
-       if (!pkg) {
-               return 0;
-       }
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a packet\n");
+    }
 
-       script = instance_lb_script(inst);
-       if (!script) {
-               return LB_STATUS_ERROR_FAULT;
-       }
+    return result;
+}
 
-       timestamp = util_timestamp();
+static Eina_Bool lazy_delete_cb(void *data)
+{
+    struct deleted_item *item = data;
 
-       switch (state) {
-       case EVENT_STATE_ACTIVATE:
-               script_handler_update_pointer(script, event_info->x, event_info->y, 1);
-               (void)script_handler_feed_event(script, LB_SCRIPT_MOUSE_DOWN, timestamp);
-               break;
-       case EVENT_STATE_ACTIVATED:
-               script_handler_update_pointer(script, event_info->x, event_info->y, -1);
-               (void)script_handler_feed_event(script, LB_SCRIPT_MOUSE_MOVE, timestamp);
-               break;
-       case EVENT_STATE_DEACTIVATE:
-               script_handler_update_pointer(script, event_info->x, event_info->y, 0);
-               (void)script_handler_feed_event(script, LB_SCRIPT_MOUSE_UP, timestamp);
-               break;
-       default:
-               break;
-       }
+    DbgPrint("Lazy delete callback called\n");
+    /*!
+     * Before invoke this callback, the instance is able to already remove this client
+     * So check it again
+     */
+    if (instance_has_client(item->inst, item->client)) {
+       (void)instance_unicast_deleted_event(item->inst, item->client, DBOX_STATUS_ERROR_NONE);
+       (void)instance_del_client(item->inst, item->client);
+    }
 
-       return 0;
+    (void)client_unref(item->client);
+    (void)instance_unref(item->inst);
+    DbgFree(item);
+    return ECORE_CALLBACK_CANCEL;
 }
 
-static int key_event_pd_route_cb(enum event_state state, struct event_data *event_info, void *data)
+static struct packet *client_delete(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, ret */
 {
-       struct inst_info *inst = data;
-       const struct pkg_info *pkg;
-       struct slave_node *slave;
-       struct packet *packet;
-       const char *cmdstr;
+    struct client_node *client;
+    struct packet *result;
+    const char *pkgname;
+    const char *id;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+    int ret;
+    int type;
+    double timestamp;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssid", &pkgname, &id, &type, &timestamp);
+    if (ret != 4) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+    /*!
+     * \note
+     * Below two types must has to be sync'd with dynamicbox-viewer
+     *
+     * DBOX_DELETE_PERMANENTLY = 0x01,
+     * DBOX_DELETE_TEMPORARY = 0x02,
+     *
+     */
+
+    /*!
+     * \NOTE:
+     * Trust the package name which are sent by the client.
+     * The package has to be a dynamicbox package name.
+     */
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       DbgPrint("Failed to find by id(%s), try to find it using timestamp(%lf)\n", id, timestamp);
+       inst = package_find_instance_by_timestamp(pkgname, timestamp);
+       if (!inst) {
+           goto out;
+       }
 
        pkg = instance_package(inst);
        if (!pkg) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+           ErrPrint("Package info is not valid: %s\n", id);
+           goto out;
+       }
+    }
+
+    if (package_is_fault(pkg)) {
+       DbgPrint("Faulted package. will be deleted soon: %s\n", id);
+       ret = DBOX_STATUS_ERROR_FAULT;
+       goto out;
+    }
+
+    if (instance_client(inst) != client) {
+       if (instance_has_client(inst, client)) {
+           struct deleted_item *item;
+
+           item = malloc(sizeof(*item));
+           if (!item) {
+               ErrPrint("Heap: %s\n", strerror(errno));
+               ret = DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+           } else {
+               /*!
+                * \NOTE:
+                * Send DELETED EVENT to the client.
+                * after return from this function.
+                *
+                * Client will prepare the deleted event after get this function's return value.
+                * So We have to make a delay to send a deleted event.
+                */
 
-       slave = package_slave(pkg);
-       if (!slave) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+               item->client = client_ref(client);
+               item->inst = instance_ref(inst);
 
-       switch (state) {
-       case EVENT_STATE_ACTIVATE:
-               cmdstr = "pd_key_down";
-               break;
-       case EVENT_STATE_ACTIVATED:
-               cmdstr = "pd_key_down";
-               break;
-       case EVENT_STATE_DEACTIVATE:
-               cmdstr = "pd_key_up";
-               break;
+               if (!ecore_timer_add(DELAY_TIME, lazy_delete_cb, item)) {
+                   ErrPrint("Failed to add a delayzed delete callback\n");
+                   (void)client_unref(client);
+                   (void)instance_unref(inst);
+                   DbgFree(item);
+                   ret = DBOX_STATUS_ERROR_FAULT;
+               } else {
+                   ret = DBOX_STATUS_ERROR_NONE;
+               }
+           }
+       } else {
+           ErrPrint("Client has no permission\n");
+           ret = DBOX_STATUS_ERROR_PERMISSION_DENIED;
+       }
+    } else {
+       switch (type) {
+       case DBOX_DELETE_PERMANENTLY:
+           ret = instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+           break;
+       case DBOX_DELETE_TEMPORARY:
+           ret = instance_destroy(inst, DBOX_DESTROY_TYPE_TEMPORARY);
+           break;
        default:
-               return LB_STATUS_ERROR_INVALID;
+           break;
        }
+    }
 
-       packet = packet_create_noack(cmdstr, "ssdi", package_name(pkg), instance_id(inst), util_timestamp(), event_info->keycode);
-       if (!packet) {
-               return LB_STATUS_ERROR_FAULT;
-       }
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a packet\n");
+    }
 
-       return slave_rpc_request_only(slave, package_name(pkg), packet, 0);
+    return result;
 }
 
-static int mouse_event_pd_route_cb(enum event_state state, struct event_data *event_info, void *data)
+static struct packet *client_resize(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, w, h, ret */
 {
-       struct inst_info *inst = data;
-       const struct pkg_info *pkg;
-       struct slave_node *slave;
-       struct packet *packet;
-       const char *cmdstr;
+    struct client_node *client;
+    struct packet *result;
+    const char *pkgname;
+    const char *id;
+    int w;
+    int h;
+    struct inst_info *inst = NULL;
+    int ret;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssii", &pkgname, &id, &w, &h);
+    if (ret != 4) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    DbgPrint("RESIZE: Client request resize to %dx%d (pid: %d, pkgname: %s)\n", w, h, pid, pkgname);
+
+    /*!
+     * \NOTE:
+     * Trust the package name which are sent by the client.
+     * The package has to be a dynamicbox package name.
+     */
+    ret = validate_request(pkgname, id, &inst, NULL);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (instance_client(inst) != client) {
+       ret = DBOX_STATUS_ERROR_PERMISSION_DENIED;
+    } else {
+       ret = instance_resize(inst, w, h);
+    }
 
-       pkg = instance_package(inst);
-       if (!pkg) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a packet\n");
+    }
 
-       slave = package_slave(pkg);
-       if (!slave) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    return result;
+}
 
-       switch (state) {
-       case EVENT_STATE_ACTIVATE:
-               cmdstr = "pd_mouse_down";
-               break;
-       case EVENT_STATE_ACTIVATED:
-               cmdstr = "pd_mouse_move";
-               break;
-       case EVENT_STATE_DEACTIVATE:
-               cmdstr = "pd_mouse_up";
-               break;
-       default:
-               return LB_STATUS_ERROR_INVALID;
-       }
+static struct packet *client_new(pid_t pid, int handle, const struct packet *packet) /* pid, timestamp, pkgname, content, cluster, category, period, ret */
+{
+    struct client_node *client;
+    struct packet *result;
+    const char *pkgname;
+    const char *content;
+    const char *cluster;
+    const char *category;
+    double period;
+    double timestamp;
+    int ret;
+    struct pkg_info *info;
+    int width;
+    int height;
+    char *lbid;
+    char *mainappid;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "dssssdii", &timestamp, &pkgname, &content, &cluster, &category, &period, &width, &height);
+    if (ret != 8) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    DbgPrint("pid[%d] period[%lf] pkgname[%s] content[%s] cluster[%s] category[%s] period[%lf]\n",
+           pid, timestamp, pkgname, content, cluster, category, period);
+
+    lbid = package_dbox_pkgname(pkgname);
+    if (!lbid) {
+       ErrPrint("This %s has no dynamicbox package\n", pkgname);
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    mainappid = dynamicbox_service_mainappid(lbid);
+    if (!package_is_enabled(mainappid)) {
+       DbgFree(mainappid);
+       DbgFree(lbid);
+       ret = DBOX_STATUS_ERROR_DISABLED;
+       goto out;
+    }
+    DbgFree(mainappid);
+
+    info = package_find(lbid);
+    if (!info) {
+       char *pkgid;
+       pkgid = dynamicbox_service_package_id(lbid);
+       if (!pkgid) {
+           DbgFree(mainappid);
+           DbgFree(lbid);
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
+       }
+
+       info = package_create(pkgid, lbid);
+       DbgFree(pkgid);
+    }
+
+    if (!info) {
+       ret = DBOX_STATUS_ERROR_FAULT;
+    } else if (package_is_fault(info)) {
+       ret = DBOX_STATUS_ERROR_FAULT;
+    } else if (util_free_space(DYNAMICBOX_CONF_IMAGE_PATH) <= DYNAMICBOX_CONF_MINIMUM_SPACE) {
+       ErrPrint("Not enough space\n");
+       ret = DBOX_STATUS_ERROR_NO_SPACE;
+    } else {
+       struct inst_info *inst;
 
-       packet = packet_create_noack(cmdstr, "ssdii", package_name(pkg), instance_id(inst), util_timestamp(), event_info->x, event_info->y);
-       if (!packet) {
-               return LB_STATUS_ERROR_FAULT;
+       if (period > 0.0f && period < DYNAMICBOX_CONF_MINIMUM_PERIOD) {
+           period = DYNAMICBOX_CONF_MINIMUM_PERIOD;
        }
 
-       return slave_rpc_request_only(slave, package_name(pkg), packet, 0);
+       inst = instance_create(client, timestamp, lbid, content, cluster, category, period, width, height);
+       /*!
+        * \note
+        * Using the "inst" without validate its value is at my disposal. ;)
+        */
+       ret = inst ? 0 : DBOX_STATUS_ERROR_FAULT;
+    }
+
+    DbgFree(lbid);
+
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a packet\n");
+    }
+
+    return result;
 }
 
-static int key_event_pd_consume_cb(enum event_state state, struct event_data *event_info, void *data)
+static struct packet *client_change_visibility(pid_t pid, int handle, const struct packet *packet)
 {
-       struct script_info *script;
-       struct inst_info *inst = data;
-       const struct pkg_info *pkg;
-       double timestamp;
-
-       pkg = instance_package(inst);
-       if (!pkg) {
-               return 0;
-       }
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    enum dynamicbox_visible_state state;
+    int ret;
+    struct inst_info *inst;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssi", &pkgname, &id, (int *)&state);
+    if (ret != 3) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    /*!
+     * \NOTE:
+     * Trust the package name which are sent by the client.
+     * The package has to be a dynamicbox package name.
+     */
+    ret = validate_request(pkgname, id, &inst, NULL);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (instance_client(inst) != client) {
+       ret = DBOX_STATUS_ERROR_PERMISSION_DENIED;
+    } else {
+       ret = instance_set_visible_state(inst, state);
+    }
 
-       script = instance_pd_script(inst);
-       if (!script) {
-               return LB_STATUS_ERROR_FAULT;
-       }
+out:
+    /*! \note No reply packet */
+    return NULL;
+}
 
-       timestamp = util_timestamp();
+static struct packet *client_set_period(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, period, ret */
+{
+    struct client_node *client;
+    struct packet *result;
+    const char *pkgname;
+    const char *id;
+    double period;
+    int ret;
+    struct inst_info *inst = NULL;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssd", &pkgname, &id, &period);
+    if (ret != 3) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    DbgPrint("pid[%d] pkgname[%s] period[%lf]\n", pid, pkgname, period);
+
+    /*!
+     * \NOTE:
+     * Trust the package name which are sent by the client.
+     * The package has to be a dynamicbox package name.
+     */
+    ret = validate_request(pkgname, id, &inst, NULL);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (instance_client(inst) != client) {
+       ret = DBOX_STATUS_ERROR_PERMISSION_DENIED;
+    } else {
+       ret = instance_set_period(inst, period);
+    }
 
-       switch (state) {
-       case EVENT_STATE_ACTIVATE:
-               script_handler_update_keycode(script, event_info->keycode);
-               (void)script_handler_feed_event(script, LB_SCRIPT_KEY_DOWN, timestamp);
-               break;
-       case EVENT_STATE_ACTIVATED:
-               script_handler_update_keycode(script, event_info->keycode);
-               (void)script_handler_feed_event(script, LB_SCRIPT_KEY_DOWN, timestamp);
-               break;
-       case EVENT_STATE_DEACTIVATE:
-               script_handler_update_keycode(script, event_info->keycode);
-               (void)script_handler_feed_event(script, LB_SCRIPT_KEY_UP, timestamp);
-               break;
-       default:
-               ErrPrint("Unknown event\n");
-               break;
-       }
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a packet\n");
+    }
 
-       return 0;
+    return result;
 }
 
-static int mouse_event_pd_consume_cb(enum event_state state, struct event_data *event_info, void *data)
+static struct packet *client_change_group(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, cluster, category, ret */
 {
-       struct script_info *script;
-       struct inst_info *inst = data;
-       const struct pkg_info *pkg;
-       double timestamp;
+    struct client_node *client;
+    struct packet *result;
+    const char *pkgname;
+    const char *id;
+    const char *cluster;
+    const char *category;
+    struct inst_info *inst = NULL;
+    int ret;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssss", &pkgname, &id, &cluster, &category);
+    if (ret != 4) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    DbgPrint("pid[%d] pkgname[%s] cluster[%s] category[%s]\n", pid, pkgname, cluster, category);
+
+    /*!
+     * \NOTE:
+     * Trust the package name which are sent by the client.
+     * The package has to be a dynamicbox package name.
+     */
+    ret = validate_request(pkgname, id, &inst, NULL);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (instance_client(inst) != client) {
+       ret = DBOX_STATUS_ERROR_PERMISSION_DENIED;
+    } else {
+       ret = instance_change_group(inst, cluster, category);
+    }
 
-       pkg = instance_package(inst);
-       if (!pkg) {
-               return 0;
-       }
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_gbar_mouse_enter(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    int x;
+    int y;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+    if (ret != 5) {
+       ErrPrint("Invalid parameter\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       ret = forward_gbar_event_packet(pkg, inst, packet);
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       struct script_info *script;
 
-       script = instance_pd_script(inst);
+       script = instance_gbar_script(inst);
        if (!script) {
-               return LB_STATUS_ERROR_FAULT;
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       timestamp = util_timestamp();
-
-       switch (state) {
-       case EVENT_STATE_ACTIVATE:
-               script_handler_update_pointer(script, event_info->x, event_info->y, 1);
-               (void)script_handler_feed_event(script, LB_SCRIPT_MOUSE_DOWN, timestamp);
-               break;
-       case EVENT_STATE_ACTIVATED:
-               script_handler_update_pointer(script, event_info->x, event_info->y, -1);
-               (void)script_handler_feed_event(script, LB_SCRIPT_MOUSE_MOVE, timestamp);
-               break;
-       case EVENT_STATE_DEACTIVATE:
-               script_handler_update_pointer(script, event_info->x, event_info->y, 0);
-               (void)script_handler_feed_event(script, LB_SCRIPT_MOUSE_UP, timestamp);
-               break;
-       default:
-               break;
-       }
-       return 0;
-}
-
-static struct packet *client_acquire(pid_t pid, int handle, const struct packet *packet) /*!< timestamp, ret */
-{
-       struct client_node *client;
-       struct packet *result;
-       double timestamp;
-       int ret;
-
-       client = client_find_by_rpc_handle(handle);
-       if (client) {
-               ErrPrint("Client is already exists %d\n", pid);
-               ret = LB_STATUS_ERROR_EXIST;
-               goto out;
-       }
-
-       if (packet_get(packet, "d", &timestamp) != 1) {
-               ErrPrint("Invalid arguemnt\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = 0;
-       /*!
-        * \note
-        * client_create will invoke the client created callback
-        */
-       client = client_create(pid, handle);
-       if (!client) {
-               ErrPrint("Failed to create a new client for %d\n", pid);
-               ret = LB_STATUS_ERROR_FAULT;
-       }
+       script_handler_update_pointer(script, x, y, -1);
+       script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_IN, timestamp);
+       ret = 0;
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
 out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *cilent_release(pid_t pid, int handle, const struct packet *packet) /*!< pid, ret */
-{
-       struct client_node *client;
-       struct packet *result;
-       int ret;
+    /*! \note No reply packet */
+    return NULL;
+}
+
+static struct packet *client_gbar_mouse_leave(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    int x;
+    int y;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+    if (ret != 5) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       ret = forward_gbar_event_packet(pkg, inst, packet);
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       struct script_info *script;
 
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
+       script = instance_gbar_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       client_destroy(client);
+       script_handler_update_pointer(script, x, y, -1);
+       script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_OUT, timestamp);
        ret = 0;
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
 out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a packet\n");
-       }
-
-       return result;
-}
-
-static int validate_request(const char *pkgname, const char *id, struct inst_info **out_inst, const struct pkg_info **out_pkg)
-{
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-
-       inst = package_find_instance_by_id(pkgname, id);
-       if (!inst) {
-               ErrPrint("Instance is not exists (%s)\n", id);
-               return LB_STATUS_ERROR_NOT_EXIST;
-       }
-
-       pkg = instance_package(inst);
-       if (!pkg) {
-               ErrPrint("System error - instance has no package?\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       if (package_is_fault(pkg)) {
-               ErrPrint("Faulted package: %s\n", pkgname);
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       if (out_inst) {
-               *out_inst = inst;
-       }
-
-       if (out_pkg) {
-               *out_pkg = pkg;
-       }
-
-       return LB_STATUS_SUCCESS;
-}
-
-/*!< pid, pkgname, filename, event, timestamp, x, y, ret */
-static struct packet *client_clicked(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       const char *event;
-       double timestamp;
-       double x;
-       double y;
-       int ret;
-       struct inst_info *inst;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               goto out;
-       }
-
-       ret = packet_get(packet, "sssddd", &pkgname, &id, &event, &timestamp, &x, &y);
-       if (ret != 6) {
-               ErrPrint("Parameter is not matched\n");
-               goto out;
-       }
-
-       /*!
-        * \NOTE:
-        * Trust the package name which are sent by the client.
-        * The package has to be a livebox package name.
-        */
-       ret = validate_request(pkgname, id, &inst, NULL);
-       if (ret == (int)LB_STATUS_SUCCESS) {
-               (void)instance_clicked(inst, event, timestamp, x, y);
-       }
-
-out:
-       /*! \note No reply packet */
-       return NULL;
-}
-
-static struct packet *client_update_mode(pid_t pid, int handle, const struct packet *packet)
-{
-       struct packet *result;
-       struct client_node *client;
-       int active_update;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       struct inst_info *inst;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssi", &pkgname, &id, &active_update);
-       if (ret != 3) {
-               ErrPrint("Invalid argument\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, NULL);
-       if (ret == (int)LB_STATUS_SUCCESS) {
-               /*!
-                * \note
-                * Send change update mode request to a slave
-                */
-               ret = instance_set_update_mode(inst, active_update);
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a packet\n");
-       }
-
-       return result;
-}
-
-/* pid, pkgname, filename, emission, source, s, sy, ex, ey, ret */
-static struct packet *client_text_signal(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       struct packet *result;
-       const char *pkgname;
-       const char *id;
-       const char *emission;
-       const char *source;
-       double sx;
-       double sy;
-       double ex;
-       double ey;
-       struct inst_info *inst = NULL;
-       int ret;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
+    /*! \note No reply packet */
+    return NULL;
+}
+
+static struct packet *client_gbar_mouse_down(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, id, width, height, timestamp, x, y, ret */
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    int x;
+    int y;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+    if (ret != 5) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       ret = forward_gbar_event_packet(pkg, inst, packet);
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       struct script_info *script;
 
-       ret = packet_get(packet, "ssssdddd", &pkgname, &id, &emission, &source, &sx, &sy, &ex, &ey);
-       if (ret != 8) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
+       script = instance_gbar_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       /*!
-        * \NOTE:
-        * Trust the package name which are sent by the client.
-        * The package has to be a livebox package name.
-        */
-       ret = validate_request(pkgname, id, &inst, NULL);
-       if (ret == (int)LB_STATUS_SUCCESS) {
-               ret = instance_text_signal_emit(inst, emission, source, sx, sy, ex, ey);
-       }
+       script_handler_update_pointer(script, x, y, 1);
+       script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_DOWN, timestamp);
+       ret = 0;
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
 out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a packet\n");
-       }
-
-       return result;
-}
-
-static Eina_Bool lazy_delete_cb(void *data)
-{
-       struct deleted_item *item = data;
-
-       DbgPrint("Lazy delete callback called\n");
-       /*!
-        * Before invoke this callback, the instance is able to already remove this client
-        * So check it again
-        */
-       if (instance_has_client(item->inst, item->client)) {
-               (void)instance_unicast_deleted_event(item->inst, item->client, LB_STATUS_SUCCESS);
-               (void)instance_del_client(item->inst, item->client);
-       }
-
-       (void)client_unref(item->client);
-       (void)instance_unref(item->inst);
-       DbgFree(item);
-       return ECORE_CALLBACK_CANCEL;
-}
-
-static struct packet *client_delete(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, ret */
-{
-       struct client_node *client;
-       struct packet *result;
-       const char *pkgname;
-       const char *id;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-       int ret;
-       int type;
-       double timestamp;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssid", &pkgname, &id, &type, &timestamp);
-       if (ret != 4) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-       /*!
-        * \note
-        * Below two types must has to be sync'd with livebox-viewer
-        *
-        * LB_DELETE_PERMANENTLY = 0x01,
-        * LB_DELETE_TEMPORARY = 0x02,
-        *
-        */
-
-       /*!
-        * \NOTE:
-        * Trust the package name which are sent by the client.
-        * The package has to be a livebox package name.
-        */
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               DbgPrint("Failed to find by id(%s), try to find it using timestamp(%lf)\n", id, timestamp);
-               inst = package_find_instance_by_timestamp(pkgname, timestamp);
-               if (!inst) {
-                       goto out;
-               }
-
-               pkg = instance_package(inst);
-               if (!pkg) {
-                       ErrPrint("Package info is not valid: %s\n", id);
-                       goto out;
-               }
-       }
+    /*! \note No reply packet */
+    return NULL;
+}
+
+static struct packet *client_gbar_mouse_up(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    int x;
+    int y;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+    if (ret != 5) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       ret = forward_gbar_event_packet(pkg, inst, packet);
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       struct script_info *script;
 
-       if (package_is_fault(pkg)) {
-               DbgPrint("Faulted package. will be deleted soon: %s\n", id);
-               ret = LB_STATUS_ERROR_FAULT;
-               goto out;
+       script = instance_gbar_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       if (instance_client(inst) != client) {
-               if (instance_has_client(inst, client)) {
-                       struct deleted_item *item;
-
-                       item = malloc(sizeof(*item));
-                       if (!item) {
-                               ErrPrint("Heap: %s\n", strerror(errno));
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               /*!
-                                * \NOTE:
-                                * Send DELETED EVENT to the client.
-                                * after return from this function.
-                                *
-                                * Client will prepare the deleted event after get this function's return value.
-                                * So We have to make a delay to send a deleted event.
-                                */
-
-                               item->client = client_ref(client);
-                               item->inst = instance_ref(inst);
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_delete_cb, item)) {
-                                       ErrPrint("Failed to add a delayzed delete callback\n");
-                                       (void)client_unref(client);
-                                       (void)instance_unref(inst);
-                                       DbgFree(item);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               } else {
-                       ErrPrint("Client has no permission\n");
-                       ret = LB_STATUS_ERROR_PERMISSION;
-               }
-       } else {
-               switch (type) {
-               case LB_DELETE_PERMANENTLY:
-                       ret = instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
-                       break;
-               case LB_DELETE_TEMPORARY:
-                       ret = instance_destroy(inst, INSTANCE_DESTROY_TEMPORARY);
-                       break;
-               default:
-                       break;
-               }
-       }
+       script_handler_update_pointer(script, x, y, 0);
+       script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_UP, timestamp);
+       ret = 0;
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
 out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_resize(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, w, h, ret */
-{
-       struct client_node *client;
-       struct packet *result;
-       const char *pkgname;
-       const char *id;
-       int w;
-       int h;
-       struct inst_info *inst = NULL;
-       int ret;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssii", &pkgname, &id, &w, &h);
-       if (ret != 4) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       DbgPrint("RESIZE: Client request resize to %dx%d (pid: %d, pkgname: %s)\n", w, h, pid, pkgname);
+    /*! \note No reply packet */
+    return NULL;
+}
+
+static struct packet *client_gbar_mouse_move(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    int x;
+    int y;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+    if (ret != 5) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       ret = forward_gbar_event_packet(pkg, inst, packet);
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       struct script_info *script;
 
-       /*!
-        * \NOTE:
-        * Trust the package name which are sent by the client.
-        * The package has to be a livebox package name.
-        */
-       ret = validate_request(pkgname, id, &inst, NULL);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
+       script = instance_gbar_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       if (instance_client(inst) != client) {
-               ret = LB_STATUS_ERROR_PERMISSION;
-       } else {
-               ret = instance_resize(inst, w, h);
-       }
+       script_handler_update_pointer(script, x, y, -1);
+       script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_MOVE, timestamp);
+       ret = 0;
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
 out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_new(pid_t pid, int handle, const struct packet *packet) /* pid, timestamp, pkgname, content, cluster, category, period, ret */
-{
-       struct client_node *client;
-       struct packet *result;
-       const char *pkgname;
-       const char *content;
-       const char *cluster;
-       const char *category;
-       double period;
-       double timestamp;
-       int ret;
-       struct pkg_info *info;
-       int width;
-       int height;
-       char *lbid;
-       char *mainappid;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "dssssdii", &timestamp, &pkgname, &content, &cluster, &category, &period, &width, &height);
-       if (ret != 8) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       DbgPrint("pid[%d] period[%lf] pkgname[%s] content[%s] cluster[%s] category[%s] period[%lf]\n",
-                                               pid, timestamp, pkgname, content, cluster, category, period);
-
-       lbid = package_lb_pkgname(pkgname);
-       if (!lbid) {
-               ErrPrint("This %s has no livebox package\n", pkgname);
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       mainappid = livebox_service_mainappid(lbid);
-       if (!package_is_enabled(mainappid)) {
-               DbgFree(mainappid);
-               DbgFree(lbid);
-               ret = LB_STATUS_ERROR_DISABLED;
-               goto out;
-       }
-       DbgFree(mainappid);
-
-       info = package_find(lbid);
-       if (!info) {
-               char *pkgid;
-               pkgid = livebox_service_appid(lbid);
-               if (!pkgid) {
-                       DbgFree(mainappid);
-                       DbgFree(lbid);
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               info = package_create(pkgid, lbid);
-               DbgFree(pkgid);
-       }
-
-       if (!info) {
-               ret = LB_STATUS_ERROR_FAULT;
-       } else if (package_is_fault(info)) {
-               ret = LB_STATUS_ERROR_FAULT;
-       } else if (util_free_space(IMAGE_PATH) <= MINIMUM_SPACE) {
-               ErrPrint("Not enough space\n");
-               ret = LB_STATUS_ERROR_NO_SPACE;
-       } else {
-               struct inst_info *inst;
-
-               if (period > 0.0f && period < MINIMUM_PERIOD) {
-                       period = MINIMUM_PERIOD;
-               }
-
-               inst = instance_create(client, timestamp, lbid, content, cluster, category, period, width, height);
-               /*!
-                * \note
-                * Using the "inst" without validate its value is at my disposal. ;)
-                */
-               ret = inst ? 0 : LB_STATUS_ERROR_FAULT;
-       }
-
-       DbgFree(lbid);
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_change_visibility(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       enum livebox_visible_state state;
-       int ret;
-       struct inst_info *inst;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssi", &pkgname, &id, (int *)&state);
-       if (ret != 3) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       /*!
-        * \NOTE:
-        * Trust the package name which are sent by the client.
-        * The package has to be a livebox package name.
-        */
-       ret = validate_request(pkgname, id, &inst, NULL);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (instance_client(inst) != client) {
-               ret = LB_STATUS_ERROR_PERMISSION;
-       } else {
-               ret = instance_set_visible_state(inst, state);
-       }
-
-out:
-       /*! \note No reply packet */
-       return NULL;
-}
-
-static struct packet *client_set_period(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, period, ret */
-{
-       struct client_node *client;
-       struct packet *result;
-       const char *pkgname;
-       const char *id;
-       double period;
-       int ret;
-       struct inst_info *inst = NULL;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssd", &pkgname, &id, &period);
-       if (ret != 3) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       DbgPrint("pid[%d] pkgname[%s] period[%lf]\n", pid, pkgname, period);
-
-       /*!
-        * \NOTE:
-        * Trust the package name which are sent by the client.
-        * The package has to be a livebox package name.
-        */
-       ret = validate_request(pkgname, id, &inst, NULL);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (instance_client(inst) != client) {
-               ret = LB_STATUS_ERROR_PERMISSION;
-       } else {
-               ret = instance_set_period(inst, period);
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_change_group(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, cluster, category, ret */
-{
-       struct client_node *client;
-       struct packet *result;
-       const char *pkgname;
-       const char *id;
-       const char *cluster;
-       const char *category;
-       struct inst_info *inst = NULL;
-       int ret;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssss", &pkgname, &id, &cluster, &category);
-       if (ret != 4) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       DbgPrint("pid[%d] pkgname[%s] cluster[%s] category[%s]\n", pid, pkgname, cluster, category);
-
-       /*!
-        * \NOTE:
-        * Trust the package name which are sent by the client.
-        * The package has to be a livebox package name.
-        */
-       ret = validate_request(pkgname, id, &inst, NULL);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (instance_client(inst) != client) {
-               ret = LB_STATUS_ERROR_PERMISSION;
-       } else {
-               ret = instance_change_group(inst, cluster, category);
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_pd_mouse_enter(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Invalid parameter\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               ret = forward_pd_event_packet(pkg, inst, packet);
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_pd_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, -1);
-               script_handler_feed_event(script, LB_SCRIPT_MOUSE_IN, timestamp);
-               ret = 0;
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       /*! \note No reply packet */
-       return NULL;
-}
-
-static struct packet *client_pd_mouse_leave(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               ret = forward_pd_event_packet(pkg, inst, packet);
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_pd_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, -1);
-               script_handler_feed_event(script, LB_SCRIPT_MOUSE_OUT, timestamp);
-               ret = 0;
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       /*! \note No reply packet */
-       return NULL;
-}
-
-static struct packet *client_pd_mouse_down(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, id, width, height, timestamp, x, y, ret */
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               ret = forward_pd_event_packet(pkg, inst, packet);
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_pd_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, 1);
-               script_handler_feed_event(script, LB_SCRIPT_MOUSE_DOWN, timestamp);
-               ret = 0;
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       /*! \note No reply packet */
-       return NULL;
-}
-
-static struct packet *client_pd_mouse_up(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               ret = forward_pd_event_packet(pkg, inst, packet);
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_pd_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, 0);
-               script_handler_feed_event(script, LB_SCRIPT_MOUSE_UP, timestamp);
-               ret = 0;
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       /*! \note No reply packet */
-       return NULL;
-}
-
-static struct packet *client_pd_mouse_move(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               ret = forward_pd_event_packet(pkg, inst, packet);
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_pd_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, -1);
-               script_handler_feed_event(script, LB_SCRIPT_MOUSE_MOVE, timestamp);
-               ret = 0;
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       /*! \note No reply packet */
-       return NULL;
-}
-
-static struct packet *client_lb_mouse_move(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = forward_lb_event_packet(pkg, inst, packet);
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_lb_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, -1);
-               script_handler_feed_event(script, LB_SCRIPT_MOUSE_MOVE, timestamp);
-               ret = 0;
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       /*! \note No reply packet */
-       return NULL;
-}
-
-static int inst_del_cb(struct inst_info *inst, void *data)
-{
-       (void)event_deactivate(data, inst);
-       return -1; /* Delete this callback */
-}
-
-
-static struct packet *client_pd_key_set(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       unsigned int keycode;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-       struct packet *result;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
-       if (ret != 4) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = event_activate(0, 0, key_event_pd_route_cb, inst);
-               if (ret == 0) {
-                       instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, key_event_pd_route_cb);
-               }
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               ret = event_activate(0, 0, key_event_pd_consume_cb, inst);
-               if (ret == 0) {
-                       instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, key_event_pd_consume_cb);
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_pd_key_unset(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       unsigned int keycode;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-       struct packet *result;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
-       if (ret != 4) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = event_deactivate(key_event_pd_route_cb, inst);
-               if (ret == 0) {
-                       instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, key_event_pd_route_cb);
-               }
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               ret = event_deactivate(key_event_pd_consume_cb, inst);
-               if (ret == 0) {
-                       instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, key_event_pd_consume_cb);
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_lb_key_set(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       unsigned int keycode;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-       struct packet *result;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
-       if (ret != 4) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = event_activate(0, 0, key_event_lb_route_cb, inst);
-               if (ret == 0) {
-                       instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, key_event_lb_route_cb);
-               }
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               ret = event_activate(0, 0, key_event_lb_consume_cb, inst);
-               if (ret == 0) {
-                       instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, key_event_lb_consume_cb);
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_lb_key_unset(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       unsigned int keycode;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-       struct packet *result;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
-       if (ret != 4) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = event_deactivate(key_event_lb_route_cb, inst);
-               if (ret == 0) {
-                       instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, key_event_lb_route_cb);
-               }
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               ret = event_deactivate(key_event_lb_consume_cb, inst);
-               if (ret == 0) {
-                       instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, key_event_lb_consume_cb);
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_lb_mouse_set(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = event_activate(x, y, mouse_event_lb_route_cb, inst);
-               if (ret == 0) {
-                       instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_lb_route_cb);
-               }
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               ret = event_activate(x, y, mouse_event_lb_consume_cb, inst);
-               if (ret == 0) {
-                       instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_lb_consume_cb);
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-out:
-       return NULL;
-}
-
-static struct packet *client_lb_mouse_unset(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = event_deactivate(mouse_event_lb_route_cb, inst);
-               if (ret == 0) {
-                       instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_lb_route_cb);
-               }
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               ret = event_deactivate(mouse_event_lb_consume_cb, inst);
-               if (ret == 0) {
-                       instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_lb_consume_cb);
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-out:
-       return NULL;
-}
-
-static struct packet *client_pd_mouse_set(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               ret = event_activate(x, y, mouse_event_pd_route_cb, inst);
-               if (ret == 0) {
-                       instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_pd_route_cb);
-               }
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               ret = event_activate(x, y, mouse_event_pd_consume_cb, inst);
-               if (ret == 0) {
-                       instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_pd_consume_cb);
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       return NULL;
-}
-
-static struct packet *client_lb_mouse_on_scroll(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = forward_lb_event_packet(pkg, inst, packet);
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_lb_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, -1);
-               script_handler_feed_event(script, LB_SCRIPT_MOUSE_ON_SCROLL, timestamp);
-               ret = 0;
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       /*! \note No reply packet */
-       return NULL;
-}
-
-static struct packet *client_lb_mouse_off_scroll(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = forward_lb_event_packet(pkg, inst, packet);
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_lb_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, -1);
-               script_handler_feed_event(script, LB_SCRIPT_MOUSE_OFF_SCROLL, timestamp);
-               ret = 0;
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       /*! \note No reply packet */
-       return NULL;
-}
-
-static struct packet *client_lb_mouse_on_hold(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = forward_lb_event_packet(pkg, inst, packet);
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_lb_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, -1);
-               script_handler_feed_event(script, LB_SCRIPT_MOUSE_ON_HOLD, timestamp);
-               ret = 0;
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       /*! \note No reply packet */
-       return NULL;
-}
-
-static struct packet *client_lb_mouse_off_hold(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = forward_lb_event_packet(pkg, inst, packet);
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_lb_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, -1);
-               script_handler_feed_event(script, LB_SCRIPT_MOUSE_OFF_HOLD, timestamp);
-               ret = 0;
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       /*! \note No reply packet */
-       return NULL;
-}
-
-static struct packet *client_pd_mouse_on_scroll(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               ret = forward_pd_event_packet(pkg, inst, packet);
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_pd_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, -1);
-               script_handler_feed_event(script, LB_SCRIPT_MOUSE_ON_SCROLL, timestamp);
-               ret = 0;
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       /*! \note No reply packet */
-       return NULL;
-}
-
-static struct packet *client_pd_mouse_off_scroll(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               ret = forward_pd_event_packet(pkg, inst, packet);
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_pd_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, -1);
-               script_handler_feed_event(script, LB_SCRIPT_MOUSE_OFF_SCROLL, timestamp);
-               ret = 0;
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       /*! \note No reply packet */
-       return NULL;
-}
-
-static struct packet *client_pd_mouse_on_hold(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               ret = forward_pd_event_packet(pkg, inst, packet);
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_pd_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, -1);
-               script_handler_feed_event(script, LB_SCRIPT_MOUSE_ON_HOLD, timestamp);
-               ret = 0;
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       /*! \note No reply packet */
-       return NULL;
-}
-
-static struct packet *client_pd_mouse_off_hold(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               ret = forward_pd_event_packet(pkg, inst, packet);
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_pd_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, -1);
-               script_handler_feed_event(script, LB_SCRIPT_MOUSE_OFF_HOLD, timestamp);
-               ret = 0;
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       /*! \note No reply packet */
-       return NULL;
-}
-
-static struct packet *client_pd_mouse_unset(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               ret = event_deactivate(mouse_event_pd_route_cb, inst);
-               if (ret == 0) {
-                       instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_pd_route_cb);
-               }
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               ret = event_deactivate(mouse_event_pd_consume_cb, inst);
-               if (ret == 0) {
-                       instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_pd_consume_cb);
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-out:
-       return NULL;
-}
-
-static struct packet *client_lb_mouse_enter(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = forward_lb_event_packet(pkg, inst, packet);
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_lb_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, -1);
-               script_handler_feed_event(script, LB_SCRIPT_MOUSE_IN, timestamp);
-               ret = 0;
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       /*! \note No reply packet */
-       return NULL;
-}
-
-static struct packet *client_lb_mouse_leave(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = forward_lb_event_packet(pkg, inst, packet);
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_lb_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, -1);
-               script_handler_feed_event(script, LB_SCRIPT_MOUSE_OUT, timestamp);
-               ret = 0;
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       /*! \note No reply packet */
-       return NULL;
-}
-
-static struct packet *client_lb_mouse_down(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = forward_lb_event_packet(pkg, inst, packet);
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_lb_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, 1);
-               script_handler_feed_event(script, LB_SCRIPT_MOUSE_DOWN, timestamp);
-               ret = 0;
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       /*! \note No reply packet */
-       return NULL;
-}
-
-static struct packet *client_lb_mouse_up(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = forward_lb_event_packet(pkg, inst, packet);
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_lb_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, 0);
-               script_handler_feed_event(script, LB_SCRIPT_MOUSE_UP, timestamp);
-               ret = 0;
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       /*! \note No reply packet */
-       return NULL;
-}
-
-static struct packet *client_pd_access_action_up(pid_t pid, int handle, const struct packet *packet)
-{
-       struct packet *result;
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst = NULL;
-       const struct pkg_info *pkg = NULL;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Invalid parameter\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               ret = forward_pd_access_packet(pkg, inst, packet_command(packet), timestamp, x, y);
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_pd_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, 0);
-               ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_ACTION, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_pd_access_action_down(pid_t pid, int handle, const struct packet *packet)
-{
-       struct packet *result;
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst = NULL;
-       const struct pkg_info *pkg = NULL;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Invalid parameter\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               ret = forward_pd_access_packet(pkg, inst, packet_command(packet), timestamp, x, y);
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_pd_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, 1);
-               ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_ACTION, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_pd_access_scroll_down(pid_t pid, int handle, const struct packet *packet)
-{
-       struct packet *result;
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst = NULL;
-       const struct pkg_info *pkg = NULL;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Invalid parameter\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               ret = forward_pd_access_packet(pkg, inst, packet_command(packet), timestamp, x, y);
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_pd_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, 1);
-               ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_SCROLL, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_pd_access_scroll_move(pid_t pid, int handle, const struct packet *packet)
-{
-       struct packet *result;
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst = NULL;
-       const struct pkg_info *pkg = NULL;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Invalid parameter\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               ret = forward_pd_access_packet(pkg, inst, packet_command(packet), timestamp, x, y);
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_pd_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, -1);
-               ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_SCROLL, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_pd_access_scroll_up(pid_t pid, int handle, const struct packet *packet)
-{
-       struct packet *result;
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst = NULL;
-       const struct pkg_info *pkg = NULL;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Invalid parameter\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               ret = forward_pd_access_packet(pkg, inst, packet_command(packet), timestamp, x, y);
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_pd_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, 0);
-               ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_SCROLL, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_pd_access_unhighlight(pid_t pid, int handle, const struct packet *packet)
-{
-       struct packet *result;
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int x;
-       int y;
-       struct inst_info *inst = NULL;
-       const struct pkg_info *pkg = NULL;
-       int ret;
-       double timestamp;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Invalid parameter\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               ret = forward_pd_access_packet(pkg, inst, packet_command(packet), timestamp, x, y);
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_pd_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, -1);
-               ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_UNHIGHLIGHT, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_pd_access_hl(pid_t pid, int handle, const struct packet *packet)
-{
-       struct packet *result;
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst = NULL;
-       const struct pkg_info *pkg = NULL;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Invalid parameter\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               ret = forward_pd_access_packet(pkg, inst, packet_command(packet), timestamp, x, y);
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_pd_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, -1);
-               ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_HIGHLIGHT, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_pd_access_hl_prev(pid_t pid, int handle, const struct packet *packet)
-{
-       struct packet *result;
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst = NULL;
-       const struct pkg_info *pkg = NULL;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Invalid parameter\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               ret = forward_pd_access_packet(pkg, inst, packet_command(packet), timestamp, x, y);
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_pd_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, -1);
-               ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_HIGHLIGHT_PREV, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_pd_access_hl_next(pid_t pid, int handle, const struct packet *packet)
-{
-       struct packet *result;
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst = NULL;
-       const struct pkg_info *pkg = NULL;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Invalid parameter\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               ret = forward_pd_access_packet(pkg, inst, packet_command(packet), timestamp, x, y);
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_pd_script(inst);
-               if (!script) {
-                       ErrPrint("Script is not created yet\n");
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, -1);
-               ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_HIGHLIGHT_NEXT, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ErrPrint("Heap: %s\n", strerror(errno));
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
-                                       ErrPrint("Failed to add timer\n");
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               } else {
-                       DbgPrint("Returns: %d\n", ret);
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_pd_access_activate(pid_t pid, int handle, const struct packet *packet)
-{
-       struct packet *result;
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst = NULL;
-       const struct pkg_info *pkg = NULL;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Invalid parameter\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               ret = forward_pd_access_packet(pkg, inst, packet_command(packet), timestamp, x, y);
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_pd_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, -1);
-               ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_ACTIVATE, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_pd_key_focus_in(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       unsigned int keycode;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-       struct packet *result;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
-       if (ret != 4) {
-               ErrPrint("Invalid parameter\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               ret = forward_pd_key_packet(pkg, inst, packet_command(packet), timestamp, keycode);
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_pd_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_keycode(script, keycode);
-               ret = script_handler_feed_event(script, LB_SCRIPT_KEY_FOCUS_IN, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_key_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_pd_key_focus_out(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       unsigned int keycode;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-       struct packet *result;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
-       if (ret != 4) {
-               ErrPrint("Invalid parameter\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               ret = forward_pd_key_packet(pkg, inst, packet_command(packet), timestamp, keycode);
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_pd_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_keycode(script, keycode);
-               ret = script_handler_feed_event(script, LB_SCRIPT_KEY_FOCUS_OUT, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_key_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_pd_key_down(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       unsigned int keycode;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-       struct packet *result;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
-       if (ret != 4) {
-               ErrPrint("Invalid parameter\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               ret = forward_pd_key_packet(pkg, inst, packet_command(packet), timestamp, keycode);
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_pd_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_keycode(script, keycode);
-               ret = script_handler_feed_event(script, LB_SCRIPT_KEY_DOWN, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_key_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_pause_request(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       double timestamp;
-       int ret;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is paused - manually reported\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "d", &timestamp);
-       if (ret != 1) {
-               ErrPrint("Invalid parameter\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       if (USE_XMONITOR) {
-               DbgPrint("XMONITOR enabled. ignore client paused request\n");
-       } else {
-               xmonitor_pause(client);
-       }
-
-out:
-       return NULL;
-}
-
-static struct packet *client_resume_request(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       double timestamp;
-       int ret;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               goto out;
-       }
-
-       ret = packet_get(packet, "d", &timestamp);
-       if (ret != 1) {
-               ErrPrint("Invalid parameter\n");
-               goto out;
-       }
-
-       if (USE_XMONITOR) {
-               DbgPrint("XMONITOR enabled. ignore client resumed request\n");
-       } else {
-               xmonitor_resume(client);
-       }
-
-out:
-       return NULL;
-}
-
-static struct packet *client_pd_key_up(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       unsigned int keycode;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-       struct packet *result;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
-       if (ret != 4) {
-               ErrPrint("Invalid parameter\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               ret = forward_pd_key_packet(pkg, inst, packet_command(packet), timestamp, keycode);
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_pd_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_keycode(script, keycode);
-               ret = script_handler_feed_event(script, LB_SCRIPT_KEY_UP, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_key_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_lb_access_hl(pid_t pid, int handle, const struct packet *packet)
-{
-       struct packet *result;
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst = NULL;
-       const struct pkg_info *pkg = NULL;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = forward_lb_access_packet(pkg, inst, packet_command(packet), timestamp, x, y);
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_lb_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, -1);
-               ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_HIGHLIGHT, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_lb_access_hl_prev(pid_t pid, int handle, const struct packet *packet)
-{
-       struct packet *result;
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = forward_lb_access_packet(pkg, inst, packet_command(packet), timestamp, x, y);
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_lb_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, -1);
-               ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_HIGHLIGHT_PREV, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_lb_access_hl_next(pid_t pid, int handle, const struct packet *packet)
-{
-       struct packet *result;
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst = NULL;
-       const struct pkg_info *pkg = NULL;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = forward_lb_access_packet(pkg, inst, packet_command(packet), timestamp, x, y);
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_lb_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, -1);
-               ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_HIGHLIGHT_NEXT, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_lb_access_action_up(pid_t pid, int handle, const struct packet *packet)
-{
-       struct packet *result;
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       struct inst_info *inst = NULL;
-       const struct pkg_info *pkg = NULL;
-       int x;
-       int y;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exist\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = forward_lb_access_packet(pkg, inst, packet_command(packet), timestamp, x, y);
-               /*!
-                * Enen if it fails to send packet,
-                * The packet will be unref'd
-                * So we don't need to check the ret value.
-                */
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_lb_script(inst);
-               if (!script) {
-                       ErrPrint("Instance has no script\n");
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, 0);
-               ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_ACTION, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_lb_access_action_down(pid_t pid, int handle, const struct packet *packet)
-{
-       struct packet *result;
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-       int x;
-       int y;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exist\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = forward_lb_access_packet(pkg, inst, packet_command(packet), timestamp, x, y);
-               /*!
-                * Enen if it fails to send packet,
-                * The packet will be unref'd
-                * So we don't need to check the ret value.
-                */
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_lb_script(inst);
-               if (!script) {
-                       ErrPrint("Instance has no script\n");
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, 1);
-               ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_ACTION, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_lb_access_unhighlight(pid_t pid, int handle, const struct packet *packet)
-{
-       struct packet *result;
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst = NULL;
-       const struct pkg_info *pkg = NULL;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = forward_lb_access_packet(pkg, inst, packet_command(packet), timestamp, x, y);
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_lb_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, -1);
-               ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_UNHIGHLIGHT, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_lb_access_scroll_down(pid_t pid, int handle, const struct packet *packet)
-{
-       struct packet *result;
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       struct inst_info *inst = NULL;
-       const struct pkg_info *pkg = NULL;
-       int x;
-       int y;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exist\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = forward_lb_access_packet(pkg, inst, packet_command(packet), timestamp, x, y);
-               /*!
-                * Enen if it fails to send packet,
-                * The packet will be unref'd
-                * So we don't need to check the ret value.
-                */
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_lb_script(inst);
-               if (!script) {
-                       ErrPrint("Instance has no script\n");
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, 1);
-               ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_SCROLL, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_lb_access_scroll_move(pid_t pid, int handle, const struct packet *packet)
-{
-       struct packet *result;
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       struct inst_info *inst = NULL;
-       const struct pkg_info *pkg = NULL;
-       int x;
-       int y;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exist\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = forward_lb_access_packet(pkg, inst, packet_command(packet), timestamp, x, y);
-               /*!
-                * Enen if it fails to send packet,
-                * The packet will be unref'd
-                * So we don't need to check the ret value.
-                */
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_lb_script(inst);
-               if (!script) {
-                       ErrPrint("Instance has no script\n");
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, -1);
-               ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_SCROLL, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_lb_access_scroll_up(pid_t pid, int handle, const struct packet *packet)
-{
-       struct packet *result;
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-       int x;
-       int y;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exist\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = forward_lb_access_packet(pkg, inst, packet_command(packet), timestamp, x, y);
-               /*!
-                * Enen if it fails to send packet,
-                * The packet will be unref'd
-                * So we don't need to check the ret value.
-                */
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_lb_script(inst);
-               if (!script) {
-                       ErrPrint("Instance has no script\n");
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, 0);
-               ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_SCROLL, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_lb_access_activate(pid_t pid, int handle, const struct packet *packet)
-{
-       struct packet *result;
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       int x;
-       int y;
-       struct inst_info *inst = NULL;
-       const struct pkg_info *pkg = NULL;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
-       if (ret != 5) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = forward_lb_access_packet(pkg, inst, packet_command(packet), timestamp, x, y);
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_lb_script(inst);
-               if (!script) {
-                       ErrPrint("Instance has no script\n");
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_pointer(script, x, y, -1);
-               ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_ACTIVATE, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_access_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_lb_key_down(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       unsigned int keycode;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-       struct packet *result;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
-       if (ret != 4) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = forward_lb_key_packet(pkg, inst, packet_command(packet), timestamp, keycode);
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_lb_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_keycode(script, keycode);
-               ret = script_handler_feed_event(script, LB_SCRIPT_KEY_DOWN, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_key_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_lb_key_focus_in(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       unsigned int keycode;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-       struct packet *result;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
-       if (ret != 4) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = forward_lb_key_packet(pkg, inst, packet_command(packet), timestamp, keycode);
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_lb_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_keycode(script, keycode);
-               ret = script_handler_feed_event(script, LB_SCRIPT_KEY_FOCUS_IN, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_key_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_lb_key_focus_out(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       unsigned int keycode;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-       struct packet *result;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
-       if (ret != 4) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = forward_lb_key_packet(pkg, inst, packet_command(packet), timestamp, keycode);
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_lb_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_keycode(script, keycode);
-               ret = script_handler_feed_event(script, LB_SCRIPT_KEY_FOCUS_OUT, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_key_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static struct packet *client_lb_key_up(pid_t pid, int handle, const struct packet *packet)
-{
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       double timestamp;
-       unsigned int keycode;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-       struct packet *result;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
-       if (ret != 4) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = forward_lb_key_packet(pkg, inst, packet_command(packet), timestamp, keycode);
-       } else if (package_lb_type(pkg) == LB_TYPE_SCRIPT) {
-               struct script_info *script;
-
-               script = instance_lb_script(inst);
-               if (!script) {
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-
-               script_handler_update_keycode(script, keycode);
-               ret = script_handler_feed_event(script, LB_SCRIPT_KEY_UP, timestamp);
-               if (ret >= 0) {
-                       struct event_cbdata *cbdata;
-
-                       cbdata = malloc(sizeof(*cbdata));
-                       if (!cbdata) {
-                               ret = LB_STATUS_ERROR_MEMORY;
-                       } else {
-                               cbdata->inst = instance_ref(inst);
-                               cbdata->status = ret;
-
-                               if (!ecore_timer_add(DELAY_TIME, lazy_key_status_cb, cbdata)) {
-                                       (void)instance_unref(cbdata->inst);
-                                       DbgFree(cbdata);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       ret = LB_STATUS_SUCCESS;
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Unsupported package\n");
-               ret = LB_STATUS_ERROR_INVALID;
-       }
-
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
-
-       return result;
-}
-
-static int release_pixmap_cb(struct client_node *client, void *canvas)
-{
-       DbgPrint("Forcely unref the \"buffer\"\n");
-       buffer_handler_pixmap_unref(canvas);
-       return -1; /* Delete this callback */
-}
-
-static struct packet *client_lb_acquire_pixmap(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
-{
-       struct packet *result;
-       const char *pkgname;
-       const char *id;
-       struct client_node *client;
-       struct inst_info *inst;
-       int ret;
-       int pixmap = 0;
-       void *buf_ptr;
-       struct buffer_info *buffer;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
-
-       ret = packet_get(packet, "ss", &pkgname, &id);
-       if (ret != 2) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
+    /*! \note No reply packet */
+    return NULL;
+}
+
+static struct packet *client_dbox_mouse_move(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    int x;
+    int y;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+    if (ret != 5) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = forward_dbox_event_packet(pkg, inst, packet);
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       struct script_info *script;
 
-       ret = validate_request(pkgname, id, &inst, NULL);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
+       script = instance_dbox_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       buffer = instance_lb_buffer(inst);
-       if (!buffer) {
-               struct script_info *script_info;
+       script_handler_update_pointer(script, x, y, -1);
+       script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_MOVE, timestamp);
+       ret = 0;
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-               script_info = instance_lb_script(inst);
-               if (!script_info) {
-                       ErrPrint("Unable to get LB buffer: %s\n", id);
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
+out:
+    /*! \note No reply packet */
+    return NULL;
+}
 
-               buffer = script_handler_buffer_info(script_info);
-               if (!buffer) {
-                       ErrPrint("Unable to get buffer_info: %s\n", id);
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
-       }
+static int inst_del_cb(struct inst_info *inst, void *data)
+{
+    int ret;
+
+    /*
+     * If you deactivate the event thread,
+     * It will calls event callbacks.
+     * And the event callbacks will try to access the "inst"
+     */
+    (void)event_deactivate(data, inst);
+
+    /* Reset callback data to prevent accessing inst from event callback */
+    ret = event_reset_cbdata(data, inst, NULL);
+    DbgPrint("Instance delete callback called: %s (%d)\n", instance_id(inst), ret);
+
+    if (DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF != DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_ON) {
+       (void)slave_set_priority(package_slave(instance_package(inst)), DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF);
+    }
+
+    return -1; /* Delete this callback */
+}
+
+
+static struct packet *client_gbar_key_set(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    unsigned int keycode;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+    struct packet *result;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
+    if (ret != 4) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = event_activate(0, 0, key_event_gbar_route_cb, inst);
+       if (ret == DBOX_STATUS_ERROR_NONE) {
+           if (DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF != DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_ON) {
+               (void)slave_set_priority(package_slave(pkg), DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_ON);
+           }
+           if (instance_event_callback_is_added(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, key_event_gbar_route_cb) <= 0) {
+               instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, key_event_gbar_route_cb);
+           }
+       }
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       ret = event_activate(0, 0, key_event_gbar_consume_cb, inst);
+       if (ret == DBOX_STATUS_ERROR_NONE) {
+           if (DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF != DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_ON) {
+               (void)slave_set_priority(package_slave(pkg), DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_ON);
+           }
+           if (instance_event_callback_is_added(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, key_event_gbar_consume_cb) <= 0) {
+               instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, key_event_gbar_consume_cb);
+           }
+       }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       buf_ptr = buffer_handler_pixmap_ref(buffer);
-       if (!buf_ptr) {
-               ErrPrint("Failed to ref pixmap\n");
-               ret = LB_STATUS_ERROR_FAULT;
-               goto out;
-       }
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_gbar_key_unset(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    unsigned int keycode;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+    struct packet *result;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
+    if (ret != 4) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = event_deactivate(key_event_gbar_route_cb, inst);
+       if (DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF != DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_ON) {
+           (void)slave_set_priority(package_slave(pkg), DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF);
+       }
+       /*
+        * This delete callback will be removed when the instance will be destroyed.
+        if (ret == 0) {
+        instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, key_event_gbar_route_cb);
+        }
+        */
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       ret = event_deactivate(key_event_gbar_consume_cb, inst);
+       if (DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF != DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_ON) {
+           (void)slave_set_priority(package_slave(pkg), DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF);
+       }
+       /*
+        * This delete callback will be removed when the instance will be destroyed.
+        if (ret == 0) {
+        instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, key_event_gbar_consume_cb);
+        }
+        */
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       ret = client_event_callback_add(client, CLIENT_EVENT_DEACTIVATE, release_pixmap_cb, buf_ptr);
-       if (ret < 0) {
-               ErrPrint("Failed to add a new client deactivate callback\n");
-               buffer_handler_pixmap_unref(buf_ptr);
-       } else {
-               pixmap = buffer_handler_pixmap(buffer);
-               ret = LB_STATUS_SUCCESS;
-       }
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_dbox_key_set(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    unsigned int keycode;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+    struct packet *result;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
+    if (ret != 4) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = event_activate(0, 0, key_event_dbox_route_cb, inst);
+       if (ret == DBOX_STATUS_ERROR_NONE) {
+           if (DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF != DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_ON) {
+               (void)slave_set_priority(package_slave(pkg), DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_ON);
+           }
+           if (instance_event_callback_is_added(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, key_event_dbox_route_cb) <= 0) {
+               instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, key_event_dbox_route_cb);
+           }
+       }
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       ret = event_activate(0, 0, key_event_dbox_consume_cb, inst);
+       if (ret == DBOX_STATUS_ERROR_NONE) {
+           if (DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF != DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_ON) {
+               (void)slave_set_priority(package_slave(pkg), DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_ON);
+           }
+           if (instance_event_callback_is_added(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, key_event_dbox_consume_cb) <= 0) {
+               instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, key_event_dbox_consume_cb);
+           }
+       }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
 out:
-       result = packet_create_reply(packet, "ii", pixmap, ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
-       }
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_dbox_key_unset(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    unsigned int keycode;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+    struct packet *result;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
+    if (ret != 4) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = event_deactivate(key_event_dbox_route_cb, inst);
+       if (DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF != DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_ON) {
+           (void)slave_set_priority(package_slave(pkg), DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF);
+       }
+       /*
+        * This delete callback will be removed when the instance will be destroyed.
+        if (ret == 0) {
+        instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, key_event_dbox_route_cb);
+        }
+        */
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       ret = event_deactivate(key_event_dbox_consume_cb, inst);
+       if (DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF != DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_ON) {
+           (void)slave_set_priority(package_slave(pkg), DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF);
+       }
+       /*
+        * This delete callback will be removed when the instance will be destroyed.
+        if (ret == 0) {
+        instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, key_event_dbox_consume_cb);
+        }
+        */
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       return result;
-}
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_dbox_mouse_set(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    int x;
+    int y;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+    if (ret != 5) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = event_activate(x, y, mouse_event_dbox_route_cb, inst);
+       if (ret == DBOX_STATUS_ERROR_NONE) {
+           if (DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF != DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_ON) {
+               (void)slave_set_priority(package_slave(pkg), DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_ON);
+           }
+           if (instance_event_callback_is_added(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_dbox_route_cb) <= 0) {
+               instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_dbox_route_cb);
+           }
+       }
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       ret = event_activate(x, y, mouse_event_dbox_consume_cb, inst);
+       if (ret == DBOX_STATUS_ERROR_NONE) {
+           if (DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF != DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_ON) {
+               (void)slave_set_priority(package_slave(pkg), DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_ON);
+           }
+           if (instance_event_callback_is_added(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_dbox_consume_cb) <= 0) {
+               instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_dbox_consume_cb);
+           }
+       }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+out:
+    return NULL;
+}
+
+static struct packet *client_dbox_mouse_unset(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    int x;
+    int y;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+    if (ret != 5) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = event_deactivate(mouse_event_dbox_route_cb, inst);
+       if (DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF != DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_ON) {
+           (void)slave_set_priority(package_slave(pkg), DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF);
+       }
+       /*
+        * This delete callback will be removed when the instance will be destroyed.
+        if (ret == 0) {
+        instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_dbox_route_cb);
+        }
+        */
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       ret = event_deactivate(mouse_event_dbox_consume_cb, inst);
+       if (DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF != DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_ON) {
+           (void)slave_set_priority(package_slave(pkg), DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF);
+       }
+       /*
+        * This delete callback will be removed when the instance will be destroyed.
+        if (ret == 0) {
+        instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_dbox_consume_cb);
+        }
+        */
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+out:
+    return NULL;
+}
+
+static struct packet *client_gbar_mouse_set(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    int x;
+    int y;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+    if (ret != 5) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       ret = event_activate(x, y, mouse_event_gbar_route_cb, inst);
+       if (ret == DBOX_STATUS_ERROR_NONE) {
+           if (DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF != DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_ON) {
+               (void)slave_set_priority(package_slave(pkg), DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_ON);
+           }
+           if (instance_event_callback_is_added(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_gbar_route_cb) <= 0) {
+               instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_gbar_route_cb);
+           }
+       }
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       ret = event_activate(x, y, mouse_event_gbar_consume_cb, inst);
+       if (ret == DBOX_STATUS_ERROR_NONE) {
+           if (DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF != DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_ON) {
+               (void)slave_set_priority(package_slave(pkg), DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_ON);
+           }
+           if (instance_event_callback_is_added(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_gbar_consume_cb) <= 0) {
+               instance_event_callback_add(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_gbar_consume_cb);
+           }
+       }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-static struct packet *client_lb_release_pixmap(pid_t pid, int handle, const struct packet *packet)
-{
-       const char *pkgname;
-       const char *id;
-       struct client_node *client;
-       int pixmap;
-       void *buf_ptr;
-       int ret;
+out:
+    return NULL;
+}
+
+static struct packet *client_dbox_mouse_on_scroll(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    int x;
+    int y;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+    if (ret != 5) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = forward_dbox_event_packet(pkg, inst, packet);
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       struct script_info *script;
 
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               goto out;
+       script = instance_dbox_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       ret = packet_get(packet, "ssi", &pkgname, &id, &pixmap);
-       if (ret != 3) {
-               ErrPrint("Parameter is not matched\n");
-               goto out;
-       }
+       script_handler_update_pointer(script, x, y, -1);
+       script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_ON_SCROLL, timestamp);
+       ret = 0;
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       ret = validate_request(pkgname, id, NULL, NULL);
-       if (ret != LB_STATUS_SUCCESS) {
-               DbgPrint("It seems that the instance is already deleted: %s\n", id);
-       }
+out:
+    /*! \note No reply packet */
+    return NULL;
+}
+
+static struct packet *client_dbox_mouse_off_scroll(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    int x;
+    int y;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+    if (ret != 5) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = forward_dbox_event_packet(pkg, inst, packet);
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       struct script_info *script;
 
-       buf_ptr = buffer_handler_pixmap_find(pixmap);
-       if (!buf_ptr) {
-               ErrPrint("Failed to find a buf_ptr of 0x%X\n", pixmap);
-               goto out;
+       script = instance_dbox_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       if (client_event_callback_del(client, CLIENT_EVENT_DEACTIVATE, release_pixmap_cb, buf_ptr) == 0) {
-               buffer_handler_pixmap_unref(buf_ptr);
-       }
+       script_handler_update_pointer(script, x, y, -1);
+       script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_OFF_SCROLL, timestamp);
+       ret = 0;
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
 out:
-       /*! \note No reply packet */
-       return NULL;
-}
+    /*! \note No reply packet */
+    return NULL;
+}
+
+static struct packet *client_dbox_mouse_on_hold(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    int x;
+    int y;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+    if (ret != 5) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = forward_dbox_event_packet(pkg, inst, packet);
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       struct script_info *script;
 
-static struct packet *client_pd_acquire_pixmap(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
-{
-       struct packet *result;
-       const char *pkgname;
-       const char *id;
-       struct client_node *client;
-       struct inst_info *inst;
-       int ret;
-       int pixmap = 0;
-       void *buf_ptr;
-       struct buffer_info *buffer;
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ret = LB_STATUS_ERROR_INVALID;
-               ErrPrint("Client %d is not exists\n", pid);
-               goto out;
+       script = instance_dbox_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       ret = packet_get(packet, "ss", &pkgname, &id);
-       if (ret != 2) {
-               ret = LB_STATUS_ERROR_INVALID;
-               ErrPrint("Parameter is not matched\n");
-               goto out;
-       }
+       script_handler_update_pointer(script, x, y, -1);
+       script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_ON_HOLD, timestamp);
+       ret = 0;
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       ret = validate_request(pkgname, id, &inst, NULL);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
+out:
+    /*! \note No reply packet */
+    return NULL;
+}
+
+static struct packet *client_dbox_mouse_off_hold(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    int x;
+    int y;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+    if (ret != 5) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = forward_dbox_event_packet(pkg, inst, packet);
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       struct script_info *script;
 
-       if (instance_get_data(inst, PD_RESIZE_MONITOR_TAG)) {
-               ret = LB_STATUS_ERROR_BUSY;
-               goto out;
+       script = instance_dbox_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       buffer = instance_pd_buffer(inst);
-       if (!buffer) {
-               struct script_info *script_info;
+       script_handler_update_pointer(script, x, y, -1);
+       script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_OFF_HOLD, timestamp);
+       ret = 0;
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-               script_info = instance_pd_script(inst);
-               if (!script_info) {
-                       ErrPrint("Unable to get LB buffer: %s\n", id);
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
+out:
+    /*! \note No reply packet */
+    return NULL;
+}
+
+static struct packet *client_gbar_mouse_on_scroll(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    int x;
+    int y;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+    if (ret != 5) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       ret = forward_gbar_event_packet(pkg, inst, packet);
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       struct script_info *script;
 
-               buffer = script_handler_buffer_info(script_info);
-               if (!buffer) {
-                       ErrPrint("Unable to get buffer_info: %s\n", id);
-                       ret = LB_STATUS_ERROR_FAULT;
-                       goto out;
-               }
+       script = instance_gbar_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       buf_ptr = buffer_handler_pixmap_ref(buffer);
-       if (!buf_ptr) {
-               ErrPrint("Failed to ref pixmap\n");
-               ret = LB_STATUS_ERROR_FAULT;
-               goto out;
-       }
+       script_handler_update_pointer(script, x, y, -1);
+       script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_ON_SCROLL, timestamp);
+       ret = 0;
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       ret = client_event_callback_add(client, CLIENT_EVENT_DEACTIVATE, release_pixmap_cb, buf_ptr);
-       if (ret < 0) {
-               ErrPrint("Failed to add a new client deactivate callback\n");
-               buffer_handler_pixmap_unref(buf_ptr);
-       } else {
-               pixmap = buffer_handler_pixmap(buffer);
-               ret = LB_STATUS_SUCCESS;
+out:
+    /*! \note No reply packet */
+    return NULL;
+}
+
+static struct packet *client_gbar_mouse_off_scroll(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    int x;
+    int y;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+    if (ret != 5) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       ret = forward_gbar_event_packet(pkg, inst, packet);
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       struct script_info *script;
+
+       script = instance_gbar_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
+       script_handler_update_pointer(script, x, y, -1);
+       script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_OFF_SCROLL, timestamp);
+       ret = 0;
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
 out:
-       result = packet_create_reply(packet, "ii", pixmap, ret);
-       if (!result) {
-               ErrPrint("Failed to create a reply packet\n");
+    /*! \note No reply packet */
+    return NULL;
+}
+
+static struct packet *client_gbar_mouse_on_hold(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    int x;
+    int y;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+    if (ret != 5) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       ret = forward_gbar_event_packet(pkg, inst, packet);
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       struct script_info *script;
+
+       script = instance_gbar_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       return result;
-}
+       script_handler_update_pointer(script, x, y, -1);
+       script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_ON_HOLD, timestamp);
+       ret = 0;
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-static struct packet *client_pd_release_pixmap(pid_t pid, int handle, const struct packet *packet)
-{
-       const char *pkgname;
-       const char *id;
-       struct client_node *client;
-       int pixmap;
-       void *buf_ptr;
-       int ret;
+out:
+    /*! \note No reply packet */
+    return NULL;
+}
+
+static struct packet *client_gbar_mouse_off_hold(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    int x;
+    int y;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+    if (ret != 5) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       ret = forward_gbar_event_packet(pkg, inst, packet);
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       struct script_info *script;
 
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               goto out;
+       script = instance_gbar_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       ret = packet_get(packet, "ssi", &pkgname, &id, &pixmap);
-       if (ret != 3) {
-               ErrPrint("Parameter is not matched\n");
-               goto out;
-       }
+       script_handler_update_pointer(script, x, y, -1);
+       script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_OFF_HOLD, timestamp);
+       ret = 0;
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       ret = validate_request(pkgname, id, NULL, NULL);
-       if (ret != LB_STATUS_SUCCESS) {
-               DbgPrint("It seems that the instance is already deleted: %s\n", id);
-       }
+out:
+    /*! \note No reply packet */
+    return NULL;
+}
+
+static struct packet *client_gbar_mouse_unset(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    int x;
+    int y;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+    if (ret != 5) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       ret = event_deactivate(mouse_event_gbar_route_cb, inst);
+       if (DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF != DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_ON) {
+           (void)slave_set_priority(package_slave(pkg), DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF);
+       }
+       /*
+        * This delete callback will be removed when the instance will be destroyed.
+        if (ret == 0) {
+        instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_gbar_route_cb);
+        }
+        */
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       ret = event_deactivate(mouse_event_gbar_consume_cb, inst);
+       if (DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF != DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_ON) {
+           (void)slave_set_priority(package_slave(pkg), DYNAMICBOX_CONF_SLAVE_EVENT_BOOST_OFF);
+       }
+       /*
+        * This delete callback will be removed when the instance will be destroyed.
+        if (ret == 0) {
+        instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_gbar_consume_cb);
+        }
+        */
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+out:
+    return NULL;
+}
+
+static struct packet *client_dbox_mouse_enter(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    int x;
+    int y;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+    if (ret != 5) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = forward_dbox_event_packet(pkg, inst, packet);
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       struct script_info *script;
 
-       buf_ptr = buffer_handler_pixmap_find(pixmap);
-       if (!buf_ptr) {
-               ErrPrint("Failed to find a buf_ptr of 0x%X\n", pixmap);
-               goto out;
+       script = instance_dbox_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       if (client_event_callback_del(client, CLIENT_EVENT_DEACTIVATE, release_pixmap_cb, buf_ptr) == 0) {
-               buffer_handler_pixmap_unref(buf_ptr);
-       }
+       script_handler_update_pointer(script, x, y, -1);
+       script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_IN, timestamp);
+       ret = 0;
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
 out:
-       /*! \note No reply packet */
-       return NULL;
-}
-
-static struct packet *client_pinup_changed(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, pinup, ret */
-{
-       struct client_node *client;
-       struct packet *result;
-       const char *pkgname;
-       const char *id;
-       int pinup;
-       int ret;
-       struct inst_info *inst;
+    /*! \note No reply packet */
+    return NULL;
+}
+
+static struct packet *client_dbox_mouse_leave(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    int x;
+    int y;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+    if (ret != 5) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = forward_dbox_event_packet(pkg, inst, packet);
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       struct script_info *script;
 
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               pinup = 0;
-               goto out;
+       script = instance_dbox_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       ret = packet_get(packet, "ssi", &pkgname, &id, &pinup);
-       if (ret != 3) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               pinup = 0;
-               goto out;
-       }
+       script_handler_update_pointer(script, x, y, -1);
+       script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_OUT, timestamp);
+       ret = 0;
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+out:
+    /*! \note No reply packet */
+    return NULL;
+}
+
+static struct packet *client_dbox_mouse_down(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    int x;
+    int y;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+    if (ret != 5) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = forward_dbox_event_packet(pkg, inst, packet);
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       struct script_info *script;
 
-       ret = validate_request(pkgname, id, &inst, NULL);
-       if (ret == (int)LB_STATUS_SUCCESS) {
-               ret = instance_set_pinup(inst, pinup);
+       script = instance_dbox_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
+       script_handler_update_pointer(script, x, y, 1);
+       script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_DOWN, timestamp);
+       ret = 0;
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
 out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a packet\n");
+    /*! \note No reply packet */
+    return NULL;
+}
+
+static struct packet *client_dbox_mouse_up(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    int x;
+    int y;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
+    if (ret != 5) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = forward_dbox_event_packet(pkg, inst, packet);
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       struct script_info *script;
+
+       script = instance_dbox_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       return result;
-}
+       script_handler_update_pointer(script, x, y, 0);
+       script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_UP, timestamp);
+       ret = 0;
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-static Eina_Bool lazy_pd_created_cb(void *inst)
-{
-       struct pkg_info *pkg;
+out:
+    /*! \note No reply packet */
+    return NULL;
+}
+
+static struct packet *client_gbar_access_action(pid_t pid, int handle, const struct packet *packet)
+{
+    struct packet *result;
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    struct access_info event;
+    struct inst_info *inst = NULL;
+    const struct pkg_info *pkg = NULL;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+    if (ret != 6) {
+       ErrPrint("Invalid parameter\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       ret = forward_gbar_access_packet(pkg, inst, packet_command(packet), timestamp, &event);
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       struct script_info *script;
 
-       if (!instance_del_data(inst, LAZY_PD_OPEN_TAG)) {
-               ErrPrint("lazy,pd,open is already deleted.\n");
-               return ECORE_CALLBACK_CANCEL;
+       script = instance_gbar_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       pkg = instance_package(inst);
-       if (pkg) {
-               struct slave_node *slave;
+       script_handler_update_pointer(script, event.x, event.y, event.type);
+       ret = script_handler_feed_event(script, DBOX_SCRIPT_ACCESS_ACTION, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_access_status(inst, ret);
+       }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-               slave = package_slave(pkg);
-               if (slave) {
-                       slave_event_callback_del(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_open_script_cb, inst);
-               }
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_gbar_access_scroll(pid_t pid, int handle, const struct packet *packet)
+{
+    struct packet *result;
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    struct access_info event;
+    struct inst_info *inst = NULL;
+    const struct pkg_info *pkg = NULL;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+    if (ret != 6) {
+       ErrPrint("Invalid parameter\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       ret = forward_gbar_access_packet(pkg, inst, packet_command(packet), timestamp, &event);
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       struct script_info *script;
+
+       script = instance_gbar_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       /*!
-        * After unref instance first,
-        * if the instance is not destroyed, try to notify the created PD event to the client.
-        */
-       if (instance_unref(inst)) {
-               int ret;
-               ret = instance_client_pd_created(inst, LB_STATUS_SUCCESS);
-               if (ret < 0) {
-                       DbgPrint("Send PD Create event (%d) to client\n", ret);
-               }
+       script_handler_update_pointer(script, event.x, event.y, event.type);
+       ret = script_handler_feed_event(script, DBOX_SCRIPT_ACCESS_SCROLL, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_access_status(inst, ret);
        }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       return ECORE_CALLBACK_CANCEL;
-}
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_gbar_access_value_change(pid_t pid, int handle, const struct packet *packet)
+{
+    struct packet *result;
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    struct access_info event;
+    struct inst_info *inst = NULL;
+    const struct pkg_info *pkg = NULL;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+    if (ret != 6) {
+       ErrPrint("Invalid parameter\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       ret = forward_gbar_access_packet(pkg, inst, packet_command(packet), timestamp, &event);
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       struct script_info *script;
 
-static Eina_Bool lazy_pd_destroyed_cb(void *inst)
-{
-       struct pkg_info *pkg;
-       struct slave_node *slave;
+       script = instance_gbar_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
+       }
 
-       if (!instance_del_data(inst, LAZY_PD_CLOSE_TAG)) {
-               ErrPrint("lazy,pd,close is already deleted.\n");
-               return ECORE_CALLBACK_CANCEL;
+       script_handler_update_pointer(script, event.x, event.y, event.type);
+       ret = script_handler_feed_event(script, DBOX_SCRIPT_ACCESS_VALUE_CHANGE, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_access_status(inst, ret);
        }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       pkg = instance_package(inst);
-       if (pkg) {
-               slave = package_slave(pkg);
-               if (slave) {
-                       if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-                               DbgPrint("Delete script type close callback\n");
-                               (void)slave_event_callback_del(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_close_script_cb, inst);
-                       } else if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-                               DbgPrint("Delete buffer type close callback\n");
-                               (void)slave_event_callback_del(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_close_buffer_cb, inst);
-                       }
-               }
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_gbar_access_mouse(pid_t pid, int handle, const struct packet *packet)
+{
+    struct packet *result;
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    struct access_info event;
+    struct inst_info *inst = NULL;
+    const struct pkg_info *pkg = NULL;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+    if (ret != 6) {
+       ErrPrint("Invalid parameter\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       ret = forward_gbar_access_packet(pkg, inst, packet_command(packet), timestamp, &event);
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       struct script_info *script;
+
+       script = instance_gbar_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       if (instance_unref(inst)) {
-               int ret;
-               
-               /*!
-                * If the instance is not deleted, we should send pd-destroy event from here.
-                */
-               ret = instance_client_pd_destroyed(inst, LB_STATUS_SUCCESS);
-               if (ret < 0) {
-                       ErrPrint("Failed sending PD Destroy event (%d)\n", ret);
-               }
+       script_handler_update_pointer(script, event.x, event.y, event.type);
+       ret = script_handler_feed_event(script, DBOX_SCRIPT_ACCESS_MOUSE, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_access_status(inst, ret);
        }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       return ECORE_CALLBACK_CANCEL;
-}
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_gbar_access_back(pid_t pid, int handle, const struct packet *packet)
+{
+    struct packet *result;
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    struct access_info event;
+    struct inst_info *inst = NULL;
+    const struct pkg_info *pkg = NULL;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+    if (ret != 6) {
+       ErrPrint("Invalid parameter\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       ret = forward_gbar_access_packet(pkg, inst, packet_command(packet), timestamp, &event);
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       struct script_info *script;
 
-static struct packet *client_pd_move(pid_t pid, int handle, const struct packet *packet) /* pkgname, id, x, y */
-{
-       struct client_node *client;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-       const char *pkgname;
-       const char *id;
-       double x = 0.0f;
-       double y = 0.0f;
-       int ret;
+       script = instance_gbar_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
+       }
 
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
+       script_handler_update_pointer(script, event.x, event.y, event.type);
+       ret = script_handler_feed_event(script, DBOX_SCRIPT_ACCESS_BACK, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_access_status(inst, ret);
        }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       ret = packet_get(packet, "ssdd", &pkgname, &id, &x, &y);
-       if (ret != 4) {
-               ErrPrint("Parameter is not correct\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_gbar_access_over(pid_t pid, int handle, const struct packet *packet)
+{
+    struct packet *result;
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    struct access_info event;
+    struct inst_info *inst = NULL;
+    const struct pkg_info *pkg = NULL;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+    if (ret != 6) {
+       ErrPrint("Invalid parameter\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       ret = forward_gbar_access_packet(pkg, inst, packet_command(packet), timestamp, &event);
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       struct script_info *script;
+
+       script = instance_gbar_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
+       script_handler_update_pointer(script, event.x, event.y, event.type);
+       ret = script_handler_feed_event(script, DBOX_SCRIPT_ACCESS_OVER, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_access_status(inst, ret);
        }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               instance_slave_set_pd_pos(inst, x, y);
-               ret = instance_signal_emit(inst, "pd,move", instance_id(inst), 0.0, 0.0, 0.0, 0.0, x, y, 0);
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               int ix;
-               int iy;
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_gbar_access_read(pid_t pid, int handle, const struct packet *packet)
+{
+    struct packet *result;
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    struct access_info event;
+    struct inst_info *inst = NULL;
+    const struct pkg_info *pkg = NULL;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+    if (ret != 6) {
+       ErrPrint("Invalid parameter\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       ret = forward_gbar_access_packet(pkg, inst, packet_command(packet), timestamp, &event);
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       struct script_info *script;
 
-               instance_slave_set_pd_pos(inst, x, y);
-               ix = x * instance_pd_width(inst);
-               iy = y * instance_pd_height(inst);
-               script_handler_update_pointer(instance_pd_script(inst), ix, iy, 0);
-               ret = instance_signal_emit(inst, "pd,move", instance_id(inst), 0.0, 0.0, 0.0, 0.0, x, y, 0);
-       } else {
-               ErrPrint("Invalid PD type\n");
-               ret = LB_STATUS_ERROR_INVALID;
+       script = instance_gbar_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
-out:
-       DbgPrint("Update PD position: %d\n", ret);
-       return NULL;
-}
 
-static Eina_Bool pd_open_monitor_cb(void *inst)
-{
-       struct pkg_info *pkg;
+       script_handler_update_pointer(script, event.x, event.y, event.type);
+       ret = script_handler_feed_event(script, DBOX_SCRIPT_ACCESS_READ, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_access_status(inst, ret);
+       }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       pkg = instance_package(inst);
-       if (pkg) {
-               struct slave_node *slave;
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_gbar_access_enable(pid_t pid, int handle, const struct packet *packet)
+{
+    struct packet *result;
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    struct access_info event;
+    struct inst_info *inst = NULL;
+    const struct pkg_info *pkg = NULL;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+    if (ret != 6) {
+       ErrPrint("Invalid parameter\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       ret = forward_gbar_access_packet(pkg, inst, packet_command(packet), timestamp, &event);
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       struct script_info *script;
+       int type;
 
-               slave = package_slave(pkg);
-               if (slave) {
-                       slave_event_callback_del(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_open_buffer_cb, inst);
-               }
+       script = instance_gbar_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       (void)instance_slave_close_pd(inst, instance_pd_owner(inst), LB_CLOSE_PD_TIMEOUT);
-       (void)instance_client_pd_created(inst, LB_STATUS_ERROR_TIMEOUT);
-       (void)instance_del_data(inst, PD_OPEN_MONITOR_TAG);
-       (void)instance_unref(inst);
-       ErrPrint("PD Open request is timed-out (%lf)\n", PD_REQUEST_TIMEOUT);
-       return ECORE_CALLBACK_CANCEL;
-}
+       type = (event.type == 0) ? DBOX_SCRIPT_ACCESS_DISABLE : DBOX_SCRIPT_ACCESS_ENABLE;
 
-static Eina_Bool pd_close_monitor_cb(void *inst)
-{
-       struct pkg_info *pkg;
+       script_handler_update_pointer(script, event.x, event.y, event.type);
+       ret = script_handler_feed_event(script, type, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_access_status(inst, ret);
+       }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       pkg = instance_package(inst);
-       if (pkg) {
-               struct slave_node *slave;
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_gbar_access_hl(pid_t pid, int handle, const struct packet *packet)
+{
+    struct packet *result;
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    struct access_info event;
+    struct inst_info *inst = NULL;
+    const struct pkg_info *pkg = NULL;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+    if (ret != 6) {
+       ErrPrint("Invalid parameter\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       ret = forward_gbar_access_packet(pkg, inst, packet_command(packet), timestamp, &event);
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       struct script_info *script;
+       int type;
 
-               slave = package_slave(pkg);
-               if (slave) {
-                       slave_event_callback_del(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_close_buffer_cb, inst);
-               }
+       script = instance_gbar_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
+       }
+
+       switch (event.type) {
+       case ACCESS_TYPE_CUR:
+           type = DBOX_SCRIPT_ACCESS_HIGHLIGHT;
+           break;
+       case ACCESS_TYPE_NEXT:
+           type = DBOX_SCRIPT_ACCESS_HIGHLIGHT_NEXT;
+           break;
+       case ACCESS_TYPE_PREV:
+           type = DBOX_SCRIPT_ACCESS_HIGHLIGHT_PREV;
+           break;
+       case ACCESS_TYPE_OFF:
+           type = DBOX_SCRIPT_ACCESS_UNHIGHLIGHT;
+           break;
+       default:
+           ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+           goto out;
        }
 
-       (void)instance_client_pd_destroyed(inst, LB_STATUS_ERROR_TIMEOUT);
-       (void)instance_del_data(inst, PD_CLOSE_MONITOR_TAG);
-       (void)instance_unref(inst);
-       ErrPrint("PD Close request is not processed in %lf seconds\n", PD_REQUEST_TIMEOUT);
-       return ECORE_CALLBACK_CANCEL;
-}
+       script_handler_update_pointer(script, event.x, event.y, event.type);
+       ret = script_handler_feed_event(script, type, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_access_status(inst, ret);
+       }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-static Eina_Bool pd_resize_monitor_cb(void *inst)
-{
-       struct pkg_info *pkg;
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_gbar_access_activate(pid_t pid, int handle, const struct packet *packet)
+{
+    struct packet *result;
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    struct access_info event;
+    struct inst_info *inst = NULL;
+    const struct pkg_info *pkg = NULL;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+    if (ret != 6) {
+       ErrPrint("Invalid parameter\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       ret = forward_gbar_access_packet(pkg, inst, packet_command(packet), timestamp, &event);
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       struct script_info *script;
 
-       pkg = instance_package(inst);
-       if (pkg) {
-               struct slave_node *slave;
-               slave = package_slave(pkg);
-               if (slave) {
-                       slave_event_callback_del(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_resize_buffer_cb, inst);
-               }
+       script = instance_gbar_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       (void)instance_slave_close_pd(inst, instance_pd_owner(inst), LB_CLOSE_PD_TIMEOUT);
-       (void)instance_client_pd_destroyed(inst, LB_STATUS_ERROR_TIMEOUT);
-       (void)instance_del_data(inst, PD_RESIZE_MONITOR_TAG);
-       (void)instance_unref(inst);
-       ErrPrint("PD Resize request is not processed in %lf seconds\n", PD_REQUEST_TIMEOUT);
-       return ECORE_CALLBACK_CANCEL;
-}
-
-static struct packet *client_create_pd(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, ret */
-{
-       struct client_node *client;
-       struct packet *result;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       struct inst_info *inst = NULL;
-       const struct pkg_info *pkg = NULL;
-       Ecore_Timer *pd_monitor;
-       double x;
-       double y;
-
-       DbgPrint("PERF_DBOX\n");
-
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
+       script_handler_update_pointer(script, event.x, event.y, event.type);
+       ret = script_handler_feed_event(script, DBOX_SCRIPT_ACCESS_ACTIVATE, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_access_status(inst, ret);
        }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_gbar_key_focus_in(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    unsigned int keycode;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+    struct packet *result;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
+    if (ret != 4) {
+       ErrPrint("Invalid parameter\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       ret = forward_gbar_key_packet(pkg, inst, packet_command(packet), timestamp, keycode);
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       struct script_info *script;
 
-       ret = packet_get(packet, "ssdd", &pkgname, &id, &x, &y);
-       if (ret != 4) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
+       script = instance_gbar_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
+       script_handler_update_keycode(script, keycode);
+       ret = script_handler_feed_event(script, DBOX_SCRIPT_KEY_FOCUS_IN, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_key_status(inst, ret);
        }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (instance_pd_owner(inst)) {
-               ErrPrint("PD is already owned\n");
-               ret = LB_STATUS_ERROR_ALREADY;
-       } else if (package_pd_type(instance_package(inst)) == PD_TYPE_BUFFER) {
-               pd_monitor = instance_get_data(inst, LAZY_PD_CLOSE_TAG);
-               if (pd_monitor) {
-                       ecore_timer_del(pd_monitor);
-                       /* This timer attribute will be deleted */
-                       lazy_pd_destroyed_cb(inst);
-               }
-               
-               if (instance_get_data(inst, PD_OPEN_MONITOR_TAG)) {
-                       DbgPrint("PD Open request is already processed\n");
-                       ret = LB_STATUS_ERROR_ALREADY;
-                       goto out;
-               }
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_gbar_key_focus_out(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    unsigned int keycode;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+    struct packet *result;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
+    if (ret != 4) {
+       ErrPrint("Invalid parameter\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       ret = forward_gbar_key_packet(pkg, inst, packet_command(packet), timestamp, keycode);
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       struct script_info *script;
 
-               if (instance_get_data(inst, PD_CLOSE_MONITOR_TAG)) {
-                       DbgPrint("PD Close request is already in process\n");
-                       ret = LB_STATUS_ERROR_BUSY;
-                       goto out;
-               }
+       script = instance_gbar_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
+       }
 
-               if (instance_get_data(inst, PD_RESIZE_MONITOR_TAG)) {
-                       DbgPrint("PD resize request is already in process\n");
-                       ret = LB_STATUS_ERROR_BUSY;
-                       goto out;
-               }
+       script_handler_update_keycode(script, keycode);
+       ret = script_handler_feed_event(script, DBOX_SCRIPT_KEY_FOCUS_OUT, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_key_status(inst, ret);
+       }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-               instance_slave_set_pd_pos(inst, x, y);
-               /*!
-                * \note
-                * Send request to the slave.
-                * The SLAVE must has to repsonse this via "release_buffer" method.
-                */
-               ret = instance_slave_open_pd(inst, client);
-               if (ret == (int)LB_STATUS_SUCCESS) {
-                       ret = instance_signal_emit(inst, "pd,show", instance_id(inst), 0.0, 0.0, 0.0, 0.0, x, y, 0);
-                       if (ret != LB_STATUS_SUCCESS) {
-                               int tmp_ret;
-
-                               tmp_ret = instance_slave_close_pd(inst, client, LB_CLOSE_PD_FAULT);
-                               if (tmp_ret < 0) {
-                                       ErrPrint("Unable to send script event for openning PD [%s], %d\n", pkgname, tmp_ret);
-                               }
-                       } else {
-                               pd_monitor = ecore_timer_add(PD_REQUEST_TIMEOUT, pd_open_monitor_cb, instance_ref(inst));
-                               if (!pd_monitor) {
-                                       (void)instance_unref(inst);
-                                       ErrPrint("Failed to create a timer for PD Open monitor\n");
-                               } else {
-                                       struct slave_node *slave;
-
-                                       (void)instance_set_data(inst, PD_OPEN_MONITOR_TAG, pd_monitor);
-
-                                       slave = package_slave(pkg);
-                                       if (!slave) {
-                                               ErrPrint("Failed to get slave(%s)\n", pkgname);
-                                               goto out;
-                                       }
-
-                                       if (slave_event_callback_add(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_open_buffer_cb, inst) != LB_STATUS_SUCCESS) {
-                                               ErrPrint("Failed to add fault handler: %s\n");
-                                       }
-                               }
-                       }
-               } else {
-                       ErrPrint("Unable to send request for openning PD [%s]\n", pkgname);
-               }
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_gbar_key_down(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    unsigned int keycode;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+    struct packet *result;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
+    if (ret != 4) {
+       ErrPrint("Invalid parameter\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       ret = forward_gbar_key_packet(pkg, inst, packet_command(packet), timestamp, keycode);
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       struct script_info *script;
 
-               /*!
-                * \note
-                * PD craeted event will be send by the acquire_buffer function.
-                * Because the slave will make request the acquire_buffer to
-                * render the PD
-                *
-                * instance_client_pd_created(inst);
-                */
-       } else if (package_pd_type(instance_package(inst)) == PD_TYPE_SCRIPT) {
-               int ix;
-               int iy;
-
-               pd_monitor = instance_get_data(inst, LAZY_PD_CLOSE_TAG);
-               if (pd_monitor) {
-                       ecore_timer_del(pd_monitor);
-                       /* lazy,pd,close will be deleted */
-                       lazy_pd_destroyed_cb(inst);
-               }
+       script = instance_gbar_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
+       }
 
-               /*!
-                * \note
-                * ret value should be cared but in this case,
-                * we ignore this for this moment, so we have to handle this error later.
-                *
-                * if ret is less than 0, the slave has some problem.
-                * but the script mode doesn't need slave for rendering default view of PD
-                * so we can hanle it later.
-                */
-               instance_slave_set_pd_pos(inst, x, y);
-               ix = x * instance_pd_width(inst);
-               iy = y * instance_pd_height(inst);
-
-               script_handler_update_pointer(instance_pd_script(inst), ix, iy, 0);
-
-               ret = instance_slave_open_pd(inst, client);
-               if (ret == (int)LB_STATUS_SUCCESS) {
-                       ret = script_handler_load(instance_pd_script(inst), 1);
-
-                       /*!
-                        * \note
-                        * Send the PD created event to the clients,
-                        */
-                       if (ret == (int)LB_STATUS_SUCCESS) {
-
-                               /*!
-                                * \note
-                                * But the created event has to be send afte return
-                                * from this function or the viewer couldn't care
-                                * the event correctly.
-                                */
-                               inst = instance_ref(inst); /* To guarantee the inst */
-
-                               /*!
-                                * \note
-                                * At here, we don't need to rememeber the timer object.
-                                * Even if the timer callback is called, after the instance is destroyed.
-                                * lazy_pd_created_cb will decrease the instance refcnt first.
-                                * At that time, if the instance is released, the timer callback will do nothing.
-                                *
-                                * 13-05-28
-                                * I change my mind. There is no requirements to keep the timer handler.
-                                * But I just add it to the tagged-data of the instance.
-                                * Just reserve for future-use.
-                                */
-                               pd_monitor = ecore_timer_add(DELAY_TIME, lazy_pd_created_cb, inst);
-                               if (!pd_monitor) {
-                                       ret = script_handler_unload(instance_pd_script(inst), 1);
-                                       ErrPrint("Unload script: %d\n", ret);
-
-                                       ret = instance_slave_close_pd(inst, client, LB_CLOSE_PD_NORMAL);
-                                       ErrPrint("Close PD %d\n", ret);
-
-                                       inst = instance_unref(inst);
-                                       if (!inst) {
-                                               DbgPrint("Instance destroyed\n");
-                                       }
-
-                                       ErrPrint("Instance: %s\n", pkgname);
-
-                                       ret = LB_STATUS_ERROR_FAULT;
-                               } else {
-                                       struct slave_node *slave;
-
-                                       (void)instance_set_data(inst, LAZY_PD_OPEN_TAG, pd_monitor);
-
-                                       slave = package_slave(pkg);
-                                       if (!slave) {
-                                               ErrPrint("Failed to get slave: %s\n", pkgname);
-                                               goto out;
-                                       }
-
-                                       if (slave_event_callback_add(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_open_script_cb, inst) != LB_STATUS_SUCCESS) {
-                                               ErrPrint("Failed to add fault callback: %s\n", pkgname);
-                                       }
-                               }
-                       } else {
-                               int tmp_ret;
-                               tmp_ret = instance_slave_close_pd(inst, client, LB_CLOSE_PD_FAULT);
-                               if (tmp_ret < 0) {
-                                       ErrPrint("Unable to load script: %d, (close: %d)\n", ret, tmp_ret);
-                               }
-                       }
-               } else {
-                       ErrPrint("Unable open PD(%s): %d\n", pkgname, ret);
-               }
-       } else {
-               ErrPrint("Invalid PD TYPE\n");
-               ret = LB_STATUS_ERROR_INVALID;
+       script_handler_update_keycode(script, keycode);
+       ret = script_handler_feed_event(script, DBOX_SCRIPT_KEY_DOWN, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_key_status(inst, ret);
        }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
 out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a packet\n");
-       }
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
 
-       return result;
+    return result;
 }
 
-static struct packet *client_destroy_pd(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, ret */
+static struct packet *client_pause_request(pid_t pid, int handle, const struct packet *packet)
 {
-       struct client_node *client;
-       struct packet *result;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       struct inst_info *inst = NULL;
-       const struct pkg_info *pkg = NULL;
-       Ecore_Timer *pd_monitor;
-       struct slave_node *slave;
+    struct client_node *client;
+    double timestamp;
+    int ret;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is paused - manually reported\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "d", &timestamp);
+    if (ret != 1) {
+       ErrPrint("Invalid parameter\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    if (DYNAMICBOX_CONF_USE_XMONITOR) {
+       DbgPrint("XMONITOR enabled. ignore client paused request\n");
+    } else {
+       xmonitor_pause(client);
+    }
 
-       DbgPrint("PERF_DBOX\n");
+out:
+    return NULL;
+}
 
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
+static struct packet *client_resume_request(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    double timestamp;
+    int ret;
 
-       ret = packet_get(packet, "ss", &pkgname, &id);
-       if (ret != 2) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       goto out;
+    }
+
+    ret = packet_get(packet, "d", &timestamp);
+    if (ret != 1) {
+       ErrPrint("Invalid parameter\n");
+       goto out;
+    }
+
+    if (DYNAMICBOX_CONF_USE_XMONITOR) {
+       DbgPrint("XMONITOR enabled. ignore client resumed request\n");
+    } else {
+       xmonitor_resume(client);
+    }
+
+out:
+    return NULL;
+}
+
+static struct packet *client_gbar_key_up(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    unsigned int keycode;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+    struct packet *result;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
+    if (ret != 4) {
+       ErrPrint("Invalid parameter\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       ret = forward_gbar_key_packet(pkg, inst, packet_command(packet), timestamp, keycode);
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       struct script_info *script;
+
+       script = instance_gbar_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
+       script_handler_update_keycode(script, keycode);
+       ret = script_handler_feed_event(script, DBOX_SCRIPT_KEY_UP, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_key_status(inst, ret);
        }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       slave = package_slave(pkg);
-       if (!slave) {
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_dbox_access_hl(pid_t pid, int handle, const struct packet *packet)
+{
+    struct packet *result;
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    struct access_info event;
+    struct inst_info *inst = NULL;
+    const struct pkg_info *pkg = NULL;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+    if (ret != 6) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = forward_dbox_access_packet(pkg, inst, packet_command(packet), timestamp, &event);
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       struct script_info *script;
+       int type;
+
+       script = instance_dbox_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
+       }
+
+       switch (event.type) {
+       case ACCESS_TYPE_CUR:
+           type = DBOX_SCRIPT_ACCESS_HIGHLIGHT;
+           break;
+       case ACCESS_TYPE_NEXT:
+           type = DBOX_SCRIPT_ACCESS_HIGHLIGHT_NEXT;
+           break;
+       case ACCESS_TYPE_PREV:
+           type = DBOX_SCRIPT_ACCESS_HIGHLIGHT_PREV;
+           break;
+       case ACCESS_TYPE_OFF:
+           type = DBOX_SCRIPT_ACCESS_UNHIGHLIGHT;
+           break;
+       default:
+           ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+           goto out;
        }
 
-       if (instance_pd_owner(inst) != client) {
-               if (instance_pd_owner(inst) == NULL) {
-                       ErrPrint("PD looks already closed\n");
-                       ret = LB_STATUS_ERROR_ALREADY;
-               } else {
-                       ErrPrint("PD owner mimatched\n");
-                       ret = LB_STATUS_ERROR_PERMISSION;
-               }
-       } else if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               DbgPrint("Buffer type PD\n");
-               pd_monitor = instance_del_data(inst, PD_OPEN_MONITOR_TAG);
-               if (pd_monitor) {
-                       ErrPrint("PD Open request is found. cancel it [%s]\n", pkgname);
-
-                       if (slave_event_callback_del(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_open_buffer_cb, inst) < 0) {
-                               DbgPrint("Failed to delete a deactivate callback\n");
-                       }
-
-                       /*!
-                        * \note
-                        * We should return negative value
-                        * Or we have to send "destroyed" event to the client.
-                        * If we didn't send destroyed event after return SUCCESS from here,
-                        * The client will permanently waiting destroyed event.
-                        * Because they understand that the destroy request is successfully processed.
-                        */
-                       ret = instance_client_pd_created(inst, LB_STATUS_ERROR_CANCEL);
-                       if (ret < 0) {
-                               ErrPrint("PD client create event: %d\n", ret);
-                       }
-
-                       ret = instance_client_pd_destroyed(inst, LB_STATUS_SUCCESS);
-                       if (ret < 0) {
-                               ErrPrint("PD client destroy event: %d\n", ret);
-                       }
-
-                       ret = instance_signal_emit(inst, "pd,hide", instance_id(inst), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0);
-                       if (ret < 0) {
-                               ErrPrint("PD close signal emit failed: %d\n", ret);
-                       }
-
-                       ret = instance_slave_close_pd(inst, client, LB_CLOSE_PD_NORMAL);
-                       if (ret < 0) {
-                               ErrPrint("PD close request failed: %d\n", ret);
-                       }
-
-                       ecore_timer_del(pd_monitor);
-                       inst = instance_unref(inst);
-                       if (!inst) {
-                               DbgPrint("Instance is deleted\n");
-                       }
-               } else if (instance_get_data(inst, LAZY_PD_CLOSE_TAG) || instance_get_data(inst, PD_CLOSE_MONITOR_TAG)) {
-                       DbgPrint("Close monitor is already fired\n");
-                       ret = LB_STATUS_ERROR_ALREADY;
-               } else {
-                       int resize_aborted = 0;
-
-                       pd_monitor = instance_del_data(inst, PD_RESIZE_MONITOR_TAG);
-                       if (pd_monitor) {
-                               ErrPrint("PD Resize request is found. clear it [%s]\n", pkgname);
-                               if (slave_event_callback_del(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_resize_buffer_cb, inst) < 0) {
-                                       DbgPrint("Failed to delete a deactivate callback\n");
-                               }
-
-                               ecore_timer_del(pd_monitor);
-
-                               inst = instance_unref(inst);
-                               if (!inst) {
-                                       DbgPrint("Instance is destroyed while resizing\n");
-                                       goto out;
-                               }
-
-                               resize_aborted = 1;
-                       }
-
-                       ret = instance_signal_emit(inst, "pd,hide", instance_id(inst), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0);
-                       if (ret < 0) {
-                               ErrPrint("PD close signal emit failed: %d\n", ret);
-                       }
-
-                       ret = instance_slave_close_pd(inst, client, LB_CLOSE_PD_NORMAL);
-                       if (ret < 0) {
-                               ErrPrint("PD close request failed: %d\n", ret);
-                       } else if (resize_aborted) {
-                               pd_monitor = ecore_timer_add(DELAY_TIME, lazy_pd_destroyed_cb, instance_ref(inst));
-                               if (!pd_monitor) {
-                                       ErrPrint("Failed to create a timer: %s\n", pkgname);
-                                       inst = instance_unref(inst);
-                                       if (!inst) {
-                                               DbgPrint("Instance is deleted\n");
-                                       }
-                               } else {
-                                       DbgPrint("Resize is aborted\n");
-                                       (void)instance_set_data(inst, LAZY_PD_CLOSE_TAG, pd_monitor);
-                                       if (slave_event_callback_add(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_close_buffer_cb, inst) < 0) {
-                                               ErrPrint("Failed to add a slave event callback\n");
-                                       }
-                               }
-                       } else {
-                               pd_monitor = ecore_timer_add(PD_REQUEST_TIMEOUT, pd_close_monitor_cb, instance_ref(inst));
-                               if (!pd_monitor) {
-                                       ErrPrint("Failed to add pd close monitor\n");
-                                       inst = instance_unref(inst);
-                                       if (!inst) {
-                                               ErrPrint("Instance is deleted while closing PD\n");
-                                       }
-                               } else {
-                                       DbgPrint("Add close monitor\n");
-                                       (void)instance_set_data(inst, PD_CLOSE_MONITOR_TAG, pd_monitor);
-                                       if (slave_event_callback_add(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_close_buffer_cb, inst) < 0) {
-                                               ErrPrint("Failed to add SLAVE EVENT callback\n");
-                                       }
-                               }
-                       }
-
-                       /*!
-                        * \note
-                        * release_buffer will be called by the slave after this routine.
-                        * It will send the "pd_destroyed" event to the client
-                        *
-                        * instance_client_pd_destroyed(inst, LB_STATUS_SUCCESS);
-                        *
-                        * Or the "pd_close_monitor_cb" or "lazy_pd_destroyed_cb" will be called.
-                        */
-               }
-       } else if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
-               DbgPrint("Script TYPE PD\n");
-               pd_monitor = instance_get_data(inst, LAZY_PD_OPEN_TAG);
-               if (pd_monitor) {
-                       ecore_timer_del(pd_monitor);
-                       (void)lazy_pd_created_cb(inst);
-               }
+       script_handler_update_pointer(script, event.x, event.y, event.type);
+       ret = script_handler_feed_event(script, type, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_access_status(inst, ret);
+       }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-               ret = script_handler_unload(instance_pd_script(inst), 1);
-               if (ret < 0) {
-                       ErrPrint("Unable to unload the script: %s, %d\n", pkgname, ret);
-               }
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_dbox_access_action(pid_t pid, int handle, const struct packet *packet)
+{
+    struct packet *result;
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    struct inst_info *inst = NULL;
+    const struct pkg_info *pkg = NULL;
+    struct access_info event;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exist\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+    if (ret != 6) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = forward_dbox_access_packet(pkg, inst, packet_command(packet), timestamp, &event);
+       /*!
+        * Enen if it fails to send packet,
+        * The packet will be unref'd
+        * So we don't need to check the ret value.
+        */
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       struct script_info *script;
 
-               /*!
-                * \note
-                * Send request to the slave.
-                * The SLAVE must has to repsonse this via "release_buffer" method.
-                */
-               ret = instance_slave_close_pd(inst, client, LB_CLOSE_PD_NORMAL);
-               if (ret < 0) {
-                       ErrPrint("Unable to close the PD: %s, %d\n", pkgname, ret);
-               }
+       script = instance_dbox_script(inst);
+       if (!script) {
+           ErrPrint("Instance has no script\n");
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
+       }
 
-               /*!
-                * \note
-                * Send the destroyed PD event to the client
-                */
-               if (ret == (int)LB_STATUS_SUCCESS) {
-                       /*!
-                        * \note
-                        * 13-05-28
-                        * I've changed my mind. There is no requirements to keep the timer handler.
-                        * But I just add it to the tagged-data of the instance.
-                        * Just reserve for future-use.
-                        */
-                       DbgPrint("Add lazy PD destroy timer\n");
-                       pd_monitor = ecore_timer_add(DELAY_TIME, lazy_pd_destroyed_cb, instance_ref(inst));
-                       if (!pd_monitor) {
-                               ErrPrint("Failed to create a timer: %s\n", pkgname);
-                               inst = instance_unref(inst);
-                               if (!inst) {
-                                       DbgPrint("instance is deleted\n");
-                               }
-                       } else {
-                               (void)instance_set_data(inst, LAZY_PD_CLOSE_TAG, pd_monitor);
-                               if (slave_event_callback_add(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_close_script_cb, inst) < 0) {
-                                       ErrPrint("Failed to add a event callback for slave\n");
-                               }
-                       }
-               }
-       } else {
-               ErrPrint("Invalid PD TYPE\n");
-               ret = LB_STATUS_ERROR_INVALID;
+       script_handler_update_pointer(script, event.x, event.y, event.type);
+       ret = script_handler_feed_event(script, DBOX_SCRIPT_ACCESS_ACTION, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_access_status(inst, ret);
        }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
 out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a packet\n");
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_dbox_access_scroll(pid_t pid, int handle, const struct packet *packet)
+{
+    struct packet *result;
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    struct inst_info *inst = NULL;
+    const struct pkg_info *pkg = NULL;
+    struct access_info event;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exist\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+    if (ret != 6) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = forward_dbox_access_packet(pkg, inst, packet_command(packet), timestamp, &event);
+       /*!
+        * Enen if it fails to send packet,
+        * The packet will be unref'd
+        * So we don't need to check the ret value.
+        */
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       struct script_info *script;
+
+       script = instance_dbox_script(inst);
+       if (!script) {
+           ErrPrint("Instance has no script\n");
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       return result;
-}
+       script_handler_update_pointer(script, event.x, event.y, event.type);
+       ret = script_handler_feed_event(script, DBOX_SCRIPT_ACCESS_SCROLL, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_access_status(inst, ret);
+       }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-static struct packet *client_activate_package(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, ret */
-{
-       struct client_node *client;
-       struct packet *result;
-       const char *pkgname;
-       int ret;
-       struct pkg_info *info;
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_dbox_access_value_change(pid_t pid, int handle, const struct packet *packet)
+{
+    struct packet *result;
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    struct inst_info *inst = NULL;
+    const struct pkg_info *pkg = NULL;
+    struct access_info event;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exist\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+    if (ret != 6) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = forward_dbox_access_packet(pkg, inst, packet_command(packet), timestamp, &event);
+       /*!
+        * Enen if it fails to send packet,
+        * The packet will be unref'd
+        * So we don't need to check the ret value.
+        */
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       struct script_info *script;
 
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               pkgname = "";
-               goto out;
+       script = instance_dbox_script(inst);
+       if (!script) {
+           ErrPrint("Instance has no script\n");
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       ret = packet_get(packet, "s", &pkgname);
-       if (ret != 1) {
-               ErrPrint("Parameter is not matched\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               pkgname = "";
-               goto out;
+       script_handler_update_pointer(script, event.x, event.y, event.type);
+       ret = script_handler_feed_event(script, DBOX_SCRIPT_ACCESS_VALUE_CHANGE, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_access_status(inst, ret);
        }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       DbgPrint("pid[%d] pkgname[%s]\n", pid, pkgname);
-
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_dbox_access_mouse(pid_t pid, int handle, const struct packet *packet)
+{
+    struct packet *result;
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    struct inst_info *inst = NULL;
+    const struct pkg_info *pkg = NULL;
+    struct access_info event;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exist\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+    if (ret != 6) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = forward_dbox_access_packet(pkg, inst, packet_command(packet), timestamp, &event);
        /*!
-        * \NOTE:
-        * Validate the livebox package name.
+        * Enen if it fails to send packet,
+        * The packet will be unref'd
+        * So we don't need to check the ret value.
         */
-       if (!package_is_lb_pkgname(pkgname)) {
-               ErrPrint("%s is not a valid livebox package\n", pkgname);
-               pkgname = "";
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       struct script_info *script;
+
+       script = instance_dbox_script(inst);
+       if (!script) {
+           ErrPrint("Instance has no script\n");
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       info = package_find(pkgname);
-       if (!info) {
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-       } else {
-               ret = package_clear_fault(info);
+       script_handler_update_pointer(script, event.x, event.y, event.type);
+       ret = script_handler_feed_event(script, DBOX_SCRIPT_ACCESS_MOUSE, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_access_status(inst, ret);
        }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
 out:
-       result = packet_create_reply(packet, "is", ret, pkgname);
-       if (!result) {
-               ErrPrint("Failed to create a packet\n");
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_dbox_access_back(pid_t pid, int handle, const struct packet *packet)
+{
+    struct packet *result;
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    struct inst_info *inst = NULL;
+    const struct pkg_info *pkg = NULL;
+    struct access_info event;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exist\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+    if (ret != 6) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = forward_dbox_access_packet(pkg, inst, packet_command(packet), timestamp, &event);
+       /*!
+        * Enen if it fails to send packet,
+        * The packet will be unref'd
+        * So we don't need to check the ret value.
+        */
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       struct script_info *script;
+
+       script = instance_dbox_script(inst);
+       if (!script) {
+           ErrPrint("Instance has no script\n");
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       return result;
-}
+       script_handler_update_pointer(script, event.x, event.y, event.type);
+       ret = script_handler_feed_event(script, DBOX_SCRIPT_ACCESS_BACK, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_access_status(inst, ret);
+       }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-static struct packet *client_subscribed(pid_t pid, int handle, const struct packet *packet)
-{
-       const char *cluster;
-       const char *category;
-       struct client_node *client;
-       int ret;
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_dbox_access_over(pid_t pid, int handle, const struct packet *packet)
+{
+    struct packet *result;
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    struct inst_info *inst = NULL;
+    const struct pkg_info *pkg = NULL;
+    struct access_info event;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exist\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+    if (ret != 6) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = forward_dbox_access_packet(pkg, inst, packet_command(packet), timestamp, &event);
+       /*!
+        * Enen if it fails to send packet,
+        * The packet will be unref'd
+        * So we don't need to check the ret value.
+        */
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       struct script_info *script;
 
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
+       script = instance_dbox_script(inst);
+       if (!script) {
+           ErrPrint("Instance has no script\n");
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       ret = packet_get(packet, "ss", &cluster, &category);
-       if (ret != 2) {
-               ErrPrint("Invalid argument\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
+       script_handler_update_pointer(script, event.x, event.y, event.type);
+       ret = script_handler_feed_event(script, DBOX_SCRIPT_ACCESS_OVER, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_access_status(inst, ret);
        }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       DbgPrint("[%d] cluster[%s] category[%s]\n", pid, cluster, category);
-       if (!strlen(cluster) || !strcasecmp(cluster, DEFAULT_CLUSTER)) {
-               ErrPrint("Invalid cluster name\n");
-               goto out;
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_dbox_access_read(pid_t pid, int handle, const struct packet *packet)
+{
+    struct packet *result;
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    struct inst_info *inst = NULL;
+    const struct pkg_info *pkg = NULL;
+    struct access_info event;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exist\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+    if (ret != 6) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = forward_dbox_access_packet(pkg, inst, packet_command(packet), timestamp, &event);
+       /*!
+        * Enen if it fails to send packet,
+        * The packet will be unref'd
+        * So we don't need to check the ret value.
+        */
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       struct script_info *script;
+
+       script = instance_dbox_script(inst);
+       if (!script) {
+           ErrPrint("Instance has no script\n");
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
+       }
+
+       script_handler_update_pointer(script, event.x, event.y, event.type);
+       ret = script_handler_feed_event(script, DBOX_SCRIPT_ACCESS_READ, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_access_status(inst, ret);
        }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_dbox_access_enable(pid_t pid, int handle, const struct packet *packet)
+{
+    struct packet *result;
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    struct inst_info *inst = NULL;
+    const struct pkg_info *pkg = NULL;
+    struct access_info event;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exist\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+    if (ret != 6) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = forward_dbox_access_packet(pkg, inst, packet_command(packet), timestamp, &event);
        /*!
-        * \todo
-        * SUBSCRIBE cluster & sub-cluster for a client.
+        * Enen if it fails to send packet,
+        * The packet will be unref'd
+        * So we don't need to check the ret value.
         */
-       ret = client_subscribe(client, cluster, category);
-       if (ret == 0) {
-               package_alter_instances_to_client(client, ALTER_CREATE);
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       struct script_info *script;
+       int type;
+
+       script = instance_dbox_script(inst);
+       if (!script) {
+           ErrPrint("Instance has no script\n");
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-out:
-       /*! \note No reply packet */
-       return NULL;
-}
+       type = (event.type == 0) ? DBOX_SCRIPT_ACCESS_DISABLE : DBOX_SCRIPT_ACCESS_ENABLE;
 
-static struct packet *client_delete_cluster(pid_t pid, int handle, const struct packet *packet)
-{
-       const char *cluster;
-       struct client_node *client;
-       struct packet *result;
-       int ret;
+       script_handler_update_pointer(script, event.x, event.y, event.type);
+       ret = script_handler_feed_event(script, type, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_access_status(inst, ret);
+       }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_dbox_access_activate(pid_t pid, int handle, const struct packet *packet)
+{
+    struct packet *result;
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    struct access_info event;
+    struct inst_info *inst = NULL;
+    const struct pkg_info *pkg = NULL;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+    if (ret != 6) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = forward_dbox_access_packet(pkg, inst, packet_command(packet), timestamp, &event);
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       struct script_info *script;
+
+       script = instance_dbox_script(inst);
+       if (!script) {
+           ErrPrint("Instance has no script\n");
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       ret = packet_get(packet, "s", &cluster);
-       if (ret != 1) {
-               ErrPrint("Invalid parameters\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
+       script_handler_update_pointer(script, event.x, event.y, event.type);
+       ret = script_handler_feed_event(script, DBOX_SCRIPT_ACCESS_ACTIVATE, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_access_status(inst, ret);
        }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       DbgPrint("pid[%d] cluster[%s]\n", pid, cluster);
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_dbox_key_down(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    unsigned int keycode;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+    struct packet *result;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
+    if (ret != 4) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = forward_dbox_key_packet(pkg, inst, packet_command(packet), timestamp, keycode);
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       struct script_info *script;
 
-       if (!strlen(cluster) || !strcasecmp(cluster, DEFAULT_CLUSTER)) {
-               ErrPrint("Invalid cluster: %s\n", cluster);
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
+       script = instance_dbox_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       /*!
-        * \todo
-        */
-       ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+       script_handler_update_keycode(script, keycode);
+       ret = script_handler_feed_event(script, DBOX_SCRIPT_KEY_DOWN, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_key_status(inst, ret);
+       }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
 out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a packet\n");
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_dbox_key_focus_in(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    unsigned int keycode;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+    struct packet *result;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
+    if (ret != 4) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = forward_dbox_key_packet(pkg, inst, packet_command(packet), timestamp, keycode);
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       struct script_info *script;
+
+       script = instance_dbox_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
        }
 
-       return result;
-}
+       script_handler_update_keycode(script, keycode);
+       ret = script_handler_feed_event(script, DBOX_SCRIPT_KEY_FOCUS_IN, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_key_status(inst, ret);
+       }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-static inline int update_pkg_cb(struct category *category, const char *pkgname, int force)
-{
-       const char *c_name;
-       const char *s_name;
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_dbox_key_focus_out(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    unsigned int keycode;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+    struct packet *result;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
+    if (ret != 4) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = forward_dbox_key_packet(pkg, inst, packet_command(packet), timestamp, keycode);
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       struct script_info *script;
 
-       c_name = group_cluster_name_by_category(category);
-       s_name = group_category_name(category);
+       script = instance_dbox_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
+       }
 
-       if (!c_name || !s_name || !pkgname) {
-               ErrPrint("Name is not valid\n");
-               return EXIT_FAILURE;
+       script_handler_update_keycode(script, keycode);
+       ret = script_handler_feed_event(script, DBOX_SCRIPT_KEY_FOCUS_OUT, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_key_status(inst, ret);
        }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       DbgPrint("Send refresh request: %s (%s/%s)\n", pkgname, c_name, s_name);
-       slave_rpc_request_update(pkgname, "", c_name, s_name, NULL, force);
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_dbox_key_up(pid_t pid, int handle, const struct packet *packet)
+{
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    double timestamp;
+    unsigned int keycode;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+    struct packet *result;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdi", &pkgname, &id, &timestamp, &keycode);
+    if (ret != 4) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = forward_dbox_key_packet(pkg, inst, packet_command(packet), timestamp, keycode);
+    } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
+       struct script_info *script;
 
-       /* Just try to create a new package */
-       if (util_free_space(IMAGE_PATH) > MINIMUM_SPACE) {
-               double timestamp;
-               struct inst_info *inst;
+       script = instance_dbox_script(inst);
+       if (!script) {
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
+       }
 
-               timestamp = util_timestamp();
-               /*!
-                * \NOTE
-                * Don't need to check the subscribed clients.
-                * Because this callback is called by the requests of clients.
-                * It means. some clients wants to handle this instances ;)
-                */
-               inst = instance_create(NULL, timestamp, pkgname, "", c_name, s_name, DEFAULT_PERIOD, 0, 0);
-               if (!inst) {
-                       ErrPrint("Failed to create a new instance\n");
-               }
+       script_handler_update_keycode(script, keycode);
+       ret = script_handler_feed_event(script, DBOX_SCRIPT_KEY_UP, timestamp);
+       if (ret >= 0) {
+           ret = send_delayed_key_status(inst, ret);
        }
+    } else {
+       ErrPrint("Unsupported package\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
 
-       return EXIT_SUCCESS;
+    return result;
 }
 
-static struct packet *client_update(pid_t pid, int handle, const struct packet *packet)
+static int release_pixmap_cb(struct client_node *client, void *canvas)
 {
-       struct inst_info *inst;
-       struct client_node *client;
-       const char *pkgname;
-       const char *id;
-       int force;
-       int ret;
+    DbgPrint("Forcely unref the \"buffer\"\n");
+    buffer_handler_pixmap_unref(canvas);
+    return -1; /* Delete this callback */
+}
+
+
+static struct packet *client_dbox_acquire_xpixmap(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+{
+    struct packet *result;
+    const char *pkgname;
+    const char *id;
+    struct client_node *client;
+    struct inst_info *inst;
+    int ret;
+    int pixmap = 0;
+    void *buf_ptr;
+    struct buffer_info *buffer;
+    int idx;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssi", &pkgname, &id, &idx);
+    if (ret != 3) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    if (idx >= DYNAMICBOX_CONF_EXTRA_BUFFER_COUNT || idx < 0) {
+       DbgPrint("Index is not valid: %d\n", idx);
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, NULL);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    buffer = instance_dbox_extra_buffer(inst, idx);
+    if (!buffer) {
+       ErrPrint("Extra buffer for %d is not available\n", idx);
+       goto out;
+    }
+
+    buf_ptr = buffer_handler_pixmap_ref(buffer);
+    if (!buf_ptr) {
+       ErrPrint("Failed to ref pixmap\n");
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = client_event_callback_add(client, CLIENT_EVENT_DEACTIVATE, release_pixmap_cb, buf_ptr);
+    if (ret < 0) {
+       ErrPrint("Failed to add a new client deactivate callback\n");
+       buffer_handler_pixmap_unref(buf_ptr);
+    } else {
+       pixmap = buffer_handler_pixmap(buffer);
+       ret = DBOX_STATUS_ERROR_NONE;
+    }
 
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Cilent %d is not exists\n", pid);
-               goto out;
-       }
+out:
+    result = packet_create_reply(packet, "ii", pixmap, ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_dbox_acquire_pixmap(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+{
+    struct packet *result;
+    const char *pkgname;
+    const char *id;
+    struct client_node *client;
+    struct inst_info *inst;
+    int ret;
+    int pixmap = 0;
+    void *buf_ptr;
+    struct buffer_info *buffer;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ss", &pkgname, &id);
+    if (ret != 2) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, NULL);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    buffer = instance_dbox_buffer(inst);
+    if (!buffer) {
+       struct script_info *script_info;
+
+       script_info = instance_dbox_script(inst);
+       if (!script_info) {
+           ErrPrint("Unable to get DBOX buffer: %s\n", id);
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
+       }
+
+       buffer = script_handler_buffer_info(script_info);
+       if (!buffer) {
+           ErrPrint("Unable to get buffer_info: %s\n", id);
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
+       }
+    }
+
+    buf_ptr = buffer_handler_pixmap_ref(buffer);
+    if (!buf_ptr) {
+       ErrPrint("Failed to ref pixmap\n");
+       ret = DBOX_STATUS_ERROR_FAULT;
+       goto out;
+    }
+
+    ret = client_event_callback_add(client, CLIENT_EVENT_DEACTIVATE, release_pixmap_cb, buf_ptr);
+    if (ret < 0) {
+       ErrPrint("Failed to add a new client deactivate callback\n");
+       buffer_handler_pixmap_unref(buf_ptr);
+    } else {
+       pixmap = buffer_handler_pixmap(buffer);
+       ret = DBOX_STATUS_ERROR_NONE;
+    }
 
-       ret = packet_get(packet, "ssi", &pkgname, &id, &force);
-       if (ret != 3) {
-               ErrPrint("Invalid argument\n");
-               goto out;
-       }
+out:
+    result = packet_create_reply(packet, "ii", pixmap, ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_dbox_release_pixmap(pid_t pid, int handle, const struct packet *packet)
+{
+    const char *pkgname;
+    const char *id;
+    struct client_node *client;
+    int pixmap;
+    void *buf_ptr;
+    int ret;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssi", &pkgname, &id, &pixmap);
+    if (ret != 3) {
+       ErrPrint("Parameter is not matched\n");
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, NULL, NULL);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       DbgPrint("It seems that the instance is already deleted: %s\n", id);
+    }
+
+    buf_ptr = buffer_handler_pixmap_find(pixmap);
+    if (!buf_ptr) {
+       ErrPrint("Failed to find a buf_ptr of 0x%X\n", pixmap);
+       goto out;
+    }
+
+    if (client_event_callback_del(client, CLIENT_EVENT_DEACTIVATE, release_pixmap_cb, buf_ptr) == 0) {
+       buffer_handler_pixmap_unref(buf_ptr);
+    }
 
-       ret = validate_request(pkgname, id, &inst, NULL);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
+out:
+    /**
+     * @note No reply packet
+     */
+    return NULL;
+}
+
+static struct packet *client_gbar_acquire_xpixmap(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+{
+    struct packet *result;
+    const char *pkgname;
+    const char *id;
+    struct client_node *client;
+    struct inst_info *inst;
+    int ret;
+    int pixmap = 0;
+    void *buf_ptr;
+    struct buffer_info *buffer;
+    int idx;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       ErrPrint("Client %d is not exists\n", pid);
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssi", &pkgname, &id, &idx);
+    if (ret != 3) {
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       ErrPrint("Parameter is not matched\n");
+       goto out;
+    }
+
+    if (idx >= DYNAMICBOX_CONF_EXTRA_BUFFER_COUNT || idx < 0) {
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, NULL);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    buffer = instance_gbar_extra_buffer(inst, idx);
+    if (!buffer) {
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    buf_ptr = buffer_handler_pixmap_ref(buffer);
+    if (!buf_ptr) {
+       ErrPrint("Failed to ref pixmap\n");
+       ret = DBOX_STATUS_ERROR_FAULT;
+       goto out;
+    }
+
+    ret = client_event_callback_add(client, CLIENT_EVENT_DEACTIVATE, release_pixmap_cb, buf_ptr);
+    if (ret < 0) {
+       ErrPrint("Failed to add a new client deactivate callback\n");
+       buffer_handler_pixmap_unref(buf_ptr);
+    } else {
+       pixmap = buffer_handler_pixmap(buffer);
+       ret = DBOX_STATUS_ERROR_NONE;
+    }
 
-       if (instance_client(inst) != client) {
-               /* PERMISSIONS */
-               ErrPrint("Insufficient permissions [%s] - %d\n", pkgname, pid);
-       } else {
-               slave_rpc_request_update(pkgname, id, instance_cluster(inst), instance_category(inst), NULL, force);
-       }
+out:
+    result = packet_create_reply(packet, "ii", pixmap, ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_gbar_acquire_pixmap(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+{
+    struct packet *result;
+    const char *pkgname;
+    const char *id;
+    struct client_node *client;
+    struct inst_info *inst;
+    int ret;
+    int pixmap = 0;
+    void *buf_ptr;
+    struct buffer_info *buffer;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       ErrPrint("Client %d is not exists\n", pid);
+       goto out;
+    }
+
+    ret = packet_get(packet, "ss", &pkgname, &id);
+    if (ret != 2) {
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       ErrPrint("Parameter is not matched\n");
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, NULL);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (instance_get_data(inst, GBAR_RESIZE_MONITOR_TAG)) {
+       ret = DBOX_STATUS_ERROR_BUSY;
+       goto out;
+    }
+
+    buffer = instance_gbar_buffer(inst);
+    if (!buffer) {
+       struct script_info *script_info;
+
+       script_info = instance_gbar_script(inst);
+       if (!script_info) {
+           ErrPrint("Unable to get DBOX buffer: %s\n", id);
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
+       }
+
+       buffer = script_handler_buffer_info(script_info);
+       if (!buffer) {
+           ErrPrint("Unable to get buffer_info: %s\n", id);
+           ret = DBOX_STATUS_ERROR_FAULT;
+           goto out;
+       }
+    }
+
+    buf_ptr = buffer_handler_pixmap_ref(buffer);
+    if (!buf_ptr) {
+       ErrPrint("Failed to ref pixmap\n");
+       ret = DBOX_STATUS_ERROR_FAULT;
+       goto out;
+    }
+
+    ret = client_event_callback_add(client, CLIENT_EVENT_DEACTIVATE, release_pixmap_cb, buf_ptr);
+    if (ret < 0) {
+       ErrPrint("Failed to add a new client deactivate callback\n");
+       buffer_handler_pixmap_unref(buf_ptr);
+    } else {
+       pixmap = buffer_handler_pixmap(buffer);
+       ret = DBOX_STATUS_ERROR_NONE;
+    }
 
 out:
-       /*! \note No reply packet */
-       return NULL;
+    result = packet_create_reply(packet, "ii", pixmap, ret);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_gbar_release_pixmap(pid_t pid, int handle, const struct packet *packet)
+{
+    const char *pkgname;
+    const char *id;
+    struct client_node *client;
+    int pixmap;
+    void *buf_ptr;
+    int ret;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssi", &pkgname, &id, &pixmap);
+    if (ret != 3) {
+       ErrPrint("Parameter is not matched\n");
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, NULL, NULL);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       DbgPrint("It seems that the instance is already deleted: %s\n", id);
+    }
+
+    buf_ptr = buffer_handler_pixmap_find(pixmap);
+    if (!buf_ptr) {
+       ErrPrint("Failed to find a buf_ptr of 0x%X\n", pixmap);
+       goto out;
+    }
+
+    if (client_event_callback_del(client, CLIENT_EVENT_DEACTIVATE, release_pixmap_cb, buf_ptr) == 0) {
+       buffer_handler_pixmap_unref(buf_ptr);
+    }
+
+out:
+    /*! \note No reply packet */
+    return NULL;
 }
 
-static struct packet *client_refresh_group(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_pinup_changed(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, pinup, ret */
 {
-       const char *cluster_id;
-       const char *category_id;
-       struct client_node *client;
-       int ret;
-       struct cluster *cluster;
-       struct category *category;
-       struct context_info *info;
-       Eina_List *info_list;
-       Eina_List *l;
-       int force;
+    struct client_node *client;
+    struct packet *result;
+    const char *pkgname;
+    const char *id;
+    int pinup;
+    int ret;
+    struct inst_info *inst;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       pinup = 0;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssi", &pkgname, &id, &pinup);
+    if (ret != 3) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       pinup = 0;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, NULL);
+    if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+       ret = instance_set_pinup(inst, pinup);
+    }
 
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Cilent %d is not exists\n", pid);
-               goto out;
-       }
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a packet\n");
+    }
 
-       ret = packet_get(packet, "ssi", &cluster_id, &category_id, &force);
-       if (ret != 3) {
-               ErrPrint("Invalid parameter\n");
-               goto out;
-       }
+    return result;
+}
 
-       DbgPrint("[%d] cluster[%s] category[%s]\n", pid, cluster_id, category_id);
+static Eina_Bool lazy_gbar_created_cb(void *inst)
+{
+    struct pkg_info *pkg;
 
-       if (!strlen(cluster_id) || !strcasecmp(cluster_id, DEFAULT_CLUSTER)) {
-               ErrPrint("Invalid cluster name: %s\n", cluster_id);
-               goto out;
+    if (!instance_del_data(inst, LAZY_GBAR_OPEN_TAG)) {
+       ErrPrint("lazy,pd,open is already deleted.\n");
+       return ECORE_CALLBACK_CANCEL;
+    }
+
+    pkg = instance_package(inst);
+    if (pkg) {
+       struct slave_node *slave;
+
+       slave = package_slave(pkg);
+       if (slave) {
+           slave_event_callback_del(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_open_script_cb, inst);
        }
+    }
 
-       cluster = group_find_cluster(cluster_id);
-       if (!cluster) {
-               ErrPrint("Cluster [%s] is not registered\n", cluster_id);
-               goto out;
+    /*!
+     * After unref instance first,
+     * if the instance is not destroyed, try to notify the created GBAR event to the client.
+     */
+    if (instance_unref(inst)) {
+       int ret;
+       ret = instance_client_gbar_created(inst, DBOX_STATUS_ERROR_NONE);
+       if (ret < 0) {
+           DbgPrint("Send GBAR Create event (%d) to client\n", ret);
        }
+    }
 
-       category = group_find_category(cluster, category_id);
-       if (!category) {
-               ErrPrint("Category [%s] is not registered\n", category_id);
-               goto out;
-       }
+    return ECORE_CALLBACK_CANCEL;
+}
 
-       info_list = group_context_info_list(category);
-       EINA_LIST_FOREACH(info_list, l, info) {
-               update_pkg_cb(category, group_pkgname_from_context_info(info), force);
-       }
+static Eina_Bool lazy_gbar_destroyed_cb(void *inst)
+{
+    struct pkg_info *pkg;
+    struct slave_node *slave;
+
+    if (!instance_del_data(inst, LAZY_GBAR_CLOSE_TAG)) {
+       ErrPrint("lazy,pd,close is already deleted.\n");
+       return ECORE_CALLBACK_CANCEL;
+    }
+
+    pkg = instance_package(inst);
+    if (pkg) {
+       slave = package_slave(pkg);
+       if (slave) {
+           if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+               DbgPrint("Delete script type close callback\n");
+               (void)slave_event_callback_del(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_close_script_cb, inst);
+           } else if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+               DbgPrint("Delete buffer type close callback\n");
+               (void)slave_event_callback_del(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_close_buffer_cb, inst);
+           }
+       }
+    }
+
+    if (instance_unref(inst)) {
+       int ret;
 
+       /*!
+        * If the instance is not deleted, we should send pd-destroy event from here.
+        */
+       ret = instance_client_gbar_destroyed(inst, DBOX_STATUS_ERROR_NONE);
+       if (ret < 0) {
+           ErrPrint("Failed sending GBAR Destroy event (%d)\n", ret);
+       }
+    }
+
+    return ECORE_CALLBACK_CANCEL;
+}
+
+static struct packet *client_gbar_move(pid_t pid, int handle, const struct packet *packet) /* pkgname, id, x, y */
+{
+    struct client_node *client;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+    const char *pkgname;
+    const char *id;
+    double x = 0.0f;
+    double y = 0.0f;
+    int ret;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdd", &pkgname, &id, &x, &y);
+    if (ret != 4) {
+       ErrPrint("Parameter is not correct\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       instance_slave_set_gbar_pos(inst, x, y);
+       ret = instance_signal_emit(inst, "pd,move", instance_id(inst), 0.0, 0.0, 0.0, 0.0, x, y, 0);
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       int ix;
+       int iy;
+
+       instance_slave_set_gbar_pos(inst, x, y);
+       ix = x * instance_gbar_width(inst);
+       iy = y * instance_gbar_height(inst);
+       script_handler_update_pointer(instance_gbar_script(inst), ix, iy, 0);
+       ret = instance_signal_emit(inst, "pd,move", instance_id(inst), 0.0, 0.0, 0.0, 0.0, x, y, 0);
+    } else {
+       ErrPrint("Invalid GBAR type\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 out:
-       /*! \note No reply packet */
-       return NULL;
+    DbgPrint("Update GBAR position: %d\n", ret);
+    return NULL;
 }
 
-static struct packet *client_delete_category(pid_t pid, int handle, const struct packet *packet)
+static Eina_Bool gbar_open_monitor_cb(void *inst)
 {
-       const char *cluster;
-       const char *category;
-       struct client_node *client;
-       struct packet *result;
-       int ret;
+    struct pkg_info *pkg;
 
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
+    pkg = instance_package(inst);
+    if (pkg) {
+       struct slave_node *slave;
 
-       ret = packet_get(packet, "ss", &cluster, &category);
-       if (ret != 2) {
-               ErrPrint("Invalid paramenters\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
+       slave = package_slave(pkg);
+       if (slave) {
+           slave_event_callback_del(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_open_buffer_cb, inst);
        }
+    }
 
-       DbgPrint("pid[%d] cluster[%s] category[%s]\n", pid, cluster, category);
-       if (!strlen(cluster) || !strcasecmp(cluster, DEFAULT_CLUSTER)) {
-               ErrPrint("Invalid cluster: %s\n", cluster);
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
+    (void)instance_slave_close_gbar(inst, instance_gbar_owner(inst), DBOX_CLOSE_GBAR_TIMEOUT);
+    (void)instance_client_gbar_created(inst, DBOX_STATUS_ERROR_TIMEOUT);
+    (void)instance_del_data(inst, GBAR_OPEN_MONITOR_TAG);
+    (void)instance_unref(inst);
+    ErrPrint("GBAR Open request is timed-out (%lf)\n", DYNAMICBOX_CONF_GBAR_REQUEST_TIMEOUT);
+    return ECORE_CALLBACK_CANCEL;
+}
 
-       /*!
-        * \todo
-        */
-       ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+static Eina_Bool gbar_close_monitor_cb(void *inst)
+{
+    struct pkg_info *pkg;
 
-out:
-       result = packet_create_reply(packet, "i", ret);
-       if (!result) {
-               ErrPrint("Failed to create a packet\n");
+    pkg = instance_package(inst);
+    if (pkg) {
+       struct slave_node *slave;
+
+       slave = package_slave(pkg);
+       if (slave) {
+           slave_event_callback_del(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_close_buffer_cb, inst);
        }
+    }
 
-       return result;
+    (void)instance_client_gbar_destroyed(inst, DBOX_STATUS_ERROR_TIMEOUT);
+    (void)instance_del_data(inst, GBAR_CLOSE_MONITOR_TAG);
+    (void)instance_unref(inst);
+    ErrPrint("GBAR Close request is not processed in %lf seconds\n", DYNAMICBOX_CONF_GBAR_REQUEST_TIMEOUT);
+    return ECORE_CALLBACK_CANCEL;
 }
 
-static struct packet *client_unsubscribed(pid_t pid, int handle, const struct packet *packet)
+static Eina_Bool gbar_resize_monitor_cb(void *inst)
 {
-       const char *cluster;
-       const char *category;
-       struct client_node *client;
-       int ret;
+    struct pkg_info *pkg;
 
-       client = client_find_by_rpc_handle(handle);
-       if (!client) {
-               ErrPrint("Client %d is not exists\n", pid);
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
+    pkg = instance_package(inst);
+    if (pkg) {
+       struct slave_node *slave;
+       slave = package_slave(pkg);
+       if (slave) {
+           slave_event_callback_del(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_resize_buffer_cb, inst);
+       }
+    }
+
+    (void)instance_slave_close_gbar(inst, instance_gbar_owner(inst), DBOX_CLOSE_GBAR_TIMEOUT);
+    (void)instance_client_gbar_destroyed(inst, DBOX_STATUS_ERROR_TIMEOUT);
+    (void)instance_del_data(inst, GBAR_RESIZE_MONITOR_TAG);
+    (void)instance_unref(inst);
+    ErrPrint("GBAR Resize request is not processed in %lf seconds\n", DYNAMICBOX_CONF_GBAR_REQUEST_TIMEOUT);
+    return ECORE_CALLBACK_CANCEL;
+}
+
+static struct packet *client_create_gbar(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, ret */
+{
+    struct client_node *client;
+    struct packet *result;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    struct inst_info *inst = NULL;
+    const struct pkg_info *pkg = NULL;
+    Ecore_Timer *gbar_monitor;
+    double x;
+    double y;
+
+    DbgPrint("PERF_DBOX\n");
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdd", &pkgname, &id, &x, &y);
+    if (ret != 4) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (instance_gbar_owner(inst)) {
+       ErrPrint("GBAR is already owned\n");
+       ret = DBOX_STATUS_ERROR_ALREADY;
+    } else if (package_gbar_type(instance_package(inst)) == GBAR_TYPE_BUFFER) {
+       gbar_monitor = instance_get_data(inst, LAZY_GBAR_CLOSE_TAG);
+       if (gbar_monitor) {
+           ecore_timer_del(gbar_monitor);
+           /* This timer attribute will be deleted */
+           lazy_gbar_destroyed_cb(inst);
+       }
+
+       if (instance_get_data(inst, GBAR_OPEN_MONITOR_TAG)) {
+           DbgPrint("GBAR Open request is already processed\n");
+           ret = DBOX_STATUS_ERROR_ALREADY;
+           goto out;
+       }
+
+       if (instance_get_data(inst, GBAR_CLOSE_MONITOR_TAG)) {
+           DbgPrint("GBAR Close request is already in process\n");
+           ret = DBOX_STATUS_ERROR_BUSY;
+           goto out;
+       }
+
+       if (instance_get_data(inst, GBAR_RESIZE_MONITOR_TAG)) {
+           DbgPrint("GBAR resize request is already in process\n");
+           ret = DBOX_STATUS_ERROR_BUSY;
+           goto out;
+       }
+
+       instance_slave_set_gbar_pos(inst, x, y);
+       /*!
+        * \note
+        * Send request to the slave.
+        * The SLAVE must has to repsonse this via "release_buffer" method.
+        */
+       ret = instance_slave_open_gbar(inst, client);
+       if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+           ret = instance_signal_emit(inst, "gbar,show", instance_id(inst), 0.0, 0.0, 0.0, 0.0, x, y, 0);
+           if (ret != DBOX_STATUS_ERROR_NONE) {
+               int tmp_ret;
+
+               tmp_ret = instance_slave_close_gbar(inst, client, DBOX_CLOSE_GBAR_FAULT);
+               if (tmp_ret < 0) {
+                   ErrPrint("Unable to send script event for openning GBAR [%s], %d\n", pkgname, tmp_ret);
+               }
+           } else {
+               gbar_monitor = ecore_timer_add(DYNAMICBOX_CONF_GBAR_REQUEST_TIMEOUT, gbar_open_monitor_cb, instance_ref(inst));
+               if (!gbar_monitor) {
+                   (void)instance_unref(inst);
+                   ErrPrint("Failed to create a timer for GBAR Open monitor\n");
+               } else {
+                   struct slave_node *slave;
 
-       ret = packet_get(packet, "ss", &cluster, &category);
-       if (ret != 2) {
-               ErrPrint("Invalid argument\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
+                   (void)instance_set_data(inst, GBAR_OPEN_MONITOR_TAG, gbar_monitor);
 
-       DbgPrint("[%d] cluster[%s] category[%s]\n", pid, cluster, category);
+                   slave = package_slave(pkg);
+                   if (!slave) {
+                       ErrPrint("Failed to get slave(%s)\n", pkgname);
+                       goto out;
+                   }
 
-       if (!strlen(cluster) || !strcasecmp(cluster, DEFAULT_CLUSTER)) {
-               ErrPrint("Invalid cluster name: %s\n", cluster);
-               goto out;
+                   if (slave_event_callback_add(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_open_buffer_cb, inst) != DBOX_STATUS_ERROR_NONE) {
+                       ErrPrint("Failed to add fault handler: %s\n");
+                   }
+               }
+           }
+       } else {
+           ErrPrint("Unable to send request for openning GBAR [%s]\n", pkgname);
        }
 
        /*!
-        * \todo
-        * UNSUBSCRIBE cluster & sub-cluster for a client.
+        * \note
+        * GBAR craeted event will be send by the acquire_buffer function.
+        * Because the slave will make request the acquire_buffer to
+        * render the GBAR
+        *
+        * instance_client_gbar_created(inst);
         */
-       ret = client_unsubscribe(client, cluster, category);
-       if (ret == 0) {
-               package_alter_instances_to_client(client, ALTER_DESTROY);
+    } else if (package_gbar_type(instance_package(inst)) == GBAR_TYPE_SCRIPT) {
+       int ix;
+       int iy;
+
+       gbar_monitor = instance_get_data(inst, LAZY_GBAR_CLOSE_TAG);
+       if (gbar_monitor) {
+           ecore_timer_del(gbar_monitor);
+           /* lazy,pd,close will be deleted */
+           lazy_gbar_destroyed_cb(inst);
        }
 
-out:
-       /*! \note No reply packet */
-       return NULL;
-}
+       /*!
+        * \note
+        * ret value should be cared but in this case,
+        * we ignore this for this moment, so we have to handle this error later.
+        *
+        * if ret is less than 0, the slave has some problem.
+        * but the script mode doesn't need slave for rendering default view of GBAR
+        * so we can hanle it later.
+        */
+       instance_slave_set_gbar_pos(inst, x, y);
+       ix = x * instance_gbar_width(inst);
+       iy = y * instance_gbar_height(inst);
 
-static struct packet *slave_hello(pid_t pid, int handle, const struct packet *packet) /* slave_name, ret */
-{
-       struct slave_node *slave;
-       const char *slavename;
-       int ret;
+       script_handler_update_pointer(instance_gbar_script(inst), ix, iy, 0);
 
-       ret = packet_get(packet, "s", &slavename);
-       if (ret != 1) {
-               ErrPrint("Parameter is not matched\n");
-               goto out;
-       }
+       ret = instance_slave_open_gbar(inst, client);
+       if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+           ret = script_handler_load(instance_gbar_script(inst), 1);
 
-       DbgPrint("New slave[%s](%d) is arrived\n", slavename, pid);
+           /*!
+            * \note
+            * Send the GBAR created event to the clients,
+            */
+           if (ret == (int)DBOX_STATUS_ERROR_NONE) {
 
-       slave = slave_find_by_name(slavename);
+               /*!
+                * \note
+                * But the created event has to be send afte return
+                * from this function or the viewer couldn't care
+                * the event correctly.
+                */
+               inst = instance_ref(inst); /* To guarantee the inst */
 
-       if (!slave) { /* Try again to find a slave using pid */
-               slave = slave_find_by_pid(pid);
-       }
+               /*!
+                * \note
+                * At here, we don't need to rememeber the timer object.
+                * Even if the timer callback is called, after the instance is destroyed.
+                * lazy_gbar_created_cb will decrease the instance refcnt first.
+                * At that time, if the instance is released, the timer callback will do nothing.
+                *
+                * 13-05-28
+                * I change my mind. There is no requirements to keep the timer handler.
+                * But I just add it to the tagged-data of the instance.
+                * Just reserve for future-use.
+                */
+               gbar_monitor = ecore_timer_add(DELAY_TIME, lazy_gbar_created_cb, inst);
+               if (!gbar_monitor) {
+                   ret = script_handler_unload(instance_gbar_script(inst), 1);
+                   ErrPrint("Unload script: %d\n", ret);
 
-       if (!slave) {
-               if (DEBUG_MODE) {
-                       char pkgname[pathconf("/", _PC_PATH_MAX)];
-                       const char *abi;
-
-                       if (aul_app_get_pkgname_bypid(pid, pkgname, sizeof(pkgname)) != AUL_R_OK) {
-                               ErrPrint("pid[%d] is not authroized provider package, try to find it using its name[%s]\n", pid, slavename);
-                               slave = slave_find_by_name(slavename);
-                               pkgname[0] = '\0'; /* Reset the pkgname */
-                       } else {
-                               slave = slave_find_by_pkgname(pkgname);
-                       }
-
-                       if (!slave) {
-                               abi = abi_find_by_pkgname(pkgname);
-                               if (!abi) {
-                                       abi = DEFAULT_ABI;
-                                       DbgPrint("Slave pkgname is invalid, ABI is replaced with '%s'(default)\n", abi);
-                               }
-
-                               slave = slave_create(slavename, 1, abi, pkgname, 0);
-                               if (!slave) {
-                                       ErrPrint("Failed to create a new slave for %s\n", slavename);
-                                       goto out;
-                               }
-
-                               DbgPrint("New slave is created (net: 0)\n");
-                       } else {
-                               DbgPrint("Registered slave is replaced with this new one\n");
-                               abi = slave_abi(slave);
-                               if (!abi) {
-                                       ErrPrint("ABI is not valid: %s\n", slavename);
-                                       abi = DEFAULT_ABI;
-                               }
-                       }
-
-                       slave_set_pid(slave, pid);
-                       DbgPrint("Provider is forcely activated, pkgname(%s), abi(%s), slavename(%s)\n", pkgname, abi, slavename);
+                   ret = instance_slave_close_gbar(inst, client, DBOX_CLOSE_GBAR_NORMAL);
+                   ErrPrint("Close GBAR %d\n", ret);
+
+                   inst = instance_unref(inst);
+                   if (!inst) {
+                       DbgPrint("Instance destroyed\n");
+                   }
+
+                   ErrPrint("Instance: %s\n", pkgname);
+
+                   ret = DBOX_STATUS_ERROR_FAULT;
                } else {
-                       ErrPrint("Slave[%d, %s] is not exists\n", pid, slavename);
+                   struct slave_node *slave;
+
+                   (void)instance_set_data(inst, LAZY_GBAR_OPEN_TAG, gbar_monitor);
+
+                   slave = package_slave(pkg);
+                   if (!slave) {
+                       ErrPrint("Failed to get slave: %s\n", pkgname);
                        goto out;
+                   }
+
+                   if (slave_event_callback_add(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_open_script_cb, inst) != DBOX_STATUS_ERROR_NONE) {
+                       ErrPrint("Failed to add fault callback: %s\n", pkgname);
+                   }
                }
+           } else {
+               int tmp_ret;
+               tmp_ret = instance_slave_close_gbar(inst, client, DBOX_CLOSE_GBAR_FAULT);
+               if (tmp_ret < 0) {
+                   ErrPrint("Unable to load script: %d, (close: %d)\n", ret, tmp_ret);
+               }
+           }
+       } else {
+           ErrPrint("Unable open GBAR(%s): %d\n", pkgname, ret);
+       }
+    } else {
+       ErrPrint("Invalid GBAR TYPE\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *client_destroy_gbar(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, ret */
+{
+    struct client_node *client;
+    struct packet *result;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    struct inst_info *inst = NULL;
+    const struct pkg_info *pkg = NULL;
+    Ecore_Timer *gbar_monitor;
+    struct slave_node *slave;
+
+    DbgPrint("PERF_DBOX\n");
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ss", &pkgname, &id);
+    if (ret != 2) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    slave = package_slave(pkg);
+    if (!slave) {
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    if (instance_gbar_owner(inst) != client) {
+       if (instance_gbar_owner(inst) == NULL) {
+           ErrPrint("GBAR looks already closed\n");
+           ret = DBOX_STATUS_ERROR_ALREADY;
+       } else {
+           ErrPrint("GBAR owner mimatched\n");
+           ret = DBOX_STATUS_ERROR_PERMISSION_DENIED;
+       }
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       DbgPrint("Buffer type GBAR\n");
+       gbar_monitor = instance_del_data(inst, GBAR_OPEN_MONITOR_TAG);
+       if (gbar_monitor) {
+           ErrPrint("GBAR Open request is found. cancel it [%s]\n", pkgname);
+
+           if (slave_event_callback_del(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_open_buffer_cb, inst) < 0) {
+               DbgPrint("Failed to delete a deactivate callback\n");
+           }
+
+           /*!
+            * \note
+            * We should return negative value
+            * Or we have to send "destroyed" event to the client.
+            * If we didn't send destroyed event after return SUCCESS from here,
+            * The client will permanently waiting destroyed event.
+            * Because they understand that the destroy request is successfully processed.
+            */
+           ret = instance_client_gbar_created(inst, DBOX_STATUS_ERROR_CANCEL);
+           if (ret < 0) {
+               ErrPrint("GBAR client create event: %d\n", ret);
+           }
+
+           ret = instance_client_gbar_destroyed(inst, DBOX_STATUS_ERROR_NONE);
+           if (ret < 0) {
+               ErrPrint("GBAR client destroy event: %d\n", ret);
+           }
+
+           ret = instance_signal_emit(inst, "gbar,hide", instance_id(inst), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0);
+           if (ret < 0) {
+               ErrPrint("GBAR close signal emit failed: %d\n", ret);
+           }
+
+           ret = instance_slave_close_gbar(inst, client, DBOX_CLOSE_GBAR_NORMAL);
+           if (ret < 0) {
+               ErrPrint("GBAR close request failed: %d\n", ret);
+           }
+
+           ecore_timer_del(gbar_monitor);
+           inst = instance_unref(inst);
+           if (!inst) {
+               DbgPrint("Instance is deleted\n");
+           }
+       } else if (instance_get_data(inst, LAZY_GBAR_CLOSE_TAG) || instance_get_data(inst, GBAR_CLOSE_MONITOR_TAG)) {
+           DbgPrint("Close monitor is already fired\n");
+           ret = DBOX_STATUS_ERROR_ALREADY;
        } else {
-               if (slave_pid(slave) != pid) {
-                       if (slave_pid(slave) > 0) {
-                               CRITICAL_LOG("Slave(%s) is already assigned to %d\n", slave_name(slave), slave_pid(slave));
-                               if (pid > 0) {
-                                       ret = aul_terminate_pid(pid);
-                                       CRITICAL_LOG("Terminate %d (ret: %d)\n", pid, ret);
-                               }
-                               goto out;
-                       }
-                       CRITICAL_LOG("PID of slave(%s) is updated (%d -> %d)\n", slave_name(slave), slave_pid(slave), pid);
-                       slave_set_pid(slave, pid);
+           int resize_aborted = 0;
+
+           gbar_monitor = instance_del_data(inst, GBAR_RESIZE_MONITOR_TAG);
+           if (gbar_monitor) {
+               ErrPrint("GBAR Resize request is found. clear it [%s]\n", pkgname);
+               if (slave_event_callback_del(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_resize_buffer_cb, inst) < 0) {
+                   DbgPrint("Failed to delete a deactivate callback\n");
                }
+
+               ecore_timer_del(gbar_monitor);
+
+               inst = instance_unref(inst);
+               if (!inst) {
+                   DbgPrint("Instance is destroyed while resizing\n");
+                   goto out;
+               }
+
+               resize_aborted = 1;
+           }
+
+           ret = instance_signal_emit(inst, "gbar,hide", instance_id(inst), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0);
+           if (ret < 0) {
+               ErrPrint("GBAR close signal emit failed: %d\n", ret);
+           }
+
+           ret = instance_slave_close_gbar(inst, client, DBOX_CLOSE_GBAR_NORMAL);
+           if (ret < 0) {
+               ErrPrint("GBAR close request failed: %d\n", ret);
+           } else if (resize_aborted) {
+               gbar_monitor = ecore_timer_add(DELAY_TIME, lazy_gbar_destroyed_cb, instance_ref(inst));
+               if (!gbar_monitor) {
+                   ErrPrint("Failed to create a timer: %s\n", pkgname);
+                   inst = instance_unref(inst);
+                   if (!inst) {
+                       DbgPrint("Instance is deleted\n");
+                   }
+               } else {
+                   DbgPrint("Resize is aborted\n");
+                   (void)instance_set_data(inst, LAZY_GBAR_CLOSE_TAG, gbar_monitor);
+                   if (slave_event_callback_add(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_close_buffer_cb, inst) < 0) {
+                       ErrPrint("Failed to add a slave event callback\n");
+                   }
+               }
+           } else {
+               gbar_monitor = ecore_timer_add(DYNAMICBOX_CONF_GBAR_REQUEST_TIMEOUT, gbar_close_monitor_cb, instance_ref(inst));
+               if (!gbar_monitor) {
+                   ErrPrint("Failed to add pd close monitor\n");
+                   inst = instance_unref(inst);
+                   if (!inst) {
+                       ErrPrint("Instance is deleted while closing GBAR\n");
+                   }
+               } else {
+                   DbgPrint("Add close monitor\n");
+                   (void)instance_set_data(inst, GBAR_CLOSE_MONITOR_TAG, gbar_monitor);
+                   if (slave_event_callback_add(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_close_buffer_cb, inst) < 0) {
+                       ErrPrint("Failed to add SLAVE EVENT callback\n");
+                   }
+               }
+           }
+
+           /*!
+            * \note
+            * release_buffer will be called by the slave after this routine.
+            * It will send the "gbar_destroyed" event to the client
+            *
+            * instance_client_gbar_destroyed(inst, DBOX_STATUS_ERROR_NONE);
+            *
+            * Or the "gbar_close_monitor_cb" or "lazy_gbar_destroyed_cb" will be called.
+            */
+       }
+    } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
+       DbgPrint("Script TYPE GBAR\n");
+       gbar_monitor = instance_get_data(inst, LAZY_GBAR_OPEN_TAG);
+       if (gbar_monitor) {
+           ecore_timer_del(gbar_monitor);
+           (void)lazy_gbar_created_cb(inst);
+       }
+
+       ret = script_handler_unload(instance_gbar_script(inst), 1);
+       if (ret < 0) {
+           ErrPrint("Unable to unload the script: %s, %d\n", pkgname, ret);
+       }
+
+       /*!
+        * \note
+        * Send request to the slave.
+        * The SLAVE must has to repsonse this via "release_buffer" method.
+        */
+       ret = instance_slave_close_gbar(inst, client, DBOX_CLOSE_GBAR_NORMAL);
+       if (ret < 0) {
+           ErrPrint("Unable to close the GBAR: %s, %d\n", pkgname, ret);
        }
 
        /*!
         * \note
-        * After updating handle,
-        * slave activated callback will be called.
+        * Send the destroyed GBAR event to the client
         */
-       slave_rpc_update_handle(slave, handle);
+       if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+           /*!
+            * \note
+            * 13-05-28
+            * I've changed my mind. There is no requirements to keep the timer handler.
+            * But I just add it to the tagged-data of the instance.
+            * Just reserve for future-use.
+            */
+           DbgPrint("Add lazy GBAR destroy timer\n");
+           gbar_monitor = ecore_timer_add(DELAY_TIME, lazy_gbar_destroyed_cb, instance_ref(inst));
+           if (!gbar_monitor) {
+               ErrPrint("Failed to create a timer: %s\n", pkgname);
+               inst = instance_unref(inst);
+               if (!inst) {
+                   DbgPrint("instance is deleted\n");
+               }
+           } else {
+               (void)instance_set_data(inst, LAZY_GBAR_CLOSE_TAG, gbar_monitor);
+               if (slave_event_callback_add(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_close_script_cb, inst) < 0) {
+                   ErrPrint("Failed to add a event callback for slave\n");
+               }
+           }
+       }
+    } else {
+       ErrPrint("Invalid GBAR TYPE\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
 out:
-       return NULL;
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a packet\n");
+    }
+
+    return result;
 }
 
-static struct packet *slave_ctrl(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_activate_package(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, ret */
 {
-       struct slave_node *slave;
-       int ctrl;
-       int ret;
-
-       slave = slave_find_by_pid(pid);
-       if (!slave) {
-               ErrPrint("Slave %d is not exists\n", pid);
-               goto out;
-       }
-
-       ret = packet_get(packet, "i", &ctrl);
-       if (ret != 1) {
-               ErrPrint("Parameter is not matched\n");
-       } else {
-               slave_set_control_option(slave, ctrl);
-       }
+    struct client_node *client;
+    struct packet *result;
+    const char *pkgname;
+    int ret;
+    struct pkg_info *info;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       pkgname = "";
+       goto out;
+    }
+
+    ret = packet_get(packet, "s", &pkgname);
+    if (ret != 1) {
+       ErrPrint("Parameter is not matched\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       pkgname = "";
+       goto out;
+    }
+
+    DbgPrint("pid[%d] pkgname[%s]\n", pid, pkgname);
+
+    /*!
+     * \NOTE:
+     * Validate the dynamicbox package name.
+     */
+    if (!package_is_dbox_pkgname(pkgname)) {
+       ErrPrint("%s is not a valid dynamicbox package\n", pkgname);
+       pkgname = "";
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    info = package_find(pkgname);
+    if (!info) {
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+    } else {
+       ret = package_clear_fault(info);
+    }
 
 out:
-       return NULL;
+    result = packet_create_reply(packet, "is", ret, pkgname);
+    if (!result) {
+       ErrPrint("Failed to create a packet\n");
+    }
+
+    return result;
 }
 
-static struct packet *slave_ping(pid_t pid, int handle, const struct packet *packet) /* slave_name, ret */
+static struct packet *client_subscribed(pid_t pid, int handle, const struct packet *packet)
 {
-       struct slave_node *slave;
-       const char *slavename;
-       int ret;
+    const char *cluster;
+    const char *category;
+    struct client_node *client;
+    int ret;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ss", &cluster, &category);
+    if (ret != 2) {
+       ErrPrint("Invalid argument\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    DbgPrint("[%d] cluster[%s] category[%s]\n", pid, cluster, category);
+    if (!strlen(cluster) || !strcasecmp(cluster, DYNAMICBOX_CONF_DEFAULT_CLUSTER)) {
+       ErrPrint("Invalid cluster name\n");
+       goto out;
+    }
+
+    /*!
+     * \todo
+     * SUBSCRIBE cluster & sub-cluster for a client.
+     */
+    ret = client_subscribe(client, cluster, category);
+    if (ret == 0) {
+       package_alter_instances_to_client(client, ALTER_CREATE);
+    }
 
-       slave = slave_find_by_pid(pid);
-       if (!slave) {
-               ErrPrint("Slave %d is not exists\n", pid);
-               goto out;
-       }
+out:
+    /*! \note No reply packet */
+    return NULL;
+}
 
-       ret = packet_get(packet, "s", &slavename);
-       if (ret != 1) {
-               ErrPrint("Parameter is not matched\n");
-       } else {
-               slave_rpc_ping(slave);
-       }
+static struct packet *client_delete_cluster(pid_t pid, int handle, const struct packet *packet)
+{
+    const char *cluster;
+    struct client_node *client;
+    struct packet *result;
+    int ret;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "s", &cluster);
+    if (ret != 1) {
+       ErrPrint("Invalid parameters\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    DbgPrint("pid[%d] cluster[%s]\n", pid, cluster);
+
+    if (!strlen(cluster) || !strcasecmp(cluster, DYNAMICBOX_CONF_DEFAULT_CLUSTER)) {
+       ErrPrint("Invalid cluster: %s\n", cluster);
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    /*!
+     * \todo
+     */
+    ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
 
 out:
-       return NULL;
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a packet\n");
+    }
+
+    return result;
 }
 
-static struct packet *slave_faulted(pid_t pid, int handle, const struct packet *packet)
+static inline int update_pkg_cb(struct category *category, const char *pkgname, int force)
 {
-       struct slave_node *slave;
-       struct pkg_info *pkg;
-       const char *pkgname;
-       const char *id;
-       const char *func;
-       int ret;
+    const char *c_name;
+    const char *s_name;
 
-       slave = slave_find_by_pid(pid);
-       if (!slave) {
-               ErrPrint("Slave %d is not exists\n", pid);
-               goto out;
-       }
+    c_name = group_cluster_name_by_category(category);
+    s_name = group_category_name(category);
 
-       ret = packet_get(packet, "sss", &pkgname, &id, &func);
-       if (ret != 3) {
-               ErrPrint("Parameter is not matched\n");
-               goto out;
-       }
+    if (!c_name || !s_name || !pkgname) {
+       ErrPrint("Name is not valid\n");
+       return EXIT_FAILURE;
+    }
 
-       ret = fault_info_set(slave, pkgname, id, func);
-       DbgPrint("Slave Faulted: %s (%d)\n", slave_name(slave), ret);
+    DbgPrint("Send refresh request: %s (%s/%s)\n", pkgname, c_name, s_name);
+    slave_rpc_request_update(pkgname, "", c_name, s_name, NULL, force);
 
-       pkg = package_find(pkgname);
-       if (!pkg) {
-               ErrPrint("There is no package info found: %s\n", pkgname);
-       } else {
-               package_faulted(pkg, 0);
+    /* Just try to create a new package */
+    if (util_free_space(DYNAMICBOX_CONF_IMAGE_PATH) > DYNAMICBOX_CONF_MINIMUM_SPACE) {
+       double timestamp;
+       struct inst_info *inst;
+
+       timestamp = util_timestamp();
+       /*!
+        * \NOTE
+        * Don't need to check the subscribed clients.
+        * Because this callback is called by the requests of clients.
+        * It means. some clients wants to handle this instances ;)
+        */
+       inst = instance_create(NULL, timestamp, pkgname, "", c_name, s_name, DYNAMICBOX_CONF_DEFAULT_PERIOD, 0, 0);
+       if (!inst) {
+           ErrPrint("Failed to create a new instance\n");
        }
+    }
+
+    return EXIT_SUCCESS;
+}
+
+static struct packet *client_update(pid_t pid, int handle, const struct packet *packet)
+{
+    struct inst_info *inst;
+    struct client_node *client;
+    const char *pkgname;
+    const char *id;
+    int force;
+    int ret;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Cilent %d is not exists\n", pid);
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssi", &pkgname, &id, &force);
+    if (ret != 3) {
+       ErrPrint("Invalid argument\n");
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, NULL);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (instance_client(inst) != client) {
+       /* PERMISSIONS */
+       ErrPrint("Insufficient permissions [%s] - %d\n", pkgname, pid);
+    } else {
+       slave_rpc_request_update(pkgname, id, instance_cluster(inst), instance_category(inst), NULL, force);
+    }
 
 out:
-       return NULL;
+    /*! \note No reply packet */
+    return NULL;
 }
 
-static struct packet *slave_lb_update_begin(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_refresh_group(pid_t pid, int handle, const struct packet *packet)
 {
-       struct slave_node *slave;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-       const char *pkgname;
-       const char *id;
-       double priority;
-       const char *content;
-       const char *title;
-       int ret;
+    const char *cluster_id;
+    const char *category_id;
+    struct client_node *client;
+    int ret;
+    struct cluster *cluster;
+    struct category *category;
+    struct context_info *info;
+    Eina_List *info_list;
+    Eina_List *l;
+    int force;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Cilent %d is not exists\n", pid);
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssi", &cluster_id, &category_id, &force);
+    if (ret != 3) {
+       ErrPrint("Invalid parameter\n");
+       goto out;
+    }
+
+    DbgPrint("[%d] cluster[%s] category[%s]\n", pid, cluster_id, category_id);
+
+    if (!strlen(cluster_id) || !strcasecmp(cluster_id, DYNAMICBOX_CONF_DEFAULT_CLUSTER)) {
+       ErrPrint("Invalid cluster name: %s\n", cluster_id);
+       goto out;
+    }
+
+    cluster = group_find_cluster(cluster_id);
+    if (!cluster) {
+       ErrPrint("Cluster [%s] is not registered\n", cluster_id);
+       goto out;
+    }
+
+    category = group_find_category(cluster, category_id);
+    if (!category) {
+       ErrPrint("Category [%s] is not registered\n", category_id);
+       goto out;
+    }
+
+    info_list = group_context_info_list(category);
+    EINA_LIST_FOREACH(info_list, l, info) {
+       update_pkg_cb(category, group_pkgname_from_context_info(info), force);
+    }
 
-       slave = slave_find_by_pid(pid);
-       if (!slave) {
-               ErrPrint("Slave %d is not exists\n", pid);
-               goto out;
-       }
+out:
+    /*! \note No reply packet */
+    return NULL;
+}
 
-       ret = packet_get(packet, "ssdss", &pkgname, &id, &priority, &content, &title);
-       if (ret != 5) {
-               ErrPrint("Invalid parameters\n");
-               goto out;
-       }
+static struct packet *client_delete_category(pid_t pid, int handle, const struct packet *packet)
+{
+    const char *cluster;
+    const char *category;
+    struct client_node *client;
+    struct packet *result;
+    int ret;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ss", &cluster, &category);
+    if (ret != 2) {
+       ErrPrint("Invalid paramenters\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    DbgPrint("pid[%d] cluster[%s] category[%s]\n", pid, cluster, category);
+    if (!strlen(cluster) || !strcasecmp(cluster, DYNAMICBOX_CONF_DEFAULT_CLUSTER)) {
+       ErrPrint("Invalid cluster: %s\n", cluster);
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    /*!
+     * \todo
+     */
+    ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
 
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
+out:
+    result = packet_create_reply(packet, "i", ret);
+    if (!result) {
+       ErrPrint("Failed to create a packet\n");
+    }
 
-       if (instance_state(inst) == INST_DESTROYED) {
-               ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
-               goto out;
-       }
+    return result;
+}
 
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = instance_lb_update_begin(inst, priority, content, title);
-               if (ret == (int)LB_STATUS_SUCCESS) {
-                       slave_freeze_ttl(slave);
-               }
-       } else {
-               ErrPrint("Invalid request[%s]\n", id);
-       }
+static struct packet *client_unsubscribed(pid_t pid, int handle, const struct packet *packet)
+{
+    const char *cluster;
+    const char *category;
+    struct client_node *client;
+    int ret;
+
+    client = client_find_by_rpc_handle(handle);
+    if (!client) {
+       ErrPrint("Client %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    ret = packet_get(packet, "ss", &cluster, &category);
+    if (ret != 2) {
+       ErrPrint("Invalid argument\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    DbgPrint("[%d] cluster[%s] category[%s]\n", pid, cluster, category);
+
+    if (!strlen(cluster) || !strcasecmp(cluster, DYNAMICBOX_CONF_DEFAULT_CLUSTER)) {
+       ErrPrint("Invalid cluster name: %s\n", cluster);
+       goto out;
+    }
+
+    /*!
+     * \todo
+     * UNSUBSCRIBE cluster & sub-cluster for a client.
+     */
+    ret = client_unsubscribe(client, cluster, category);
+    if (ret == 0) {
+       package_alter_instances_to_client(client, ALTER_DESTROY);
+    }
 
 out:
-       return NULL;
+    /*! \note No reply packet */
+    return NULL;
 }
 
-static struct packet *slave_lb_update_end(pid_t pid, int handle, const struct packet *packet)
+static struct packet *slave_hello(pid_t pid, int handle, const struct packet *packet) /* slave_name, ret */
 {
-       struct slave_node *slave;
-       struct inst_info *inst;
-       const struct pkg_info *pkg;
-       const char *pkgname;
-       const char *id;
-       int ret;
+    struct slave_node *slave;
+    const char *slavename;
+    int ret;
 
-       slave = slave_find_by_pid(pid);
-       if (!slave) {
-               ErrPrint("Slave %d is not exists\n", pid);
-               goto out;
-       }
+    ret = packet_get(packet, "s", &slavename);
+    if (ret != 1) {
+       ErrPrint("Parameter is not matched\n");
+       goto out;
+    }
 
-       ret = packet_get(packet, "ss", &pkgname, &id);
-       if (ret != 2) {
-               ErrPrint("Invalid parameters\n");
-               goto out;
-       }
+    DbgPrint("New slave[%s](%d) is arrived\n", slavename, pid);
 
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
+    slave = slave_find_by_name(slavename);
 
-       if (instance_state(inst) == INST_DESTROYED) {
-               ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
-               goto out;
+    if (!slave) { /* Try again to find a slave using pid */
+       slave = slave_find_by_pid(pid);
+    }
+
+    if (!slave) {
+       if (DYNAMICBOX_CONF_DEBUG_MODE || g_conf.debug_mode) {
+           char pkgname[pathconf("/", _PC_PATH_MAX)];
+           const char *abi;
+
+           if (aul_app_get_pkgname_bypid(pid, pkgname, sizeof(pkgname)) != AUL_R_OK) {
+               ErrPrint("pid[%d] is not authroized provider package, try to find it using its name[%s]\n", pid, slavename);
+               slave = slave_find_by_name(slavename);
+               pkgname[0] = '\0'; /* Reset the pkgname */
+           } else {
+               slave = slave_find_by_pkgname(pkgname);
+           }
+
+           if (!slave) {
+               abi = abi_find_by_pkgname(pkgname);
+               if (!abi) {
+                   abi = DYNAMICBOX_CONF_DEFAULT_ABI;
+                   DbgPrint("Slave pkgname is invalid, ABI is replaced with '%s'(default)\n", abi);
+               }
+
+               slave = slave_create(slavename, 1, abi, pkgname, 0);
+               if (!slave) {
+                   ErrPrint("Failed to create a new slave for %s\n", slavename);
+                   goto out;
+               }
+
+               DbgPrint("New slave is created (net: 0)\n");
+           } else {
+               DbgPrint("Registered slave is replaced with this new one\n");
+               abi = slave_abi(slave);
+               if (!abi) {
+                   ErrPrint("ABI is not valid: %s\n", slavename);
+                   abi = DYNAMICBOX_CONF_DEFAULT_ABI;
+               }
+           }
+
+           slave_set_pid(slave, pid);
+           DbgPrint("Provider is forcely activated, pkgname(%s), abi(%s), slavename(%s)\n", pkgname, abi, slavename);
+       } else {
+           ErrPrint("Slave[%d, %s] is not exists\n", pid, slavename);
+           goto out;
        }
-
-       if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               ret = instance_lb_update_end(inst);
-               if (ret == (int)LB_STATUS_SUCCESS) {
-                       slave_thaw_ttl(slave);
+    } else {
+       if (slave_pid(slave) != pid) {
+           if (slave_pid(slave) > 0) {
+               CRITICAL_LOG("Slave(%s) is already assigned to %d\n", slave_name(slave), slave_pid(slave));
+               if (pid > 0) {
+                   ret = aul_terminate_pid(pid);
+                   CRITICAL_LOG("Terminate %d (ret: %d)\n", pid, ret);
                }
-       } else {
-               ErrPrint("Invalid request[%s]\n", id);
+               goto out;
+           }
+           CRITICAL_LOG("PID of slave(%s) is updated (%d -> %d)\n", slave_name(slave), slave_pid(slave), pid);
+           slave_set_pid(slave, pid);
        }
+    }
+
+    /*!
+     * \note
+     * After updating handle,
+     * slave activated callback will be called.
+     */
+    slave_rpc_update_handle(slave, handle);
 
 out:
-       return NULL;
+    return NULL;
 }
 
-static struct packet *slave_pd_update_begin(pid_t pid, int handle, const struct packet *packet)
+static struct packet *slave_ctrl(pid_t pid, int handle, const struct packet *packet)
 {
-       struct slave_node *slave;
-       const struct pkg_info *pkg;
-       struct inst_info *inst;
-       const char *pkgname;
-       const char *id;
-       int ret;
-
-       slave = slave_find_by_pid(pid);
-       if (!slave) {
-               ErrPrint("Slave %d is not exists\n", pid);
-               goto out;
-       }
-
-       ret = packet_get(packet, "ss", &pkgname, &id);
-       if (ret != 2) {
-               ErrPrint("Invalid parameters\n");
-               goto out;
-       }
-
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
-
-       if (instance_state(inst) == INST_DESTROYED) {
-               ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
-               goto out;
-       }
+    struct slave_node *slave;
+    int ctrl;
+    int ret;
 
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               (void)instance_pd_update_begin(inst);
-       } else {
-               ErrPrint("Invalid request[%s]\n", id);
-       }
+    slave = slave_find_by_pid(pid);
+    if (!slave) {
+       ErrPrint("Slave %d is not exists\n", pid);
+       goto out;
+    }
+
+    ret = packet_get(packet, "i", &ctrl);
+    if (ret != 1) {
+       ErrPrint("Parameter is not matched\n");
+    } else {
+       slave_set_control_option(slave, ctrl);
+    }
 
 out:
-       return NULL;
+    return NULL;
 }
 
-static struct packet *slave_key_status(pid_t pid, int handle, const struct packet *packet)
+static struct packet *slave_ping(pid_t pid, int handle, const struct packet *packet) /* slave_name, ret */
 {
-       struct slave_node *slave;
-       struct inst_info *inst;
-       const char *pkgname;
-       const char *id;
-       int status;
-       int ret;
+    struct slave_node *slave;
+    const char *slavename;
+    int ret;
 
-       slave = slave_find_by_pid(pid);
-       if (!slave) {
-               ErrPrint("Slave %d is not exists\n", pid);
-               goto out;
-       }
+    slave = slave_find_by_pid(pid);
+    if (!slave) {
+       ErrPrint("Slave %d is not exists\n", pid);
+       goto out;
+    }
 
-       ret = packet_get(packet, "ssi", &pkgname, &id, &status);
-       if (ret != 3) {
-               ErrPrint("Invalid parameters\n");
-               goto out;
-       }
+    ret = packet_get(packet, "s", &slavename);
+    if (ret != 1) {
+       ErrPrint("Parameter is not matched\n");
+    } else {
+       slave_rpc_ping(slave);
+    }
 
-       ret = validate_request(pkgname, id, &inst, NULL);
-       if (ret == (int)LB_STATUS_SUCCESS) {
-               if (instance_state(inst) == INST_DESTROYED) {
-                       ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
-               } else {
-                       (void)instance_forward_packet(inst, packet_ref((struct packet *)packet));
-               }
-       }
+out:
+    return NULL;
+}
+
+static struct packet *slave_faulted(pid_t pid, int handle, const struct packet *packet)
+{
+    struct slave_node *slave;
+    struct pkg_info *pkg;
+    const char *pkgname;
+    const char *id;
+    const char *func;
+    int ret;
+
+    slave = slave_find_by_pid(pid);
+    if (!slave) {
+       ErrPrint("Slave %d is not exists\n", pid);
+       goto out;
+    }
+
+    ret = packet_get(packet, "sss", &pkgname, &id, &func);
+    if (ret != 3) {
+       ErrPrint("Parameter is not matched\n");
+       goto out;
+    }
+
+    ret = fault_info_set(slave, pkgname, id, func);
+    DbgPrint("Slave Faulted: %s (%d)\n", slave_name(slave), ret);
+
+    pkg = package_find(pkgname);
+    if (!pkg) {
+       ErrPrint("There is no package info found: %s\n", pkgname);
+    } else {
+       package_faulted(pkg, 0);
+    }
 
 out:
-       return NULL;
+    return NULL;
+}
+
+static struct packet *slave_dbox_update_begin(pid_t pid, int handle, const struct packet *packet)
+{
+    struct slave_node *slave;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+    const char *pkgname;
+    const char *id;
+    double priority;
+    const char *content;
+    const char *title;
+    int ret;
+
+    slave = slave_find_by_pid(pid);
+    if (!slave) {
+       ErrPrint("Slave %d is not exists\n", pid);
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssdss", &pkgname, &id, &priority, &content, &title);
+    if (ret != 5) {
+       ErrPrint("Invalid parameters\n");
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (instance_state(inst) == INST_DESTROYED) {
+       ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = instance_dbox_update_begin(inst, priority, content, title);
+       if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+           slave_freeze_ttl(slave);
+       }
+    } else {
+       ErrPrint("Invalid request[%s]\n", id);
+    }
+
+out:
+    return NULL;
 }
 
-static struct packet *slave_access_status(pid_t pid, int handle, const struct packet *packet)
+static struct packet *slave_dbox_update_end(pid_t pid, int handle, const struct packet *packet)
 {
-       struct slave_node *slave;
-       struct inst_info *inst;
-       const char *pkgname;
-       const char *id;
-       int status;
-       int ret;
+    struct slave_node *slave;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+    const char *pkgname;
+    const char *id;
+    int ret;
 
-       slave = slave_find_by_pid(pid);
-       if (!slave) {
-               ErrPrint("Slave %d is not exists\n", pid);
-               goto out;
-       }
+    slave = slave_find_by_pid(pid);
+    if (!slave) {
+       ErrPrint("Slave %d is not exists\n", pid);
+       goto out;
+    }
 
-       ret = packet_get(packet, "ssi", &pkgname, &id, &status);
-       if (ret != 3) {
-               ErrPrint("Invalid parameters\n");
-               goto out;
-       }
+    ret = packet_get(packet, "ss", &pkgname, &id);
+    if (ret != 2) {
+       ErrPrint("Invalid parameters\n");
+       goto out;
+    }
 
-       ret = validate_request(pkgname, id, &inst, NULL);
-       if (ret == (int)LB_STATUS_SUCCESS) {
-               if (instance_state(inst) == INST_DESTROYED) {
-                       ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
-               } else {
-                       (void)instance_forward_packet(inst, packet_ref((struct packet *)packet));
-               }
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (instance_state(inst) == INST_DESTROYED) {
+       ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
+       goto out;
+    }
+
+    if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       ret = instance_dbox_update_end(inst);
+       if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+           slave_thaw_ttl(slave);
        }
+    } else {
+       ErrPrint("Invalid request[%s]\n", id);
+    }
 
 out:
-       return NULL;
+    return NULL;
+}
+
+static struct packet *slave_gbar_update_begin(pid_t pid, int handle, const struct packet *packet)
+{
+    struct slave_node *slave;
+    const struct pkg_info *pkg;
+    struct inst_info *inst;
+    const char *pkgname;
+    const char *id;
+    int ret;
+
+    slave = slave_find_by_pid(pid);
+    if (!slave) {
+       ErrPrint("Slave %d is not exists\n", pid);
+       goto out;
+    }
+
+    ret = packet_get(packet, "ss", &pkgname, &id);
+    if (ret != 2) {
+       ErrPrint("Invalid parameters\n");
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (instance_state(inst) == INST_DESTROYED) {
+       ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       (void)instance_gbar_update_begin(inst);
+    } else {
+       ErrPrint("Invalid request[%s]\n", id);
+    }
+
+out:
+    return NULL;
 }
 
-static struct packet *slave_close_pd(pid_t pid, int handle, const struct packet *packet)
+static struct packet *slave_key_status(pid_t pid, int handle, const struct packet *packet)
 {
-       struct slave_node *slave;
-       struct inst_info *inst;
-       const char *pkgname;
-       const char *id;
-       int status;
-       int ret;
-
-       slave = slave_find_by_pid(pid);
-       if (!slave) {
-               ErrPrint("Slave %d is not exists\n", pid);
-               goto out;
+    struct slave_node *slave;
+    struct inst_info *inst;
+    const char *pkgname;
+    const char *id;
+    int status;
+    int ret;
+
+    slave = slave_find_by_pid(pid);
+    if (!slave) {
+       ErrPrint("Slave %d is not exists\n", pid);
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssi", &pkgname, &id, &status);
+    if (ret != 3) {
+       ErrPrint("Invalid parameters\n");
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, NULL);
+    if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+       if (instance_state(inst) == INST_DESTROYED) {
+           ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
+       } else {
+           (void)instance_forward_packet(inst, packet_ref((struct packet *)packet));
        }
+    }
 
-       ret = packet_get(packet, "ssi", &pkgname, &id, &status);
-       if (ret != 3) {
-               ErrPrint("Invalid parameters\n");
-               goto out;
-       }
+out:
+    return NULL;
+}
 
-       ret = validate_request(pkgname, id, &inst, NULL);
-       if (ret == (int)LB_STATUS_SUCCESS) {
-               if (instance_state(inst) == INST_DESTROYED) {
-                       ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
-               } else {
-                       (void)instance_forward_packet(inst, packet_ref((struct packet *)packet));
-               }
+static struct packet *slave_access_status(pid_t pid, int handle, const struct packet *packet)
+{
+    struct slave_node *slave;
+    struct inst_info *inst;
+    const char *pkgname;
+    const char *id;
+    int status;
+    int ret;
+
+    slave = slave_find_by_pid(pid);
+    if (!slave) {
+       ErrPrint("Slave %d is not exists\n", pid);
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssi", &pkgname, &id, &status);
+    if (ret != 3) {
+       ErrPrint("Invalid parameters\n");
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, NULL);
+    if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+       if (instance_state(inst) == INST_DESTROYED) {
+           ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
+       } else {
+           (void)instance_forward_packet(inst, packet_ref((struct packet *)packet));
        }
+    }
 
 out:
-       return NULL;
+    return NULL;
 }
 
-static struct packet *slave_pd_update_end(pid_t pid, int handle, const struct packet *packet)
+static struct packet *slave_close_gbar(pid_t pid, int handle, const struct packet *packet)
 {
-       struct slave_node *slave;
-       const struct pkg_info *pkg;
-       struct inst_info *inst;
-       const char *pkgname;
-       const char *id;
-       int ret;
-
-       slave = slave_find_by_pid(pid);
-       if (!slave) {
-               ErrPrint("Slave %d is not exists\n", pid);
-               goto out;
-       }
+    struct slave_node *slave;
+    struct inst_info *inst;
+    const char *pkgname;
+    const char *id;
+    int status;
+    int ret;
 
-       ret = packet_get(packet, "ss", &pkgname, &id);
-       if (ret != 2) {
-               ErrPrint("Invalid parameters\n");
-               goto out;
-       }
+    slave = slave_find_by_pid(pid);
+    if (!slave) {
+       ErrPrint("Slave %d is not exists\n", pid);
+       goto out;
+    }
 
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
+    ret = packet_get(packet, "ssi", &pkgname, &id, &status);
+    if (ret != 3) {
+       ErrPrint("Invalid parameters\n");
+       goto out;
+    }
 
+    ret = validate_request(pkgname, id, &inst, NULL);
+    if (ret == (int)DBOX_STATUS_ERROR_NONE) {
        if (instance_state(inst) == INST_DESTROYED) {
-               ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
-               goto out;
-       }
-
-       if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               (void)instance_pd_update_end(inst);
+           ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
        } else {
-               ErrPrint("Invalid request[%s]\n", id);
+           (void)instance_forward_packet(inst, packet_ref((struct packet *)packet));
        }
+    }
 
 out:
-       return NULL;
+    return NULL;
+}
+
+static struct packet *slave_gbar_update_end(pid_t pid, int handle, const struct packet *packet)
+{
+    struct slave_node *slave;
+    const struct pkg_info *pkg;
+    struct inst_info *inst;
+    const char *pkgname;
+    const char *id;
+    int ret;
+
+    slave = slave_find_by_pid(pid);
+    if (!slave) {
+       ErrPrint("Slave %d is not exists\n", pid);
+       goto out;
+    }
+
+    ret = packet_get(packet, "ss", &pkgname, &id);
+    if (ret != 2) {
+       ErrPrint("Invalid parameters\n");
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (instance_state(inst) == INST_DESTROYED) {
+       ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
+       goto out;
+    }
+
+    if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       (void)instance_gbar_update_end(inst);
+    } else {
+       ErrPrint("Invalid request[%s]\n", id);
+    }
+
+out:
+    return NULL;
 }
 
 static struct packet *slave_call(pid_t pid, int handle, const struct packet *packet) /* slave_name, pkgname, filename, function, ret */
 {
-       struct slave_node *slave;
-       const char *pkgname;
-       const char *id;
-       const char *func;
-       int ret;
+    struct slave_node *slave;
+    const char *pkgname;
+    const char *id;
+    const char *func;
+    int ret;
 
-       slave = slave_find_by_pid(pid);
-       if (!slave) {
-               ErrPrint("Slave %d is not exists\n", pid);
-               goto out;
-       }
+    slave = slave_find_by_pid(pid);
+    if (!slave) {
+       ErrPrint("Slave %d is not exists\n", pid);
+       goto out;
+    }
 
-       ret = packet_get(packet, "sss", &pkgname, &id, &func);
-       if (ret != 3) {
-               ErrPrint("Parameter is not matched\n");
-               goto out;
-       }
+    ret = packet_get(packet, "sss", &pkgname, &id, &func);
+    if (ret != 3) {
+       ErrPrint("Parameter is not matched\n");
+       goto out;
+    }
 
-       ret = fault_func_call(slave, pkgname, id, func);
-       slave_give_more_ttl(slave);
+    ret = fault_func_call(slave, pkgname, id, func);
+    slave_give_more_ttl(slave);
 
 out:
-       return NULL;
+    return NULL;
 }
 
 static struct packet *slave_ret(pid_t pid, int handle, const struct packet *packet) /* slave_name, pkgname, filename, function, ret */
 {
-       struct slave_node *slave;
-       const char *pkgname;
-       const char *id;
-       const char *func;
-       int ret;
+    struct slave_node *slave;
+    const char *pkgname;
+    const char *id;
+    const char *func;
+    int ret;
 
-       slave = slave_find_by_pid(pid);
-       if (!slave) {
-               ErrPrint("Slave %d is not exists\n", pid);
-               goto out;
+    slave = slave_find_by_pid(pid);
+    if (!slave) {
+       ErrPrint("Slave %d is not exists\n", pid);
+       goto out;
+    }
+
+    ret = packet_get(packet, "sss", &pkgname, &id, &func);
+    if (ret != 3) {
+       ErrPrint("Parameter is not matched\n");
+       goto out;
+    }
+
+    ret = fault_func_ret(slave, pkgname, id, func);
+    slave_give_more_ttl(slave);
+
+out:
+    return NULL;
+}
+
+static struct packet *slave_extra_info(pid_t pid, int handle, const struct packet *packet)
+{
+    struct slave_node *slave;
+    const char *pkgname;
+    const char *id;
+    const char *content_info;
+    const char *title;
+    const char *icon;
+    const char *name;
+    double priority;
+    int ret;
+    struct inst_info *inst;
+
+    slave = slave_find_by_pid(pid);
+    if (!slave) {
+       ErrPrint("Slave %d is not exists\n", pid);
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssssssd", &pkgname, &id, &content_info, &title, &icon, &name, &priority);
+    if (ret != 7) {
+       ErrPrint("Parameter is not matchd\n");
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, NULL);
+    if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+       if (instance_state(inst) == INST_DESTROYED) {
+           ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
+           goto out;
        }
 
-       ret = packet_get(packet, "sss", &pkgname, &id, &func);
-       if (ret != 3) {
-               ErrPrint("Parameter is not matched\n");
-               goto out;
+       instance_set_dbox_info(inst, priority, content_info, title);
+       instance_set_alt_info(inst, icon, name);
+       instance_extra_info_updated_by_instance(inst);
+       slave_give_more_ttl(slave);
+    }
+
+out:
+    return NULL;
+}
+
+static struct packet *slave_updated(pid_t pid, int handle, const struct packet *packet) /* slave_name, pkgname, filename, width, height, ret */
+{
+    struct slave_node *slave;
+    const char *pkgname;
+    const char *safe_filename;
+    const char *id;
+    int w;
+    int h;
+    int x;
+    int y;
+    int ret;
+    struct inst_info *inst;
+
+    slave = slave_find_by_pid(pid);
+    if (!slave) {
+       ErrPrint("Slave %d is not exists\n", pid);
+       goto out;
+    }
+
+    ret = packet_get(packet, "sssiiii", &pkgname, &id, &safe_filename, &x, &y, &w, &h);
+    if (ret != 7) {
+       ErrPrint("Parameter is not matched\n");
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, NULL);
+    if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+       if (instance_state(inst) == INST_DESTROYED) {
+           ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
+           goto out;
+       }
+
+       switch (package_dbox_type(instance_package(inst))) {
+       case DBOX_TYPE_SCRIPT:
+           script_handler_resize(instance_dbox_script(inst), w, h);
+           if (safe_filename) {
+               (void)script_handler_parse_desc(inst, safe_filename, 0);
+           } else {
+               safe_filename = util_uri_to_path(id);
+               (void)script_handler_parse_desc(inst, safe_filename, 0);
+           }
+
+           if (unlink(safe_filename) < 0) {
+               ErrPrint("unlink: %s - %s\n", strerror(errno), safe_filename);
+           }
+           break;
+       case DBOX_TYPE_BUFFER:
+       default:
+           /*!
+            * \check
+            * text format (inst)
+            */
+           instance_dbox_updated_by_instance(inst, safe_filename, x, y, w, h);
+           break;
        }
 
-       ret = fault_func_ret(slave, pkgname, id, func);
        slave_give_more_ttl(slave);
+    }
 
 out:
-       return NULL;
+    return NULL;
 }
 
-static struct packet *slave_updated(pid_t pid, int handle, const struct packet *packet) /* slave_name, pkgname, filename, width, height, priority, ret */
+static struct packet *slave_hold_scroll(pid_t pid, int handle, const struct packet *packet)
 {
-       struct slave_node *slave;
-       const char *pkgname;
-       const char *safe_filename;
-       const char *id;
-       const char *content_info;
-       const char *title;
-       const char *icon;
-       const char *name;
-       int w;
-       int h;
-       double priority;
-       int ret;
-       struct inst_info *inst;
-
-       slave = slave_find_by_pid(pid);
-       if (!slave) {
-               ErrPrint("Slave %d is not exists\n", pid);
-               goto out;
+    struct slave_node *slave;
+    struct inst_info *inst;
+    const char *pkgname;
+    const char *id;
+    int seize;
+    int ret;
+
+    slave = slave_find_by_pid(pid);
+    if (!slave) {
+       ErrPrint("Slave %d is not exists\n", pid);
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssi", &pkgname, &id, &seize);
+    if (ret != 3) {
+       ErrPrint("Parameter is not matched\n");
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, NULL);
+    if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+       if (instance_state(inst) == INST_DESTROYED) {
+           ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
+       } else {
+           (void)instance_hold_scroll(inst, seize);
        }
+    }
 
-       ret = packet_get(packet, "ssiidsssss", &pkgname, &id,
-                                               &w, &h, &priority,
-                                               &content_info, &title,
-                                               &safe_filename, &icon, &name);
-       if (ret != 10) {
-               ErrPrint("Parameter is not matched\n");
-               goto out;
-       }
+out:
+    return NULL;
+}
+
+static struct packet *slave_extra_updated(pid_t pid, int handle, const struct packet *packet)
+{
+    struct slave_node *slave;
+    const char *pkgname;
+    const char *id;
+    int idx;
+    int x;
+    int y;
+    int w;
+    int h;
+    int ret;
+    int is_gbar;
+    struct inst_info *inst;
+
+    slave = slave_find_by_pid(pid);
+    if (!slave) {
+       ErrPrint("Slave %d is not exists\n", pid);
+       goto out;
+    }
+
+    ret = packet_get(packet, "ssiiiiii", &pkgname, &id, &is_gbar, &idx, &x, &y, &w, &h);
+    if (ret != 8) {
+       ErrPrint("Parameter is not matched\n");
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, NULL);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (instance_state(inst) == INST_DESTROYED) {
+       ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
+       goto out;
+    }
+
+    (void)instance_extra_updated_by_instance(inst, is_gbar, idx, x, y, w, h);
+out:
+    return NULL;
+}
 
-       ret = validate_request(pkgname, id, &inst, NULL);
-       if (ret == (int)LB_STATUS_SUCCESS) {
-               if (instance_state(inst) == INST_DESTROYED) {
-                       ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
-                       goto out;
-               }
+static struct packet *slave_desc_updated(pid_t pid, int handle, const struct packet *packet) /* slave_name, pkgname, filename, decsfile, ret */
+{
+    struct slave_node *slave;
+    const char *pkgname;
+    const char *id;
+    const char *descfile;
+    int x;
+    int y;
+    int w;
+    int h;
+    int ret;
+    struct inst_info *inst;
+
+    slave = slave_find_by_pid(pid);
+    if (!slave) {
+       ErrPrint("Slave %d is not exists\n", pid);
+       goto out;
+    }
+
+    ret = packet_get(packet, "sssiiii", &pkgname, &id, &descfile, &x, &y, &w, &h);
+    if (ret != 7) {
+       ErrPrint("Parameter is not matched\n");
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, NULL);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    if (instance_state(inst) == INST_DESTROYED) {
+       ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
+       goto out;
+    }
+
+    switch (package_gbar_type(instance_package(inst))) {
+    case GBAR_TYPE_SCRIPT:
+       DbgPrint("%s updated (%s)\n", instance_id(inst), descfile);
+       if (script_handler_is_loaded(instance_gbar_script(inst))) {
+           (void)script_handler_parse_desc(inst, descfile, 1);
+       }
+       break;
+    case GBAR_TYPE_TEXT:
+       instance_set_gbar_size(inst, 0, 0);
+    case GBAR_TYPE_BUFFER:
+       instance_gbar_updated(pkgname, id, descfile, x, y, w, h);
+       break;
+    default:
+       DbgPrint("Ignore updated DESC(%s)\n", pkgname);
+       break;
+    }
 
-               instance_set_lb_info(inst, priority, content_info, title);
-               instance_set_alt_info(inst, icon, name);
-
-               switch (package_lb_type(instance_package(inst))) {
-               case LB_TYPE_SCRIPT:
-                       script_handler_resize(instance_lb_script(inst), w, h);
-                       if (safe_filename) {
-                               (void)script_handler_parse_desc(inst, safe_filename, 0);
-                       } else {
-                               safe_filename = util_uri_to_path(id);
-                               (void)script_handler_parse_desc(inst, safe_filename, 0);
-                       }
-
-                       if (unlink(safe_filename) < 0) {
-                               ErrPrint("unlink: %s - %s\n", strerror(errno), safe_filename);
-                       }
-                       break;
-               case LB_TYPE_BUFFER:
-               default:
-                       /*!
-                        * \check
-                        * text format (inst)
-                        */
-                       instance_set_lb_size(inst, w, h);
-                       instance_lb_updated_by_instance(inst, safe_filename);
-                       break;
-               }
+out:
+    return NULL;
+}
 
-               slave_give_more_ttl(slave);
-       }
+static struct packet *slave_deleted(pid_t pid, int handle, const struct packet *packet) /* slave_name, pkgname, id, ret */
+{
+    struct slave_node *slave;
+    const char *pkgname;
+    const char *id;
+    int ret;
+    struct inst_info *inst;
+
+    slave = slave_find_by_pid(pid);
+    if (!slave) {
+       ErrPrint("Slave %d is not exists\n", pid);
+       goto out;
+    }
+
+    ret = packet_get(packet, "ss", &pkgname, &id);
+    if (ret != 2) {
+       ErrPrint("Parameter is not matched\n");
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, NULL);
+    if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+       ret = instance_destroyed(inst, DBOX_STATUS_ERROR_NONE);
+    }
 
 out:
-       return NULL;
+    return NULL;
 }
 
-static struct packet *slave_hold_scroll(pid_t pid, int handle, const struct packet *packet)
+/*!
+ * \note for the BUFFER Type slave
+ */
+static struct packet *slave_acquire_buffer(pid_t pid, int handle, const struct packet *packet) /* type, id, w, h, size */
 {
-       struct slave_node *slave;
-       struct inst_info *inst;
-       const char *pkgname;
-       const char *id;
-       int seize;
-       int ret;
+    enum target_type target;
+    const char *pkgname;
+    const char *id;
+    int w;
+    int h;
+    int pixel_size;
+    struct packet *result;
+    struct slave_node *slave;
+    struct inst_info *inst = NULL;
+    const struct pkg_info *pkg = NULL;
+    int ret;
+
+    slave = slave_find_by_pid(pid);
+    if (!slave) {
+       ErrPrint("Failed to find a slave\n");
+       id = "";
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
 
-       slave = slave_find_by_pid(pid);
-       if (!slave) {
-               ErrPrint("Slave %d is not exists\n", pid);
-               goto out;
-       }
+    ret = packet_get(packet, "issiii", &target, &pkgname, &id, &w, &h, &pixel_size);
+    if (ret != 6) {
+       ErrPrint("Invalid argument\n");
+       id = "";
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
 
-       ret = packet_get(packet, "ssi", &pkgname, &id, &seize);
-       if (ret != 3) {
-               ErrPrint("Parameter is not matched\n");
-               goto out;
-       }
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    id = "";
 
-       ret = validate_request(pkgname, id, &inst, NULL);
-       if (ret == (int)LB_STATUS_SUCCESS) {
-               if (instance_state(inst) == INST_DESTROYED) {
-                       ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
-               } else {
-                       (void)instance_hold_scroll(inst, seize);
-               }
-       }
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
 
-out:
-       return NULL;
-}
+    ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
 
-static struct packet *slave_desc_updated(pid_t pid, int handle, const struct packet *packet) /* slave_name, pkgname, filename, decsfile, ret */
-{
-       struct slave_node *slave;
-       const char *pkgname;
-       const char *id;
-       const char *descfile;
-       int ret;
-       struct inst_info *inst;
+    if (instance_state(inst) == INST_DESTROYED) {
+       ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
+       goto out;
+    }
 
-       slave = slave_find_by_pid(pid);
-       if (!slave) {
-               ErrPrint("Slave %d is not exists\n", pid);
+    if (target == TYPE_DBOX && package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       struct buffer_info *info;
+
+       info = instance_dbox_buffer(inst);
+       if (!info) {
+           if (!instance_create_dbox_buffer(inst, pixel_size)) {
+               ErrPrint("Failed to create a DBOX buffer\n");
+               ret = DBOX_STATUS_ERROR_FAULT;
                goto out;
-       }
+           }
 
-       ret = packet_get(packet, "sss", &pkgname, &id, &descfile);
-       if (ret != 3) {
-               ErrPrint("Parameter is not matched\n");
+           info = instance_dbox_buffer(inst);
+           if (!info) {
+               ErrPrint("DBOX buffer is not valid\n");
+               /*!
+                * \NOTE
+                * ret value should not be changed.
+                */
                goto out;
+           }
        }
 
-       ret = validate_request(pkgname, id, &inst, NULL);
-       if (ret != LB_STATUS_SUCCESS) {
+       ret = buffer_handler_resize(info, w, h);
+       ret = buffer_handler_load(info);
+       if (ret == 0) {
+           instance_set_dbox_size(inst, w, h);
+           instance_set_dbox_info(inst, DYNAMICBOX_CONF_PRIORITY_NO_CHANGE, DYNAMICBOX_CONF_CONTENT_NO_CHANGE, DYNAMICBOX_CONF_TITLE_NO_CHANGE);
+           id = buffer_handler_id(info);
+       } else {
+           ErrPrint("Failed to load a buffer(%d)\n", ret);
+       }
+    } else if (target == TYPE_GBAR && package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       struct buffer_info *info;
+       Ecore_Timer *gbar_monitor;
+       int is_resize;
+
+       is_resize = 0;
+       gbar_monitor = instance_del_data(inst, GBAR_OPEN_MONITOR_TAG);
+       if (!gbar_monitor) {
+           gbar_monitor = instance_del_data(inst, GBAR_RESIZE_MONITOR_TAG);
+           is_resize = !!gbar_monitor;
+           if (!is_resize) {
+               /* Invalid request. Reject this */
+               ErrPrint("Invalid request\n");
                goto out;
+           }
+
+           slave_event_callback_del(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_resize_buffer_cb, inst);
+       } else {
+           slave_event_callback_del(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_open_buffer_cb, inst);
        }
 
-       if (instance_state(inst) == INST_DESTROYED) {
-               ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
+       ecore_timer_del(gbar_monitor);
+       inst = instance_unref(inst);
+       if (!inst) {
+           ErrPrint("Instance refcnt is ZERO: %s\n", pkgname);
+           goto out;
+       }
+
+       info = instance_gbar_buffer(inst);
+       if (!info) {
+           if (!instance_create_gbar_buffer(inst, pixel_size)) {
+               ErrPrint("Failed to create a GBAR buffer\n");
+               ret = DBOX_STATUS_ERROR_FAULT;
+               instance_client_gbar_created(inst, ret);
+               goto out;
+           }
+
+           info = instance_gbar_buffer(inst);
+           if (!info) {
+               ErrPrint("GBAR buffer is not valid\n");
+               /*!
+                * \NOTE
+                * ret value should not be changed.
+                */
+               instance_client_gbar_created(inst, ret);
                goto out;
+           }
        }
 
-       switch (package_pd_type(instance_package(inst))) {
-       case PD_TYPE_SCRIPT:
-               DbgPrint("%s updated (%s)\n", instance_id(inst), descfile);
-               if (script_handler_is_loaded(instance_pd_script(inst))) {
-                       (void)script_handler_parse_desc(inst, descfile, 1);
-               }
-               break;
-       case PD_TYPE_TEXT:
-               instance_set_pd_size(inst, 0, 0);
-       case PD_TYPE_BUFFER:
-               instance_pd_updated(pkgname, id, descfile);
-               break;
-       default:
-               DbgPrint("Ignore updated DESC(%s)\n", pkgname);
-               break;
+       ret = buffer_handler_resize(info, w, h);
+       ret = buffer_handler_load(info);
+       if (ret == 0) {
+           instance_set_gbar_size(inst, w, h);
+           id = buffer_handler_id(info);
+       } else {
+           ErrPrint("Failed to load a buffer (%d)\n", ret);
+       }
+
+       /*!
+        * Send the GBAR created event to the client
+        */
+       if (!is_resize) {
+           instance_client_gbar_created(inst, ret);
        }
+    }
 
 out:
-       return NULL;
-}
+    result = packet_create_reply(packet, "is", ret, id);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *slave_acquire_extra_buffer(pid_t pid, int handle, const struct packet *packet)
+{
+    struct slave_node *slave;
+    struct inst_info *inst;
+    struct packet *result;
+    const struct pkg_info *pkg;
+    const char *pkgname;
+    const char *id;
+    int pixel_size;
+    int target;
+    int idx;
+    int ret;
+    int w;
+    int h;
+
+    slave = slave_find_by_pid(pid);
+    if (!slave) {
+       ErrPrint("Slave %d is not exists\n", pid);
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       id = "";
+       goto out;
+    }
 
-static struct packet *slave_deleted(pid_t pid, int handle, const struct packet *packet) /* slave_name, pkgname, id, ret */
-{
-       struct slave_node *slave;
-       const char *pkgname;
-       const char *id;
-       int ret;
-       struct inst_info *inst;
+    ret = packet_get(packet, "issiiii", &target, &pkgname, &id, &w, &h, &pixel_size, &idx);
+    if (ret != 7) {
+       ErrPrint("Invalid parameters\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       id = "";
+       goto out;
+    }
 
-       slave = slave_find_by_pid(pid);
-       if (!slave) {
-               ErrPrint("Slave %d is not exists\n", pid);
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    id = "";
+
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+
+    if (instance_state(inst) == INST_DESTROYED) {
+       ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
+       goto out;
+    }
+
+    if (target == TYPE_DBOX && package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       struct buffer_info *info;
+
+       info = instance_dbox_extra_buffer(inst, idx);
+       if (!info) {
+           if (!instance_create_dbox_extra_buffer(inst, pixel_size, idx)) {
+               ErrPrint("Failed to create a DBOX buffer\n");
+               ret = DBOX_STATUS_ERROR_FAULT;
+               goto out;
+           }
+
+           info = instance_dbox_extra_buffer(inst, idx);
+           if (!info) {
+               ErrPrint("DBOX extra buffer is not valid\n");
+               /*!
+                * \NOTE
+                * ret value should not be changed.
+                */
                goto out;
+           }
+       }
+
+       ret = buffer_handler_resize(info, w, h);
+       ret = buffer_handler_load(info);
+       if (ret == 0) {
+           /**
+            * @todo
+            * Send the extra buffer info to the viewer.
+            * Then the viewer will try to acquire extra pixmap(aka, resource id) information
+            */
+           id = buffer_handler_id(info);
+           DbgPrint("Extra buffer is loaded: %s\n", id);
+           (void)instance_client_dbox_extra_buffer_created(inst, idx);
+       } else {
+           ErrPrint("Failed to load a buffer(%d)\n", ret);
        }
+    } else if (target == TYPE_GBAR && package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       struct buffer_info *info;
+
+       info = instance_gbar_extra_buffer(inst, idx);
+       if (!info) {
+           if (!instance_create_gbar_extra_buffer(inst, pixel_size, idx)) {
+               ErrPrint("Failed to create a GBAR buffer\n");
+               ret = DBOX_STATUS_ERROR_FAULT;
+               goto out;
+           }
 
-       ret = packet_get(packet, "ss", &pkgname, &id);
-       if (ret != 2) {
-               ErrPrint("Parameter is not matched\n");
+           info = instance_gbar_extra_buffer(inst, idx);
+           if (!info) {
+               ErrPrint("GBAR buffer is not valid\n");
+               /*!
+                * \NOTE
+                * ret value should not be changed.
+                */
                goto out;
+           }
        }
 
-       ret = validate_request(pkgname, id, &inst, NULL);
-       if (ret == (int)LB_STATUS_SUCCESS) {
-               ret = instance_destroyed(inst, LB_STATUS_SUCCESS);
+       ret = buffer_handler_resize(info, w, h);
+       ret = buffer_handler_load(info);
+       if (ret == 0) {
+           id = buffer_handler_id(info);
+           /**
+            * @todo
+            * Send the extra buffer acquired event to the viewer
+            */
+           DbgPrint("Extra buffer is loaded: %s\n", id);
+           (void)instance_client_gbar_extra_buffer_created(inst, idx);
+       } else {
+           ErrPrint("Failed to load a buffer (%d)\n", ret);
        }
+    }
 
 out:
-       return NULL;
+    result = packet_create_reply(packet, "is", ret, id);
+    if (!result) {
+       ErrPrint("Failed to create a reply packet\n");
+    }
+
+    return result;
 }
 
-/*!
- * \note for the BUFFER Type slave
- */
-static struct packet *slave_acquire_buffer(pid_t pid, int handle, const struct packet *packet) /* type, id, w, h, size */
+static struct packet *slave_resize_buffer(pid_t pid, int handle, const struct packet *packet)
 {
-       enum target_type target;
-       const char *pkgname;
-       const char *id;
-       int w;
-       int h;
-       int pixel_size;
-       struct packet *result;
-       struct slave_node *slave;
-       struct inst_info *inst = NULL;
-       const struct pkg_info *pkg = NULL;
-       int ret;
+    struct slave_node *slave;
+    struct packet *result;
+    enum target_type type;
+    const char *pkgname;
+    const char *id;
+    int w;
+    int h;
+    struct inst_info *inst = NULL;
+    const struct pkg_info *pkg = NULL;
+    int ret;
+
+    slave = slave_find_by_pid(pid);
+    if (!slave) {
+       ErrPrint("Failed to find a slave\n");
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       id = "";
+       goto out;
+    }
 
-       slave = slave_find_by_pid(pid);
-       if (!slave) {
-               ErrPrint("Failed to find a slave\n");
-               id = "";
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
-       }
+    ret = packet_get(packet, "issii", &type, &pkgname, &id, &w, &h);
+    if (ret != 5) {
+       ErrPrint("Invalid argument\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       id = "";
+       goto out;
+    }
 
-       ret = packet_get(packet, "issiii", &target, &pkgname, &id, &w, &h, &pixel_size);
-       if (ret != 6) {
-               ErrPrint("Invalid argument\n");
-               id = "";
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    id = "";
 
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       id = "";
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
 
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
+    ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    /*!
+     * \note
+     * Reset "id", It will be re-used from here
+     */
+
+    if (instance_state(inst) == INST_DESTROYED) {
+       ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
+       goto out;
+    }
+
+    if (type == TYPE_DBOX && package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       struct buffer_info *info;
+
+       info = instance_dbox_buffer(inst);
+       if (!info) {
+           goto out;
        }
 
-       ret = LB_STATUS_ERROR_INVALID;
+       ret = buffer_handler_resize(info, w, h);
+       /*!
+        * \note
+        * id is resued for newly assigned ID
+        */
+       if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+           id = buffer_handler_id(info);
+           instance_set_dbox_size(inst, w, h);
+           instance_set_dbox_info(inst, DYNAMICBOX_CONF_PRIORITY_NO_CHANGE, DYNAMICBOX_CONF_CONTENT_NO_CHANGE, DYNAMICBOX_CONF_TITLE_NO_CHANGE);
+       }
+    } else if (type == TYPE_GBAR && package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       struct buffer_info *info;
 
-       if (instance_state(inst) == INST_DESTROYED) {
-               ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
-               goto out;
+       info = instance_gbar_buffer(inst);
+       if (!info) {
+           goto out;
        }
 
-       if (target == TYPE_LB && package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               struct buffer_info *info;
-
-               info = instance_lb_buffer(inst);
-               if (!info) {
-                       if (!instance_create_lb_buffer(inst, pixel_size)) {
-                               ErrPrint("Failed to create a LB buffer\n");
-                               ret = LB_STATUS_ERROR_FAULT;
-                               goto out;
-                       }
-
-                       info = instance_lb_buffer(inst);
-                       if (!info) {
-                               ErrPrint("LB buffer is not valid\n");
-                               /*!
-                                * \NOTE
-                                * ret value should not be changed.
-                                */
-                               goto out;
-                       }
-               }
+       ret = buffer_handler_resize(info, w, h);
+       /*!
+        * \note
+        * id is resued for newly assigned ID
+        */
+       if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+           id = buffer_handler_id(info);
+           instance_set_gbar_size(inst, w, h);
+       }
+    }
 
-               ret = buffer_handler_resize(info, w, h);
-               ret = buffer_handler_load(info);
-               if (ret == 0) {
-                       instance_set_lb_size(inst, w, h);
-                       instance_set_lb_info(inst, PRIORITY_NO_CHANGE, CONTENT_NO_CHANGE, TITLE_NO_CHANGE);
-                       id = buffer_handler_id(info);
-               } else {
-                       ErrPrint("Failed to load a buffer(%d)\n", ret);
-               }
-       } else if (target == TYPE_PD && package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               struct buffer_info *info;
-               Ecore_Timer *pd_monitor;
-               int is_resize;
-
-               is_resize = 0;
-               pd_monitor = instance_del_data(inst, PD_OPEN_MONITOR_TAG);
-               if (!pd_monitor) {
-                       pd_monitor = instance_del_data(inst, PD_RESIZE_MONITOR_TAG);
-                       is_resize = !!pd_monitor;
-                       if (!is_resize) {
-                               /* Invalid request. Reject this */
-                               ErrPrint("Invalid request\n");
-                               goto out;
-                       }
-
-                       slave_event_callback_del(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_resize_buffer_cb, inst);
+out:
+    result = packet_create_reply(packet, "is", ret, id);
+    if (!result) {
+       ErrPrint("Failed to create a packet\n");
+    }
+
+    return result;
+}
+
+static struct packet *slave_release_buffer(pid_t pid, int handle, const struct packet *packet)
+{
+    enum target_type type;
+    const char *pkgname;
+    const char *id;
+    struct packet *result;
+    struct slave_node *slave;
+    struct inst_info *inst;
+    const struct pkg_info *pkg;
+    int ret;
+
+    slave = slave_find_by_pid(pid);
+    if (!slave) {
+       ErrPrint("Failed to find a slave\n");
+       ret = DBOX_STATUS_ERROR_NOT_EXIST;
+       goto out;
+    }
+
+    if (packet_get(packet, "iss", &type, &pkgname, &id) != 3) {
+       ErrPrint("Inavlid argument\n");
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+       goto out;
+    }
+
+    ret = validate_request(pkgname, id, &inst, &pkg);
+    if (ret != DBOX_STATUS_ERROR_NONE) {
+       goto out;
+    }
+
+    ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+
+    if (type == TYPE_DBOX && package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+       struct buffer_info *info;
+
+       info = instance_dbox_buffer(inst);
+       ret = buffer_handler_unload(info);
+    } else if (type == TYPE_GBAR && package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+       struct buffer_info *info;
+       Ecore_Timer *gbar_monitor;
+
+       gbar_monitor = instance_del_data(inst, GBAR_CLOSE_MONITOR_TAG);
+       if (!gbar_monitor && !package_is_fault(pkg)) {
+           ErrPrint("Slave requests to release a buffer\n");
+           /**
+            * @note
+            * In this case just keep going to release buffer,
+            * Even if a user(client) doesn't wants to destroy the GBAR.
+            *
+            * If the slave tries to destroy GBAR buffer, it should be
+            * released and reported to the client about its status.
+            *
+            * Even if the pd is destroyed by timeout handler,
+            * instance_client_gbar_destroyed function will be ignored
+            * by pd.need_to_send_close_event flag.
+            * which will be checked by instance_client_gbar_destroyed function.
+            */
+
+           /**
+            * @note
+            * provider can try to resize the buffer size.
+            * in that case, it will release the buffer first.
+            * Then even though the client doesn't request to close the GBAR,
+            * the provider can release it.
+            * If we send the close event to the client,
+            * The client will not able to allocate GBAR again.
+            * In this case, add the pd,monitor again. from here.
+            * to wait the re-allocate buffer.
+            * If the client doesn't request buffer reallocation,
+            * Treat it as a fault. and close the GBAR.
+            */
+           info = instance_gbar_buffer(inst);
+           ret = buffer_handler_unload(info);
+
+           if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+               gbar_monitor = ecore_timer_add(DYNAMICBOX_CONF_GBAR_REQUEST_TIMEOUT, gbar_resize_monitor_cb, instance_ref(inst));
+               if (!gbar_monitor) {
+                   ErrPrint("Failed to create a timer for GBAR Open monitor\n");
+                   inst = instance_unref(inst);
+                   if (!inst) {
+                       DbgPrint("Instance is deleted\n");
+                   }
                } else {
-                       slave_event_callback_del(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_open_buffer_cb, inst);
+                   (void)instance_set_data(inst, GBAR_RESIZE_MONITOR_TAG, gbar_monitor);
+                   if (slave_event_callback_add(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_resize_buffer_cb, inst) != DBOX_STATUS_ERROR_NONE) {
+                       ErrPrint("Failed to add event handler: %s\n", pkgname);
+                   }
                }
+           }
+       } else {
+           if (gbar_monitor) {
+               /**
+                * @note
+                * If the instance has gbar_monitor, the pd close requested from client via client_destroy_gbar.
+                */
+               slave_event_callback_del(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_close_buffer_cb, inst);
+               ecore_timer_del(gbar_monitor);
 
-               ecore_timer_del(pd_monitor);
                inst = instance_unref(inst);
                if (!inst) {
-                       ErrPrint("Instance refcnt is ZERO: %s\n", pkgname);
-                       goto out;
+                   ErrPrint("Instance is released: %s\n", pkgname);
+                   ret = DBOX_STATUS_ERROR_FAULT;
+                   goto out;
                }
+           } /* else {
+                @note
+                This case means that the package is faulted so the service provider tries to release the buffer
+              */
 
-               info = instance_pd_buffer(inst);
-               if (!info) {
-                       if (!instance_create_pd_buffer(inst, pixel_size)) {
-                               ErrPrint("Failed to create a PD buffer\n");
-                               ret = LB_STATUS_ERROR_FAULT;
-                               instance_client_pd_created(inst, ret);
-                               goto out;
-                       }
-
-                       info = instance_pd_buffer(inst);
-                       if (!info) {
-                               ErrPrint("PD buffer is not valid\n");
-                               /*!
-                                * \NOTE
-                                * ret value should not be changed.
-                                */
-                               instance_client_pd_created(inst, ret);
-                               goto out;
-                       }
-               }
-
-               ret = buffer_handler_resize(info, w, h);
-               ret = buffer_handler_load(info);
-               if (ret == 0) {
-                       instance_set_pd_size(inst, w, h);
-                       id = buffer_handler_id(info);
-               } else {
-                       ErrPrint("Failed to load a buffer (%d)\n", ret);
-               }
+           info = instance_gbar_buffer(inst);
+           ret = buffer_handler_unload(info);
 
-               /*!
-                * Send the PD created event to the client
-                */
-               if (!is_resize) {
-                       instance_client_pd_created(inst, ret);
-               }
+           /**
+            * @note
+            * Send the GBAR destroyed event to the client
+            */
+           instance_client_gbar_destroyed(inst, ret);
+       }
        }
 
 out:
-       result = packet_create_reply(packet, "is", ret, id);
+       result = packet_create_reply(packet, "i", ret);
        if (!result) {
-               ErrPrint("Failed to create a packet\n");
+           ErrPrint("Failed to create a packet\n");
        }
 
        return result;
-}
+    }
 
-static struct packet *slave_resize_buffer(pid_t pid, int handle, const struct packet *packet)
-{
+    static struct packet *slave_release_extra_buffer(pid_t pid, int handle, const struct packet *packet)
+    {
        struct slave_node *slave;
        struct packet *result;
-       enum target_type type;
-       const char *pkgname;
        const char *id;
-       int w;
-       int h;
-       struct inst_info *inst = NULL;
-       const struct pkg_info *pkg = NULL;
+       struct buffer_info *info = NULL;
        int ret;
+       int idx;
+       int type;
+       const char *pkgname;
+       struct inst_info *inst;
+       const struct pkg_info *pkg;
 
        slave = slave_find_by_pid(pid);
        if (!slave) {
-               ErrPrint("Failed to find a slave\n");
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               id = "";
-               goto out;
+           ErrPrint("Slave %d is not exists\n", pid);
+           ret = DBOX_STATUS_ERROR_NOT_EXIST;
+           goto out;
        }
 
-       ret = packet_get(packet, "issii", &type, &pkgname, &id, &w, &h);
-       if (ret != 5) {
-               ErrPrint("Invalid argument\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               id = "";
-               goto out;
+       if (packet_get(packet, "issi", &type, &pkgname, &id, &idx) != 4) {
+           ErrPrint("Inavlid argument\n");
+           ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+           goto out;
        }
 
        ret = validate_request(pkgname, id, &inst, &pkg);
-       id = "";
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
+       if (ret != DBOX_STATUS_ERROR_NONE) {
+           goto out;
        }
 
-       ret = LB_STATUS_ERROR_INVALID;
-       /*!
-        * \note
-        * Reset "id", It will be re-used from here
-        */
+       ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
 
-       if (instance_state(inst) == INST_DESTROYED) {
-               ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
-               goto out;
+       if (type == TYPE_DBOX && package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+           info = instance_dbox_extra_buffer(inst, idx);
+           (void)instance_client_dbox_extra_buffer_destroyed(inst, idx);
+       } else if (type == TYPE_GBAR && package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+           info = instance_gbar_extra_buffer(inst, idx);
+           (void)instance_client_gbar_extra_buffer_destroyed(inst, idx);
        }
 
-       if (type == TYPE_LB && package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               struct buffer_info *info;
-
-               info = instance_lb_buffer(inst);
-               if (!info) {
-                       goto out;
-               }
-
-               ret = buffer_handler_resize(info, w, h);
-               /*!
-                * \note
-                * id is resued for newly assigned ID
-                */
-               if (ret == (int)LB_STATUS_SUCCESS) {
-                       id = buffer_handler_id(info);
-                       instance_set_lb_size(inst, w, h);
-                       instance_set_lb_info(inst, PRIORITY_NO_CHANGE, CONTENT_NO_CHANGE, TITLE_NO_CHANGE);
-               }
-       } else if (type == TYPE_PD && package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               struct buffer_info *info;
-
-               info = instance_pd_buffer(inst);
-               if (!info) {
-                       goto out;
-               }
-
-               ret = buffer_handler_resize(info, w, h);
-               /*!
-                * \note
-                * id is resued for newly assigned ID
-                */
-               if (ret == (int)LB_STATUS_SUCCESS) {
-                       id = buffer_handler_id(info);
-                       instance_set_pd_size(inst, w, h);
-               }
+       if (info) {
+           ret = buffer_handler_unload(info);
        }
 
 out:
-       result = packet_create_reply(packet, "is", ret, id);
+       result = packet_create_reply(packet, "i", ret);
        if (!result) {
-               ErrPrint("Failed to create a packet\n");
+           ErrPrint("Failed to create a reply packet\n");
        }
 
        return result;
-}
+    }
 
-static struct packet *slave_release_buffer(pid_t pid, int handle, const struct packet *packet)
-{
-       enum target_type type;
-       const char *pkgname;
-       const char *id;
+    static struct packet *service_instance_count(pid_t pid, int handle, const struct packet *packet)
+    {
        struct packet *result;
-       struct slave_node *slave;
+       struct pkg_info *pkg;
+       double timestamp;
+       const char *pkgname;
+       const char *cluster;
+       const char *category;
+       Eina_List *pkg_list;
+       Eina_List *l;
+       Eina_List *inst_list;
+       Eina_List *inst_l;
        struct inst_info *inst;
-       const struct pkg_info *pkg;
        int ret;
 
-       slave = slave_find_by_pid(pid);
-       if (!slave) {
-               ErrPrint("Failed to find a slave\n");
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               goto out;
+       ret = packet_get(packet, "sssd", &pkgname, &cluster, &category, &timestamp);
+       if (ret != 4) {
+           ErrPrint("Invalid packet\n");
+           ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+           goto out;
        }
 
-       if (packet_get(packet, "iss", &type, &pkgname, &id) != 3) {
-               ErrPrint("Inavlid argument\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
-       }
+       pkg_list = (Eina_List *)package_list();
 
-       ret = validate_request(pkgname, id, &inst, &pkg);
-       if (ret != LB_STATUS_SUCCESS) {
-               goto out;
-       }
+       ret = 0;
+       EINA_LIST_FOREACH(pkg_list, l, pkg) {
+           if (pkgname && pkgname[0]) {
+               if (strcmp(package_name(pkg), pkgname)) {
+                   continue;
+               }
+           }
 
-       ret = LB_STATUS_ERROR_INVALID;
-
-       if (type == TYPE_LB && package_lb_type(pkg) == LB_TYPE_BUFFER) {
-               struct buffer_info *info;
-
-               info = instance_lb_buffer(inst);
-               ret = buffer_handler_unload(info);
-       } else if (type == TYPE_PD && package_pd_type(pkg) == PD_TYPE_BUFFER) {
-               struct buffer_info *info;
-               Ecore_Timer *pd_monitor;
-
-               pd_monitor = instance_del_data(inst, PD_CLOSE_MONITOR_TAG);
-               if (!pd_monitor && !package_is_fault(pkg)) {
-                       ErrPrint("Slave requests to release a buffer\n");
-                       /*!
-                        * \note
-                        * In this case just keep going to release buffer,
-                        * Even if a user(client) doesn't wants to destroy the PD.
-                        *
-                        * If the slave tries to destroy PD buffer, it should be
-                        * released and reported to the client about its status.
-                        *
-                        * Even if the pd is destroyed by timeout handler,
-                        * instance_client_pd_destroyed function will be ignored
-                        * by pd.need_to_send_close_event flag.
-                        * which will be checked by instance_client_pd_destroyed function.
-                        */
-
-                       /*!
-                        * \note
-                        * provider can try to resize the buffer size.
-                        * in that case, it will release the buffer first.
-                        * Then even though the client doesn't request to close the PD,
-                        * the provider can release it.
-                        * If we send the close event to the client,
-                        * The client will not able to allocate PD again.
-                        * In this case, add the pd,monitor again. from here.
-                        * to wait the re-allocate buffer.
-                        * If the client doesn't request buffer reallocation,
-                        * Treat it as a fault. and close the PD.
-                        */
-                       info = instance_pd_buffer(inst);
-                       ret = buffer_handler_unload(info);
-
-                       if (ret == (int)LB_STATUS_SUCCESS) {
-                               pd_monitor = ecore_timer_add(PD_REQUEST_TIMEOUT, pd_resize_monitor_cb, instance_ref(inst));
-                               if (!pd_monitor) {
-                                       ErrPrint("Failed to create a timer for PD Open monitor\n");
-                                       inst = instance_unref(inst);
-                                       if (!inst) {
-                                               DbgPrint("Instance is deleted\n");
-                                       }
-                               } else {
-                                       (void)instance_set_data(inst, PD_RESIZE_MONITOR_TAG, pd_monitor);
-                                       if (slave_event_callback_add(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_resize_buffer_cb, inst) != LB_STATUS_SUCCESS) {
-                                               ErrPrint("Failed to add event handler: %s\n", pkgname);
-                                       }
-                               }
-                       }
-               } else {
-                       if (pd_monitor) {
-                               /*!
-                                * \note
-                                * If the instance has pd_monitor, the pd close requested from client via client_destroy_pd.
-                                */
-                               slave_event_callback_del(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_close_buffer_cb, inst);
-                               ecore_timer_del(pd_monitor);
-
-                               inst = instance_unref(inst);
-                               if (!inst) {
-                                       ErrPrint("Instance is released: %s\n", pkgname);
-                                       ret = LB_STATUS_ERROR_FAULT;
-                                       goto out;
-                               }
-                       } /* else {
-                               \note
-                               This case means that the package is faulted so the service provider tries to release the buffer
-                       */
-
-                       info = instance_pd_buffer(inst);
-                       ret = buffer_handler_unload(info);
-
-                       /*!
-                        * \note
-                        * Send the PD destroyed event to the client
-                        */
-                       instance_client_pd_destroyed(inst, ret);
+           inst_list = package_instance_list(pkg);
+           EINA_LIST_FOREACH(inst_list, inst_l, inst) {
+               if (cluster && cluster[0]) {
+                   if (strcmp(instance_cluster(inst), cluster)) {
+                       continue;
+                   }
+               }
+
+               if (category && category[0]) {
+                   if (strcmp(instance_category(inst), category)) {
+                       continue;
+                   }
                }
+
+               ret++;
+           }
        }
 
 out:
        result = packet_create_reply(packet, "i", ret);
        if (!result) {
-               ErrPrint("Failed to create a packet\n");
+           ErrPrint("Failed to create a packet\n");
        }
 
        return result;
-}
+    }
 
-static struct packet *service_change_period(pid_t pid, int handle, const struct packet *packet)
-{
+    static struct packet *service_change_period(pid_t pid, int handle, const struct packet *packet)
+    {
        struct inst_info *inst;
        struct packet *result;
        const char *pkgname;
@@ -7382,56 +7618,56 @@ static struct packet *service_change_period(pid_t pid, int handle, const struct
 
        ret = packet_get(packet, "ssd", &pkgname, &id, &period);
        if (ret != 3) {
-               ErrPrint("Invalid packet\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
+           ErrPrint("Invalid packet\n");
+           ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+           goto out;
        }
 
        if (!strlen(id)) {
-               struct pkg_info *pkg;
+           struct pkg_info *pkg;
+
+           pkg = package_find(pkgname);
+           if (!pkg) {
+               ret = DBOX_STATUS_ERROR_NOT_EXIST;
+           } else if (package_is_fault(pkg)) {
+               ret = DBOX_STATUS_ERROR_FAULT;
+           } else {
+               Eina_List *inst_list;
+               Eina_List *l;
 
-               pkg = package_find(pkgname);
-               if (!pkg) {
-                       ret = LB_STATUS_ERROR_NOT_EXIST;
-               } else if (package_is_fault(pkg)) {
-                       ret = LB_STATUS_ERROR_FAULT;
-               } else {
-                       Eina_List *inst_list;
-                       Eina_List *l;
-
-                       inst_list = package_instance_list(pkg);
-                       EINA_LIST_FOREACH(inst_list, l, inst) {
-                               ret = instance_set_period(inst, period);
-                               if (ret < 0) {
-                                       ErrPrint("Failed to change the period of %s to (%lf)\n", pkgname, period);
-                               }
-                       }
+               inst_list = package_instance_list(pkg);
+               EINA_LIST_FOREACH(inst_list, l, inst) {
+                   ret = instance_set_period(inst, period);
+                   if (ret < 0) {
+                       ErrPrint("Failed to change the period of %s to (%lf)\n", pkgname, period);
+                   }
                }
+           }
        } else {
-               ret = validate_request(pkgname, id, &inst, NULL);
-               if (ret == (int)LB_STATUS_SUCCESS) {
-                       if (instance_state(inst) == INST_DESTROYED) {
-                               ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
-                               ret = LB_STATUS_ERROR_INVALID;
-                               goto out;
-                       }
-
-                       ret = instance_set_period(inst, period);
+           ret = validate_request(pkgname, id, &inst, NULL);
+           if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+               if (instance_state(inst) == INST_DESTROYED) {
+                   ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
+                   ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+                   goto out;
                }
+
+               ret = instance_set_period(inst, period);
+           }
        }
 
        DbgPrint("Change the update period: %s, %lf : %d\n", pkgname, period, ret);
 out:
        result = packet_create_reply(packet, "i", ret);
        if (!result) {
-               ErrPrint("Failed to create a packet\n");
+           ErrPrint("Failed to create a packet\n");
        }
 
        return result;
-}
+    }
 
-static struct packet *service_update(pid_t pid, int handle, const struct packet *packet)
-{
+    static struct packet *service_update(pid_t pid, int handle, const struct packet *packet)
+    {
        Eina_List *inst_list;
        struct pkg_info *pkg;
        struct packet *result;
@@ -7446,54 +7682,54 @@ static struct packet *service_update(pid_t pid, int handle, const struct packet
 
        ret = packet_get(packet, "sssssi", &pkgname, &id, &cluster, &category, &content, &force);
        if (ret != 6) {
-               ErrPrint("Invalid Packet\n");
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
+           ErrPrint("Invalid Packet\n");
+           ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+           goto out;
        }
 
-       lbid = package_lb_pkgname(pkgname);
+       lbid = package_dbox_pkgname(pkgname);
        if (!lbid) {
-               ErrPrint("Invalid package %s\n", pkgname);
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
+           ErrPrint("Invalid package %s\n", pkgname);
+           ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+           goto out;
        }
 
        pkg = package_find(lbid);
        if (!pkg) {
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               DbgFree(lbid);
-               goto out;
+           ret = DBOX_STATUS_ERROR_NOT_EXIST;
+           DbgFree(lbid);
+           goto out;
        }
 
        if (package_is_fault(pkg)) {
-               ret = LB_STATUS_ERROR_FAULT;
-               DbgFree(lbid);
-               goto out;
+           ret = DBOX_STATUS_ERROR_FAULT;
+           DbgFree(lbid);
+           goto out;
        }
 
        inst_list = package_instance_list(pkg);
        if (!eina_list_count(inst_list)) {
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               DbgFree(lbid);
-               goto out;
+           ret = DBOX_STATUS_ERROR_NOT_EXIST;
+           DbgFree(lbid);
+           goto out;
        }
 
        if (id && strlen(id)) {
-               Eina_List *l;
-               struct inst_info *inst;
+           Eina_List *l;
+           struct inst_info *inst;
 
-               ret = LB_STATUS_ERROR_NOT_EXIST;
-               EINA_LIST_FOREACH(inst_list, l, inst) {
-                       if (!strcmp(instance_id(inst), id)) {
-                               ret = LB_STATUS_SUCCESS;
-                               break;
-                       }
+           ret = DBOX_STATUS_ERROR_NOT_EXIST;
+           EINA_LIST_FOREACH(inst_list, l, inst) {
+               if (!strcmp(instance_id(inst), id)) {
+                   ret = DBOX_STATUS_ERROR_NONE;
+                   break;
                }
+           }
 
-               if (ret == (int)LB_STATUS_ERROR_NOT_EXIST) {
-                       DbgFree(lbid);
-                       goto out;
-               }
+           if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST) {
+               DbgFree(lbid);
+               goto out;
+           }
        }
 
        /*!
@@ -7502,19 +7738,19 @@ static struct packet *service_update(pid_t pid, int handle, const struct packet
         */
        slave_rpc_request_update(lbid, id, cluster, category, content, force);
        DbgFree(lbid);
-       ret = LB_STATUS_SUCCESS;
+       ret = DBOX_STATUS_ERROR_NONE;
 
 out:
        result = packet_create_reply(packet, "i", ret);
        if (!result) {
-               ErrPrint("Failed to create a packet\n");
+           ErrPrint("Failed to create a packet\n");
        }
 
        return result;
-}
+    }
 
-static struct packet *liveinfo_hello(pid_t pid, int handle, const struct packet *packet)
-{
+    static struct packet *liveinfo_hello(pid_t pid, int handle, const struct packet *packet)
+    {
        struct liveinfo *info;
        struct packet *result;
        int ret;
@@ -7524,18 +7760,18 @@ static struct packet *liveinfo_hello(pid_t pid, int handle, const struct packet
        DbgPrint("Request arrived from %d\n", pid);
 
        if (packet_get(packet, "d", &timestamp) != 1) {
-               ErrPrint("Invalid packet\n");
-               fifo_name = "";
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
+           ErrPrint("Invalid packet\n");
+           fifo_name = "";
+           ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+           goto out;
        }
 
        info = liveinfo_create(pid, handle);
        if (!info) {
-               ErrPrint("Failed to create a liveinfo object\n");
-               fifo_name = "";
-               ret = LB_STATUS_ERROR_INVALID;
-               goto out;
+           ErrPrint("Failed to create a liveinfo object\n");
+           fifo_name = "";
+           ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+           goto out;
        }
 
        ret = 0;
@@ -7545,14 +7781,14 @@ static struct packet *liveinfo_hello(pid_t pid, int handle, const struct packet
 out:
        result = packet_create_reply(packet, "si", fifo_name, ret);
        if (!result) {
-               ErrPrint("Failed to create a result packet\n");
+           ErrPrint("Failed to create a result packet\n");
        }
 
        return result;
-}
+    }
 
-static Eina_Bool lazy_slave_list_cb(void *info)
-{
+    static Eina_Bool lazy_slave_list_cb(void *info)
+    {
        FILE *fp;
        Eina_List *list;
        Eina_List *l;
@@ -7561,71 +7797,71 @@ static Eina_Bool lazy_slave_list_cb(void *info)
        liveinfo_open_fifo(info);
        fp = liveinfo_fifo(info);
        if (!fp) {
-               liveinfo_close_fifo(info);
-               return ECORE_CALLBACK_CANCEL;
+           liveinfo_close_fifo(info);
+           return ECORE_CALLBACK_CANCEL;
        }
 
        list = (Eina_List *)slave_list();
        EINA_LIST_FOREACH(list, l, slave) {
-               fprintf(fp, "%d %s %s %s %d %d %d %s %d %d %lf\n", 
-                       slave_pid(slave),
-                       slave_name(slave),
-                       slave_pkgname(slave),
-                       slave_abi(slave),
-                       slave_is_secured(slave),
-                       slave_refcnt(slave),
-                       slave_fault_count(slave),
-                       slave_state_string(slave),
-                       slave_loaded_instance(slave),
-                       slave_loaded_package(slave),
-                       slave_ttl(slave)
-               );
+           fprintf(fp, "%d %s %s %s %d %d %d %s %d %d %lf\n", 
+                   slave_pid(slave),
+                   slave_name(slave),
+                   slave_pkgname(slave),
+                   slave_abi(slave),
+                   slave_is_secured(slave),
+                   slave_refcnt(slave),
+                   slave_fault_count(slave),
+                   slave_state_string(slave),
+                   slave_loaded_instance(slave),
+                   slave_loaded_package(slave),
+                   slave_ttl(slave)
+                  );
        }
 
        fprintf(fp, "EOD\n");
        liveinfo_close_fifo(info);
        return ECORE_CALLBACK_CANCEL;
-}
+    }
 
-static struct packet *liveinfo_slave_list(pid_t pid, int handle, const struct packet *packet)
-{
+    static struct packet *liveinfo_slave_list(pid_t pid, int handle, const struct packet *packet)
+    {
        struct liveinfo *info;
        double timestamp;
 
        if (packet_get(packet, "d", &timestamp) != 1) {
-               ErrPrint("Invalid argument\n");
-               goto out;
+           ErrPrint("Invalid argument\n");
+           goto out;
        }
 
        info = liveinfo_find_by_pid(pid);
        if (!info) {
-               ErrPrint("Invalid request\n");
-               goto out;
+           ErrPrint("Invalid request\n");
+           goto out;
        }
 
        lazy_slave_list_cb(info);
 out:
        return NULL;
-}
+    }
 
-static inline const char *visible_state_string(enum livebox_visible_state state)
-{
+    static inline const char *visible_state_string(enum dynamicbox_visible_state state)
+    {
        switch (state) {
-       case LB_SHOW:
-               return "Show";
-       case LB_HIDE:
-               return "Hide";
-       case LB_HIDE_WITH_PAUSE:
-               return "Paused";
+       case DBOX_SHOW:
+           return "Show";
+       case DBOX_HIDE:
+           return "Hide";
+       case DBOX_HIDE_WITH_PAUSE:
+           return "Paused";
        default:
-               break;
+           break;
        }
 
        return "Unknown";
-}
+    }
 
-static Eina_Bool inst_list_cb(void *info)
-{
+    static Eina_Bool inst_list_cb(void *info)
+    {
        FILE *fp;
        char *pkgname;
        struct pkg_info *pkg;
@@ -7635,41 +7871,42 @@ static Eina_Bool inst_list_cb(void *info)
 
        pkgname = liveinfo_data(info);
        if (!pkgname) {
-               return ECORE_CALLBACK_CANCEL;
+           return ECORE_CALLBACK_CANCEL;
        }
 
        liveinfo_open_fifo(info);
        fp = liveinfo_fifo(info);
        if (!fp) {
-               ErrPrint("Invalid fp\n");
-               liveinfo_close_fifo(info);
-               free(pkgname);
-               return ECORE_CALLBACK_CANCEL;
+           ErrPrint("Invalid fp\n");
+           liveinfo_close_fifo(info);
+           free(pkgname);
+           return ECORE_CALLBACK_CANCEL;
        }
 
-       if (!package_is_lb_pkgname(pkgname)) {
-               ErrPrint("Invalid package name\n");
-               free(pkgname);
-               goto close_out;
+       if (!package_is_dbox_pkgname(pkgname)) {
+           ErrPrint("Invalid package name\n");
+           free(pkgname);
+           goto close_out;
        }
 
        pkg = package_find(pkgname);
        free(pkgname);
        if (!pkg) {
-               ErrPrint("Package is not exists\n");
-               goto close_out;
+           ErrPrint("Package is not exists\n");
+           goto close_out;
        }
 
        inst_list = package_instance_list(pkg);
        EINA_LIST_FOREACH(inst_list, l, inst) {
-               fprintf(fp, "%s %s %s %lf %s %d %d\n",
-                       instance_id(inst),
-                       instance_cluster(inst),
-                       instance_category(inst),
-                       instance_period(inst),
-                       visible_state_string(instance_visible_state(inst)),
-                       instance_lb_width(inst),
-                       instance_lb_height(inst));
+           fprintf(fp, "%s %s %s %s %lf %s %d %d\n",
+                   instance_id(inst),
+                   buffer_handler_id(instance_dbox_buffer(inst)),
+                   instance_cluster(inst),
+                   instance_category(inst),
+                   instance_period(inst),
+                   visible_state_string(instance_visible_state(inst)),
+                   instance_dbox_width(inst),
+                   instance_dbox_height(inst));
        }
 
 close_out:
@@ -7677,29 +7914,29 @@ close_out:
        liveinfo_close_fifo(info);
 
        return ECORE_CALLBACK_CANCEL;
-}
+    }
 
-static struct packet *liveinfo_inst_list(pid_t pid, int handle, const struct packet *packet)
-{
+    static struct packet *liveinfo_inst_list(pid_t pid, int handle, const struct packet *packet)
+    {
        const char *pkgname;
        char *dup_pkgname;
        struct liveinfo *info;
 
        if (packet_get(packet, "s", &pkgname) != 1) {
-               ErrPrint("Invalid argument\n");
-               goto out;
+           ErrPrint("Invalid argument\n");
+           goto out;
        }
 
        info = liveinfo_find_by_pid(pid);
        if (!info) {
-               ErrPrint("Invalid request\n");
-               goto out;
+           ErrPrint("Invalid request\n");
+           goto out;
        }
 
        dup_pkgname = strdup(pkgname);
        if (!dup_pkgname) {
-               ErrPrint("Invalid request\n");
-               goto out;
+           ErrPrint("Invalid request\n");
+           goto out;
        }
 
        liveinfo_set_data(info, dup_pkgname);
@@ -7707,10 +7944,10 @@ static struct packet *liveinfo_inst_list(pid_t pid, int handle, const struct pac
 
 out:
        return NULL;
-}
+    }
 
-static Eina_Bool pkg_list_cb(void *info)
-{
+    static Eina_Bool pkg_list_cb(void *info)
+    {
        FILE *fp;
        Eina_List *l;
        Eina_List *list;
@@ -7723,230 +7960,230 @@ static Eina_Bool pkg_list_cb(void *info)
        liveinfo_open_fifo(info);
        fp = liveinfo_fifo(info);
        if (!fp) {
-               DbgPrint("Failed to open a pipe\n");
-               liveinfo_close_fifo(info);
-               return ECORE_CALLBACK_CANCEL;
+           DbgPrint("Failed to open a pipe\n");
+           liveinfo_close_fifo(info);
+           return ECORE_CALLBACK_CANCEL;
        }
 
        list = (Eina_List *)package_list();
        EINA_LIST_FOREACH(list, l, pkg) {
-               slave = package_slave(pkg);
-
-               if (slave) {
-                       slavename = slave_name(slave);
-                       pid = slave_pid(slave);
-               } else {
-                       pid = (pid_t)-1;
-                       slavename = "";
-               }
-
-               inst_list = (Eina_List *)package_instance_list(pkg);
-               fprintf(fp, "%d %s %s %s %d %d %d\n",
-                       pid,
-                       strlen(slavename) ? slavename : "(none)",
-                       package_name(pkg),
-                       package_abi(pkg),
-                       package_refcnt(pkg),
-                       package_fault_count(pkg),
-                       eina_list_count(inst_list)
-               );
-               DbgPrint("%d %s %s %s %d %d %d\n",
-                       pid,
-                       strlen(slavename) ? slavename : "(none)",
-                       package_name(pkg),
-                       package_abi(pkg),
-                       package_refcnt(pkg),
-                       package_fault_count(pkg),
-                       eina_list_count(inst_list)
-               );
+           slave = package_slave(pkg);
+
+           if (slave) {
+               slavename = slave_name(slave);
+               pid = slave_pid(slave);
+           } else {
+               pid = (pid_t)-1;
+               slavename = "";
+           }
+
+           inst_list = (Eina_List *)package_instance_list(pkg);
+           fprintf(fp, "%d %s %s %s %d %d %d\n",
+                   pid,
+                   strlen(slavename) ? slavename : "(none)",
+                   package_name(pkg),
+                   package_abi(pkg),
+                   package_refcnt(pkg),
+                   package_fault_count(pkg),
+                   eina_list_count(inst_list)
+                  );
+           DbgPrint("%d %s %s %s %d %d %d\n",
+                   pid,
+                   strlen(slavename) ? slavename : "(none)",
+                   package_name(pkg),
+                   package_abi(pkg),
+                   package_refcnt(pkg),
+                   package_fault_count(pkg),
+                   eina_list_count(inst_list)
+                   );
        }
 
        fprintf(fp, "EOD\n");
        DbgPrint("EOD\n");
        liveinfo_close_fifo(info);
        return ECORE_CALLBACK_CANCEL;
-}
+    }
 
-static struct packet *liveinfo_pkg_list(pid_t pid, int handle, const struct packet *packet)
-{
+    static struct packet *liveinfo_pkg_list(pid_t pid, int handle, const struct packet *packet)
+    {
        struct liveinfo *info;
        double timestamp;
 
        if (packet_get(packet, "d", &timestamp) != 1) {
-               ErrPrint("Invalid argument\n");
-               goto out;
+           ErrPrint("Invalid argument\n");
+           goto out;
        }
 
        DbgPrint("Package List: %lf\n", timestamp);
 
        info = liveinfo_find_by_pid(pid);
        if (!info) {
-               ErrPrint("Invalid request\n");
-               goto out;
+           ErrPrint("Invalid request\n");
+           goto out;
        }
 
        pkg_list_cb(info);
 out:
        return NULL;
-}
+    }
 
-static struct packet *liveinfo_slave_ctrl(pid_t pid, int handle, const struct packet *packet)
-{
+    static struct packet *liveinfo_slave_ctrl(pid_t pid, int handle, const struct packet *packet)
+    {
        return NULL;
-}
+    }
 
-static Eina_Bool pkg_ctrl_rmpack_cb(void *info)
-{
+    static Eina_Bool pkg_ctrl_rmpack_cb(void *info)
+    {
        FILE *fp;
        liveinfo_open_fifo(info);
        fp = liveinfo_fifo(info);
        if (!fp) {
-               liveinfo_close_fifo(info);
-               return ECORE_CALLBACK_CANCEL;
+           liveinfo_close_fifo(info);
+           return ECORE_CALLBACK_CANCEL;
        }
 
        fprintf(fp, "%d\n", ENOSYS);
        fprintf(fp, "EOD\n");
        liveinfo_close_fifo(info);
        return ECORE_CALLBACK_CANCEL;
-}
+    }
 
-static Eina_Bool pkg_ctrl_rminst_cb(void *info)
-{
+    static Eina_Bool pkg_ctrl_rminst_cb(void *info)
+    {
        FILE *fp;
 
        liveinfo_open_fifo(info);
        fp = liveinfo_fifo(info);
        if (!fp) {
-               liveinfo_close_fifo(info);
-               return ECORE_CALLBACK_CANCEL;
+           liveinfo_close_fifo(info);
+           return ECORE_CALLBACK_CANCEL;
        }
 
        fprintf(fp, "%d\n", (int)liveinfo_data(info));
        fprintf(fp, "EOD\n");
        liveinfo_close_fifo(info);
        return ECORE_CALLBACK_CANCEL;
-}
+    }
 
-static Eina_Bool pkg_ctrl_faultinst_cb(void *info)
-{
+    static Eina_Bool pkg_ctrl_faultinst_cb(void *info)
+    {
        FILE *fp;
 
        liveinfo_open_fifo(info);
        fp = liveinfo_fifo(info);
        if (!fp) {
-               liveinfo_close_fifo(info);
-               return ECORE_CALLBACK_CANCEL;
+           liveinfo_close_fifo(info);
+           return ECORE_CALLBACK_CANCEL;
        }
 
        fprintf(fp, "%d\n", (int)liveinfo_data(info));
        fprintf(fp, "EOD\n");
        liveinfo_close_fifo(info);
        return ECORE_CALLBACK_CANCEL;
-}
+    }
 
-static struct packet *liveinfo_pkg_ctrl(pid_t pid, int handle, const struct packet *packet)
-{
+    static struct packet *liveinfo_pkg_ctrl(pid_t pid, int handle, const struct packet *packet)
+    {
        struct liveinfo *info;
        char *cmd;
        char *pkgname;
        char *id;
 
        if (packet_get(packet, "sss", &cmd, &pkgname, &id) != 3) {
-               ErrPrint("Invalid argument\n");
-               goto out;
+           ErrPrint("Invalid argument\n");
+           goto out;
        }
 
        info = liveinfo_find_by_pid(pid);
        if (!info) {
-               ErrPrint("Invalid request\n");
-               goto out;
+           ErrPrint("Invalid request\n");
+           goto out;
        }
 
        if (!strcmp(cmd, "rmpack")) {
-               pkg_ctrl_rmpack_cb(info);
+           pkg_ctrl_rmpack_cb(info);
        } else if (!strcmp(cmd, "rminst")) {
-               struct inst_info *inst;
-               inst = package_find_instance_by_id(pkgname, id);
-               if (!inst) {
-                       liveinfo_set_data(info, (void *)ENOENT);
-               } else {
-                       (void)instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
-                       liveinfo_set_data(info, (void *)0);
-               }
-
-               pkg_ctrl_rminst_cb(info);
+           struct inst_info *inst;
+           inst = package_find_instance_by_id(pkgname, id);
+           if (!inst) {
+               liveinfo_set_data(info, (void *)ENOENT);
+           } else {
+               (void)instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+               liveinfo_set_data(info, (void *)0);
+           }
+
+           pkg_ctrl_rminst_cb(info);
        } else if (!strcmp(cmd, "faultinst")) {
-               struct inst_info *inst;
-               inst = package_find_instance_by_id(pkgname, id);
-               if (!inst) {
-                       liveinfo_set_data(info, (void *)ENOENT);
+           struct inst_info *inst;
+           inst = package_find_instance_by_id(pkgname, id);
+           if (!inst) {
+               liveinfo_set_data(info, (void *)ENOENT);
+           } else {
+               struct pkg_info *pkg;
+
+               pkg = instance_package(inst);
+               if (!pkg) {
+                   liveinfo_set_data(info, (void *)EFAULT);
                } else {
-                       struct pkg_info *pkg;
-
-                       pkg = instance_package(inst);
-                       if (!pkg) {
-                               liveinfo_set_data(info, (void *)EFAULT);
-                       } else {
-                               (void)package_faulted(pkg, 1);
-                               liveinfo_set_data(info, (void *)0);
-                       }
+                   (void)package_faulted(pkg, 1);
+                   liveinfo_set_data(info, (void *)0);
                }
+           }
 
-               pkg_ctrl_faultinst_cb(info);
+           pkg_ctrl_faultinst_cb(info);
        }
 
 out:
        return NULL;
-}
+    }
 
-static Eina_Bool master_ctrl_cb(void *info)
-{
+    static Eina_Bool master_ctrl_cb(void *info)
+    {
        FILE *fp;
 
        liveinfo_open_fifo(info);
        fp = liveinfo_fifo(info);
        if (!fp) {
-               liveinfo_close_fifo(info);
-               return ECORE_CALLBACK_CANCEL;
+           liveinfo_close_fifo(info);
+           return ECORE_CALLBACK_CANCEL;
        }
        fprintf(fp, "%d\nEOD\n", (int)liveinfo_data(info));
        liveinfo_close_fifo(info);
 
        return ECORE_CALLBACK_CANCEL;
-}
+    }
 
-static struct packet *liveinfo_master_ctrl(pid_t pid, int handle, const struct packet *packet)
-{
+    static struct packet *liveinfo_master_ctrl(pid_t pid, int handle, const struct packet *packet)
+    {
        struct liveinfo *info;
        char *cmd;
        char *var;
        char *val;
-       int ret = LB_STATUS_ERROR_INVALID;
+       int ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
 
        if (packet_get(packet, "sss", &cmd, &var, &val) != 3) {
-               ErrPrint("Invalid argument\n");
-               goto out;
+           ErrPrint("Invalid argument\n");
+           goto out;
        }
 
        info = liveinfo_find_by_pid(pid);
        if (!info) {
-               ErrPrint("Invalid request\n");
-               goto out;
+           ErrPrint("Invalid request\n");
+           goto out;
        }
 
        if (!strcasecmp(var, "debug")) {
-               if (!strcasecmp(cmd, "set")) {
-                       g_conf.debug_mode = !strcasecmp(val, "on");
-               } else if (!strcasecmp(cmd, "get")) {
-               }
-               ret = g_conf.debug_mode;
+           if (!strcasecmp(cmd, "set")) {
+               g_conf.debug_mode = !strcasecmp(val, "on");
+           } else if (!strcasecmp(cmd, "get")) {
+           }
+           ret = g_conf.debug_mode;
        } else if (!strcasecmp(var, "slave_max_load")) {
-               if (!strcasecmp(cmd, "set")) {
-                       g_conf.slave_max_load = atoi(val);
-               } else if (!strcasecmp(cmd, "get")) {
-               }
-               ret = g_conf.slave_max_load;
+           if (!strcasecmp(cmd, "set")) {
+               g_conf.slave_max_load = atoi(val);
+           } else if (!strcasecmp(cmd, "get")) {
+           }
+           ret = g_conf.slave_max_load;
        }
 
        liveinfo_set_data(info, (void *)ret);
@@ -7954,524 +8191,553 @@ static struct packet *liveinfo_master_ctrl(pid_t pid, int handle, const struct p
 
 out:
        return NULL;
-}
+    }
 
-static struct method s_info_table[] = {
+    static struct method s_info_table[] = {
        {
-               .cmd = "liveinfo_hello",
-               .handler = liveinfo_hello,
+           .cmd = CMD_STR_INFO_HELLO,
+           .handler = liveinfo_hello,
        },
        {
-               .cmd = "slave_list",
-               .handler = liveinfo_slave_list,
+           .cmd = CMD_STR_INFO_SLAVE_LIST,
+           .handler = liveinfo_slave_list,
        },
        {
-               .cmd = "pkg_list",
-               .handler = liveinfo_pkg_list,
+           .cmd = CMD_STR_INFO_PKG_LIST,
+           .handler = liveinfo_pkg_list,
        },
        {
-               .cmd = "inst_list",
-               .handler = liveinfo_inst_list,
+           .cmd = CMD_STR_INFO_INST_LIST,
+           .handler = liveinfo_inst_list,
        },
        {
-               .cmd = "slave_ctrl",
-               .handler = liveinfo_slave_ctrl,
+           .cmd = CMD_STR_INFO_SLAVE_CTRL,
+           .handler = liveinfo_slave_ctrl,
        },
        {
-               .cmd = "pkg_ctrl",
-               .handler = liveinfo_pkg_ctrl,
+           .cmd = CMD_STR_INFO_PKG_CTRL,
+           .handler = liveinfo_pkg_ctrl,
        },
        {
-               .cmd = "master_ctrl",
-               .handler = liveinfo_master_ctrl,
+           .cmd = CMD_STR_INFO_MASTER_CTRL,
+           .handler = liveinfo_master_ctrl,
        },
        {
-               .cmd = NULL,
-               .handler = NULL,
+           .cmd = NULL,
+           .handler = NULL,
        },
-};
+    };
 
-static struct method s_client_table[] = {
+    static struct method s_client_table[] = {
        {
-               .cmd = "pd_mouse_move",
-               .handler = client_pd_mouse_move, /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+           .cmd = CMD_STR_GBAR_MOUSE_MOVE,
+           .handler = client_gbar_mouse_move, /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
        },
        {
-               .cmd = "lb_mouse_move",
-               .handler = client_lb_mouse_move, /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+           .cmd = CMD_STR_DBOX_MOUSE_MOVE,
+           .handler = client_dbox_mouse_move, /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
        },
        {
-               .cmd = "pd_mouse_down",
-               .handler = client_pd_mouse_down, /* pid, pkgname, id, width, height, timestamp, x, y, ret */
+           .cmd = CMD_STR_GBAR_MOUSE_DOWN,
+           .handler = client_gbar_mouse_down, /* pid, pkgname, id, width, height, timestamp, x, y, ret */
        },
        {
-               .cmd = "pd_mouse_up",
-               .handler = client_pd_mouse_up, /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+           .cmd = CMD_STR_GBAR_MOUSE_UP,
+           .handler = client_gbar_mouse_up, /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
        },
        {
-               .cmd = "lb_mouse_down",
-               .handler = client_lb_mouse_down, /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+           .cmd = CMD_STR_DBOX_MOUSE_DOWN,
+           .handler = client_dbox_mouse_down, /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
        },
        {
-               .cmd = "lb_mouse_up",
-               .handler = client_lb_mouse_up, /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+           .cmd = CMD_STR_DBOX_MOUSE_UP,
+           .handler = client_dbox_mouse_up, /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
        },
        {
-               .cmd = "pd_mouse_enter",
-               .handler = client_pd_mouse_enter, /* pid, pkgname, id, width, height, timestamp, x, y, ret */
+           .cmd = CMD_STR_GBAR_MOUSE_ENTER,
+           .handler = client_gbar_mouse_enter, /* pid, pkgname, id, width, height, timestamp, x, y, ret */
        },
        {
-               .cmd = "pd_mouse_leave",
-               .handler = client_pd_mouse_leave, /* pid, pkgname, id, width, height, timestamp, x, y, ret */
+           .cmd = CMD_STR_GBAR_MOUSE_LEAVE,
+           .handler = client_gbar_mouse_leave, /* pid, pkgname, id, width, height, timestamp, x, y, ret */
        },
        {
-               .cmd = "lb_mouse_enter",
-               .handler = client_lb_mouse_enter, /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+           .cmd = CMD_STR_DBOX_MOUSE_ENTER,
+           .handler = client_dbox_mouse_enter, /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
        },
        {
-               .cmd = "lb_mouse_leave",
-               .handler = client_lb_mouse_leave, /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
+           .cmd = CMD_STR_DBOX_MOUSE_LEAVE,
+           .handler = client_dbox_mouse_leave, /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
        },
        {
-               .cmd = "lb_mouse_set",
-               .handler = client_lb_mouse_set,
+           .cmd = CMD_STR_DBOX_MOUSE_ON_SCROLL,
+           .handler = client_dbox_mouse_on_scroll,
        },
        {
-               .cmd = "lb_mouse_unset",
-               .handler = client_lb_mouse_unset,
+           .cmd = CMD_STR_DBOX_MOUSE_OFF_SCROLL,
+           .handler = client_dbox_mouse_off_scroll,
        },
        {
-               .cmd = "pd_mouse_set",
-               .handler = client_pd_mouse_set,
+           .cmd = CMD_STR_GBAR_MOUSE_ON_SCROLL,
+           .handler = client_gbar_mouse_on_scroll,
        },
        {
-               .cmd = "pd_mouse_unset",
-               .handler = client_pd_mouse_unset,
+           .cmd = CMD_STR_GBAR_MOUSE_OFF_SCROLL,
+           .handler = client_gbar_mouse_off_scroll,
        },
        {
-               .cmd = "lb_mouse_on_scroll",
-               .handler = client_lb_mouse_on_scroll,
+           .cmd = CMD_STR_DBOX_MOUSE_ON_HOLD,
+           .handler = client_dbox_mouse_on_hold,
        },
        {
-               .cmd = "lb_mouse_off_scroll",
-               .handler = client_lb_mouse_off_scroll,
+           .cmd = CMD_STR_DBOX_MOUSE_OFF_HOLD,
+           .handler = client_dbox_mouse_off_hold,
        },
        {
-               .cmd = "pd_mouse_on_scroll",
-               .handler = client_pd_mouse_on_scroll,
+           .cmd = CMD_STR_GBAR_MOUSE_ON_HOLD,
+           .handler = client_gbar_mouse_on_hold,
        },
        {
-               .cmd = "pd_mouse_off_scroll",
-               .handler = client_pd_mouse_off_scroll,
+           .cmd = CMD_STR_GBAR_MOUSE_OFF_HOLD,
+           .handler = client_gbar_mouse_off_hold,
        },
        {
-               .cmd = "lb_mouse_on_hold",
-               .handler = client_lb_mouse_on_hold,
+           .cmd = CMD_STR_CLICKED,
+           .handler = client_clicked, /*!< pid, pkgname, filename, event, timestamp, x, y, ret */
        },
        {
-               .cmd = "lb_mouse_off_hold",
-               .handler = client_lb_mouse_off_hold,
+           .cmd = CMD_STR_TEXT_SIGNAL,
+           .handler = client_text_signal, /* pid, pkgname, filename, emission, source, s, sy, ex, ey, ret */
        },
        {
-               .cmd = "pd_mouse_on_hold",
-               .handler = client_pd_mouse_on_hold,
+           .cmd = CMD_STR_DELETE,
+           .handler = client_delete, /* pid, pkgname, filename, ret */
        },
        {
-               .cmd = "pd_mouse_off_hold",
-               .handler = client_pd_mouse_off_hold,
+           .cmd = CMD_STR_RESIZE,
+           .handler = client_resize, /* pid, pkgname, filename, w, h, ret */
        },
        {
-               .cmd = "change,visibility",
-               .handler = client_change_visibility,
+           .cmd = CMD_STR_NEW,
+           .handler = client_new, /* pid, timestamp, pkgname, content, cluster, category, period, ret */
        },
        {
-               .cmd = "lb_acquire_pixmap",
-               .handler = client_lb_acquire_pixmap,
+           .cmd = CMD_STR_SET_PERIOD,
+           .handler = client_set_period, /* pid, pkgname, filename, period, ret, period */
        },
        {
-               .cmd = "lb_release_pixmap",
-               .handler = client_lb_release_pixmap,
+           .cmd = CMD_STR_CHANGE_GROUP,
+           .handler = client_change_group, /* pid, pkgname, filename, cluster, category, ret */
        },
        {
-               .cmd = "pd_acquire_pixmap",
-               .handler = client_pd_acquire_pixmap,
+           .cmd = CMD_STR_GBAR_MOVE,
+           .handler = client_gbar_move, /* pkgname, id, x, y */
        },
        {
-               .cmd = "pd_release_pixmap",
-               .handler = client_pd_release_pixmap,
+           .cmd = CMD_STR_GBAR_ACCESS_HL,
+           .handler = client_gbar_access_hl,
        },
        {
-               .cmd = "acquire",
-               .handler = client_acquire, /*!< pid, ret */
+           .cmd = CMD_STR_GBAR_ACCESS_ACTIVATE,
+           .handler = client_gbar_access_activate,
        },
        {
-               .cmd = "release",
-               .handler = cilent_release, /*!< pid, ret */
+           .cmd = CMD_STR_GBAR_ACCESS_ACTION,
+           .handler = client_gbar_access_action,
        },
        {
-               .cmd = "clicked",
-               .handler = client_clicked, /*!< pid, pkgname, filename, event, timestamp, x, y, ret */
+           .cmd = CMD_STR_GBAR_ACCESS_SCROLL,
+           .handler = client_gbar_access_scroll,
        },
        {
-               .cmd = "text_signal",
-               .handler = client_text_signal, /* pid, pkgname, filename, emission, source, s, sy, ex, ey, ret */
+           .cmd = CMD_STR_GBAR_ACCESS_VALUE_CHANGE,
+           .handler = client_gbar_access_value_change,
        },
        {
-               .cmd = "delete",
-               .handler = client_delete, /* pid, pkgname, filename, ret */
+           .cmd = CMD_STR_GBAR_ACCESS_MOUSE,
+           .handler = client_gbar_access_mouse,
        },
        {
-               .cmd = "resize",
-               .handler = client_resize, /* pid, pkgname, filename, w, h, ret */
+           .cmd = CMD_STR_GBAR_ACCESS_BACK,
+           .handler = client_gbar_access_back,
        },
        {
-               .cmd = "new",
-               .handler = client_new, /* pid, timestamp, pkgname, content, cluster, category, period, ret */
+           .cmd = CMD_STR_GBAR_ACCESS_OVER,
+           .handler = client_gbar_access_over,
        },
        {
-               .cmd = "set_period",
-               .handler = client_set_period, /* pid, pkgname, filename, period, ret, period */
+           .cmd = CMD_STR_GBAR_ACCESS_READ,
+           .handler = client_gbar_access_read,
        },
        {
-               .cmd = "change_group",
-               .handler = client_change_group, /* pid, pkgname, filename, cluster, category, ret */
+           .cmd = CMD_STR_GBAR_ACCESS_ENABLE,
+           .handler = client_gbar_access_enable,
        },
+
        {
-               .cmd = "pinup_changed",
-               .handler = client_pinup_changed, /* pid, pkgname, filename, pinup, ret */
+           .cmd = CMD_STR_DBOX_ACCESS_HL,
+           .handler = client_dbox_access_hl,
        },
        {
-               .cmd = "create_pd",
-               .handler = client_create_pd, /* pid, pkgname, filename, ret */
+           .cmd = CMD_STR_DBOX_ACCESS_ACTIVATE,
+           .handler = client_dbox_access_activate,
        },
        {
-               .cmd = "pd_move",
-               .handler = client_pd_move, /* pkgname, id, x, y */
+           .cmd = CMD_STR_DBOX_ACCESS_ACTION,
+           .handler = client_dbox_access_action,
        },
        {
-               .cmd = "destroy_pd",
-               .handler = client_destroy_pd, /* pid, pkgname, filename, ret */
+           .cmd = CMD_STR_DBOX_ACCESS_SCROLL,
+           .handler = client_dbox_access_scroll,
        },
        {
-               .cmd = "activate_package",
-               .handler = client_activate_package, /* pid, pkgname, ret */
+           .cmd = CMD_STR_DBOX_ACCESS_VALUE_CHANGE,
+           .handler = client_dbox_access_value_change,
        },
        {
-               .cmd = "subscribe", /* pid, cluster, sub-cluster */
-               .handler = client_subscribed,
+           .cmd = CMD_STR_DBOX_ACCESS_MOUSE,
+           .handler = client_dbox_access_mouse,
        },
        {
-               .cmd = "unsubscribe", /* pid, cluster, sub-cluster */
-               .handler = client_unsubscribed,
+           .cmd = CMD_STR_DBOX_ACCESS_BACK,
+           .handler = client_dbox_access_back,
        },
        {
-               .cmd = "delete_cluster",
-               .handler = client_delete_cluster,
+           .cmd = CMD_STR_DBOX_ACCESS_OVER,
+           .handler = client_dbox_access_over,
        },
        {
-               .cmd = "delete_category",
-               .handler = client_delete_category,
+           .cmd = CMD_STR_DBOX_ACCESS_READ,
+           .handler = client_dbox_access_read,
        },
        {
-               .cmd = "refresh_group",
-               .handler = client_refresh_group,
+           .cmd = CMD_STR_DBOX_ACCESS_ENABLE,
+           .handler = client_dbox_access_enable,
        },
        {
-               .cmd = "update",
-               .handler = client_update,
+           .cmd = CMD_STR_DBOX_KEY_DOWN,
+           .handler = client_dbox_key_down,
+       },
+       {
+           .cmd = CMD_STR_DBOX_KEY_UP,
+           .handler = client_dbox_key_up,
        },
-
        {
-               .cmd = "pd_access_hl",
-               .handler = client_pd_access_hl,
+           .cmd = CMD_STR_DBOX_KEY_FOCUS_IN,
+           .handler = client_dbox_key_focus_in,
        },
        {
-               .cmd = "pd_access_hl_prev",
-               .handler = client_pd_access_hl_prev,
+           .cmd = CMD_STR_DBOX_KEY_FOCUS_OUT,
+           .handler = client_dbox_key_focus_out,
        },
        {
-               .cmd = "pd_access_hl_next",
-               .handler = client_pd_access_hl_next,
+           .cmd = CMD_STR_GBAR_KEY_DOWN,
+           .handler = client_gbar_key_down,
        },
        {
-               .cmd = "pd_access_activate",
-               .handler = client_pd_access_activate,
+           .cmd = CMD_STR_GBAR_KEY_UP,
+           .handler = client_gbar_key_up,
        },
        {
-               .cmd = "pd_access_action_up",
-               .handler = client_pd_access_action_up,
+           .cmd = CMD_STR_GBAR_KEY_FOCUS_IN,
+           .handler = client_gbar_key_focus_in,
        },
        {
-               .cmd = "pd_access_action_down",
-               .handler = client_pd_access_action_down,
+           .cmd = CMD_STR_GBAR_KEY_FOCUS_OUT,
+           .handler = client_gbar_key_focus_out,
        },
        {
-               .cmd = "pd_access_unhighlight",
-               .handler = client_pd_access_unhighlight,
+           .cmd = CMD_STR_UPDATE_MODE,
+           .handler = client_update_mode,
        },
+       // Cut HERE. Above list must be sync'd with provider list.
+
        {
-               .cmd = "pd_access_scroll_down",
-               .handler = client_pd_access_scroll_down,
+           .cmd = CMD_STR_DBOX_MOUSE_SET,
+           .handler = client_dbox_mouse_set,
        },
        {
-               .cmd = "pd_access_scroll_move",
-               .handler = client_pd_access_scroll_move,
+           .cmd = CMD_STR_DBOX_MOUSE_UNSET,
+           .handler = client_dbox_mouse_unset,
        },
        {
-               .cmd = "pd_access_scroll_up",
-               .handler = client_pd_access_scroll_up,
+           .cmd = CMD_STR_GBAR_MOUSE_SET,
+           .handler = client_gbar_mouse_set,
        },
-
        {
-               .cmd = "lb_access_hl",
-               .handler = client_lb_access_hl,
+           .cmd = CMD_STR_GBAR_MOUSE_UNSET,
+           .handler = client_gbar_mouse_unset,
        },
        {
-               .cmd = "lb_access_hl_prev",
-               .handler = client_lb_access_hl_prev,
+           .cmd = CMD_STR_CHANGE_VISIBILITY,
+           .handler = client_change_visibility,
        },
        {
-               .cmd = "lb_access_hl_next",
-               .handler = client_lb_access_hl_next,
+           .cmd = CMD_STR_DBOX_ACQUIRE_PIXMAP,
+           .handler = client_dbox_acquire_pixmap,
        },
        {
-               .cmd = "lb_access_activate",
-               .handler = client_lb_access_activate,
+           .cmd = CMD_STR_DBOX_RELEASE_PIXMAP,
+           .handler = client_dbox_release_pixmap,
        },
        {
-               .cmd = "lb_access_action_up",
-               .handler = client_lb_access_action_up,
+           .cmd = CMD_STR_GBAR_ACQUIRE_PIXMAP,
+           .handler = client_gbar_acquire_pixmap,
        },
        {
-               .cmd = "lb_access_action_down",
-               .handler = client_lb_access_action_down,
+           .cmd = CMD_STR_GBAR_RELEASE_PIXMAP,
+           .handler = client_gbar_release_pixmap,
        },
        {
-               .cmd = "lb_access_unhighlight",
-               .handler = client_lb_access_unhighlight,
+           .cmd = CMD_STR_ACQUIRE,
+           .handler = client_acquire, /*!< pid, ret */
        },
        {
-               .cmd = "lb_access_scroll_down",
-               .handler = client_lb_access_scroll_down,
+           .cmd = CMD_STR_RELEASE,
+           .handler = cilent_release, /*!< pid, ret */
        },
        {
-               .cmd = "lb_access_scroll_move",
-               .handler = client_lb_access_scroll_move,
+           .cmd = CMD_STR_PINUP_CHANGED,
+           .handler = client_pinup_changed, /* pid, pkgname, filename, pinup, ret */
        },
        {
-               .cmd = "lb_access_scroll_up",
-               .handler = client_lb_access_scroll_up,
+           .cmd = CMD_STR_CREATE_GBAR,
+           .handler = client_create_gbar, /* pid, pkgname, filename, ret */
        },
-
        {
-               .cmd = "lb_key_down",
-               .handler = client_lb_key_down,
+           .cmd = CMD_STR_DESTROY_GBAR,
+           .handler = client_destroy_gbar, /* pid, pkgname, filename, ret */
        },
        {
-               .cmd = "lb_key_up",
-               .handler = client_lb_key_up,
+           .cmd = CMD_STR_ACTIVATE_PACKAGE,
+           .handler = client_activate_package, /* pid, pkgname, ret */
        },
        {
-               .cmd = "lb_key_focus_in",
-               .handler = client_lb_key_focus_in,
+           .cmd = CMD_STR_SUBSCRIBE, /* pid, cluster, sub-cluster */
+           .handler = client_subscribed,
        },
        {
-               .cmd = "lb_key_focus_out",
-               .handler = client_lb_key_focus_out,
+           .cmd = CMD_STR_UNSUBSCRIBE, /* pid, cluster, sub-cluster */
+           .handler = client_unsubscribed,
        },
        {
-               .cmd = "lb_key_set",
-               .handler = client_lb_key_set,
+           .cmd = CMD_STR_DELETE_CLUSTER,
+           .handler = client_delete_cluster,
        },
        {
-               .cmd = "lb_key_unset",
-               .handler = client_lb_key_unset,
+           .cmd = CMD_STR_DELETE_CATEGORY,
+           .handler = client_delete_category,
        },
-
        {
-               .cmd = "pd_key_down",
-               .handler = client_pd_key_down,
+           .cmd = CMD_STR_REFRESH_GROUP,
+           .handler = client_refresh_group,
        },
        {
-               .cmd = "pd_key_up",
-               .handler = client_pd_key_up,
+           .cmd = CMD_STR_UPDATE,
+           .handler = client_update,
        },
+
        {
-               .cmd = "pd_key_focus_in",
-               .handler = client_pd_key_focus_in,
+           .cmd = CMD_STR_DBOX_KEY_SET,
+           .handler = client_dbox_key_set,
        },
        {
-               .cmd = "pd_key_focus_out",
-               .handler = client_pd_key_focus_out,
+           .cmd = CMD_STR_DBOX_KEY_UNSET,
+           .handler = client_dbox_key_unset,
        },
+
        {
-               .cmd = "pd_key_set",
-               .handler = client_pd_key_set,
+           .cmd = CMD_STR_GBAR_KEY_SET,
+           .handler = client_gbar_key_set,
        },
        {
-               .cmd = "pd_key_unset",
-               .handler = client_pd_key_unset,
+           .cmd = CMD_STR_GBAR_KEY_UNSET,
+           .handler = client_gbar_key_unset,
        },
 
        {
-               .cmd = "client_paused",
-               .handler = client_pause_request,
+           .cmd = CMD_STR_CLIENT_PAUSED,
+           .handler = client_pause_request,
        },
        {
-               .cmd = "client_resumed",
-               .handler = client_resume_request,
+           .cmd = CMD_STR_CLIENT_RESUMED,
+           .handler = client_resume_request,
        },
-
        {
-               .cmd = "update_mode",
-               .handler = client_update_mode,
+           .cmd = CMD_STR_DBOX_ACQUIRE_XPIXMAP,
+           .handler = client_dbox_acquire_xpixmap,
+       },
+       {
+           .cmd = CMD_STR_GBAR_ACQUIRE_XPIXMAP,
+           .handler = client_gbar_acquire_xpixmap,
        },
 
        {
-               .cmd = NULL,
-               .handler = NULL,
+           .cmd = NULL,
+           .handler = NULL,
        },
-};
+    };
 
-static struct method s_service_table[] = {
+    static struct method s_service_table[] = {
        {
-               .cmd = "service_update",
-               .handler = service_update,
+           .cmd = CMD_STR_SERVICE_UPDATE,
+           .handler = service_update,
        },
        {
-               .cmd = "service_change_period",
-               .handler = service_change_period,
+           .cmd = CMD_STR_SERVICE_CHANGE_PERIOD,
+           .handler = service_change_period,
        },
        {
-               .cmd = NULL,
-               .handler = NULL,
+           .cmd = CMD_STR_SERVICE_INST_CNT,
+           .handler = service_instance_count,
        },
-};
+       {
+           .cmd = NULL,
+           .handler = NULL,
+       },
+    };
 
-static struct method s_slave_table[] = {
+    static struct method s_slave_table[] = {
        {
-               .cmd = "call",
-               .handler = slave_call, /* slave_name, pkgname, filename, function, ret */
+           .cmd = CMD_STR_UPDATED,
+           .handler = slave_updated, /* slave_name, pkgname, filename, width, height, ret */
        },
        {
-               .cmd = "ret",
-               .handler = slave_ret, /* slave_name, pkgname, filename, function, ret */
+           .cmd = CMD_STR_DESC_UPDATED,
+           .handler = slave_desc_updated, /* slave_name, pkgname, filename, decsfile, ret */
        },
        {
-               .cmd = "updated",
-               .handler = slave_updated, /* slave_name, pkgname, filename, width, height, priority, ret */
+           .cmd = CMD_STR_EXTRA_UPDATED,
+           .handler = slave_extra_updated,
        },
        {
-               .cmd = "desc_updated",
-               .handler = slave_desc_updated, /* slave_name, pkgname, filename, decsfile, ret */
+           .cmd = CMD_STR_EXTRA_INFO,
+           .handler = slave_extra_info, /* slave_name, pkgname, filename, priority, content_info, title, icon, name */
        },
        {
-               .cmd = "deleted",
-               .handler = slave_deleted, /* slave_name, pkgname, filename, ret */
+           .cmd = CMD_STR_DELETED,
+           .handler = slave_deleted, /* slave_name, pkgname, filename, ret */
        },
        {
-               .cmd = "acquire_buffer",
-               .handler = slave_acquire_buffer, /* slave_name, id, w, h, size, - out - type, shmid */
+           .cmd = CMD_STR_FAULTED,
+           .handler = slave_faulted, /* slave_name, pkgname, id, funcname */
        },
        {
-               .cmd = "resize_buffer",
-               .handler = slave_resize_buffer,
+           .cmd = CMD_STR_SCROLL,
+           .handler = slave_hold_scroll, /* slave_name, pkgname, id, seize */
        },
+
        {
-               .cmd = "release_buffer",
-               .handler = slave_release_buffer, /* slave_name, id - ret */
+           .cmd = CMD_STR_DBOX_UPDATE_BEGIN,
+           .handler = slave_dbox_update_begin,
        },
        {
-               .cmd = "faulted",
-               .handler = slave_faulted, /* slave_name, pkgname, id, funcname */
+           .cmd = CMD_STR_DBOX_UPDATE_END,
+           .handler = slave_dbox_update_end,
        },
        {
-               .cmd = "scroll",
-               .handler = slave_hold_scroll, /* slave_name, pkgname, id, seize */
+           .cmd = CMD_STR_GBAR_UPDATE_BEGIN,
+           .handler = slave_gbar_update_begin,
        },
-
        {
-               .cmd = "lb_update_begin",
-               .handler = slave_lb_update_begin,
+           .cmd = CMD_STR_GBAR_UPDATE_END,
+           .handler = slave_gbar_update_end,
        },
+
        {
-               .cmd = "lb_update_end",
-               .handler = slave_lb_update_end,
+           .cmd = CMD_STR_ACCESS_STATUS,
+           .handler = slave_access_status,
        },
        {
-               .cmd = "pd_update_begin",
-               .handler = slave_pd_update_begin,
+           .cmd = CMD_STR_KEY_STATUS,
+           .handler = slave_key_status,
        },
        {
-               .cmd = "pd_update_end",
-               .handler = slave_pd_update_end,
+           .cmd = CMD_STR_CLOSE_GBAR,
+           .handler = slave_close_gbar,
        },
 
        {
-               .cmd = "access_status",
-               .handler = slave_access_status,
+           .cmd = CMD_STR_CALL,
+           .handler = slave_call, /* slave_name, pkgname, filename, function, ret */
        },
        {
-               .cmd = "key_status",
-               .handler = slave_key_status,
+           .cmd = CMD_STR_RET,
+           .handler = slave_ret, /* slave_name, pkgname, filename, function, ret */
        },
        {
-               .cmd = "close_pd",
-               .handler = slave_close_pd,
+           .cmd = CMD_STR_ACQUIRE_BUFFER,
+           .handler = slave_acquire_buffer, /* slave_name, id, w, h, size, - out - type, shmid */
+       },
+       {
+           .cmd = CMD_STR_RESIZE_BUFFER,
+           .handler = slave_resize_buffer,
        },
-
        {
-               .cmd = "hello",
-               .handler = slave_hello, /* slave_name, ret */
+           .cmd = CMD_STR_RELEASE_BUFFER,
+           .handler = slave_release_buffer, /* slave_name, id - ret */
        },
        {
-               .cmd = "ping",
-               .handler = slave_ping, /* slave_name, ret */
+           .cmd = CMD_STR_HELLO,
+           .handler = slave_hello, /* slave_name, ret */
        },
        {
-               .cmd = "ctrl",
-               .handler = slave_ctrl, /* control bits */
+           .cmd = CMD_STR_PING,
+           .handler = slave_ping, /* slave_name, ret */
+       },
+       {
+           .cmd = CMD_STR_CTRL,
+           .handler = slave_ctrl, /* control bits */
        },
 
        {
-               .cmd = NULL,
-               .handler = NULL,
+           .cmd = CMD_STR_ACQUIRE_XBUFFER,
+           .handler = slave_acquire_extra_buffer,
+       },
+       {
+           .cmd = CMD_STR_RELEASE_XBUFFER,
+           .handler = slave_release_extra_buffer,
        },
-};
 
-HAPI int server_init(void)
-{
-       com_core_packet_use_thread(COM_CORE_THREAD);
+       {
+           .cmd = NULL,
+           .handler = NULL,
+       },
+    };
+
+    HAPI int server_init(void)
+    {
+       com_core_packet_use_thread(DYNAMICBOX_CONF_COM_CORE_THREAD);
 
        if (unlink(INFO_SOCKET) < 0) {
-               ErrPrint("info socket: %s\n", strerror(errno));
+           ErrPrint("info socket: %s\n", strerror(errno));
        }
 
        if (unlink(SLAVE_SOCKET) < 0) {
-               ErrPrint("slave socket: %s\n", strerror(errno));
+           ErrPrint("slave socket: %s\n", strerror(errno));
        }
 
        if (unlink(CLIENT_SOCKET) < 0) {
-               ErrPrint("client socket: %s\n", strerror(errno));
+           ErrPrint("client socket: %s\n", strerror(errno));
        }
 
        if (unlink(SERVICE_SOCKET) < 0) {
-               ErrPrint("service socket: %s\n", strerror(errno));
+           ErrPrint("service socket: %s\n", strerror(errno));
        }
 
        s_info.info_fd = com_core_packet_server_init(INFO_SOCKET, s_info_table);
        if (s_info.info_fd < 0) {
-               ErrPrint("Failed to create a info socket\n");
+           ErrPrint("Failed to create a info socket\n");
        }
 
        s_info.slave_fd = com_core_packet_server_init(SLAVE_SOCKET, s_slave_table);
        if (s_info.slave_fd < 0) {
-               ErrPrint("Failed to create a slave socket\n");
+           ErrPrint("Failed to create a slave socket\n");
        }
 
        s_info.client_fd = com_core_packet_server_init(CLIENT_SOCKET, s_client_table);
        if (s_info.client_fd < 0) {
-               ErrPrint("Failed to create a client socket\n");
+           ErrPrint("Failed to create a client socket\n");
        }
 
        /*!
@@ -8481,61 +8747,61 @@ HAPI int server_init(void)
         */
        s_info.remote_client_fd = com_core_packet_server_init("remote://:"CLIENT_PORT, s_client_table);
        if (s_info.client_fd < 0) {
-               ErrPrint("Failed to create a remote client socket\n");
+           ErrPrint("Failed to create a remote client socket\n");
        }
 
        s_info.service_fd = com_core_packet_server_init(SERVICE_SOCKET, s_service_table);
        if (s_info.service_fd < 0) {
-               ErrPrint("Faild to create a service socket\n");
+           ErrPrint("Faild to create a service socket\n");
        }
 
        if (chmod(INFO_SOCKET, 0600) < 0) {
-               ErrPrint("info socket: %s\n", strerror(errno));
+           ErrPrint("info socket: %s\n", strerror(errno));
        }
 
        if (chmod(SLAVE_SOCKET, 0666) < 0) {
-               ErrPrint("slave socket: %s\n", strerror(errno));
+           ErrPrint("slave socket: %s\n", strerror(errno));
        }
 
        if (chmod(CLIENT_SOCKET, 0666) < 0) {
-               ErrPrint("client socket: %s\n", strerror(errno));
+           ErrPrint("client socket: %s\n", strerror(errno));
        }
 
        if (chmod(SERVICE_SOCKET, 0666) < 0) {
-               ErrPrint("service socket: %s\n", strerror(errno));
+           ErrPrint("service socket: %s\n", strerror(errno));
        }
 
        return 0;
-}
+    }
 
-HAPI int server_fini(void)
-{
+    HAPI int server_fini(void)
+    {
        if (s_info.info_fd > 0) {
-               com_core_packet_server_fini(s_info.info_fd);
-               s_info.info_fd = -1;
+           com_core_packet_server_fini(s_info.info_fd);
+           s_info.info_fd = -1;
        }
 
        if (s_info.slave_fd > 0) {
-               com_core_packet_server_fini(s_info.slave_fd);
-               s_info.slave_fd = -1;
+           com_core_packet_server_fini(s_info.slave_fd);
+           s_info.slave_fd = -1;
        }
 
        if (s_info.client_fd > 0) {
-               com_core_packet_server_fini(s_info.client_fd);
-               s_info.client_fd = -1;
+           com_core_packet_server_fini(s_info.client_fd);
+           s_info.client_fd = -1;
        }
 
        if (s_info.remote_client_fd > 0) {
-               com_core_packet_server_fini(s_info.remote_client_fd);
-               s_info.remote_client_fd = -1;
+           com_core_packet_server_fini(s_info.remote_client_fd);
+           s_info.remote_client_fd = -1;
        }
 
        if (s_info.service_fd > 0) {
-               com_core_packet_server_fini(s_info.service_fd);
-               s_info.service_fd = -1;
+           com_core_packet_server_fini(s_info.service_fd);
+           s_info.service_fd = -1;
        }
 
        return 0;
-}
+    }
 
-/* End of a file */
+    /* End of a file */
index e2b27c9..6fd0909 100644 (file)
@@ -30,7 +30,7 @@
 #include <Eina.h>
 #include <com-core.h>
 #if defined(HAVE_LIVEBOX)
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
 #else
 #include <lite-errno.h>
 #endif
 int errno;
 
 struct service_event_item {
-       enum {
-               SERVICE_EVENT_TIMER
-       } type;
-
-       union {
-               struct {
-                       int fd;
-               } timer;
-       } info;
-
-       int (*event_cb)(struct service_context *svc_cx, void *data);
-       void *cbdata;
+    enum {
+       SERVICE_EVENT_TIMER
+    } type;
+
+    union {
+       struct {
+           int fd;
+       } timer;
+    } info;
+
+    int (*event_cb)(struct service_context *svc_cx, void *data);
+    void *cbdata;
 };
 
 struct tcb_event_cbdata {
-       struct tcb *tcb;
-       void (*cb)(struct service_context *svc_ctx, struct tcb *tcb, void *data);
-       void *data;
+    struct tcb *tcb;
+    void (*cb)(struct service_context *svc_ctx, struct tcb *tcb, void *data);
+    void *data;
 };
 
 /*!
@@ -72,29 +72,29 @@ struct tcb_event_cbdata {
  * Server information and global (only in this file-scope) variables are defined
  */
 struct service_context {
-       pthread_t server_thid; /*!< Server thread Id */
-       int fd; /*!< Server socket handle */
+    pthread_t server_thid; /*!< Server thread Id */
+    int fd; /*!< Server socket handle */
 
-       Eina_List *tcb_list; /*!< TCB list, list of every thread for client connections */
-       pthread_mutex_t tcb_list_lock;
+    Eina_List *tcb_list; /*!< TCB list, list of every thread for client connections */
+    pthread_mutex_t tcb_list_lock;
 
-       Eina_List *packet_list;
-       pthread_mutex_t packet_list_lock;
-       int evt_pipe[PIPE_MAX];
-       int tcb_pipe[PIPE_MAX];
+    Eina_List *packet_list;
+    pthread_mutex_t packet_list_lock;
+    int evt_pipe[PIPE_MAX];
+    int tcb_pipe[PIPE_MAX];
 
-       int (*service_thread_main)(struct tcb *tcb, struct packet *packet, void *data);
-       void *service_thread_data;
+    int (*service_thread_main)(struct tcb *tcb, struct packet *packet, void *data);
+    void *service_thread_data;
 
-       Eina_List *event_list;
+    Eina_List *event_list;
 
-       Eina_List *tcb_create_cb_list;
-       Eina_List *tcb_destroy_cb_list;
+    Eina_List *tcb_create_cb_list;
+    Eina_List *tcb_destroy_cb_list;
 };
 
 struct packet_info {
-       struct tcb *tcb;
-       struct packet *packet;
+    struct tcb *tcb;
+    struct packet *packet;
 };
 
 /*!
@@ -104,12 +104,12 @@ struct packet_info {
  *   When a new client is comming to us, this TCB block will be allocated and initialized.
  */
 struct tcb { /* Thread controll block */
-       struct service_context *svc_ctx;
-       pthread_t thid; /*!< Thread Id */
-       int fd; /*!< Connection handle */
-       enum tcb_type type;
-       int ctrl_pipe[PIPE_MAX];
-       pid_t pid; /*!< Keep the PID of client, if the client is remote one, this will be -1 */
+    struct service_context *svc_ctx;
+    pthread_t thid; /*!< Thread Id */
+    int fd; /*!< Connection handle */
+    enum tcb_type type;
+    int ctrl_pipe[PIPE_MAX];
+    pid_t pid; /*!< Keep the PID of client, if the client is remote one, this will be -1 */
 };
 
 /*!
@@ -119,227 +119,227 @@ struct tcb { /* Thread controll block */
  */
 static void *client_packet_pump_main(void *data)
 {
-       struct tcb *tcb = data;
-       struct service_context *svc_ctx = tcb->svc_ctx;
-       struct packet *packet = NULL;
-       fd_set set;
-       char *ptr = NULL;
-       int size = 0;
-       int packet_offset = 0;
-       int recv_offset = 0;
-       long ret;
-       int fd;
-       char evt_ch = EVT_CH;
-       enum {
-               RECV_INIT,
-               RECV_HEADER,
-               RECV_PAYLOAD,
-               RECV_DONE,
-       } recv_state;
-       struct packet_info *packet_info;
-       Eina_List *l;
-
-       ret = 0;
-       recv_state = RECV_INIT;
+    struct tcb *tcb = data;
+    struct service_context *svc_ctx = tcb->svc_ctx;
+    struct packet *packet = NULL;
+    fd_set set;
+    char *ptr = NULL;
+    int size = 0;
+    int packet_offset = 0;
+    int recv_offset = 0;
+    long ret;
+    int fd;
+    char evt_ch = EVT_CH;
+    enum {
+       RECV_INIT,
+       RECV_HEADER,
+       RECV_PAYLOAD,
+       RECV_DONE,
+    } recv_state;
+    struct packet_info *packet_info;
+    Eina_List *l;
+
+    ret = 0;
+    recv_state = RECV_INIT;
+    /*!
+     * \note
+     * To escape from the switch statement, we use this ret value
+     */
+    while (ret == 0) {
+       FD_ZERO(&set);
+       FD_SET(tcb->fd, &set);
+       FD_SET(tcb->ctrl_pipe[PIPE_READ], &set);
+       fd = tcb->fd > tcb->ctrl_pipe[PIPE_READ] ? tcb->fd : tcb->ctrl_pipe[PIPE_READ];
+       ret = select(fd + 1, &set, NULL, NULL, NULL);
+       if (ret < 0) {
+           ret = -errno;
+           if (errno == EINTR) {
+               ErrPrint("INTERRUPTED\n");
+               ret = 0;
+               continue;
+           }
+           ErrPrint("Error: %s\n", strerror(errno));
+           DbgFree(ptr);
+           ptr = NULL;
+           break;
+       } else if (ret == 0) {
+           ErrPrint("Timeout\n");
+           ret = -ETIMEDOUT;
+           DbgFree(ptr);
+           ptr = NULL;
+           break;
+       }
+
+       if (FD_ISSET(tcb->ctrl_pipe[PIPE_READ], &set)) {
+           DbgPrint("Thread is canceled\n");
+           ret = -ECANCELED;
+           DbgFree(ptr);
+           ptr = NULL;
+           break;
+       }
+
+       if (!FD_ISSET(tcb->fd, &set)) {
+           ErrPrint("Unexpected handler is toggled\n");
+           ret = -EINVAL;
+           DbgFree(ptr);
+           ptr = NULL;
+           break;
+       }
+
        /*!
-        * \note
-        * To escape from the switch statement, we use this ret value
+        * \TODO
+        * Service!!! Receive packet & route packet
         */
-       while (ret == 0) {
-               FD_ZERO(&set);
-               FD_SET(tcb->fd, &set);
-               FD_SET(tcb->ctrl_pipe[PIPE_READ], &set);
-               fd = tcb->fd > tcb->ctrl_pipe[PIPE_READ] ? tcb->fd : tcb->ctrl_pipe[PIPE_READ];
-               ret = select(fd + 1, &set, NULL, NULL, NULL);
-               if (ret < 0) {
-                       ret = -errno;
-                       if (errno == EINTR) {
-                               ErrPrint("INTERRUPTED\n");
-                               ret = 0;
-                               continue;
-                       }
-                       ErrPrint("Error: %s\n", strerror(errno));
-                       DbgFree(ptr);
-                       ptr = NULL;
-                       break;
-               } else if (ret == 0) {
-                       ErrPrint("Timeout\n");
-                       ret = -ETIMEDOUT;
-                       DbgFree(ptr);
-                       ptr = NULL;
-                       break;
+       switch (recv_state) {
+           case RECV_INIT:
+               size = packet_header_size();
+               packet_offset = 0;
+               recv_offset = 0;
+               packet = NULL;
+               ptr = malloc(size);
+               if (!ptr) {
+                   ErrPrint("Heap: %s\n", strerror(errno));
+                   ret = -ENOMEM;
+                   break;
                }
-
-               if (FD_ISSET(tcb->ctrl_pipe[PIPE_READ], &set)) {
-                       DbgPrint("Thread is canceled\n");
+               recv_state = RECV_HEADER;
+               /* Go through, don't break from here */
+           case RECV_HEADER:
+               ret = secure_socket_recv(tcb->fd, ptr, size - recv_offset, &tcb->pid);
+               if (ret <= 0) {
+                   if (ret == 0) {
                        ret = -ECANCELED;
-                       DbgFree(ptr);
-                       ptr = NULL;
-                       break;
+                   }
+                   DbgFree(ptr);
+                   ptr = NULL;
+                   break;
                }
 
-               if (!FD_ISSET(tcb->fd, &set)) {
-                       ErrPrint("Unexpected handler is toggled\n");
-                       ret = -EINVAL;
-                       DbgFree(ptr);
-                       ptr = NULL;
+               recv_offset += ret;
+               ret = 0;
+
+               if (recv_offset == size) {
+                   packet = packet_build(packet, packet_offset, ptr, size);
+                   DbgFree(ptr);
+                   ptr = NULL;
+                   if (!packet) {
+                       ret = -EFAULT;
                        break;
-               }
+                   }
 
-               /*!
-                * \TODO
-                * Service!!! Receive packet & route packet
-                */
-               switch (recv_state) {
-               case RECV_INIT:
-                       size = packet_header_size();
-                       packet_offset = 0;
+                   packet_offset += recv_offset;
+
+                   size = packet_payload_size(packet);
+                   if (size <= 0) {
+                       recv_state = RECV_DONE;
                        recv_offset = 0;
-                       packet = NULL;
-                       ptr = malloc(size);
-                       if (!ptr) {
-                               ErrPrint("Heap: %s\n", strerror(errno));
-                               ret = -ENOMEM;
-                               break;
-                       }
-                       recv_state = RECV_HEADER;
-                       /* Go through, don't break from here */
-               case RECV_HEADER:
-                       ret = secure_socket_recv(tcb->fd, ptr, size - recv_offset, &tcb->pid);
-                       if (ret <= 0) {
-                               if (ret == 0) {
-                                       ret = -ECANCELED;
-                               }
-                               DbgFree(ptr);
-                               ptr = NULL;
-                               break;
-                       }
-
-                       recv_offset += ret;
-                       ret = 0;
-
-                       if (recv_offset == size) {
-                               packet = packet_build(packet, packet_offset, ptr, size);
-                               DbgFree(ptr);
-                               ptr = NULL;
-                               if (!packet) {
-                                       ret = -EFAULT;
-                                       break;
-                               }
-
-                               packet_offset += recv_offset;
-
-                               size = packet_payload_size(packet);
-                               if (size <= 0) {
-                                       recv_state = RECV_DONE;
-                                       recv_offset = 0;
-                                       break;
-                               }
-
-                               recv_state = RECV_PAYLOAD;
-                               recv_offset = 0;
-
-                               ptr = malloc(size);
-                               if (!ptr) {
-                                       ErrPrint("Heap: %s\n", strerror(errno));
-                                       ret = -ENOMEM;
-                               }
-                       }
-                       break;
-               case RECV_PAYLOAD:
-                       ret = secure_socket_recv(tcb->fd, ptr, size - recv_offset, &tcb->pid);
-                       if (ret <= 0) {
-                               if (ret == 0) {
-                                       ret = -ECANCELED;
-                               }
-                               DbgFree(ptr);
-                               ptr = NULL;
-                               break;
-                       }
-
-                       recv_offset += ret;
-                       ret = 0;
-
-                       if (recv_offset == size) {
-                               packet = packet_build(packet, packet_offset, ptr, size);
-                               DbgFree(ptr);
-                               ptr = NULL;
-                               if (!packet) {
-                                       ret = -EFAULT;
-                                       break;
-                               }
-
-                               packet_offset += recv_offset;
-
-                               recv_state = RECV_DONE;
-                               recv_offset = 0;
-                       }
-                       break;
-               case RECV_DONE:
-               default:
-                       /* Dead code */
                        break;
-               }
+                   }
+
+                   recv_state = RECV_PAYLOAD;
+                   recv_offset = 0;
 
-               if (recv_state == RECV_DONE) {
-                       /*!
-                        * Push this packet to the packet list with TCB
-                        * Then the service main function will get this.
-                        */
-                       packet_info = malloc(sizeof(*packet_info));
-                       if (!packet_info) {
-                               ret = -errno;
-                               ErrPrint("Heap: %s\n", strerror(errno));
-                               packet_destroy(packet);
-                               break;
-                       }
-
-                       packet_info->packet = packet;
-                       packet_info->tcb = tcb;
-
-                       CRITICAL_SECTION_BEGIN(&svc_ctx->packet_list_lock);
-                       svc_ctx->packet_list = eina_list_append(svc_ctx->packet_list, packet_info);
-                       CRITICAL_SECTION_END(&svc_ctx->packet_list_lock);
-
-                       if (write(svc_ctx->evt_pipe[PIPE_WRITE], &evt_ch, sizeof(evt_ch)) != sizeof(evt_ch)) {
-                               ret = -errno;
-                               ErrPrint("Unable to write a pipe: %s\n", strerror(errno));
-                               CRITICAL_SECTION_BEGIN(&svc_ctx->packet_list_lock);
-                               svc_ctx->packet_list = eina_list_remove(svc_ctx->packet_list, packet_info);
-                               CRITICAL_SECTION_END(&svc_ctx->packet_list_lock);
-
-                               packet_destroy(packet);
-                               DbgFree(packet_info);
-                               ErrPrint("Terminate thread: %p\n", tcb);
-                               break;
-                       } else {
-                               DbgPrint("Packet received: %d bytes\n", packet_offset);
-                               recv_state = RECV_INIT;
-                       }
-
-                       /* Take a breathe */
-                       pthread_yield();
+                   ptr = malloc(size);
+                   if (!ptr) {
+                       ErrPrint("Heap: %s\n", strerror(errno));
+                       ret = -ENOMEM;
+                   }
+               }
+               break;
+           case RECV_PAYLOAD:
+               ret = secure_socket_recv(tcb->fd, ptr, size - recv_offset, &tcb->pid);
+               if (ret <= 0) {
+                   if (ret == 0) {
+                       ret = -ECANCELED;
+                   }
+                   DbgFree(ptr);
+                   ptr = NULL;
+                   break;
                }
-       }
 
-       CRITICAL_SECTION_BEGIN(&svc_ctx->packet_list_lock);
-       EINA_LIST_FOREACH(svc_ctx->packet_list, l, packet_info) {
-               if (packet_info->tcb == tcb) {
-                       DbgPrint("Reset ptr of the TCB[%p] in the list of packet info\n", tcb);
-                       packet_info->tcb = NULL;
+               recv_offset += ret;
+               ret = 0;
+
+               if (recv_offset == size) {
+                   packet = packet_build(packet, packet_offset, ptr, size);
+                   DbgFree(ptr);
+                   ptr = NULL;
+                   if (!packet) {
+                       ret = -EFAULT;
+                       break;
+                   }
+
+                   packet_offset += recv_offset;
+
+                   recv_state = RECV_DONE;
+                   recv_offset = 0;
                }
+               break;
+           case RECV_DONE:
+           default:
+               /* Dead code */
+               break;
        }
-       CRITICAL_SECTION_END(&svc_ctx->packet_list_lock);
 
-       /*!
-        * \note
-        * Emit a signal to collect this TCB from the SERVER THREAD.
-        */
-       if (write(svc_ctx->tcb_pipe[PIPE_WRITE], &tcb, sizeof(tcb)) != sizeof(tcb)) {
-               ErrPrint("Unable to write pipe: %s\n", strerror(errno));
+       if (recv_state == RECV_DONE) {
+           /*!
+            * Push this packet to the packet list with TCB
+            * Then the service main function will get this.
+            */
+           packet_info = malloc(sizeof(*packet_info));
+           if (!packet_info) {
+               ret = -errno;
+               ErrPrint("Heap: %s\n", strerror(errno));
+               packet_destroy(packet);
+               break;
+           }
+
+           packet_info->packet = packet;
+           packet_info->tcb = tcb;
+
+           CRITICAL_SECTION_BEGIN(&svc_ctx->packet_list_lock);
+           svc_ctx->packet_list = eina_list_append(svc_ctx->packet_list, packet_info);
+           CRITICAL_SECTION_END(&svc_ctx->packet_list_lock);
+
+           if (write(svc_ctx->evt_pipe[PIPE_WRITE], &evt_ch, sizeof(evt_ch)) != sizeof(evt_ch)) {
+               ret = -errno;
+               ErrPrint("Unable to write a pipe: %s\n", strerror(errno));
+               CRITICAL_SECTION_BEGIN(&svc_ctx->packet_list_lock);
+               svc_ctx->packet_list = eina_list_remove(svc_ctx->packet_list, packet_info);
+               CRITICAL_SECTION_END(&svc_ctx->packet_list_lock);
+
+               packet_destroy(packet);
+               DbgFree(packet_info);
+               ErrPrint("Terminate thread: %p\n", tcb);
+               break;
+           } else {
+               DbgPrint("Packet received: %d bytes\n", packet_offset);
+               recv_state = RECV_INIT;
+           }
+
+           /* Take a breathe */
+           pthread_yield();
        }
+    }
 
-       return (void *)ret;
+    CRITICAL_SECTION_BEGIN(&svc_ctx->packet_list_lock);
+    EINA_LIST_FOREACH(svc_ctx->packet_list, l, packet_info) {
+       if (packet_info->tcb == tcb) {
+           DbgPrint("Reset ptr of the TCB[%p] in the list of packet info\n", tcb);
+           packet_info->tcb = NULL;
+       }
+    }
+    CRITICAL_SECTION_END(&svc_ctx->packet_list_lock);
+
+    /*!
+     * \note
+     * Emit a signal to collect this TCB from the SERVER THREAD.
+     */
+    if (write(svc_ctx->tcb_pipe[PIPE_WRITE], &tcb, sizeof(tcb)) != sizeof(tcb)) {
+       ErrPrint("Unable to write pipe: %s\n", strerror(errno));
+    }
+
+    return (void *)ret;
 }
 
 /*!
@@ -348,34 +348,34 @@ static void *client_packet_pump_main(void *data)
  */
 HAPI int service_register_tcb_callback(struct service_context *svc_ctx, struct tcb *tcb, enum tcb_event_type event, void (*cb)(struct service_context *svc_ctx, struct tcb *tcb, void *data), void *data)
 {
-       struct tcb_event_cbdata *cbdata;
+    struct tcb_event_cbdata *cbdata;
 
-       cbdata = malloc(sizeof(*cbdata));
-       if (!cbdata) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    cbdata = malloc(sizeof(*cbdata));
+    if (!cbdata) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       cbdata->tcb = tcb;
-       cbdata->cb = cb;
-       cbdata->data = data;
+    cbdata->tcb = tcb;
+    cbdata->cb = cb;
+    cbdata->data = data;
 
-       switch (event) {
+    switch (event) {
        case TCB_EVENT_CREATE:
-               if (tcb) {
-                       DbgPrint("To catch the create event of TCB does not requires \"tcb\" handle\n");
-               }
-               svc_ctx->tcb_create_cb_list = eina_list_append(svc_ctx->tcb_create_cb_list, cbdata);
-               break;
+           if (tcb) {
+               DbgPrint("To catch the create event of TCB does not requires \"tcb\" handle\n");
+           }
+           svc_ctx->tcb_create_cb_list = eina_list_append(svc_ctx->tcb_create_cb_list, cbdata);
+           break;
        case TCB_EVENT_DESTROY:
-               svc_ctx->tcb_destroy_cb_list = eina_list_append(svc_ctx->tcb_destroy_cb_list, cbdata);
-               break;
+           svc_ctx->tcb_destroy_cb_list = eina_list_append(svc_ctx->tcb_destroy_cb_list, cbdata);
+           break;
        default:
-               DbgFree(cbdata);
-               return LB_STATUS_ERROR_INVALID;
-       }
+           DbgFree(cbdata);
+           return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 /*!
@@ -384,33 +384,33 @@ HAPI int service_register_tcb_callback(struct service_context *svc_ctx, struct t
  */
 HAPI int service_unregister_tcb_callback(struct service_context *svc_ctx, struct tcb *tcb, enum tcb_event_type event, void (*cb)(struct service_context *svc_ctx, struct tcb *tcb, void *data), void *data)
 {
-       struct tcb_event_cbdata *cbdata;
-       Eina_List *l;
+    struct tcb_event_cbdata *cbdata;
+    Eina_List *l;
 
-       switch (event) {
+    switch (event) {
        case TCB_EVENT_CREATE:
-               EINA_LIST_FOREACH(svc_ctx->tcb_create_cb_list, l, cbdata) {
-                       if (cbdata->tcb == tcb && cbdata->cb == cb && cbdata->data == data) {
-                               svc_ctx->tcb_create_cb_list = eina_list_remove(svc_ctx->tcb_create_cb_list, cbdata);
-                               DbgFree(cbdata);
-                               return LB_STATUS_SUCCESS;
-                       }
+           EINA_LIST_FOREACH(svc_ctx->tcb_create_cb_list, l, cbdata) {
+               if (cbdata->tcb == tcb && cbdata->cb == cb && cbdata->data == data) {
+                   svc_ctx->tcb_create_cb_list = eina_list_remove(svc_ctx->tcb_create_cb_list, cbdata);
+                   DbgFree(cbdata);
+                   return DBOX_STATUS_ERROR_NONE;
                }
-               break;
+           }
+           break;
        case TCB_EVENT_DESTROY:
-               EINA_LIST_FOREACH(svc_ctx->tcb_destroy_cb_list, l, cbdata) {
-                       if (cbdata->tcb == tcb && cbdata->cb == cb && cbdata->data == data) {
-                               svc_ctx->tcb_destroy_cb_list = eina_list_remove(svc_ctx->tcb_destroy_cb_list, cbdata);
-                               DbgFree(cbdata);
-                               return LB_STATUS_SUCCESS;
-                       }
+           EINA_LIST_FOREACH(svc_ctx->tcb_destroy_cb_list, l, cbdata) {
+               if (cbdata->tcb == tcb && cbdata->cb == cb && cbdata->data == data) {
+                   svc_ctx->tcb_destroy_cb_list = eina_list_remove(svc_ctx->tcb_destroy_cb_list, cbdata);
+                   DbgFree(cbdata);
+                   return DBOX_STATUS_ERROR_NONE;
                }
-               break;
+           }
+           break;
        default:
-               return LB_STATUS_ERROR_INVALID;
-       }
+           return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       return LB_STATUS_ERROR_NOT_EXIST;
+    return DBOX_STATUS_ERROR_NOT_EXIST;
 }
 
 /*!
@@ -419,55 +419,55 @@ HAPI int service_unregister_tcb_callback(struct service_context *svc_ctx, struct
  */
 static inline struct tcb *tcb_create(struct service_context *svc_ctx, int fd)
 {
-       struct tcb *tcb;
-       int status;
-       struct tcb_event_cbdata *cbdata;
-       Eina_List *l;
-       Eina_List *n;
-
-       tcb = malloc(sizeof(*tcb));
-       if (!tcb) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return NULL;
-       }
-
-       if (pipe2(tcb->ctrl_pipe, O_CLOEXEC) < 0) {
-               ErrPrint("pipe2: %s\n", strerror(errno));
-               DbgFree(tcb);
-               return NULL;
-       }
-
-       tcb->fd = fd;
-       tcb->svc_ctx = svc_ctx;
-       tcb->type = TCB_CLIENT_TYPE_APP;
-       tcb->pid = -1;
-
-       DbgPrint("Create a new service thread [%d]\n", fd);
-       status = pthread_create(&tcb->thid, NULL, client_packet_pump_main, tcb);
-       if (status != 0) {
-               ErrPrint("Unable to create a new thread: %s\n", strerror(status));
-               CLOSE_PIPE(tcb->ctrl_pipe);
-               DbgFree(tcb);
-               return NULL;
+    struct tcb *tcb;
+    int status;
+    struct tcb_event_cbdata *cbdata;
+    Eina_List *l;
+    Eina_List *n;
+
+    tcb = malloc(sizeof(*tcb));
+    if (!tcb) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
+
+    if (pipe2(tcb->ctrl_pipe, O_CLOEXEC) < 0) {
+       ErrPrint("pipe2: %s\n", strerror(errno));
+       DbgFree(tcb);
+       return NULL;
+    }
+
+    tcb->fd = fd;
+    tcb->svc_ctx = svc_ctx;
+    tcb->type = TCB_CLIENT_TYPE_APP;
+    tcb->pid = -1;
+
+    DbgPrint("Create a new service thread [%d]\n", fd);
+    status = pthread_create(&tcb->thid, NULL, client_packet_pump_main, tcb);
+    if (status != 0) {
+       ErrPrint("Unable to create a new thread: %s\n", strerror(status));
+       CLOSE_PIPE(tcb->ctrl_pipe);
+       DbgFree(tcb);
+       return NULL;
+    }
+
+    CRITICAL_SECTION_BEGIN(&svc_ctx->tcb_list_lock);
+    svc_ctx->tcb_list = eina_list_append(svc_ctx->tcb_list, tcb);
+    CRITICAL_SECTION_END(&svc_ctx->tcb_list_lock);
+
+    EINA_LIST_FOREACH_SAFE(svc_ctx->tcb_create_cb_list, l, n, cbdata) {
+       if (!cbdata->cb) {
+           /* ASSERT */
+           ErrPrint("invalid CB\n");
+           svc_ctx->tcb_create_cb_list = eina_list_remove(svc_ctx->tcb_create_cb_list, cbdata);
+           DbgFree(cbdata);
+           continue;
        }
 
-       CRITICAL_SECTION_BEGIN(&svc_ctx->tcb_list_lock);
-       svc_ctx->tcb_list = eina_list_append(svc_ctx->tcb_list, tcb);
-       CRITICAL_SECTION_END(&svc_ctx->tcb_list_lock);
-
-       EINA_LIST_FOREACH_SAFE(svc_ctx->tcb_create_cb_list, l, n, cbdata) {
-               if (!cbdata->cb) {
-                       /* ASSERT */
-                       ErrPrint("invalid CB\n");
-                       svc_ctx->tcb_create_cb_list = eina_list_remove(svc_ctx->tcb_create_cb_list, cbdata);
-                       DbgFree(cbdata);
-                       continue;
-               }
-
-               cbdata->cb(svc_ctx, tcb, cbdata->data);
-       }
+       cbdata->cb(svc_ctx, tcb, cbdata->data);
+    }
 
-       return tcb;
+    return tcb;
 }
 
 /*!
@@ -476,131 +476,131 @@ static inline struct tcb *tcb_create(struct service_context *svc_ctx, int fd)
  */
 static inline void tcb_teminate_all(struct service_context *svc_ctx)
 {
-       struct tcb *tcb;
-       void *ret;
-       int status;
-       char ch = EVT_END_CH;
-
-       /*!
-        * We don't need to make critical section on here.
-        * If we call this after terminate the server thread first.
-        * Then there is no other thread to access tcb_list.
-        */
-       EINA_LIST_FREE(svc_ctx->tcb_list, tcb) {
-               /*!
-                * ASSERT(tcb->fd >= 0);
-                */
-               if (write(tcb->ctrl_pipe[PIPE_WRITE], &ch, sizeof(ch)) != sizeof(ch)) {
-                       ErrPrint("write: %s\n", strerror(errno));
-               }
-
-               status = pthread_join(tcb->thid, &ret);
-               if (status != 0) {
-                       ErrPrint("Unable to join a thread: %s\n", strerror(status));
-               } else {
-                       DbgPrint("Thread returns: %p\n", ret);
-               }
-
-               secure_socket_destroy_handle(tcb->fd);
-
-               CLOSE_PIPE(tcb->ctrl_pipe);
-               DbgFree(tcb);
-       }
-}
-
-/*!
- * \note
- * SERVER THREAD
- */
-static inline void tcb_destroy(struct service_context *svc_ctx, struct tcb *tcb)
-{
-       void *ret;
-       int status;
-       char ch = EVT_END_CH;
-       struct tcb_event_cbdata *cbdata;
-       Eina_List *l;
-       Eina_List *n;
-
-       EINA_LIST_FOREACH_SAFE(svc_ctx->tcb_destroy_cb_list, l, n, cbdata) {
-               if (!cbdata->cb) {
-                       /* ASSERT */
-                       ErrPrint("invalid CB\n");
-                       svc_ctx->tcb_destroy_cb_list = eina_list_remove(svc_ctx->tcb_destroy_cb_list, cbdata);
-                       DbgFree(cbdata);
-                       continue;
-               }
-
-               if (cbdata->tcb != tcb) {
-                       continue;
-               }
-
-               cbdata->cb(svc_ctx, tcb, cbdata->data);
-
-               if (eina_list_data_find(svc_ctx->tcb_destroy_cb_list, cbdata)) {
-                       svc_ctx->tcb_destroy_cb_list = eina_list_remove(svc_ctx->tcb_destroy_cb_list, cbdata);
-                       DbgFree(cbdata);
-               }
-       }
-
-       CRITICAL_SECTION_BEGIN(&svc_ctx->tcb_list_lock);
-       svc_ctx->tcb_list = eina_list_remove(svc_ctx->tcb_list, tcb);
-       CRITICAL_SECTION_END(&svc_ctx->tcb_list_lock);
+    struct tcb *tcb;
+    void *ret;
+    int status;
+    char ch = EVT_END_CH;
+
+    /*!
+     * We don't need to make critical section on here.
+     * If we call this after terminate the server thread first.
+     * Then there is no other thread to access tcb_list.
+     */
+    EINA_LIST_FREE(svc_ctx->tcb_list, tcb) {
        /*!
         * ASSERT(tcb->fd >= 0);
-        * Close the connection, and then collecting the return value of thread
         */
        if (write(tcb->ctrl_pipe[PIPE_WRITE], &ch, sizeof(ch)) != sizeof(ch)) {
-               ErrPrint("write: %s\n", strerror(errno));
+           ErrPrint("write: %s\n", strerror(errno));
        }
 
        status = pthread_join(tcb->thid, &ret);
        if (status != 0) {
-               ErrPrint("Unable to join a thread: %s\n", strerror(status));
+           ErrPrint("Unable to join a thread: %s\n", strerror(status));
        } else {
-               DbgPrint("Thread returns: %p\n", ret);
+           DbgPrint("Thread returns: %p\n", ret);
        }
 
        secure_socket_destroy_handle(tcb->fd);
 
        CLOSE_PIPE(tcb->ctrl_pipe);
        DbgFree(tcb);
+    }
 }
 
 /*!
  * \note
  * SERVER THREAD
  */
-static inline int update_fdset(struct service_context *svc_ctx, fd_set *set)
+static inline void tcb_destroy(struct service_context *svc_ctx, struct tcb *tcb)
 {
-       Eina_List *l;
-       struct service_event_item *item;
-       int fd = 0;
-
-       FD_ZERO(set);
-
-       FD_SET(svc_ctx->fd, set);
-       fd = svc_ctx->fd;
+    void *ret;
+    int status;
+    char ch = EVT_END_CH;
+    struct tcb_event_cbdata *cbdata;
+    Eina_List *l;
+    Eina_List *n;
+
+    EINA_LIST_FOREACH_SAFE(svc_ctx->tcb_destroy_cb_list, l, n, cbdata) {
+       if (!cbdata->cb) {
+           /* ASSERT */
+           ErrPrint("invalid CB\n");
+           svc_ctx->tcb_destroy_cb_list = eina_list_remove(svc_ctx->tcb_destroy_cb_list, cbdata);
+           DbgFree(cbdata);
+           continue;
+       }
 
-       FD_SET(svc_ctx->tcb_pipe[PIPE_READ], set);
-       if (svc_ctx->tcb_pipe[PIPE_READ] > fd) {
-               fd = svc_ctx->tcb_pipe[PIPE_READ];
+       if (cbdata->tcb != tcb) {
+           continue;
        }
 
-       FD_SET(svc_ctx->evt_pipe[PIPE_READ], set);
-       if (svc_ctx->evt_pipe[PIPE_READ] > fd) {
-               fd = svc_ctx->evt_pipe[PIPE_READ];
+       cbdata->cb(svc_ctx, tcb, cbdata->data);
+
+       if (eina_list_data_find(svc_ctx->tcb_destroy_cb_list, cbdata)) {
+           svc_ctx->tcb_destroy_cb_list = eina_list_remove(svc_ctx->tcb_destroy_cb_list, cbdata);
+           DbgFree(cbdata);
        }
+    }
+
+    CRITICAL_SECTION_BEGIN(&svc_ctx->tcb_list_lock);
+    svc_ctx->tcb_list = eina_list_remove(svc_ctx->tcb_list, tcb);
+    CRITICAL_SECTION_END(&svc_ctx->tcb_list_lock);
+    /*!
+     * ASSERT(tcb->fd >= 0);
+     * Close the connection, and then collecting the return value of thread
+     */
+    if (write(tcb->ctrl_pipe[PIPE_WRITE], &ch, sizeof(ch)) != sizeof(ch)) {
+       ErrPrint("write: %s\n", strerror(errno));
+    }
+
+    status = pthread_join(tcb->thid, &ret);
+    if (status != 0) {
+       ErrPrint("Unable to join a thread: %s\n", strerror(status));
+    } else {
+       DbgPrint("Thread returns: %p\n", ret);
+    }
+
+    secure_socket_destroy_handle(tcb->fd);
+
+    CLOSE_PIPE(tcb->ctrl_pipe);
+    DbgFree(tcb);
+}
 
-       EINA_LIST_FOREACH(svc_ctx->event_list, l, item) {
-               if (item->type == SERVICE_EVENT_TIMER) {
-                       FD_SET(item->info.timer.fd, set);
-                       if (fd < item->info.timer.fd) {
-                               fd = item->info.timer.fd;
-                       }
-               }
+/*!
+ * \note
+ * SERVER THREAD
+ */
+static inline int update_fdset(struct service_context *svc_ctx, fd_set *set)
+{
+    Eina_List *l;
+    struct service_event_item *item;
+    int fd = 0;
+
+    FD_ZERO(set);
+
+    FD_SET(svc_ctx->fd, set);
+    fd = svc_ctx->fd;
+
+    FD_SET(svc_ctx->tcb_pipe[PIPE_READ], set);
+    if (svc_ctx->tcb_pipe[PIPE_READ] > fd) {
+       fd = svc_ctx->tcb_pipe[PIPE_READ];
+    }
+
+    FD_SET(svc_ctx->evt_pipe[PIPE_READ], set);
+    if (svc_ctx->evt_pipe[PIPE_READ] > fd) {
+       fd = svc_ctx->evt_pipe[PIPE_READ];
+    }
+
+    EINA_LIST_FOREACH(svc_ctx->event_list, l, item) {
+       if (item->type == SERVICE_EVENT_TIMER) {
+           FD_SET(item->info.timer.fd, set);
+           if (fd < item->info.timer.fd) {
+               fd = item->info.timer.fd;
+           }
        }
+    }
 
-       return fd + 1;
+    return fd + 1;
 }
 
 /*!
@@ -609,42 +609,42 @@ static inline int update_fdset(struct service_context *svc_ctx, fd_set *set)
  */
 static inline void processing_timer_event(struct service_context *svc_ctx, fd_set *set)
 {
-       uint64_t expired_count;
-       Eina_List *l;
-       Eina_List *n;
-       struct service_event_item *item;
-
-       EINA_LIST_FOREACH_SAFE(svc_ctx->event_list, l, n, item) {
-               switch (item->type) {
-               case SERVICE_EVENT_TIMER:
-                       if (!FD_ISSET(item->info.timer.fd, set)) {
-                               break;
-                       }
-
-                       if (read(item->info.timer.fd, &expired_count, sizeof(expired_count)) == sizeof(expired_count)) {
-                               DbgPrint("Expired %d times\n", expired_count);
-                               if (item->event_cb(svc_ctx, item->cbdata) >= 0) {
-                                       break;
-                               }
-                       } else {
-                               ErrPrint("read: %s\n", strerror(errno));
-                       }
-
-                       if (!eina_list_data_find(svc_ctx->event_list, item)) {
-                               break;
-                       }
-
-                       svc_ctx->event_list = eina_list_remove(svc_ctx->event_list, item);
-                       if (close(item->info.timer.fd) < 0) {
-                               ErrPrint("close: %s\n", strerror(errno));
-                       }
-                       DbgFree(item);
-                       break;
-               default:
-                       ErrPrint("Unknown event: %d\n", item->type);
+    uint64_t expired_count;
+    Eina_List *l;
+    Eina_List *n;
+    struct service_event_item *item;
+
+    EINA_LIST_FOREACH_SAFE(svc_ctx->event_list, l, n, item) {
+       switch (item->type) {
+           case SERVICE_EVENT_TIMER:
+               if (!FD_ISSET(item->info.timer.fd, set)) {
+                   break;
+               }
+
+               if (read(item->info.timer.fd, &expired_count, sizeof(expired_count)) == sizeof(expired_count)) {
+                   DbgPrint("Expired %d times\n", expired_count);
+                   if (item->event_cb(svc_ctx, item->cbdata) >= 0) {
                        break;
+                   }
+               } else {
+                   ErrPrint("read: %s\n", strerror(errno));
                }
+
+               if (!eina_list_data_find(svc_ctx->event_list, item)) {
+                   break;
+               }
+
+               svc_ctx->event_list = eina_list_remove(svc_ctx->event_list, item);
+               if (close(item->info.timer.fd) < 0) {
+                   ErrPrint("close: %s\n", strerror(errno));
+               }
+               DbgFree(item);
+               break;
+           default:
+               ErrPrint("Unknown event: %d\n", item->type);
+               break;
        }
+    }
 }
 
 /*!
@@ -656,169 +656,169 @@ static inline void processing_timer_event(struct service_context *svc_ctx, fd_se
  */
 static void *server_main(void *data)
 {
-       struct service_context *svc_ctx = data;
-       fd_set set;
-       fd_set except_set;
-       long ret;
-       int client_fd;
-       struct tcb *tcb;
-       int fd;
-       char evt_ch;
-       struct packet_info *packet_info;
-
-       DbgPrint("Server thread is activated\n");
-       while (1) {
-               fd = update_fdset(svc_ctx, &set);
-               memcpy(&except_set, &set, sizeof(set));
-
-               ret = select(fd, &set, NULL, &except_set, NULL);
-               if (ret < 0) {
-                       ret = -errno;
-                       if (errno == EINTR) {
-                               DbgPrint("INTERRUPTED\n");
-                               continue;
-                       }
-                       ErrPrint("Error: %s\n", strerror(errno));
-                       break;
-               } else if (ret == 0) {
-                       ErrPrint("Timeout\n");
-                       ret = -ETIMEDOUT;
-                       break;
-               }
+    struct service_context *svc_ctx = data;
+    fd_set set;
+    fd_set except_set;
+    long ret;
+    int client_fd;
+    struct tcb *tcb;
+    int fd;
+    char evt_ch;
+    struct packet_info *packet_info;
+
+    DbgPrint("Server thread is activated\n");
+    while (1) {
+       fd = update_fdset(svc_ctx, &set);
+       memcpy(&except_set, &set, sizeof(set));
+
+       ret = select(fd, &set, NULL, &except_set, NULL);
+       if (ret < 0) {
+           ret = -errno;
+           if (errno == EINTR) {
+               DbgPrint("INTERRUPTED\n");
+               continue;
+           }
+           ErrPrint("Error: %s\n", strerror(errno));
+           break;
+       } else if (ret == 0) {
+           ErrPrint("Timeout\n");
+           ret = -ETIMEDOUT;
+           break;
+       }
 
-               if (FD_ISSET(svc_ctx->fd, &set)) {
-                       client_fd = secure_socket_get_connection_handle(svc_ctx->fd);
-                       if (client_fd < 0) {
-                               ErrPrint("Failed to establish a new connection [%d]\n", svc_ctx->fd);
-                               ret = -EFAULT;
-                               break;
-                       }
-
-                       tcb = tcb_create(svc_ctx, client_fd);
-                       if (!tcb) {
-                               ErrPrint("Failed to create a new TCB: %d (%d)\n", client_fd, svc_ctx->fd);
-                               secure_socket_destroy_handle(client_fd);
-                       }
-               }
+       if (FD_ISSET(svc_ctx->fd, &set)) {
+           client_fd = secure_socket_get_connection_handle(svc_ctx->fd);
+           if (client_fd < 0) {
+               ErrPrint("Failed to establish a new connection [%d]\n", svc_ctx->fd);
+               ret = -EFAULT;
+               break;
+           }
 
-               if (FD_ISSET(svc_ctx->evt_pipe[PIPE_READ], &set)) {
-                       if (read(svc_ctx->evt_pipe[PIPE_READ], &evt_ch, sizeof(evt_ch)) != sizeof(evt_ch)) {
-                               ErrPrint("Unable to read pipe: %s\n", strerror(errno));
-                               ret = -EFAULT;
-                               break;
-                       }
-
-                       CRITICAL_SECTION_BEGIN(&svc_ctx->packet_list_lock);
-                       packet_info = eina_list_nth(svc_ctx->packet_list, 0);
-                       svc_ctx->packet_list = eina_list_remove(svc_ctx->packet_list, packet_info);
-                       CRITICAL_SECTION_END(&svc_ctx->packet_list_lock);
-
-                       if (packet_info) {
-                               /*!
-                                * \CRITICAL
-                                * What happens if the client thread is terminated, so the packet_info->tcb is deleted
-                                * while processing svc_ctx->service_thread_main?
-                                */
-                               ret = svc_ctx->service_thread_main(packet_info->tcb, packet_info->packet, svc_ctx->service_thread_data);
-                               if (ret < 0) {
-                                       ErrPrint("Service thread returns: %d\n", ret);
-                               }
-
-                               packet_destroy(packet_info->packet);
-                               DbgFree(packet_info);
-                       }
-
-                       /* Take a breathe */
-                       pthread_yield();
-               }
+           tcb = tcb_create(svc_ctx, client_fd);
+           if (!tcb) {
+               ErrPrint("Failed to create a new TCB: %d (%d)\n", client_fd, svc_ctx->fd);
+               secure_socket_destroy_handle(client_fd);
+           }
+       }
+
+       if (FD_ISSET(svc_ctx->evt_pipe[PIPE_READ], &set)) {
+           if (read(svc_ctx->evt_pipe[PIPE_READ], &evt_ch, sizeof(evt_ch)) != sizeof(evt_ch)) {
+               ErrPrint("Unable to read pipe: %s\n", strerror(errno));
+               ret = -EFAULT;
+               break;
+           }
 
-               processing_timer_event(svc_ctx, &set);
+           CRITICAL_SECTION_BEGIN(&svc_ctx->packet_list_lock);
+           packet_info = eina_list_nth(svc_ctx->packet_list, 0);
+           svc_ctx->packet_list = eina_list_remove(svc_ctx->packet_list, packet_info);
+           CRITICAL_SECTION_END(&svc_ctx->packet_list_lock);
 
+           if (packet_info) {
                /*!
-                * \note
-                * Destroying TCB should be processed at last.
+                * \CRITICAL
+                * What happens if the client thread is terminated, so the packet_info->tcb is deleted
+                * while processing svc_ctx->service_thread_main?
                 */
-               if (FD_ISSET(svc_ctx->tcb_pipe[PIPE_READ], &set)) {
-                       Eina_List *lockfree_packet_list;
-                       Eina_List *l;
-                       Eina_List *n;
-
-                       if (read(svc_ctx->tcb_pipe[PIPE_READ], &tcb, sizeof(tcb)) != sizeof(tcb)) {
-                               ErrPrint("Unable to read pipe: %s\n", strerror(errno));
-                               ret = -EFAULT;
-                               break;
-                       }
-
-                       if (!tcb) {
-                               ErrPrint("Terminate service thread\n");
-                               ret = -ECANCELED;
-                               break;
-                       }
-
-                       lockfree_packet_list = NULL;
-                       CRITICAL_SECTION_BEGIN(&svc_ctx->packet_list_lock);
-                       EINA_LIST_FOREACH_SAFE(svc_ctx->packet_list, l, n, packet_info) {
-                               if (packet_info->tcb != tcb) {
-                                       continue;
-                               }
-
-                               svc_ctx->packet_list = eina_list_remove(svc_ctx->packet_list, packet_info);
-                               lockfree_packet_list = eina_list_append(lockfree_packet_list, packet_info);
-                       }
-                       CRITICAL_SECTION_END(&svc_ctx->packet_list_lock);
-
-                       EINA_LIST_FREE(lockfree_packet_list, packet_info) {
-                               ret = read(svc_ctx->evt_pipe[PIPE_READ], &evt_ch, sizeof(evt_ch));
-                               DbgPrint("Flushing filtered pipe: %d (%c)\n", ret, evt_ch);
-                               ret = svc_ctx->service_thread_main(packet_info->tcb, packet_info->packet, svc_ctx->service_thread_data);
-                               if (ret < 0) {
-                                       ErrPrint("Service thread returns: %d\n", ret);
-                               }
-                               packet_destroy(packet_info->packet);
-                               DbgFree(packet_info);
-                       }
-
-                       /*!
-                        * \note
-                        * Invoke the service thread main, to notify the termination of a TCB
-                        */
-                       ret = svc_ctx->service_thread_main(tcb, NULL, svc_ctx->service_thread_data);
-
-                       /*!
-                        * at this time, the client thread can access this tcb.
-                        * how can I protect this TCB from deletion without disturbing the server thread?
-                        */
-                       tcb_destroy(svc_ctx, tcb);
+               ret = svc_ctx->service_thread_main(packet_info->tcb, packet_info->packet, svc_ctx->service_thread_data);
+               if (ret < 0) {
+                   ErrPrint("Service thread returns: %d\n", ret);
                }
 
-               /* If there is no such triggered FD? */
+               packet_destroy(packet_info->packet);
+               DbgFree(packet_info);
+           }
+
+           /* Take a breathe */
+           pthread_yield();
        }
 
+       processing_timer_event(svc_ctx, &set);
+
        /*!
-        * Consuming all pended packets before terminates server thread.
-        *
-        * If the server thread is terminated, we should flush all pended packets.
-        * And we should services them.
-        * While processing this routine, the mutex is locked.
-        * So every other client thread will be slowed down, sequently, every clients can meet problems.
-        * But in case of termination of server thread, there could be systemetic problem.
-        * This only should be happenes while terminating the master daemon process.
+        * \note
+        * Destroying TCB should be processed at last.
         */
-       CRITICAL_SECTION_BEGIN(&svc_ctx->packet_list_lock);
-       EINA_LIST_FREE(svc_ctx->packet_list, packet_info) {
+       if (FD_ISSET(svc_ctx->tcb_pipe[PIPE_READ], &set)) {
+           Eina_List *lockfree_packet_list;
+           Eina_List *l;
+           Eina_List *n;
+
+           if (read(svc_ctx->tcb_pipe[PIPE_READ], &tcb, sizeof(tcb)) != sizeof(tcb)) {
+               ErrPrint("Unable to read pipe: %s\n", strerror(errno));
+               ret = -EFAULT;
+               break;
+           }
+
+           if (!tcb) {
+               ErrPrint("Terminate service thread\n");
+               ret = -ECANCELED;
+               break;
+           }
+
+           lockfree_packet_list = NULL;
+           CRITICAL_SECTION_BEGIN(&svc_ctx->packet_list_lock);
+           EINA_LIST_FOREACH_SAFE(svc_ctx->packet_list, l, n, packet_info) {
+               if (packet_info->tcb != tcb) {
+                   continue;
+               }
+
+               svc_ctx->packet_list = eina_list_remove(svc_ctx->packet_list, packet_info);
+               lockfree_packet_list = eina_list_append(lockfree_packet_list, packet_info);
+           }
+           CRITICAL_SECTION_END(&svc_ctx->packet_list_lock);
+
+           EINA_LIST_FREE(lockfree_packet_list, packet_info) {
                ret = read(svc_ctx->evt_pipe[PIPE_READ], &evt_ch, sizeof(evt_ch));
-               DbgPrint("Flushing pipe: %d (%c)\n", ret, evt_ch);
+               DbgPrint("Flushing filtered pipe: %d (%c)\n", ret, evt_ch);
                ret = svc_ctx->service_thread_main(packet_info->tcb, packet_info->packet, svc_ctx->service_thread_data);
                if (ret < 0) {
-                       ErrPrint("Service thread returns: %d\n", ret);
+                   ErrPrint("Service thread returns: %d\n", ret);
                }
                packet_destroy(packet_info->packet);
                DbgFree(packet_info);
+           }
+
+           /*!
+            * \note
+            * Invoke the service thread main, to notify the termination of a TCB
+            */
+           ret = svc_ctx->service_thread_main(tcb, NULL, svc_ctx->service_thread_data);
+
+           /*!
+            * at this time, the client thread can access this tcb.
+            * how can I protect this TCB from deletion without disturbing the server thread?
+            */
+           tcb_destroy(svc_ctx, tcb);
        }
-       CRITICAL_SECTION_END(&svc_ctx->packet_list_lock);
 
-       tcb_teminate_all(svc_ctx);
-       return (void *)ret;
+       /* If there is no such triggered FD? */
+    }
+
+    /*!
+     * Consuming all pended packets before terminates server thread.
+     *
+     * If the server thread is terminated, we should flush all pended packets.
+     * And we should services them.
+     * While processing this routine, the mutex is locked.
+     * So every other client thread will be slowed down, sequently, every clients can meet problems.
+     * But in case of termination of server thread, there could be systemetic problem.
+     * This only should be happenes while terminating the master daemon process.
+     */
+    CRITICAL_SECTION_BEGIN(&svc_ctx->packet_list_lock);
+    EINA_LIST_FREE(svc_ctx->packet_list, packet_info) {
+       ret = read(svc_ctx->evt_pipe[PIPE_READ], &evt_ch, sizeof(evt_ch));
+       DbgPrint("Flushing pipe: %d (%c)\n", ret, evt_ch);
+       ret = svc_ctx->service_thread_main(packet_info->tcb, packet_info->packet, svc_ctx->service_thread_data);
+       if (ret < 0) {
+           ErrPrint("Service thread returns: %d\n", ret);
+       }
+       packet_destroy(packet_info->packet);
+       DbgFree(packet_info);
+    }
+    CRITICAL_SECTION_END(&svc_ctx->packet_list_lock);
+
+    tcb_teminate_all(svc_ctx);
+    return (void *)ret;
 }
 
 /*!
@@ -827,97 +827,97 @@ static void *server_main(void *data)
  */
 HAPI struct service_context *service_common_create(const char *addr, int (*service_thread_main)(struct tcb *tcb, struct packet *packet, void *data), void *data)
 {
-       int status;
-       struct service_context *svc_ctx;
+    int status;
+    struct service_context *svc_ctx;
 
-       if (!service_thread_main || !addr) {
-               ErrPrint("Invalid argument\n");
-               return NULL;
-       }
+    if (!service_thread_main || !addr) {
+       ErrPrint("Invalid argument\n");
+       return NULL;
+    }
 
-       if (strncmp(addr, COM_CORE_REMOTE_SCHEME, strlen(COM_CORE_REMOTE_SCHEME))) {
-               int offset = 0;
+    if (strncmp(addr, COM_CORE_REMOTE_SCHEME, strlen(COM_CORE_REMOTE_SCHEME))) {
+       int offset = 0;
 
-               offset = strlen(COM_CORE_LOCAL_SCHEME);
-               if (strncmp(addr, COM_CORE_LOCAL_SCHEME, offset)) {
-                       offset = 0;
-               }
-
-               if (unlink(addr + offset) < 0) {
-                       ErrPrint("[%s] - %s\n", addr, strerror(errno));
-               }
+       offset = strlen(COM_CORE_LOCAL_SCHEME);
+       if (strncmp(addr, COM_CORE_LOCAL_SCHEME, offset)) {
+           offset = 0;
        }
 
-       svc_ctx = calloc(1, sizeof(*svc_ctx));
-       if (!svc_ctx) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return NULL;
+       if (unlink(addr + offset) < 0) {
+           ErrPrint("[%s] - %s\n", addr, strerror(errno));
        }
+    }
 
-       svc_ctx->fd = secure_socket_create_server(addr);
-       if (svc_ctx->fd < 0) {
-               DbgFree(svc_ctx);
-               return NULL;
-       }
+    svc_ctx = calloc(1, sizeof(*svc_ctx));
+    if (!svc_ctx) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
 
-       svc_ctx->service_thread_main = service_thread_main;
-       svc_ctx->service_thread_data = data;
+    svc_ctx->fd = secure_socket_create_server(addr);
+    if (svc_ctx->fd < 0) {
+       DbgFree(svc_ctx);
+       return NULL;
+    }
 
-       if (fcntl(svc_ctx->fd, F_SETFD, FD_CLOEXEC) < 0) {
-               ErrPrint("fcntl: %s\n", strerror(errno));
-       }
+    svc_ctx->service_thread_main = service_thread_main;
+    svc_ctx->service_thread_data = data;
 
-       if (fcntl(svc_ctx->fd, F_SETFL, O_NONBLOCK) < 0) {
-               ErrPrint("fcntl: %s\n", strerror(errno));
-       }
+    if (fcntl(svc_ctx->fd, F_SETFD, FD_CLOEXEC) < 0) {
+       ErrPrint("fcntl: %s\n", strerror(errno));
+    }
 
-       if (pipe2(svc_ctx->evt_pipe, O_CLOEXEC) < 0) {
-               ErrPrint("pipe: %d\n", strerror(errno));
-               secure_socket_destroy_handle(svc_ctx->fd);
-               DbgFree(svc_ctx);
-               return NULL;
-       }
+    if (fcntl(svc_ctx->fd, F_SETFL, O_NONBLOCK) < 0) {
+       ErrPrint("fcntl: %s\n", strerror(errno));
+    }
 
-       if (pipe2(svc_ctx->tcb_pipe, O_CLOEXEC) < 0) {
-               ErrPrint("pipe: %s\n", strerror(errno));
-               CLOSE_PIPE(svc_ctx->evt_pipe);
-               secure_socket_destroy_handle(svc_ctx->fd);
-               DbgFree(svc_ctx);
-               return NULL;
-       }
+    if (pipe2(svc_ctx->evt_pipe, O_CLOEXEC) < 0) {
+       ErrPrint("pipe: %d\n", strerror(errno));
+       secure_socket_destroy_handle(svc_ctx->fd);
+       DbgFree(svc_ctx);
+       return NULL;
+    }
 
-       status = pthread_mutex_init(&svc_ctx->packet_list_lock, NULL);
-       if (status != 0) {
-               ErrPrint("Unable to create a mutex: %s\n", strerror(status));
-               CLOSE_PIPE(svc_ctx->evt_pipe);
-               CLOSE_PIPE(svc_ctx->tcb_pipe);
-               secure_socket_destroy_handle(svc_ctx->fd);
-               DbgFree(svc_ctx);
-               return NULL;
-       }
+    if (pipe2(svc_ctx->tcb_pipe, O_CLOEXEC) < 0) {
+       ErrPrint("pipe: %s\n", strerror(errno));
+       CLOSE_PIPE(svc_ctx->evt_pipe);
+       secure_socket_destroy_handle(svc_ctx->fd);
+       DbgFree(svc_ctx);
+       return NULL;
+    }
 
-       DbgPrint("Creating server thread\n");
-       status = pthread_create(&svc_ctx->server_thid, NULL, server_main, svc_ctx);
+    status = pthread_mutex_init(&svc_ctx->packet_list_lock, NULL);
+    if (status != 0) {
+       ErrPrint("Unable to create a mutex: %s\n", strerror(status));
+       CLOSE_PIPE(svc_ctx->evt_pipe);
+       CLOSE_PIPE(svc_ctx->tcb_pipe);
+       secure_socket_destroy_handle(svc_ctx->fd);
+       DbgFree(svc_ctx);
+       return NULL;
+    }
+
+    DbgPrint("Creating server thread\n");
+    status = pthread_create(&svc_ctx->server_thid, NULL, server_main, svc_ctx);
+    if (status != 0) {
+       ErrPrint("Unable to create a thread for shortcut service: %s\n", strerror(status));
+       status = pthread_mutex_destroy(&svc_ctx->packet_list_lock);
        if (status != 0) {
-               ErrPrint("Unable to create a thread for shortcut service: %s\n", strerror(status));
-               status = pthread_mutex_destroy(&svc_ctx->packet_list_lock);
-               if (status != 0) {
-                       ErrPrint("Error: %s\n", strerror(status));
-               }
-               CLOSE_PIPE(svc_ctx->evt_pipe);
-               CLOSE_PIPE(svc_ctx->tcb_pipe);
-               secure_socket_destroy_handle(svc_ctx->fd);
-               DbgFree(svc_ctx);
-               return NULL;
+           ErrPrint("Error: %s\n", strerror(status));
        }
+       CLOSE_PIPE(svc_ctx->evt_pipe);
+       CLOSE_PIPE(svc_ctx->tcb_pipe);
+       secure_socket_destroy_handle(svc_ctx->fd);
+       DbgFree(svc_ctx);
+       return NULL;
+    }
 
-       /*!
-        * \note
-        * To give a chance to run for server thread.
-        */
-       pthread_yield();
+    /*!
+     * \note
+     * To give a chance to run for server thread.
+     */
+    pthread_yield();
 
-       return svc_ctx;
+    return svc_ctx;
 }
 
 /*!
@@ -926,39 +926,39 @@ HAPI struct service_context *service_common_create(const char *addr, int (*servi
  */
 HAPI int service_common_destroy(struct service_context *svc_ctx)
 {
-       int status = 0;
-       void *ret;
-
-       if (!svc_ctx) {
-               return -EINVAL;
-       }
-
-       /*!
-        * \note
-        * Terminate server thread
-        */
-       if (write(svc_ctx->tcb_pipe[PIPE_WRITE], &status, sizeof(status)) != sizeof(status)) {
-               ErrPrint("Failed to write: %s\n", strerror(errno));
-       }
-
-       status = pthread_join(svc_ctx->server_thid, &ret);
-       if (status != 0) {
-               ErrPrint("Join: %s\n", strerror(status));
-       } else {
-               DbgPrint("Thread returns: %p\n", ret);
-       }
-
-       secure_socket_destroy_handle(svc_ctx->fd);
-
-       status = pthread_mutex_destroy(&svc_ctx->packet_list_lock);
-       if (status != 0) {
-               ErrPrint("Unable to destroy a mutex: %s\n", strerror(status));
-       }
-
-       CLOSE_PIPE(svc_ctx->evt_pipe);
-       CLOSE_PIPE(svc_ctx->tcb_pipe);
-       DbgFree(svc_ctx);
-       return 0;
+    int status = 0;
+    void *ret;
+
+    if (!svc_ctx) {
+       return -EINVAL;
+    }
+
+    /*!
+     * \note
+     * Terminate server thread
+     */
+    if (write(svc_ctx->tcb_pipe[PIPE_WRITE], &status, sizeof(status)) != sizeof(status)) {
+       ErrPrint("Failed to write: %s\n", strerror(errno));
+    }
+
+    status = pthread_join(svc_ctx->server_thid, &ret);
+    if (status != 0) {
+       ErrPrint("Join: %s\n", strerror(status));
+    } else {
+       DbgPrint("Thread returns: %p\n", ret);
+    }
+
+    secure_socket_destroy_handle(svc_ctx->fd);
+
+    status = pthread_mutex_destroy(&svc_ctx->packet_list_lock);
+    if (status != 0) {
+       ErrPrint("Unable to destroy a mutex: %s\n", strerror(status));
+    }
+
+    CLOSE_PIPE(svc_ctx->evt_pipe);
+    CLOSE_PIPE(svc_ctx->tcb_pipe);
+    DbgFree(svc_ctx);
+    return 0;
 }
 
 /*!
@@ -967,20 +967,20 @@ HAPI int service_common_destroy(struct service_context *svc_ctx)
  */
 HAPI int tcb_is_valid(struct service_context *svc_ctx, struct tcb *tcb)
 {
-       Eina_List *l;
-       struct tcb *tmp;
-       int ret = -ENOENT;
-
-       CRITICAL_SECTION_BEGIN(&svc_ctx->tcb_list_lock);
-       EINA_LIST_FOREACH(svc_ctx->tcb_list, l, tmp) {
-               if (tmp == tcb /* && tcb->svc_ctx == svc_ctx */) {
-                       ret = tcb->fd;
-                       break;
-               }
+    Eina_List *l;
+    struct tcb *tmp;
+    int ret = -ENOENT;
+
+    CRITICAL_SECTION_BEGIN(&svc_ctx->tcb_list_lock);
+    EINA_LIST_FOREACH(svc_ctx->tcb_list, l, tmp) {
+       if (tmp == tcb /* && tcb->svc_ctx == svc_ctx */) {
+           ret = tcb->fd;
+           break;
        }
-       CRITICAL_SECTION_END(&svc_ctx->tcb_list_lock);
+    }
+    CRITICAL_SECTION_END(&svc_ctx->tcb_list_lock);
 
-       return ret;
+    return ret;
 }
 
 /*!
@@ -989,11 +989,11 @@ HAPI int tcb_is_valid(struct service_context *svc_ctx, struct tcb *tcb)
  */
 HAPI int tcb_pid(struct tcb *tcb)
 {
-       if (!tcb) {
-               return -1;
-       }
+    if (!tcb) {
+       return -1;
+    }
 
-       return tcb->pid;
+    return tcb->pid;
 }
 
 /*!
@@ -1002,11 +1002,11 @@ HAPI int tcb_pid(struct tcb *tcb)
  */
 HAPI int tcb_fd(struct tcb *tcb)
 {
-       if (!tcb) {
-               return -EINVAL;
-       }
+    if (!tcb) {
+       return -EINVAL;
+    }
 
-       return tcb->fd;
+    return tcb->fd;
 }
 
 /*!
@@ -1015,11 +1015,11 @@ HAPI int tcb_fd(struct tcb *tcb)
  */
 HAPI int tcb_client_type(struct tcb *tcb)
 {
-       if (!tcb) {
-               return -EINVAL;
-       }
+    if (!tcb) {
+       return -EINVAL;
+    }
 
-       return tcb->type;
+    return tcb->type;
 }
 
 /*!
@@ -1028,13 +1028,13 @@ HAPI int tcb_client_type(struct tcb *tcb)
  */
 HAPI int tcb_client_type_set(struct tcb *tcb, enum tcb_type type)
 {
-       if (!tcb) {
-               return -EINVAL;
-       }
+    if (!tcb) {
+       return -EINVAL;
+    }
 
-       DbgPrint("TCB[%p] Client type is changed to %d from %d\n", tcb, type, tcb->type);
-       tcb->type = type;
-       return 0;
+    DbgPrint("TCB[%p] Client type is changed to %d from %d\n", tcb, type, tcb->type);
+    tcb->type = type;
+    return 0;
 }
 
 /*!
@@ -1043,11 +1043,11 @@ HAPI int tcb_client_type_set(struct tcb *tcb, enum tcb_type type)
  */
 HAPI struct service_context *tcb_svc_ctx(struct tcb *tcb)
 {
-       if (!tcb) {
-               return NULL;
-       }
+    if (!tcb) {
+       return NULL;
+    }
 
-       return tcb->svc_ctx;
+    return tcb->svc_ctx;
 }
 
 /*!
@@ -1056,13 +1056,13 @@ HAPI struct service_context *tcb_svc_ctx(struct tcb *tcb)
  */
 HAPI int service_common_unicast_packet(struct tcb *tcb, struct packet *packet)
 {
-       if (!tcb || !packet) {
-               DbgPrint("Invalid unicast: tcb[%p], packet[%p]\n", tcb, packet);
-               return -EINVAL;
-       }
+    if (!tcb || !packet) {
+       DbgPrint("Invalid unicast: tcb[%p], packet[%p]\n", tcb, packet);
+       return -EINVAL;
+    }
 
-       DbgPrint("Unicast packet\n");
-       return com_core_send(tcb->fd, (void *)packet_data(packet), packet_size(packet), DEFAULT_TIMEOUT);
+    DbgPrint("Unicast packet\n");
+    return com_core_send(tcb->fd, (void *)packet_data(packet), packet_size(packet), DEFAULT_TIMEOUT);
 }
 
 /*!
@@ -1071,37 +1071,37 @@ HAPI int service_common_unicast_packet(struct tcb *tcb, struct packet *packet)
  */
 HAPI int service_common_multicast_packet(struct tcb *tcb, struct packet *packet, int type)
 {
-       Eina_List *l;
-       struct tcb *target;
-       struct service_context *svc_ctx;
-       int ret;
-
-       if (!tcb || !packet) {
-               DbgPrint("Invalid multicast: tcb[%p], packet[%p]\n", tcb, packet);
-               return -EINVAL;
+    Eina_List *l;
+    struct tcb *target;
+    struct service_context *svc_ctx;
+    int ret;
+
+    if (!tcb || !packet) {
+       DbgPrint("Invalid multicast: tcb[%p], packet[%p]\n", tcb, packet);
+       return -EINVAL;
+    }
+
+    svc_ctx = tcb->svc_ctx;
+
+    DbgPrint("Multicasting packets\n");
+
+    /*!
+     * \note
+     * Does not need to make a critical section from here.
+     */
+    EINA_LIST_FOREACH(svc_ctx->tcb_list, l, target) {
+       if (target == tcb || target->type != type) {
+           DbgPrint("Skip target: %p(%d) == %p/%d\n", target, target->type, tcb, type);
+           continue;
        }
 
-       svc_ctx = tcb->svc_ctx;
-
-       DbgPrint("Multicasting packets\n");
-
-       /*!
-        * \note
-        * Does not need to make a critical section from here.
-        */
-       EINA_LIST_FOREACH(svc_ctx->tcb_list, l, target) {
-               if (target == tcb || target->type != type) {
-                       DbgPrint("Skip target: %p(%d) == %p/%d\n", target, target->type, tcb, type);
-                       continue;
-               }
-
-               ret = com_core_send(target->fd, (void *)packet_data(packet), packet_size(packet), DEFAULT_TIMEOUT);
-               if (ret < 0) {
-                       ErrPrint("Failed to send packet: %d\n", ret);
-               }
+       ret = com_core_send(target->fd, (void *)packet_data(packet), packet_size(packet), DEFAULT_TIMEOUT);
+       if (ret < 0) {
+           ErrPrint("Failed to send packet: %d\n", ret);
        }
-       DbgPrint("Finish to multicast packet\n");
-       return 0;
+    }
+    DbgPrint("Finish to multicast packet\n");
+    return 0;
 }
 
 /*!
@@ -1110,59 +1110,59 @@ HAPI int service_common_multicast_packet(struct tcb *tcb, struct packet *packet,
  */
 HAPI struct service_event_item *service_common_add_timer(struct service_context *svc_ctx, double timer, int (*timer_cb)(struct service_context *svc_cx, void *data), void *data)
 {
-       struct service_event_item *item;
-
-       item = calloc(1, sizeof(*item));
-       if (!item) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return NULL;
-       }
-
-       item->type = SERVICE_EVENT_TIMER;
-       item->info.timer.fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK | TFD_CLOEXEC);
-       if (item->info.timer.fd < 0) {
-               ErrPrint("Error: %s\n", strerror(errno));
-               DbgFree(item);
-               return NULL;
-       }
+    struct service_event_item *item;
+
+    item = calloc(1, sizeof(*item));
+    if (!item) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
+
+    item->type = SERVICE_EVENT_TIMER;
+    item->info.timer.fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK | TFD_CLOEXEC);
+    if (item->info.timer.fd < 0) {
+       ErrPrint("Error: %s\n", strerror(errno));
+       DbgFree(item);
+       return NULL;
+    }
 
-       if (service_common_update_timer(item, timer) < 0) {
-               if (close(item->info.timer.fd) < 0) {
-                       ErrPrint("close: %s\n", strerror(errno));
-               }
-               DbgFree(item);
-               return NULL;
+    if (service_common_update_timer(item, timer) < 0) {
+       if (close(item->info.timer.fd) < 0) {
+           ErrPrint("close: %s\n", strerror(errno));
        }
+       DbgFree(item);
+       return NULL;
+    }
 
-       item->event_cb = timer_cb;
-       item->cbdata = data;
+    item->event_cb = timer_cb;
+    item->cbdata = data;
 
-       svc_ctx->event_list = eina_list_append(svc_ctx->event_list, item);
-       return item;
+    svc_ctx->event_list = eina_list_append(svc_ctx->event_list, item);
+    return item;
 }
 
 HAPI int service_common_update_timer(struct service_event_item *item, double timer)
 {
-       struct itimerspec spec;
+    struct itimerspec spec;
 
-       spec.it_interval.tv_sec = (time_t)timer;
-       spec.it_interval.tv_nsec = (timer - spec.it_interval.tv_sec) * 1000000000;
+    spec.it_interval.tv_sec = (time_t)timer;
+    spec.it_interval.tv_nsec = (timer - spec.it_interval.tv_sec) * 1000000000;
 
-       if (clock_gettime(CLOCK_MONOTONIC, &spec.it_value) < 0) {
-               ErrPrint("clock_gettime: %s\n", strerror(errno));
-               return -EFAULT;
-       }
+    if (clock_gettime(CLOCK_MONOTONIC, &spec.it_value) < 0) {
+       ErrPrint("clock_gettime: %s\n", strerror(errno));
+       return -EFAULT;
+    }
 
-       spec.it_value.tv_sec += spec.it_interval.tv_sec;
-       spec.it_value.tv_nsec += spec.it_interval.tv_nsec;
+    spec.it_value.tv_sec += spec.it_interval.tv_sec;
+    spec.it_value.tv_nsec += spec.it_interval.tv_nsec;
 
-       if (timerfd_settime(item->info.timer.fd, TFD_TIMER_ABSTIME, &spec, NULL) < 0) {
-               ErrPrint("Error: %s\n", strerror(errno));
-               return -EFAULT;
-       }
+    if (timerfd_settime(item->info.timer.fd, TFD_TIMER_ABSTIME, &spec, NULL) < 0) {
+       ErrPrint("Error: %s\n", strerror(errno));
+       return -EFAULT;
+    }
 
-       DbgPrint("Armed interval: %u %u\n", spec.it_interval.tv_sec, spec.it_interval.tv_nsec);
-       return 0;
+    DbgPrint("Armed interval: %u %u\n", spec.it_interval.tv_sec, spec.it_interval.tv_nsec);
+    return 0;
 }
 
 /*!
@@ -1171,23 +1171,23 @@ HAPI int service_common_update_timer(struct service_event_item *item, double tim
  */
 HAPI int service_common_del_timer(struct service_context *svc_ctx, struct service_event_item *item)
 {
-       if (!eina_list_data_find(svc_ctx->event_list, item)) {
-               ErrPrint("Invalid event item\n");
-               return -EINVAL;
-       }
-
-       svc_ctx->event_list = eina_list_remove(svc_ctx->event_list, item);
-
-       if (close(item->info.timer.fd) < 0) {
-               ErrPrint("close: %s\n", strerror(errno));
-       }
-       DbgFree(item);
-       return 0;
+    if (!eina_list_data_find(svc_ctx->event_list, item)) {
+       ErrPrint("Invalid event item\n");
+       return -EINVAL;
+    }
+
+    svc_ctx->event_list = eina_list_remove(svc_ctx->event_list, item);
+
+    if (close(item->info.timer.fd) < 0) {
+       ErrPrint("close: %s\n", strerror(errno));
+    }
+    DbgFree(item);
+    return 0;
 }
 
 HAPI int service_common_fd(struct service_context *ctx)
 {
-       return ctx->fd;
+    return ctx->fd;
 }
 
 /* End of a file */
index 84cb0b1..0f435ec 100644 (file)
@@ -38,7 +38,9 @@
 #include "critical_log.h"
 
 #if defined(HAVE_LIVEBOX)
-#include <livebox-service.h>
+#include <dynamicbox_service.h>
+#include <dynamicbox_conf.h>
+#include <dynamicbox_errno.h>
 #include "client_life.h"
 #include "slave_life.h"
 #include "xmonitor.h"
 
 int errno;
 
+struct event_cbdata {
+    int (*handler)(enum oom_event_type type, void *data);
+    void *data;
+    int deleted;
+};
+
 static struct {
-       int deactivated;
+    int deactivated;
+    Eina_List *oom_event_list;
+    int oom_event_in_process;
 } s_info = {
-       .deactivated = 0,
+    .deactivated = 0,
+    .oom_event_list = NULL,
+    .oom_event_in_process = 0,
 };
 
 static void lcd_state_cb(keynode_t *node, void *user_data)
 {
-       if (!node) {
-               return;
-       }
+    if (!node) {
+       return;
+    }
 
-       xmonitor_handle_state_changes();
+    xmonitor_handle_state_changes();
 }
 
 HAPI int setting_is_lcd_off(void)
 {
-       int state;
+    int state;
 
-       if (vconf_get_int(VCONFKEY_PM_STATE, &state) != 0) {
-               ErrPrint("Idle lock state is not valid\n");
-               state = VCONFKEY_PM_STATE_NORMAL; /* UNLOCK */
-       }
+    if (!DYNAMICBOX_CONF_CHECK_LCD) {
+       /* Always turned on */
+       return 0;
+    }
+
+    if (vconf_get_int(VCONFKEY_PM_STATE, &state) != 0) {
+       ErrPrint("Idle lock state is not valid\n");
+       state = VCONFKEY_PM_STATE_NORMAL; /* UNLOCK */
+    }
 
-       DbgPrint("State: %d, (%d:lcdoff, %d:sleep)\n", state, VCONFKEY_PM_STATE_LCDOFF, VCONFKEY_PM_STATE_SLEEP);
-       return state == VCONFKEY_PM_STATE_LCDOFF || state == VCONFKEY_PM_STATE_SLEEP;
+    ErrPrint("State: %d, (%d:lcdoff, %d:sleep)\n", state, VCONFKEY_PM_STATE_LCDOFF, VCONFKEY_PM_STATE_SLEEP);
+    return state == VCONFKEY_PM_STATE_LCDOFF || state == VCONFKEY_PM_STATE_SLEEP;
 }
 
 static void power_off_cb(keynode_t *node, void *user_data)
 {
-       int val;
-       CRITICAL_LOG("Terminated(vconf)\n");
-
-       if (vconf_get_int(VCONFKEY_SYSMAN_POWER_OFF_STATUS, &val) != 0) {
-               ErrPrint("Failed to get power off status (%d)\n", val);
-               return;
-       }
-
-       if (val == VCONFKEY_SYSMAN_POWER_OFF_DIRECT || val == VCONFKEY_SYSMAN_POWER_OFF_RESTART) {
-               DbgPrint("Power off requested: Ignored\n");
-       } else {
-               ErrPrint("Unknown power state: %d\n", val);
-       }
+    int val;
+    CRITICAL_LOG("Terminated(vconf)\n");
+
+    if (vconf_get_int(VCONFKEY_SYSMAN_POWER_OFF_STATUS, &val) != 0) {
+       ErrPrint("Failed to get power off status (%d)\n", val);
+       return;
+    }
+
+    if (val == VCONFKEY_SYSMAN_POWER_OFF_DIRECT || val == VCONFKEY_SYSMAN_POWER_OFF_RESTART) {
+       DbgPrint("Power off requested: Ignored\n");
+    } else {
+       ErrPrint("Unknown power state: %d\n", val);
+    }
 }
 
 static void region_changed_cb(keynode_t *node, void *user_data)
 {
-        char *region;
-        char *r;
-
-        region = vconf_get_str(VCONFKEY_REGIONFORMAT);
-        if (!region) {
-               return;
-       }
-
-       setenv("LC_CTYPE", region, 1);
-       setenv("LC_NUMERIC", region, 1);
-       setenv("LC_TIME", region, 1);
-       setenv("LC_COLLATE", region, 1);
-       setenv("LC_MONETARY", region, 1);
-       setenv("LC_PAPER", region, 1);
-       setenv("LC_NAME", region, 1);
-       setenv("LC_ADDRESS", region, 1);
-       setenv("LC_TELEPHONE", region, 1);
-       setenv("LC_MEASUREMENT", region, 1);
-       setenv("LC_IDENTIFICATION", region, 1);
-
-       r = setlocale(LC_ALL, "");
-       if (r == NULL) {
-               ErrPrint("Failed to change region\n");
-       }
-
-       DbgFree(region);
+    char *region;
+    char *r;
+
+    region = vconf_get_str(VCONFKEY_REGIONFORMAT);
+    if (!region) {
+       return;
+    }
+
+    setenv("LC_CTYPE", region, 1);
+    setenv("LC_NUMERIC", region, 1);
+    setenv("LC_TIME", region, 1);
+    setenv("LC_COLLATE", region, 1);
+    setenv("LC_MONETARY", region, 1);
+    setenv("LC_PAPER", region, 1);
+    setenv("LC_NAME", region, 1);
+    setenv("LC_ADDRESS", region, 1);
+    setenv("LC_TELEPHONE", region, 1);
+    setenv("LC_MEASUREMENT", region, 1);
+    setenv("LC_IDENTIFICATION", region, 1);
+
+    r = setlocale(LC_ALL, "");
+    if (r == NULL) {
+       ErrPrint("Failed to change region\n");
+    }
+
+    DbgFree(region);
 }
 
 static void lang_changed_cb(keynode_t *node, void *user_data)
 {
-        char *lang;
-               char *r;
+    char *lang;
+    char *r;
 
-        lang = vconf_get_str(VCONFKEY_LANGSET);
-        if (!lang) {
-               return;
-       }
+    lang = vconf_get_str(VCONFKEY_LANGSET);
+    if (!lang) {
+       return;
+    }
 
-       setenv("LANG", lang, 1);
-       setenv("LC_MESSAGES", lang, 1);
+    setenv("LANG", lang, 1);
+    setenv("LC_MESSAGES", lang, 1);
 
-       r = setlocale(LC_ALL, "");
-       if (!r) {
-               ErrPrint("Failed to change locale\n");
-       }
+    r = setlocale(LC_ALL, "");
+    if (!r) {
+       ErrPrint("Failed to change locale\n");
+    }
 
-       DbgPrint("Locale: %s\n", setlocale(LC_ALL, NULL));
-       DbgFree(lang);
+    DbgPrint("Locale: %s\n", setlocale(LC_ALL, NULL));
+    DbgFree(lang);
 }
 
 static void low_mem_cb(keynode_t *node, void *user_data)
 {
-       int val;
-
-       val = vconf_keynode_get_int(node);
-
-       if (val >= VCONFKEY_SYSMAN_LOW_MEMORY_SOFT_WARNING)     {
-               CRITICAL_LOG("Low memory: level %d\n", val);
-               if (s_info.deactivated == 0) {
-                       s_info.deactivated = 1;
-                       //slave_deactivate_all(0, 1, 0);
-                       malloc_trim(0);
-                       ErrPrint("Fall into the low mem status\n");
+    int val;
+    Eina_List *l;
+    Eina_List *n;
+    struct event_cbdata *item;
+
+    val = vconf_keynode_get_int(node);
+
+    if (val >= VCONFKEY_SYSMAN_LOW_MEMORY_SOFT_WARNING)     {
+       CRITICAL_LOG("Low memory: level %d\n", val);
+       if (s_info.deactivated == 0) {
+           s_info.deactivated = 1;
+
+           s_info.oom_event_in_process = 1;
+           EINA_LIST_FOREACH_SAFE(s_info.oom_event_list, l, n, item) {
+               if (item->deleted || item->handler(OOM_TYPE_LOW, item->data) < 0 || item->deleted) {
+                   s_info.oom_event_list = eina_list_remove(s_info.oom_event_list, item);
+                   free(item);
                }
-       } else {
-               CRITICAL_LOG("Normal memory: level %d\n", val);
-               if (s_info.deactivated == 1) {
-                       s_info.deactivated = 0;
-                       //slave_activate_all();
-                       ErrPrint("Recover from the low mem status\n");
+           }
+           s_info.oom_event_in_process = 0;
+
+           //slave_deactivate_all(0, 1, 0);
+           malloc_trim(0);
+           ErrPrint("Fall into the low mem status\n");
+       }
+    } else {
+       CRITICAL_LOG("Normal memory: level %d\n", val);
+       if (s_info.deactivated == 1) {
+           s_info.deactivated = 0;
+
+           s_info.oom_event_in_process = 1;
+           EINA_LIST_FOREACH_SAFE(s_info.oom_event_list, l, n, item) {
+               if (item->deleted || item->handler(OOM_TYPE_NORMAL, item->data) < 0 || item->deleted) {
+                   s_info.oom_event_list = eina_list_remove(s_info.oom_event_list, item);
+                   free(item);
                }
+           }
+           s_info.oom_event_in_process = 0;
+
+           //slave_activate_all();
+           ErrPrint("Recover from the low mem status\n");
        }
+    }
 }
 
-HAPI int setting_init(void)
+HAPI int setting_add_oom_event_callback(int (*handler)(enum oom_event_type type, void *data), void *data)
 {
-       int ret;
+    struct event_cbdata *item;
 
-       ret = vconf_notify_key_changed(VCONFKEY_PM_STATE, lcd_state_cb, NULL);
-       if (ret < 0) {
-               ErrPrint("Failed to add vconf for lock state: %d\n", ret);
-       }
-
-       ret = vconf_notify_key_changed(VCONFKEY_SYSMAN_POWER_OFF_STATUS, power_off_cb, NULL);
-       if (ret < 0) {
-               ErrPrint("Failed to add vconf for power state: %d \n", ret);
-       }
+    item = malloc(sizeof(*item));
+    if (!item) {
+       ErrPrint("malloc: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       ret = vconf_notify_key_changed(VCONFKEY_LANGSET, lang_changed_cb, NULL);
-       if (ret < 0) {
-               ErrPrint("Failed to add vconf for lang change: %d\n", ret);
-       }
+    item->handler = handler;
+    item->data = data;
+    item->deleted = 0;
 
-       ret = vconf_notify_key_changed(VCONFKEY_REGIONFORMAT, region_changed_cb, NULL);
-       if (ret < 0) {
-               ErrPrint("Failed to add vconf for region change: %d\n", ret);
-       }
+    s_info.oom_event_list = eina_list_append(s_info.oom_event_list, item);
+    return DBOX_STATUS_ERROR_NONE;
+}
 
-       ret = vconf_notify_key_changed(VCONFKEY_SYSMAN_LOW_MEMORY, low_mem_cb, NULL);
-       if (ret < 0) {
-               ErrPrint("Failed to add vconf for low mem monitor: %d\n", ret);
+HAPI int setting_del_oom_event_callback(int (*handler)(enum oom_event_type type, void *data), void *data)
+{
+    struct event_cbdata *item;
+    Eina_List *l;
+    Eina_List *n;
+
+    EINA_LIST_FOREACH_SAFE(s_info.oom_event_list, l, n, item) {
+       if (handler == item->handler && item->data == data) {
+           if (s_info.oom_event_in_process) {
+               item->deleted = 1;
+           } else {
+               s_info.oom_event_list = eina_list_remove(s_info.oom_event_list, item);
+               free(item);
+           }
+           return DBOX_STATUS_ERROR_NONE;
        }
+    }
 
-       lang_changed_cb(NULL, NULL);
-       region_changed_cb(NULL, NULL);
-       return ret;
+    return DBOX_STATUS_ERROR_NOT_EXIST;
 }
 
-HAPI int setting_fini(void)
+HAPI enum oom_event_type setting_oom_level(void)
 {
-       int ret;
+    int ret;
+    int status;
 
-       ret = vconf_ignore_key_changed(VCONFKEY_SYSMAN_LOW_MEMORY, low_mem_cb);
-       if (ret < 0) {
-               ErrPrint("Failed to ignore vconf key (%d)\n", ret);
-       }
-
-       ret = vconf_ignore_key_changed(VCONFKEY_REGIONFORMAT, region_changed_cb);
-       if (ret < 0) {
-               ErrPrint("Failed to ignore vconf key (%d)\n", ret);
-       }
+    ret = vconf_get_int(VCONFKEY_SYSMAN_LOW_MEMORY, &status);
+    if (ret == 0 && status >= VCONFKEY_SYSMAN_LOW_MEMORY_SOFT_WARNING) {
+       return OOM_TYPE_LOW;
+    }
 
-       ret = vconf_ignore_key_changed(VCONFKEY_LANGSET, lang_changed_cb);
-       if (ret < 0) {
-               ErrPrint("Failed to ignore vconf key (%d)\n", ret);
-       }
-
-       ret = vconf_ignore_key_changed(VCONFKEY_PM_STATE, lcd_state_cb);
-       if (ret < 0) {
-               ErrPrint("Failed to ignore vconf key (%d)\n", ret);
-       }
+    return OOM_TYPE_NORMAL;
+}
 
-       ret = vconf_ignore_key_changed(VCONFKEY_SYSMAN_POWER_OFF_STATUS, power_off_cb);
-       if (ret < 0) {
-               ErrPrint("Failed to ignore vconf key (%d)\n", ret);
-       }
+HAPI int setting_init(void)
+{
+    int ret;
+
+    ret = vconf_notify_key_changed(VCONFKEY_PM_STATE, lcd_state_cb, NULL);
+    if (ret < 0) {
+       ErrPrint("Failed to add vconf for lock state: %d\n", ret);
+    }
+
+    ret = vconf_notify_key_changed(VCONFKEY_SYSMAN_POWER_OFF_STATUS, power_off_cb, NULL);
+    if (ret < 0) {
+       ErrPrint("Failed to add vconf for power state: %d \n", ret);
+    }
+
+    ret = vconf_notify_key_changed(VCONFKEY_LANGSET, lang_changed_cb, NULL);
+    if (ret < 0) {
+       ErrPrint("Failed to add vconf for lang change: %d\n", ret);
+    }
+
+    ret = vconf_notify_key_changed(VCONFKEY_REGIONFORMAT, region_changed_cb, NULL);
+    if (ret < 0) {
+       ErrPrint("Failed to add vconf for region change: %d\n", ret);
+    }
+
+    ret = vconf_notify_key_changed(VCONFKEY_SYSMAN_LOW_MEMORY, low_mem_cb, NULL);
+    if (ret < 0) {
+       ErrPrint("Failed to add vconf for low mem monitor: %d\n", ret);
+    }
+
+    lang_changed_cb(NULL, NULL);
+    region_changed_cb(NULL, NULL);
+    return ret;
+}
 
-       return ret;
+HAPI int setting_fini(void)
+{
+    int ret;
+
+    ret = vconf_ignore_key_changed(VCONFKEY_SYSMAN_LOW_MEMORY, low_mem_cb);
+    if (ret < 0) {
+       ErrPrint("Failed to ignore vconf key (%d)\n", ret);
+    }
+
+    ret = vconf_ignore_key_changed(VCONFKEY_REGIONFORMAT, region_changed_cb);
+    if (ret < 0) {
+       ErrPrint("Failed to ignore vconf key (%d)\n", ret);
+    }
+
+    ret = vconf_ignore_key_changed(VCONFKEY_LANGSET, lang_changed_cb);
+    if (ret < 0) {
+       ErrPrint("Failed to ignore vconf key (%d)\n", ret);
+    }
+
+    ret = vconf_ignore_key_changed(VCONFKEY_PM_STATE, lcd_state_cb);
+    if (ret < 0) {
+       ErrPrint("Failed to ignore vconf key (%d)\n", ret);
+    }
+
+    ret = vconf_ignore_key_changed(VCONFKEY_SYSMAN_POWER_OFF_STATUS, power_off_cb);
+    if (ret < 0) {
+       ErrPrint("Failed to ignore vconf key (%d)\n", ret);
+    }
+
+    return ret;
 }
 
 /* End of a file */
index bffd8ea..bffc1ee 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <dlog.h>
 #if defined(HAVE_LIVEBOX)
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
 #else
 #include "lite-errno.h"
 #endif
 #include "conf.h"
 
 static struct info {
-       Eina_List *context_list;
-       struct service_context *svc_ctx;
+    Eina_List *context_list;
+    struct service_context *svc_ctx;
 } s_info = {
-       .context_list = NULL, /*!< \WARN: This is only used for SERVICE THREAD */
-       .svc_ctx = NULL, /*!< \WARN: This is only used for MAIN THREAD */
+    .context_list = NULL, /*!< \WARN: This is only used for SERVICE THREAD */
+    .svc_ctx = NULL, /*!< \WARN: This is only used for MAIN THREAD */
 };
 
 struct context {
-       struct tcb *tcb;
-       double seq;
+    struct tcb *tcb;
+    double seq;
 };
 
 /*!
@@ -54,19 +54,19 @@ struct context {
  */
 static inline int put_reply_context(struct tcb *tcb, double seq)
 {
-       struct context *ctx;
+    struct context *ctx;
 
-       ctx = malloc(sizeof(*ctx));
-       if (!ctx) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return -ENOMEM;
-       }
+    ctx = malloc(sizeof(*ctx));
+    if (!ctx) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return -ENOMEM;
+    }
 
-       ctx->tcb = tcb;
-       ctx->seq = seq; /* Could we this sequence value is uniq? */
+    ctx->tcb = tcb;
+    ctx->seq = seq; /* Could we this sequence value is uniq? */
 
-       s_info.context_list = eina_list_append(s_info.context_list, ctx);
-       return 0;
+    s_info.context_list = eina_list_append(s_info.context_list, ctx);
+    return 0;
 }
 
 /*!
@@ -74,41 +74,41 @@ static inline int put_reply_context(struct tcb *tcb, double seq)
  */
 static inline struct tcb *get_reply_context(double seq)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct context *ctx;
-       struct tcb *tcb;
-
-       tcb = NULL;
-       EINA_LIST_FOREACH_SAFE(s_info.context_list, l, n, ctx) {
-               if (ctx->seq != seq) {
-                       continue;
-               }
-
-               s_info.context_list = eina_list_remove(s_info.context_list, ctx);
-               tcb = ctx->tcb;
-               DbgFree(ctx);
-               break;
+    Eina_List *l;
+    Eina_List *n;
+    struct context *ctx;
+    struct tcb *tcb;
+
+    tcb = NULL;
+    EINA_LIST_FOREACH_SAFE(s_info.context_list, l, n, ctx) {
+       if (ctx->seq != seq) {
+           continue;
        }
 
-       return tcb;
+       s_info.context_list = eina_list_remove(s_info.context_list, ctx);
+       tcb = ctx->tcb;
+       DbgFree(ctx);
+       break;
+    }
+
+    return tcb;
 }
 
 static void send_reply_packet(struct tcb *tcb, struct packet *packet, int ret)
 {
-       struct packet *reply_packet;
+    struct packet *reply_packet;
 
-       reply_packet = packet_create_reply(packet, "i", ret);
-       if (!reply_packet) {
-               ErrPrint("Failed to create a packet\n");
-               return;
-       }
+    reply_packet = packet_create_reply(packet, "i", ret);
+    if (!reply_packet) {
+       ErrPrint("Failed to create a packet\n");
+       return;
+    }
 
-       if (service_common_unicast_packet(tcb, reply_packet) < 0) {
-               ErrPrint("Unable to send reply packet\n");
-       }
+    if (service_common_unicast_packet(tcb, reply_packet) < 0) {
+       ErrPrint("Unable to send reply packet\n");
+    }
 
-       packet_destroy(reply_packet);
+    packet_destroy(reply_packet);
 }
 
 /*!
@@ -116,88 +116,88 @@ static void send_reply_packet(struct tcb *tcb, struct packet *packet, int ret)
  */
 static int service_thread_main(struct tcb *tcb, struct packet *packet, void *data)
 {
-       const char *command;
-       int ret;
+    const char *command;
+    int ret;
 
-       if (!packet) {
-               DbgPrint("TCB: %p is terminated (NIL packet)\n", tcb);
-               return 0;
-       }
+    if (!packet) {
+       DbgPrint("TCB: %p is terminated (NIL packet)\n", tcb);
+       return 0;
+    }
 
-       command = packet_command(packet);
-       if (!command) {
-               ErrPrint("Invalid command\n");
-               return -EINVAL;
-       }
+    command = packet_command(packet);
+    if (!command) {
+       ErrPrint("Invalid command\n");
+       return -EINVAL;
+    }
 
-       switch (packet_type(packet)) {
+    switch (packet_type(packet)) {
        case PACKET_REQ:
 
-               /* Need to send reply packet */
-               DbgPrint("%p REQ: Command: [%s]\n", tcb, command);
-               if (!strcmp(command, "add_livebox") || !strcmp(command, "rm_livebox")) {
-                       ret = security_server_check_privilege_by_sockfd(tcb_fd(tcb), "data-provider-master::shortcut.livebox", "w");
-                       if (ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) {
-                               ErrPrint("SMACK:Access denied\n");
-                               send_reply_packet(tcb, packet, SHORTCUT_ERROR_PERMISSION);
-                               break;
-                       }
-
-               } else if (!strcmp(command, "add_shortcut") || !strcmp(command, "rm_shortcut")) {
-                       ret = security_server_check_privilege_by_sockfd(tcb_fd(tcb), "data-provider-master::shortcut.shortcut", "w");
-                       if (ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) {
-                               ErrPrint("SMACK:Access denied\n");
-                               send_reply_packet(tcb, packet, SHORTCUT_ERROR_PERMISSION);
-                               break;
-                       }
+           /* Need to send reply packet */
+           DbgPrint("%p REQ: Command: [%s]\n", tcb, command);
+           if (!strcmp(command, "add_livebox") || !strcmp(command, "rm_livebox")) {
+               ret = security_server_check_privilege_by_sockfd(tcb_fd(tcb), "data-provider-master::shortcut.livebox", "w");
+               if (ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) {
+                   ErrPrint("SMACK:Access denied\n");
+                   send_reply_packet(tcb, packet, SHORTCUT_ERROR_PERMISSION_DENIED);
+                   break;
                }
 
-               if (service_common_multicast_packet(tcb, packet, TCB_CLIENT_TYPE_SERVICE) < 0) {
-                       ErrPrint("Unable to send service request packet\n");
-               } else {
-                       (void)put_reply_context(tcb, packet_seq(packet));
+           } else if (!strcmp(command, "add_shortcut") || !strcmp(command, "rm_shortcut")) {
+               ret = security_server_check_privilege_by_sockfd(tcb_fd(tcb), "data-provider-master::shortcut.shortcut", "w");
+               if (ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) {
+                   ErrPrint("SMACK:Access denied\n");
+                   send_reply_packet(tcb, packet, SHORTCUT_ERROR_PERMISSION_DENIED);
+                   break;
                }
-               break;
+           }
+
+           if (service_common_multicast_packet(tcb, packet, TCB_CLIENT_TYPE_SERVICE) < 0) {
+               ErrPrint("Unable to send service request packet\n");
+           } else {
+               (void)put_reply_context(tcb, packet_seq(packet));
+           }
+           break;
        case PACKET_REQ_NOACK:
-               /* Doesn't need to send reply packet */
-               DbgPrint("%p REQ_NOACK: Command: [%s]\n", tcb, command);
-               if (!strcmp(command, "service_register")) {
-                       tcb_client_type_set(tcb, TCB_CLIENT_TYPE_SERVICE);
-                       break;
-               }
-
-               if (service_common_multicast_packet(tcb, packet, TCB_CLIENT_TYPE_SERVICE) < 0) {
-                       ErrPrint("Unable to send service reuqest packet\n");
-               }
+           /* Doesn't need to send reply packet */
+           DbgPrint("%p REQ_NOACK: Command: [%s]\n", tcb, command);
+           if (!strcmp(command, "service_register")) {
+               tcb_client_type_set(tcb, TCB_CLIENT_TYPE_SERVICE);
                break;
-       case PACKET_ACK:
-               /* Okay, client(or app) send a reply packet to us. */
-               DbgPrint("%p ACK: Command: [%s]\n", tcb, command);
-               tcb = get_reply_context(packet_seq(packet));
-               if (!tcb) {
-                       ErrPrint("There is no proper context\n");
-                       break;
-               }
+           }
 
-               if (tcb_is_valid(s_info.svc_ctx, tcb) < 0) {
-                       ErrPrint("TCB is not valid (already disconnected?)\n");
-                       break;
-               }
+           if (service_common_multicast_packet(tcb, packet, TCB_CLIENT_TYPE_SERVICE) < 0) {
+               ErrPrint("Unable to send service reuqest packet\n");
+           }
+           break;
+       case PACKET_ACK:
+           /* Okay, client(or app) send a reply packet to us. */
+           DbgPrint("%p ACK: Command: [%s]\n", tcb, command);
+           tcb = get_reply_context(packet_seq(packet));
+           if (!tcb) {
+               ErrPrint("There is no proper context\n");
+               break;
+           }
 
-               if (service_common_unicast_packet(tcb, packet) < 0) {
-                       ErrPrint("Unable to send reply packet\n");
-               }
+           if (tcb_is_valid(s_info.svc_ctx, tcb) < 0) {
+               ErrPrint("TCB is not valid (already disconnected?)\n");
                break;
-       default:
-               ErrPrint("Packet type is not valid[%s]\n", command);
-               return -EINVAL;
-       }
+           }
 
-       /*!
-        * return value has no meanning,
-        * it will be printed by dlogutil.
-        */
-       return 0;
+           if (service_common_unicast_packet(tcb, packet) < 0) {
+               ErrPrint("Unable to send reply packet\n");
+           }
+           break;
+       default:
+           ErrPrint("Packet type is not valid[%s]\n", command);
+           return -EINVAL;
+    }
+
+    /*!
+     * return value has no meanning,
+     * it will be printed by dlogutil.
+     */
+    return 0;
 }
 
 
@@ -208,49 +208,49 @@ static int service_thread_main(struct tcb *tcb, struct packet *packet, void *dat
 
 HAPI int shortcut_service_init(void)
 {
-       if (s_info.svc_ctx) {
-               ErrPrint("Already initialized\n");
-               return LB_STATUS_ERROR_ALREADY;
+    if (s_info.svc_ctx) {
+       ErrPrint("Already initialized\n");
+       return DBOX_STATUS_ERROR_ALREADY;
+    }
+
+    s_info.svc_ctx = service_common_create(SHORTCUT_SOCKET, service_thread_main, NULL);
+    if (!s_info.svc_ctx) {
+       ErrPrint("Unable to activate service thread\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    if (smack_fsetlabel(service_common_fd(s_info.svc_ctx), SHORTCUT_SMACK_LABEL, SMACK_LABEL_IPOUT) != 0) {
+       if (errno != EOPNOTSUPP) {
+           ErrPrint("Unable to set SMACK label(%d)\n", errno);
+           service_common_destroy(s_info.svc_ctx);
+           s_info.svc_ctx = NULL;
+           return DBOX_STATUS_ERROR_FAULT;
        }
-
-       s_info.svc_ctx = service_common_create(SHORTCUT_SOCKET, service_thread_main, NULL);
-       if (!s_info.svc_ctx) {
-               ErrPrint("Unable to activate service thread\n");
-               return LB_STATUS_ERROR_FAULT;
+    }
+
+    if (smack_fsetlabel(service_common_fd(s_info.svc_ctx), SHORTCUT_SMACK_LABEL, SMACK_LABEL_IPIN) != 0) {
+       if (errno != EOPNOTSUPP) {
+           ErrPrint("Unable to set SMACK label(%d)\n", errno);
+           service_common_destroy(s_info.svc_ctx);
+           s_info.svc_ctx = NULL;
+           return DBOX_STATUS_ERROR_FAULT;
        }
+    }
 
-       if (smack_fsetlabel(service_common_fd(s_info.svc_ctx), SHORTCUT_SMACK_LABEL, SMACK_LABEL_IPOUT) != 0) {
-               if (errno != EOPNOTSUPP) {
-                       ErrPrint("Unable to set SMACK label(%d)\n", errno);
-                       service_common_destroy(s_info.svc_ctx);
-                       s_info.svc_ctx = NULL;
-                       return LB_STATUS_ERROR_FAULT;
-               }
-       }
-
-       if (smack_fsetlabel(service_common_fd(s_info.svc_ctx), SHORTCUT_SMACK_LABEL, SMACK_LABEL_IPIN) != 0) {
-               if (errno != EOPNOTSUPP) {
-                       ErrPrint("Unable to set SMACK label(%d)\n", errno);
-                       service_common_destroy(s_info.svc_ctx);
-                       s_info.svc_ctx = NULL;
-                       return LB_STATUS_ERROR_FAULT;
-               }
-       }
-
-       DbgPrint("Successfully initiated\n");
-       return LB_STATUS_SUCCESS;
+    DbgPrint("Successfully initiated\n");
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int shortcut_service_fini(void)
 {
-       if (!s_info.svc_ctx) {
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       service_common_destroy(s_info.svc_ctx);
-       s_info.svc_ctx = NULL;
-       DbgPrint("Successfully Finalized\n");
-       return LB_STATUS_SUCCESS;
+    if (!s_info.svc_ctx) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    service_common_destroy(s_info.svc_ctx);
+    s_info.svc_ctx = NULL;
+    DbgPrint("Successfully Finalized\n");
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 /* End of a file */
index eeff1b3..07185bc 100644 (file)
@@ -22,6 +22,7 @@
 #include <pthread.h>
 #include <malloc.h>
 #include <sys/time.h>
+#include <sys/resource.h>
 
 #include <Eina.h>
 #include <Ecore.h>
@@ -31,7 +32,9 @@
 #include <bundle.h>
 
 #include <packet.h>
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
+#include <dynamicbox_conf.h>
+#include <dynamicbox_cmd_list.h>
 
 #include "critical_log.h"
 #include "slave_life.h"
 #include "abi.h"
 #include "xmonitor.h"
 
+#define BUNDLE_SLAVE_SVC_OP_TYPE "__APP_SVC_OP_TYPE__"
+#define APP_CONTROL_OPERATION_MAIN "http://tizen.org/appcontrol/operation/main"
+
 int errno;
 
 struct slave_node {
-       char *name;
-       char *abi;
-       char *pkgname;
-       int secured;    /* Only A package(livebox) is loaded for security requirements */
-       int refcnt;
-       int fault_count;
-       int critical_fault_count;
-       enum slave_state state;
-       int network;
-
-       int loaded_instance;
-       int loaded_package;
-
-       int reactivate_instances;
-       int reactivate_slave;
-
-       pid_t pid;
-
-       enum event_process {
-               SLAVE_EVENT_PROCESS_IDLE = 0x00,
-               SLAVE_EVENT_PROCESS_ACTIVATE = 0x01,
-               SLAVE_EVENT_PROCESS_DEACTIVATE = 0x02,
-               SLAVE_EVENT_PROCESS_DELETE = 0x04,
-               SLAVE_EVENT_PROCESS_FAULT = 0x08,
-               SLAVE_EVENT_PROCESS_PAUSE = 0x10,
-               SLAVE_EVENT_PROCESS_RESUME = 0x20
-       } in_event_process;
-       Eina_List *event_activate_list;
-       Eina_List *event_deactivate_list;
-       Eina_List *event_delete_list;
-       Eina_List *event_fault_list;
-       Eina_List *event_pause_list;
-       Eina_List *event_resume_list;
-
-       Eina_List *data_list;
-
-       Ecore_Timer *ttl_timer; /*!< Time to live */
-       Ecore_Timer *activate_timer; /*!< Waiting hello packet for this time */
-       Ecore_Timer *relaunch_timer; /*!< Try to relaunch service app */
-       Ecore_Timer *terminate_timer; /*!< Waiting this timer before terminate the service provider */
-       int relaunch_count;
-
-       int ctrl_option;
+    char *name;
+    char *abi;
+    char *pkgname;
+    int secured;       /* Only A package(dynamicbox) is loaded for security requirements */
+    int refcnt;
+    int fault_count;
+    int critical_fault_count;
+    enum slave_state state;
+    int network;
+
+    int loaded_instance;
+    int loaded_package;
+
+    int reactivate_instances;
+    int reactivate_slave;
+
+    pid_t pid;
+
+    enum event_process {
+       SLAVE_EVENT_PROCESS_IDLE = 0x00,
+       SLAVE_EVENT_PROCESS_ACTIVATE = 0x01,
+       SLAVE_EVENT_PROCESS_DEACTIVATE = 0x02,
+       SLAVE_EVENT_PROCESS_DELETE = 0x04,
+       SLAVE_EVENT_PROCESS_FAULT = 0x08,
+       SLAVE_EVENT_PROCESS_PAUSE = 0x10,
+       SLAVE_EVENT_PROCESS_RESUME = 0x20
+    } in_event_process;
+    Eina_List *event_activate_list;
+    Eina_List *event_deactivate_list;
+    Eina_List *event_delete_list;
+    Eina_List *event_fault_list;
+    Eina_List *event_pause_list;
+    Eina_List *event_resume_list;
+
+    Eina_List *data_list;
+
+    Ecore_Timer *ttl_timer; /*!< Time to live */
+    Ecore_Timer *activate_timer; /*!< Waiting hello packet for this time */
+    Ecore_Timer *relaunch_timer; /*!< Try to relaunch service app */
+    Ecore_Timer *terminate_timer; /*!< Waiting this timer before terminate the service provider */
+    int relaunch_count;
+
+    int ctrl_option;
 
 #if defined(_USE_ECORE_TIME_GET)
-       double activated_at;
+    double activated_at;
 #else
-       struct timeval activated_at;
+    struct timeval activated_at;
 #endif
 };
 
 struct event {
-       struct slave_node *slave;
+    struct slave_node *slave;
 
-       int (*evt_cb)(struct slave_node *, void *);
-       void *cbdata;
-       int deleted;
+    int (*evt_cb)(struct slave_node *, void *);
+    void *cbdata;
+    int deleted;
 };
 
 struct priv_data {
-       char *tag;
-       void *data;
+    char *tag;
+    void *data;
 };
 
 static struct {
-       Eina_List *slave_list;
-       int deactivate_all_refcnt;
+    Eina_List *slave_list;
+    int deactivate_all_refcnt;
 } s_info = {
-       .slave_list = NULL,
-       .deactivate_all_refcnt = 0,
+    .slave_list = NULL,
+    .deactivate_all_refcnt = 0,
 };
 
 static Eina_Bool slave_ttl_cb(void *data)
 {
-       struct slave_node *slave = (struct slave_node *)data;
+    struct slave_node *slave = (struct slave_node *)data;
 
-       /*!
-        * \note
-        * ttl_timer must has to be set to NULL before deactivate the slave
-        * It will be used for making decision of the expired TTL timer or the fault of a livebox.
-        */
-       slave->ttl_timer = NULL;
+    /*!
+     * \note
+     * ttl_timer must has to be set to NULL before deactivate the slave
+     * It will be used for making decision of the expired TTL timer or the fault of a dynamicbox.
+     */
+    slave->ttl_timer = NULL;
 
-       slave_set_reactivation(slave, 0);
-       slave_set_reactivate_instances(slave, 1);
+    slave_set_reactivation(slave, 0);
+    slave_set_reactivate_instances(slave, 1);
 
-       slave = slave_deactivate(slave, 1);
-       if (!slave) {
-               DbgPrint("Slave is deleted\n");
-       }
+    slave = slave_deactivate(slave, 1);
+    if (!slave) {
+       DbgPrint("Slave is deleted\n");
+    }
 
-       /*! To recover all instances state it is activated again */
-       return ECORE_CALLBACK_CANCEL;
+    /*! To recover all instances state it is activated again */
+    return ECORE_CALLBACK_CANCEL;
 }
 
 static inline int xmonitor_pause_cb(void *data)
 {
-       slave_pause(data);
-       return LB_STATUS_SUCCESS;
+    slave_pause(data);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static inline int xmonitor_resume_cb(void *data)
 {
-       slave_resume(data);
-       return LB_STATUS_SUCCESS;
+    slave_resume(data);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static inline struct slave_node *create_slave_node(const char *name, int is_secured, const char *abi, const char *pkgname, int network)
 {
-       struct slave_node *slave;
+    struct slave_node *slave;
 
-       slave = calloc(1, sizeof(*slave));
-       if (!slave) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return NULL;
-       }
+    slave = calloc(1, sizeof(*slave));
+    if (!slave) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
 
-       slave->name = strdup(name);
-       if (!slave->name) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(slave);
-               return NULL;
-       }
+    slave->name = strdup(name);
+    if (!slave->name) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(slave);
+       return NULL;
+    }
 
-       slave->abi = strdup(abi);
-       if (!slave->abi) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(slave->name);
-               DbgFree(slave);
-               return NULL;
-       }
+    slave->abi = strdup(abi);
+    if (!slave->abi) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(slave->name);
+       DbgFree(slave);
+       return NULL;
+    }
 
-       slave->pkgname = strdup(pkgname);
-       if (!slave->pkgname) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(slave->abi);
-               DbgFree(slave->name);
-               DbgFree(slave);
-               return NULL;
-       }
+    slave->pkgname = strdup(pkgname);
+    if (!slave->pkgname) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(slave->abi);
+       DbgFree(slave->name);
+       DbgFree(slave);
+       return NULL;
+    }
 
-       slave->secured = is_secured;
-       slave->pid = (pid_t)-1;
-       slave->state = SLAVE_TERMINATED;
-       slave->network = network;
-       slave->relaunch_count = SLAVE_RELAUNCH_COUNT;
+    slave->secured = is_secured;
+    slave->pid = (pid_t)-1;
+    slave->state = SLAVE_TERMINATED;
+    slave->network = network;
+    slave->relaunch_count = DYNAMICBOX_CONF_SLAVE_RELAUNCH_COUNT;
 
-       xmonitor_add_event_callback(XMONITOR_PAUSED, xmonitor_pause_cb, slave);
-       xmonitor_add_event_callback(XMONITOR_RESUMED, xmonitor_resume_cb, slave);
+    xmonitor_add_event_callback(XMONITOR_PAUSED, xmonitor_pause_cb, slave);
+    xmonitor_add_event_callback(XMONITOR_RESUMED, xmonitor_resume_cb, slave);
 
-       s_info.slave_list = eina_list_append(s_info.slave_list, slave);
-       return slave;
+    s_info.slave_list = eina_list_append(s_info.slave_list, slave);
+    return slave;
 }
 
 static inline void invoke_delete_cb(struct slave_node *slave)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct event *event;
+    Eina_List *l;
+    Eina_List *n;
+    struct event *event;
 
-       slave->in_event_process |= SLAVE_EVENT_PROCESS_DELETE;
-       EINA_LIST_FOREACH_SAFE(slave->event_delete_list, l, n, event) {
-               if (event->deleted || event->evt_cb(event->slave, event->cbdata) < 0 || event->deleted) {
-                       slave->event_delete_list = eina_list_remove(slave->event_delete_list, event);
-                       DbgFree(event);
-               }
+    slave->in_event_process |= SLAVE_EVENT_PROCESS_DELETE;
+    EINA_LIST_FOREACH_SAFE(slave->event_delete_list, l, n, event) {
+       if (event->deleted || event->evt_cb(event->slave, event->cbdata) < 0 || event->deleted) {
+           slave->event_delete_list = eina_list_remove(slave->event_delete_list, event);
+           DbgFree(event);
        }
-       slave->in_event_process &= ~SLAVE_EVENT_PROCESS_DELETE;
+    }
+    slave->in_event_process &= ~SLAVE_EVENT_PROCESS_DELETE;
 }
 
 static inline void destroy_slave_node(struct slave_node *slave)
 {
-       struct event *event;
-       struct priv_data *priv;
+    struct event *event;
+    struct priv_data *priv;
 
-       if (slave_pid(slave) != (pid_t)-1) {
-               ErrPrint("Slave is not deactivated\n");
-               return;
-       }
+    if (slave_pid(slave) != (pid_t)-1) {
+       ErrPrint("Slave is not deactivated\n");
+       return;
+    }
 
-       xmonitor_del_event_callback(XMONITOR_PAUSED, xmonitor_pause_cb, slave);
-       xmonitor_del_event_callback(XMONITOR_RESUMED, xmonitor_resume_cb, slave);
+    xmonitor_del_event_callback(XMONITOR_PAUSED, xmonitor_pause_cb, slave);
+    xmonitor_del_event_callback(XMONITOR_RESUMED, xmonitor_resume_cb, slave);
 
-       invoke_delete_cb(slave);
-       slave_rpc_fini(slave); /*!< Finalize the RPC after handling all delete callbacks */
+    invoke_delete_cb(slave);
+    slave_rpc_fini(slave); /*!< Finalize the RPC after handling all delete callbacks */
 
-       EINA_LIST_FREE(slave->event_delete_list, event) {
-               DbgFree(event);
-       }
+    EINA_LIST_FREE(slave->event_delete_list, event) {
+       DbgFree(event);
+    }
 
-       EINA_LIST_FREE(slave->event_activate_list, event) {
-               DbgFree(event);
-       }
+    EINA_LIST_FREE(slave->event_activate_list, event) {
+       DbgFree(event);
+    }
 
-       EINA_LIST_FREE(slave->event_deactivate_list, event) {
-               DbgFree(event);
-       }
+    EINA_LIST_FREE(slave->event_deactivate_list, event) {
+       DbgFree(event);
+    }
 
-       EINA_LIST_FREE(slave->event_fault_list, event) {
-               DbgFree(event);
-       }
+    EINA_LIST_FREE(slave->event_fault_list, event) {
+       DbgFree(event);
+    }
 
-       EINA_LIST_FREE(slave->data_list, priv) {
-               DbgFree(priv->tag);
-               DbgFree(priv);
-       }
+    EINA_LIST_FREE(slave->data_list, priv) {
+       DbgFree(priv->tag);
+       DbgFree(priv);
+    }
 
-       s_info.slave_list = eina_list_remove(s_info.slave_list, slave);
+    s_info.slave_list = eina_list_remove(s_info.slave_list, slave);
 
-       if (slave->ttl_timer) {
-               ecore_timer_del(slave->ttl_timer);
-       }
+    if (slave->ttl_timer) {
+       ecore_timer_del(slave->ttl_timer);
+    }
 
-       if (slave->activate_timer) {
-               ecore_timer_del(slave->activate_timer);
-       }
+    if (slave->activate_timer) {
+       ecore_timer_del(slave->activate_timer);
+    }
 
-       if (slave->relaunch_timer) {
-               ecore_timer_del(slave->relaunch_timer);
-       }
+    if (slave->relaunch_timer) {
+       ecore_timer_del(slave->relaunch_timer);
+    }
 
-       DbgFree(slave->abi);
-       DbgFree(slave->name);
-       DbgFree(slave->pkgname);
-       DbgFree(slave);
-       return;
+    DbgFree(slave->abi);
+    DbgFree(slave->name);
+    DbgFree(slave->pkgname);
+    DbgFree(slave);
+    return;
 }
 
 static inline struct slave_node *find_slave(const char *name)
 {
-       struct slave_node *slave;
-       Eina_List *l;
+    struct slave_node *slave;
+    Eina_List *l;
 
-       EINA_LIST_FOREACH(s_info.slave_list, l, slave) {
-               if (!strcmp(slave->name, name)) {
-                       return slave;
-               }
+    EINA_LIST_FOREACH(s_info.slave_list, l, slave) {
+       if (!strcmp(slave->name, name)) {
+           return slave;
        }
-       
-       return NULL;
+    }
+
+    return NULL;
 }
 
 HAPI int slave_expired_ttl(struct slave_node *slave)
 {
-       if (!slave) {
-               return 0;
-       }
+    if (!slave) {
+       return 0;
+    }
 
-       if (!slave->secured) {
-               return 0;
-       }
+    if (!slave->secured) {
+       return 0;
+    }
 
-       return !!slave->ttl_timer;
+    return !!slave->ttl_timer;
 }
 
 HAPI struct slave_node *slave_ref(struct slave_node *slave)
 {
-       if (!slave) {
-               return NULL;
-       }
+    if (!slave) {
+       return NULL;
+    }
 
-       slave->refcnt++;
-       return slave;
+    slave->refcnt++;
+    return slave;
 }
 
 HAPI struct slave_node *slave_unref(struct slave_node *slave)
 {
-       if (!slave) {
-               return NULL;
-       }
+    if (!slave) {
+       return NULL;
+    }
 
-       if (slave->refcnt == 0) {
-               ErrPrint("Slave refcnt is not valid\n");
-               return NULL;
-       }
+    if (slave->refcnt == 0) {
+       ErrPrint("Slave refcnt is not valid\n");
+       return NULL;
+    }
 
-       slave->refcnt--;
-       if (slave->refcnt == 0) {
-               destroy_slave_node(slave);
-               slave = NULL;
-       }
+    slave->refcnt--;
+    if (slave->refcnt == 0) {
+       destroy_slave_node(slave);
+       slave = NULL;
+    }
 
-       return slave;
+    return slave;
 }
 
 HAPI const int const slave_refcnt(struct slave_node *slave)
 {
-       return slave->refcnt;
+    return slave->refcnt;
 }
 
 HAPI struct slave_node *slave_create(const char *name, int is_secured, const char *abi, const char *pkgname, int network)
 {
-       struct slave_node *slave;
+    struct slave_node *slave;
 
-       slave = find_slave(name);
-       if (slave) {
-               if (slave->secured != is_secured) {
-                       ErrPrint("Exists slave and creating slave's security flag is not matched\n");
-               }
-               return slave;
+    slave = find_slave(name);
+    if (slave) {
+       if (slave->secured != is_secured) {
+           ErrPrint("Exists slave and creating slave's security flag is not matched\n");
        }
+       return slave;
+    }
 
-       slave = create_slave_node(name, is_secured, abi, pkgname, network);
-       if (!slave) {
-               return NULL;
-       }
+    slave = create_slave_node(name, is_secured, abi, pkgname, network);
+    if (!slave) {
+       return NULL;
+    }
 
-       slave_ref(slave);
-       slave_rpc_init(slave);
+    slave_ref(slave);
+    slave_rpc_init(slave);
 
-       return slave;
+    return slave;
 }
 
 /*!
@@ -368,1350 +374,1444 @@ HAPI struct slave_node *slave_create(const char *name, int is_secured, const cha
  */
 HAPI void slave_destroy(struct slave_node *slave)
 {
-       slave_unref(slave);
+    slave_unref(slave);
 }
 
 static inline void invoke_fault_cb(struct slave_node *slave)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct event *event;
+    Eina_List *l;
+    Eina_List *n;
+    struct event *event;
 
-       slave->in_event_process |= SLAVE_EVENT_PROCESS_FAULT;
-       EINA_LIST_FOREACH_SAFE(slave->event_fault_list, l, n, event) {
-               if (event->deleted || event->evt_cb(event->slave, event->cbdata) < 0 || event->deleted) {
-                       slave->event_fault_list = eina_list_remove(slave->event_fault_list, event);
-                       DbgFree(event);
-               }
+    slave->in_event_process |= SLAVE_EVENT_PROCESS_FAULT;
+    EINA_LIST_FOREACH_SAFE(slave->event_fault_list, l, n, event) {
+       if (event->deleted || event->evt_cb(event->slave, event->cbdata) < 0 || event->deleted) {
+           slave->event_fault_list = eina_list_remove(slave->event_fault_list, event);
+           DbgFree(event);
        }
-       slave->in_event_process &= ~SLAVE_EVENT_PROCESS_FAULT;
+    }
+    slave->in_event_process &= ~SLAVE_EVENT_PROCESS_FAULT;
 }
 
 static inline void invoke_activate_cb(struct slave_node *slave)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct event *event;
+    Eina_List *l;
+    Eina_List *n;
+    struct event *event;
 
-       slave->in_event_process |= SLAVE_EVENT_PROCESS_ACTIVATE;
-       EINA_LIST_FOREACH_SAFE(slave->event_activate_list, l, n, event) {
-               if (event->deleted || event->evt_cb(event->slave, event->cbdata) < 0 || event->deleted) {
-                       slave->event_activate_list = eina_list_remove(slave->event_activate_list, event);
-                       DbgFree(event);
-               }
+    slave->in_event_process |= SLAVE_EVENT_PROCESS_ACTIVATE;
+    EINA_LIST_FOREACH_SAFE(slave->event_activate_list, l, n, event) {
+       if (event->deleted || event->evt_cb(event->slave, event->cbdata) < 0 || event->deleted) {
+           slave->event_activate_list = eina_list_remove(slave->event_activate_list, event);
+           DbgFree(event);
        }
-       slave->in_event_process &= ~SLAVE_EVENT_PROCESS_ACTIVATE;
+    }
+    slave->in_event_process &= ~SLAVE_EVENT_PROCESS_ACTIVATE;
 }
 
 static Eina_Bool activate_timer_cb(void *data)
 {
-       struct slave_node *slave = data;
+    struct slave_node *slave = data;
 
-       if (slave->relaunch_timer) {
-               ecore_timer_del(slave->relaunch_timer);
-               slave->relaunch_timer = NULL;
-       }
+    if (slave->relaunch_timer) {
+       ecore_timer_del(slave->relaunch_timer);
+       slave->relaunch_timer = NULL;
+    }
 
-       slave->fault_count++;
-       invoke_fault_cb(slave);
+    slave->fault_count++;
+    invoke_fault_cb(slave);
 
-       slave_set_reactivation(slave, 0);
-       slave_set_reactivate_instances(slave, 0);
+    slave_set_reactivation(slave, 0);
+    slave_set_reactivate_instances(slave, 0);
 
-       slave->activate_timer = NULL;
-       if (slave_pid(slave) > 0) {
-               int ret;
-               DbgPrint("Try to terminate PID: %d\n", slave_pid(slave));
-               ret = aul_terminate_pid(slave_pid(slave));
-               if (ret < 0) {
-                       ErrPrint("Terminate failed, pid %d (reason: %d)\n", slave_pid(slave), ret);
-               }
+    slave->activate_timer = NULL;
+    if (slave_pid(slave) > 0) {
+       int ret;
+       DbgPrint("Try to terminate PID: %d\n", slave_pid(slave));
+       ret = aul_terminate_pid(slave_pid(slave));
+       if (ret < 0) {
+           ErrPrint("Terminate failed, pid %d (reason: %d)\n", slave_pid(slave), ret);
        }
+    }
 
-       CRITICAL_LOG("Slave is not activated in %lf sec (slave: %s)\n", SLAVE_ACTIVATE_TIME, slave_name(slave));
-       slave = slave_deactivated(slave);
-       return ECORE_CALLBACK_CANCEL;
+    CRITICAL_LOG("Slave is not activated in %lf sec (slave: %s)\n", DYNAMICBOX_CONF_SLAVE_ACTIVATE_TIME, slave_name(slave));
+    slave = slave_deactivated(slave);
+    return ECORE_CALLBACK_CANCEL;
 }
 
 static inline void invoke_slave_fault_handler(struct slave_node *slave)
 {
-       slave->fault_count++;
-       invoke_fault_cb(slave);
+    slave->fault_count++;
+    invoke_fault_cb(slave);
 
-       slave_set_reactivation(slave, 0);
-       slave_set_reactivate_instances(slave, 0);
+    slave_set_reactivation(slave, 0);
+    slave_set_reactivate_instances(slave, 0);
 
-       if (slave_pid(slave) > 0) {
-               if ((slave->ctrl_option & PROVIDER_CTRL_MANUAL_TERMINATION) == PROVIDER_CTRL_MANUAL_TERMINATION) {
-                       DbgPrint("Manual termination is turned on\n");
-                       (void)slave_rpc_disconnect(slave);
-               } else {
-                       int ret;
-                       DbgPrint("Try to terminate PID: %d\n", slave_pid(slave));
-                       ret = aul_terminate_pid(slave_pid(slave));
-                       if (ret < 0) {
-                               ErrPrint("Terminate failed, pid %d (reason: %d)\n", slave_pid(slave), ret);
-                       }
-               }
+    if (slave_pid(slave) > 0) {
+       if ((slave->ctrl_option & PROVIDER_CTRL_MANUAL_TERMINATION) == PROVIDER_CTRL_MANUAL_TERMINATION) {
+           DbgPrint("Manual termination is turned on\n");
+           (void)slave_rpc_disconnect(slave);
+       } else {
+           int ret;
+           DbgPrint("Try to terminate PID: %d\n", slave_pid(slave));
+           ret = aul_terminate_pid(slave_pid(slave));
+           if (ret < 0) {
+               ErrPrint("Terminate failed, pid %d (reason: %d)\n", slave_pid(slave), ret);
+           }
        }
+    }
 
-       slave->state = SLAVE_TERMINATED;
+    slave->state = SLAVE_TERMINATED;
 }
 
 static Eina_Bool relaunch_timer_cb(void *data)
 {
-       struct slave_node *slave = data;
-       int ret = ECORE_CALLBACK_CANCEL;
-
-       if (!slave->activate_timer) {
-               ErrPrint("Activate timer is not valid\n");
-               slave->relaunch_timer = NULL;
-
-               invoke_slave_fault_handler(slave);
-       } else if (!slave->relaunch_count) {
-               ErrPrint("Relaunch count is exhahausted\n");
-               ecore_timer_del(slave->activate_timer);
-               slave->activate_timer = NULL;
+    struct slave_node *slave = data;
+    int ret = ECORE_CALLBACK_CANCEL;
 
-               slave->relaunch_timer = NULL;
-               invoke_slave_fault_handler(slave);
-       } else {
-               bundle *param;
+    if (!slave->activate_timer) {
+       ErrPrint("Activate timer is not valid\n");
+       slave->relaunch_timer = NULL;
 
-               param = bundle_create();
-               if (!param) {
-                       ErrPrint("Failed to create a bundle\n");
+       invoke_slave_fault_handler(slave);
+    } else if (!slave->relaunch_count) {
+       ErrPrint("Relaunch count is exhahausted\n");
+       ecore_timer_del(slave->activate_timer);
+       slave->activate_timer = NULL;
 
-                       ecore_timer_del(slave->activate_timer);
-                       slave->activate_timer = NULL;
+       slave->relaunch_timer = NULL;
+       invoke_slave_fault_handler(slave);
+    } else {
+       bundle *param;
 
-                       slave->relaunch_timer = NULL;
+       param = bundle_create();
+       if (!param) {
+           ErrPrint("Failed to create a bundle\n");
 
-                       invoke_slave_fault_handler(slave);
-               } else {
-                       bundle_add(param, BUNDLE_SLAVE_NAME, slave_name(slave));
-                       bundle_add(param, BUNDLE_SLAVE_SECURED, slave->secured ? "true" : "false");
-                       bundle_add(param, BUNDLE_SLAVE_ABI, slave->abi);
+           ecore_timer_del(slave->activate_timer);
+           slave->activate_timer = NULL;
 
-                       slave->pid = (pid_t)aul_launch_app(slave_pkgname(slave), param);
+           slave->relaunch_timer = NULL;
 
-                       bundle_free(param);
+           invoke_slave_fault_handler(slave);
+       } else {
+           bundle_add(param, BUNDLE_SLAVE_SVC_OP_TYPE, APP_CONTROL_OPERATION_MAIN);
+           bundle_add(param, DYNAMICBOX_CONF_BUNDLE_SLAVE_NAME, slave_name(slave));
+           bundle_add(param, DYNAMICBOX_CONF_BUNDLE_SLAVE_SECURED, slave->secured ? "true" : "false");
+           bundle_add(param, DYNAMICBOX_CONF_BUNDLE_SLAVE_ABI, slave->abi);
+
+           slave->pid = (pid_t)aul_launch_app(slave_pkgname(slave), param);
+
+           bundle_free(param);
+
+           switch (slave->pid) {
+           case AUL_R_EHIDDENFORGUEST: /**< App hidden for guest mode */
+           case AUL_R_ENOLAUNCHPAD:    /**< no launchpad */
+           case AUL_R_EILLACC:         /**< Illegal Access */
+           case AUL_R_EINVAL:          /**< Invalid argument */
+           case AUL_R_ENOINIT:         /**< AUL handler NOT initialized */
+           case AUL_R_ERROR:           /**< General error */
+               CRITICAL_LOG("Failed to launch a new slave %s (%d)\n", slave_name(slave), slave->pid);
+               slave->pid = (pid_t)-1;
+               ecore_timer_del(slave->activate_timer);
+               slave->activate_timer = NULL;
 
-                       switch (slave->pid) {
-#if defined(WEARABLE)
-                       case AUL_R_EHIDDENFORGUEST:     /**< App hidden for guest mode */
-#endif
-                       case AUL_R_ENOLAUNCHPAD:        /**< no launchpad */
-                       case AUL_R_EILLACC:             /**< Illegal Access */
-                       case AUL_R_EINVAL:              /**< Invalid argument */
-                       case AUL_R_ENOINIT:             /**< AUL handler NOT initialized */
-                       case AUL_R_ERROR:               /**< General error */
-                               CRITICAL_LOG("Failed to launch a new slave %s (%d)\n", slave_name(slave), slave->pid);
-                               slave->pid = (pid_t)-1;
-                               ecore_timer_del(slave->activate_timer);
-                               slave->activate_timer = NULL;
-
-                               slave->relaunch_timer = NULL;
-
-                               invoke_slave_fault_handler(slave);
-                               /* Waiting app-launch result */
-                               break;
-                       case AUL_R_ETIMEOUT:            /**< Timeout */
-                       case AUL_R_ECOMM:               /**< Comunication Error */
-                       case AUL_R_ETERMINATING:        /**< application terminating */
-                       case AUL_R_ECANCELED:           /**< Operation canceled */
-                               slave->relaunch_count--;
-
-                               CRITICAL_LOG("Try relaunch again %s (%d), %d\n", slave_name(slave), slave->pid, slave->relaunch_count);
-                               slave->pid = (pid_t)-1;
-                               ret = ECORE_CALLBACK_RENEW;
-                               ecore_timer_reset(slave->activate_timer);
-                               /* Try again after a few secs later */
-                               break;
-                       case AUL_R_LOCAL:               /**< Launch by himself */
-                       case AUL_R_OK:                  /**< General success */
-                       default:
-                               DbgPrint("Slave %s is launched with %d as %s\n", slave_pkgname(slave), slave->pid, slave_name(slave));
-                               slave->relaunch_timer = NULL;
-                               ecore_timer_reset(slave->activate_timer);
-                               break;
-                       }
-               }
+               slave->relaunch_timer = NULL;
 
+               invoke_slave_fault_handler(slave);
+               /* Waiting app-launch result */
+               break;
+           case AUL_R_ETIMEOUT:                /**< Timeout */
+           case AUL_R_ECOMM:           /**< Comunication Error */
+           case AUL_R_ETERMINATING:    /**< application terminating */
+           case AUL_R_ECANCELED:               /**< Operation canceled */
+               slave->relaunch_count--;
+
+               CRITICAL_LOG("Try relaunch again %s (%d), %d\n", slave_name(slave), slave->pid, slave->relaunch_count);
+               slave->pid = (pid_t)-1;
+               ret = ECORE_CALLBACK_RENEW;
+               ecore_timer_reset(slave->activate_timer);
+               /* Try again after a few secs later */
+               break;
+           case AUL_R_LOCAL:           /**< Launch by himself */
+           case AUL_R_OK:                      /**< General success */
+           default:
+               DbgPrint("Slave %s is launched with %d as %s\n", slave_pkgname(slave), slave->pid, slave_name(slave));
+               slave->relaunch_timer = NULL;
+               ecore_timer_reset(slave->activate_timer);
+               break;
+           }
        }
 
-       return ret;
+    }
+
+    return ret;
 }
 
 HAPI int slave_activate(struct slave_node *slave)
 {
-       /*!
-        * \note
-        * This check code can be replaced with the slave->state check code
-        * If the slave data has the PID, it means, it is activated
-        * Even if it is in the termiating sequence, it will have the PID
-        * before terminated at last.
-        * So we can use this simple code for checking the slave's last state.
-        * about it is alive? or not.
-        */
-       if (slave_pid(slave) != (pid_t)-1) {
-               if (slave->terminate_timer) {
-                       DbgPrint("Clear terminate timer. to reuse (%d)\n", slave->pid);
-                       ecore_timer_del(slave->terminate_timer);
-                       slave->terminate_timer = NULL;
-               } else if (slave_state(slave) == SLAVE_REQUEST_TO_TERMINATE || slave_state(slave) == SLAVE_REQUEST_TO_DISCONNECT) {
-                       slave_set_reactivation(slave, 1);
-               }
-               return LB_STATUS_ERROR_ALREADY;
-       } else if (slave_state(slave) == SLAVE_REQUEST_TO_LAUNCH) {
-               DbgPrint("Slave is already launched: but the AUL is timed out\n");
-               return LB_STATUS_ERROR_ALREADY;
+    /**
+     * @todo
+     * If a slave is deactivated by OOM killer,
+     * We should not activate it again from here.
+     * Instead of this, it should be reactivated by user event or oom event(normal)
+     */
+
+    /**
+     * @note
+     * This check code can be replaced with the slave->state check code
+     * If the slave data has the PID, it means, it is activated
+     * Even if it is in the termiating sequence, it will have the PID
+     * until it is terminated at last.
+     * So we can use this simple code for checking the slave's last state.
+     * whether it is alive or not.
+     */
+    if (slave_pid(slave) != (pid_t)-1) {
+       if (slave->terminate_timer) {
+           DbgPrint("Clear terminate timer. to reuse (%d)\n", slave->pid);
+           ecore_timer_del(slave->terminate_timer);
+           slave->terminate_timer = NULL;
+       } else if (slave_state(slave) == SLAVE_REQUEST_TO_TERMINATE || slave_state(slave) == SLAVE_REQUEST_TO_DISCONNECT) {
+           slave_set_reactivation(slave, 1);
+       }
+       return DBOX_STATUS_ERROR_ALREADY;
+    } else if (slave_state(slave) == SLAVE_REQUEST_TO_LAUNCH) {
+       DbgPrint("Slave is already launched: but the AUL is timed out\n");
+       return DBOX_STATUS_ERROR_ALREADY;
+    }
+
+    if (DYNAMICBOX_CONF_DEBUG_MODE || g_conf.debug_mode) {
+       DbgPrint("Debug Mode enabled. name[%s] secured[%d] abi[%s]\n", slave_name(slave), slave->secured, slave->abi);
+    } else {
+       bundle *param;
+
+       slave->relaunch_count = DYNAMICBOX_CONF_SLAVE_RELAUNCH_COUNT;
+
+       param = bundle_create();
+       if (!param) {
+           ErrPrint("Failed to create a bundle\n");
+           return DBOX_STATUS_ERROR_FAULT;
+       }
+
+       bundle_add(param, BUNDLE_SLAVE_SVC_OP_TYPE, APP_CONTROL_OPERATION_MAIN);
+       bundle_add(param, DYNAMICBOX_CONF_BUNDLE_SLAVE_NAME, slave_name(slave));
+       bundle_add(param, DYNAMICBOX_CONF_BUNDLE_SLAVE_SECURED, slave->secured ? "true" : "false");
+       bundle_add(param, DYNAMICBOX_CONF_BUNDLE_SLAVE_ABI, slave->abi);
+
+       slave->pid = (pid_t)aul_launch_app(slave_pkgname(slave), param);
+
+       bundle_free(param);
+
+       switch (slave->pid) {
+       case AUL_R_EHIDDENFORGUEST:     /**< App hidden for guest mode */
+       case AUL_R_ENOLAUNCHPAD:        /**< no launchpad */
+       case AUL_R_EILLACC:             /**< Illegal Access */
+       case AUL_R_EINVAL:              /**< Invalid argument */
+       case AUL_R_ENOINIT:             /**< AUL handler NOT initialized */
+       case AUL_R_ERROR:               /**< General error */
+           CRITICAL_LOG("Failed to launch a new slave %s (%d)\n", slave_name(slave), slave->pid);
+           slave->pid = (pid_t)-1;
+           /* Waiting app-launch result */
+           break;
+       case AUL_R_ECOMM:               /**< Comunication Error */
+       case AUL_R_ETERMINATING:        /**< application terminating */
+       case AUL_R_ECANCELED:           /**< Operation canceled */
+       case AUL_R_ETIMEOUT:            /**< Timeout */
+           CRITICAL_LOG("Try relaunch this soon %s (%d)\n", slave_name(slave), slave->pid);
+           slave->relaunch_timer = ecore_timer_add(DYNAMICBOX_CONF_SLAVE_RELAUNCH_TIME, relaunch_timer_cb, slave);
+           if (!slave->relaunch_timer) {
+               CRITICAL_LOG("Failed to register a relaunch timer (%s)\n", slave_name(slave));
+               slave->pid = (pid_t)-1;
+               return DBOX_STATUS_ERROR_FAULT;
+           }
+           /* Try again after a few secs later */
+           break;
+       case AUL_R_LOCAL:               /**< Launch by himself */
+       case AUL_R_OK:                  /**< General success */
+       default:
+           DbgPrint("Slave %s is launched with %d as %s\n", slave_pkgname(slave), slave->pid, slave_name(slave));
+           break;
        }
 
-       if (DEBUG_MODE) {
-               DbgPrint("Debug Mode enabled. name[%s] secured[%d] abi[%s]\n", slave_name(slave), slave->secured, slave->abi);
-       } else {
-               bundle *param;
-
-               slave->relaunch_count = SLAVE_RELAUNCH_COUNT;
-
-               param = bundle_create();
-               if (!param) {
-                       ErrPrint("Failed to create a bundle\n");
-                       return LB_STATUS_ERROR_FAULT;
-               }
-
-               bundle_add(param, BUNDLE_SLAVE_NAME, slave_name(slave));
-               bundle_add(param, BUNDLE_SLAVE_SECURED, slave->secured ? "true" : "false");
-               bundle_add(param, BUNDLE_SLAVE_ABI, slave->abi);
-
-               slave->pid = (pid_t)aul_launch_app(slave_pkgname(slave), param);
-
-               bundle_free(param);
-
-               switch (slave->pid) {
-#if defined(WEARABLE)
-               case AUL_R_EHIDDENFORGUEST:     /**< App hidden for guest mode */
-#endif
-               case AUL_R_ENOLAUNCHPAD:        /**< no launchpad */
-               case AUL_R_EILLACC:             /**< Illegal Access */
-               case AUL_R_EINVAL:              /**< Invalid argument */
-               case AUL_R_ENOINIT:             /**< AUL handler NOT initialized */
-               case AUL_R_ERROR:               /**< General error */
-                       CRITICAL_LOG("Failed to launch a new slave %s (%d)\n", slave_name(slave), slave->pid);
-                       slave->pid = (pid_t)-1;
-                       /* Waiting app-launch result */
-                       break;
-               case AUL_R_ECOMM:               /**< Comunication Error */
-               case AUL_R_ETERMINATING:        /**< application terminating */
-               case AUL_R_ECANCELED:           /**< Operation canceled */
-               case AUL_R_ETIMEOUT:            /**< Timeout */
-                       CRITICAL_LOG("Try relaunch this soon %s (%d)\n", slave_name(slave), slave->pid);
-                       slave->relaunch_timer = ecore_timer_add(SLAVE_RELAUNCH_TIME, relaunch_timer_cb, slave);
-                       if (!slave->relaunch_timer) {
-                               CRITICAL_LOG("Failed to register a relaunch timer (%s)\n", slave_name(slave));
-                               slave->pid = (pid_t)-1;
-                               return LB_STATUS_ERROR_FAULT;
-                       }
-                       /* Try again after a few secs later */
-                       break;
-               case AUL_R_LOCAL:               /**< Launch by himself */
-               case AUL_R_OK:                  /**< General success */
-               default:
-                       DbgPrint("Slave %s is launched with %d as %s\n", slave_pkgname(slave), slave->pid, slave_name(slave));
-                       break;
-               }
-
-               slave->activate_timer = ecore_timer_add(SLAVE_ACTIVATE_TIME, activate_timer_cb, slave);
-               if (!slave->activate_timer) {
-                       ErrPrint("Failed to register an activate timer\n");
-               }
+       slave->activate_timer = ecore_timer_add(DYNAMICBOX_CONF_SLAVE_ACTIVATE_TIME, activate_timer_cb, slave);
+       if (!slave->activate_timer) {
+           ErrPrint("Failed to register an activate timer\n");
        }
+    }
 
-       slave->state = SLAVE_REQUEST_TO_LAUNCH;
-       /*!
-        * \note
-        * Increase the refcnt of a slave,
-        * To prevent from making an orphan(slave).
-        */
-       (void)slave_ref(slave);
+    slave->state = SLAVE_REQUEST_TO_LAUNCH;
+    /*!
+     * \note
+     * Increase the refcnt of a slave,
+     * To prevent from making an orphan(slave).
+     */
+    (void)slave_ref(slave);
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int slave_give_more_ttl(struct slave_node *slave)
 {
-       double delay;
+    double delay;
 
-       if (!slave->secured || !slave->ttl_timer) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!slave->secured || !slave->ttl_timer) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       delay = SLAVE_TTL - ecore_timer_pending_get(slave->ttl_timer);
-       ecore_timer_delay(slave->ttl_timer, delay);
-       return LB_STATUS_SUCCESS;
+    delay = DYNAMICBOX_CONF_SLAVE_TTL - ecore_timer_pending_get(slave->ttl_timer);
+    ecore_timer_delay(slave->ttl_timer, delay);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int slave_freeze_ttl(struct slave_node *slave)
 {
-       if (!slave->secured || !slave->ttl_timer) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!slave->secured || !slave->ttl_timer) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       ecore_timer_freeze(slave->ttl_timer);
-       return LB_STATUS_SUCCESS;
+    ecore_timer_freeze(slave->ttl_timer);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int slave_thaw_ttl(struct slave_node *slave)
 {
-       double delay;
+    double delay;
 
-       if (!slave->secured || !slave->ttl_timer) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!slave->secured || !slave->ttl_timer) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       ecore_timer_thaw(slave->ttl_timer);
+    ecore_timer_thaw(slave->ttl_timer);
 
-       delay = SLAVE_TTL - ecore_timer_pending_get(slave->ttl_timer);
-       ecore_timer_delay(slave->ttl_timer, delay);
-       return LB_STATUS_SUCCESS;
+    delay = DYNAMICBOX_CONF_SLAVE_TTL - ecore_timer_pending_get(slave->ttl_timer);
+    ecore_timer_delay(slave->ttl_timer, delay);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int slave_activated(struct slave_node *slave)
 {
-       slave->state = SLAVE_RESUMED;
+    slave->state = SLAVE_RESUMED;
 
-       if (xmonitor_is_paused()) {
-               slave_pause(slave);
-       }
+    if (xmonitor_is_paused()) {
+       slave_pause(slave);
+    }
 
-       if (slave->secured == 1 && SLAVE_TTL > 0.0f) {
-               DbgPrint("Slave deactivation timer is added (%s - %lf)\n", slave_name(slave), SLAVE_TTL);
-               slave->ttl_timer = ecore_timer_add(SLAVE_TTL, slave_ttl_cb, slave);
-               if (!slave->ttl_timer) {
-                       ErrPrint("Failed to create a TTL timer\n");
-               }
+    if (slave->secured == 1 && DYNAMICBOX_CONF_SLAVE_TTL > 0.0f) {
+       DbgPrint("Slave deactivation timer is added (%s - %lf)\n", slave_name(slave), DYNAMICBOX_CONF_SLAVE_TTL);
+       slave->ttl_timer = ecore_timer_add(DYNAMICBOX_CONF_SLAVE_TTL, slave_ttl_cb, slave);
+       if (!slave->ttl_timer) {
+           ErrPrint("Failed to create a TTL timer\n");
        }
+    }
 
-       invoke_activate_cb(slave);
+    invoke_activate_cb(slave);
 
-       slave_set_reactivation(slave, 0);
-       slave_set_reactivate_instances(slave, 0);
+    slave_set_reactivation(slave, 0);
+    slave_set_reactivate_instances(slave, 0);
 
 #if defined(_USE_ECORE_TIME_GET)
-       slave->activated_at = ecore_time_get();
+    slave->activated_at = ecore_time_get();
 #else
-       if (gettimeofday(&slave->activated_at, NULL) < 0) {
-               ErrPrint("Failed to get time of day: %s\n", strerror(errno));
-               slave->activated_at.tv_sec = 0;
-               slave->activated_at.tv_usec = 0;
-       }
+    if (gettimeofday(&slave->activated_at, NULL) < 0) {
+       ErrPrint("Failed to get time of day: %s\n", strerror(errno));
+       slave->activated_at.tv_sec = 0;
+       slave->activated_at.tv_usec = 0;
+    }
 #endif
 
-       if (slave->activate_timer) {
-               ecore_timer_del(slave->activate_timer);
-               slave->activate_timer = NULL;
-       }
+    if (slave->activate_timer) {
+       ecore_timer_del(slave->activate_timer);
+       slave->activate_timer = NULL;
+    }
 
-       if (slave->relaunch_timer) {
-               ecore_timer_del(slave->relaunch_timer);
-               slave->relaunch_timer = NULL;
-       }
+    if (slave->relaunch_timer) {
+       ecore_timer_del(slave->relaunch_timer);
+       slave->relaunch_timer = NULL;
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static inline int invoke_deactivate_cb(struct slave_node *slave)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct event *event;
-       int ret;
-       int reactivate = 0;
+    Eina_List *l;
+    Eina_List *n;
+    struct event *event;
+    int ret;
+    int reactivate = 0;
 
-       slave->in_event_process |= SLAVE_EVENT_PROCESS_DEACTIVATE;
+    slave->in_event_process |= SLAVE_EVENT_PROCESS_DEACTIVATE;
 
-       EINA_LIST_FOREACH_SAFE(slave->event_deactivate_list, l, n, event) {
-               if (event->deleted) {
-                       slave->event_deactivate_list = eina_list_remove(slave->event_deactivate_list, event);
-                       DbgFree(event);
-                       continue;
-               }
+    EINA_LIST_FOREACH_SAFE(slave->event_deactivate_list, l, n, event) {
+       if (event->deleted) {
+           slave->event_deactivate_list = eina_list_remove(slave->event_deactivate_list, event);
+           DbgFree(event);
+           continue;
+       }
 
-               ret = event->evt_cb(event->slave, event->cbdata);
-               if (ret < 0 || event->deleted) {
-                       slave->event_deactivate_list = eina_list_remove(slave->event_deactivate_list, event);
-                       DbgFree(event);
-               }
+       ret = event->evt_cb(event->slave, event->cbdata);
+       if (ret < 0 || event->deleted) {
+           slave->event_deactivate_list = eina_list_remove(slave->event_deactivate_list, event);
+           DbgFree(event);
+       }
 
-               if (ret == SLAVE_NEED_TO_REACTIVATE) {
-                       reactivate++;
-               }
+       if (ret == SLAVE_NEED_TO_REACTIVATE) {
+           reactivate++;
        }
+    }
 
-       slave->in_event_process &= ~SLAVE_EVENT_PROCESS_DEACTIVATE;
+    slave->in_event_process &= ~SLAVE_EVENT_PROCESS_DEACTIVATE;
 
-       return reactivate;
+    return reactivate;
 }
 
 static Eina_Bool terminate_timer_cb(void *data)
 {
-       struct slave_node *slave = data;
-       int ret;
+    struct slave_node *slave = data;
+    int ret;
 
-       /*!
-        * \todo
-        * check the return value of the aul_terminate_pid
-        */
-       slave->state = SLAVE_REQUEST_TO_TERMINATE;
-       slave->terminate_timer = NULL;
+    /*!
+     * \todo
+     * check the return value of the aul_terminate_pid
+     */
+    slave->state = SLAVE_REQUEST_TO_TERMINATE;
+    slave->terminate_timer = NULL;
 
-       DbgPrint("Terminate slave: %d (%s)\n", slave_pid(slave), slave_name(slave));
-       ret = aul_terminate_pid(slave->pid);
-       if (ret < 0) {
-               ErrPrint("Terminate slave(%s) failed. pid %d (%d)\n", slave_name(slave), slave_pid(slave), ret);
-               slave = slave_deactivated(slave);
-               if (slave == NULL) {
-                       DbgPrint("Slave is deleted\n");
-               }
+    DbgPrint("Terminate slave: %d (%s)\n", slave_pid(slave), slave_name(slave));
+    ret = aul_terminate_pid(slave->pid);
+    if (ret < 0) {
+       ErrPrint("Terminate slave(%s) failed. pid %d (%d)\n", slave_name(slave), slave_pid(slave), ret);
+       slave = slave_deactivated(slave);
+       if (slave == NULL) {
+           DbgPrint("Slave is deleted\n");
        }
+    }
 
-       return ECORE_CALLBACK_CANCEL;
+    return ECORE_CALLBACK_CANCEL;
 }
 
 HAPI struct slave_node *slave_deactivate(struct slave_node *slave, int no_timer)
 {
-       int ret;
+    int ret;
 
-       if (!slave_is_activated(slave)) {
-               ErrPrint("Slave is already deactivated\n");
-               if (slave_loaded_instance(slave) == 0) {
-                       /*!
-                        * \note
-                        * If a slave has no more instances,
-                        * Destroy it
-                        */
-                       slave = slave_unref(slave);
-               }
-               return slave;
+    if (!slave_is_activated(slave)) {
+       ErrPrint("Slave is already deactivated\n");
+       if (slave_loaded_instance(slave) == 0) {
+           /*!
+            * \note
+            * If a slave has no more instances,
+            * Destroy it
+            */
+           slave = slave_unref(slave);
        }
+       return slave;
+    }
 
-       if (slave_pid(slave) <= 0) {
-               return slave;
-       }
+    if (slave_pid(slave) <= 0) {
+       return slave;
+    }
 
-       if ((slave->ctrl_option & PROVIDER_CTRL_MANUAL_TERMINATION) == PROVIDER_CTRL_MANUAL_TERMINATION) {
-               /*!
-                * \note
-                * In this case,
-                * The provider requests MANUAL TERMINATION control option.
-                * Master will not send terminate request in this case, the provider should be terminated by itself.
-                */
-               DbgPrint("Manual termination is turned on\n");
-               slave->state = SLAVE_REQUEST_TO_DISCONNECT;
-               (void)slave_rpc_disconnect(slave);
-       } else if (slave->terminate_timer) {
-               ErrPrint("Terminate timer is already fired (%d)\n", slave->pid);
-       } else if (!no_timer) {
-               DbgPrint("Fire the terminate timer: %d\n", slave->pid);
-               slave->terminate_timer = ecore_timer_add(SLAVE_ACTIVATE_TIME, terminate_timer_cb, slave);
-               if (!slave->terminate_timer) {
-                       /*!
-                        * \note
-                        * Normally, Call the terminate_timer_cb directly from here
-                        * But in this case. if the aul_terminate_pid failed, Call the slave_deactivated function directly.
-                        * Then the "slave" pointer can be changed. To trace it, Copy the body of terminate_timer_cb to here.
-                        */
-                       ErrPrint("Failed to add a new timer for terminating\n");
-                       DbgPrint("Terminate slave: %d (%s)\n", slave_pid(slave), slave_name(slave));
-                       /*!
-                        * \todo
-                        * check the return value of the aul_terminate_pid
-                        */
-                       slave->state = SLAVE_REQUEST_TO_TERMINATE;
-
-                       ret = aul_terminate_pid(slave->pid);
-                       if (ret < 0) {
-                               ErrPrint("Terminate slave(%s) failed. pid %d (%d)\n", slave_name(slave), slave_pid(slave), ret);
-                               slave = slave_deactivated(slave);
-                       }
-               }
-       } else {
-               /*!
-                * \todo
-                * check the return value of the aul_terminate_pid
-                */
-               slave->state = SLAVE_REQUEST_TO_TERMINATE;
+    if ((slave->ctrl_option & PROVIDER_CTRL_MANUAL_TERMINATION) == PROVIDER_CTRL_MANUAL_TERMINATION) {
+       /*!
+        * \note
+        * In this case,
+        * The provider requests MANUAL TERMINATION control option.
+        * Master will not send terminate request in this case, the provider should be terminated by itself.
+        */
+       DbgPrint("Manual termination is turned on\n");
+       slave->state = SLAVE_REQUEST_TO_DISCONNECT;
+       (void)slave_rpc_disconnect(slave);
+    } else if (slave->terminate_timer) {
+       ErrPrint("Terminate timer is already fired (%d)\n", slave->pid);
+    } else if (!no_timer && !slave->secured) {
+       DbgPrint("Fire the terminate timer: %d\n", slave->pid);
+       slave->terminate_timer = ecore_timer_add(DYNAMICBOX_CONF_SLAVE_ACTIVATE_TIME, terminate_timer_cb, slave);
+       if (!slave->terminate_timer) {
+           /*!
+            * \note
+            * Normally, Call the terminate_timer_cb directly from here
+            * But in this case. if the aul_terminate_pid failed, Call the slave_deactivated function directly.
+            * Then the "slave" pointer can be changed. To trace it, Copy the body of terminate_timer_cb to here.
+            */
+           ErrPrint("Failed to add a new timer for terminating\n");
+           DbgPrint("Terminate slave: %d (%s)\n", slave_pid(slave), slave_name(slave));
+           /*!
+            * \todo
+            * check the return value of the aul_terminate_pid
+            */
+           slave->state = SLAVE_REQUEST_TO_TERMINATE;
+
+           ret = aul_terminate_pid(slave->pid);
+           if (ret < 0) {
+               ErrPrint("Terminate slave(%s) failed. pid %d (%d)\n", slave_name(slave), slave_pid(slave), ret);
+               slave = slave_deactivated(slave);
+           }
+       }
+    } else {
+       /*!
+        * \todo
+        * check the return value of the aul_terminate_pid
+        */
+       slave->state = SLAVE_REQUEST_TO_TERMINATE;
 
-               DbgPrint("Terminate slave: %d (%s)\n", slave_pid(slave), slave_name(slave));
-               ret = aul_terminate_pid(slave->pid);
-               if (ret < 0) {
-                       ErrPrint("Terminate slave(%s) failed. pid %d (%d)\n", slave_name(slave), slave_pid(slave), ret);
-                       slave = slave_deactivated(slave);
-               }
+       DbgPrint("Terminate slave: %d (%s)\n", slave_pid(slave), slave_name(slave));
+       ret = aul_terminate_pid(slave->pid);
+       if (ret < 0) {
+           ErrPrint("Terminate slave(%s) failed. pid %d (%d)\n", slave_name(slave), slave_pid(slave), ret);
+           slave = slave_deactivated(slave);
        }
+    }
 
-       return slave;
+    return slave;
 }
 
 HAPI struct slave_node *slave_deactivated(struct slave_node *slave)
 {
-       int reactivate;
+    int reactivate;
 
-       slave->pid = (pid_t)-1;
-       slave->state = SLAVE_TERMINATED;
+    slave->pid = (pid_t)-1;
+    slave->state = SLAVE_TERMINATED;
 
-       if (slave->ttl_timer) {
-               ecore_timer_del(slave->ttl_timer);
-               slave->ttl_timer = NULL;
-       }
+    if (slave->ttl_timer) {
+       ecore_timer_del(slave->ttl_timer);
+       slave->ttl_timer = NULL;
+    }
 
-       if (slave->activate_timer) {
-               ecore_timer_del(slave->activate_timer);
-               slave->activate_timer = NULL;
-       }
+    if (slave->activate_timer) {
+       ecore_timer_del(slave->activate_timer);
+       slave->activate_timer = NULL;
+    }
 
-       if (slave->relaunch_timer) {
-               ecore_timer_del(slave->relaunch_timer);
-               slave->relaunch_timer = NULL;
-       }
+    if (slave->relaunch_timer) {
+       ecore_timer_del(slave->relaunch_timer);
+       slave->relaunch_timer = NULL;
+    }
 
-       if (slave->terminate_timer) {
-               ecore_timer_del(slave->terminate_timer);
-               slave->terminate_timer = NULL;
-       }
+    if (slave->terminate_timer) {
+       ecore_timer_del(slave->terminate_timer);
+       slave->terminate_timer = NULL;
+    }
 
-       reactivate = invoke_deactivate_cb(slave);
+    reactivate = invoke_deactivate_cb(slave);
 
-       slave = slave_unref(slave);
-       if (!slave) {
-               DbgPrint("SLAVE object is destroyed\n");
-               return slave;
-       }
+    slave = slave_unref(slave);
+    if (!slave) {
+       DbgPrint("SLAVE object is destroyed\n");
+       return slave;
+    }
 
-       if ((slave->ctrl_option & PROVIDER_CTRL_MANUAL_REACTIVATION) == PROVIDER_CTRL_MANUAL_REACTIVATION) {
-               /*!
-                * \note
-                * In this case, the provider(Slave) should be reactivated by itself or user.
-                * The master will not reactivate it automatically.
-                */
-               DbgPrint("Manual reactivate option is turned on\n");
-       } else if (reactivate && slave_need_to_reactivate(slave)) {
-               int ret;
-
-               DbgPrint("Need to reactivate a slave\n");
-               ret = slave_activate(slave);
-               if (ret < 0 && ret != LB_STATUS_ERROR_ALREADY) {
-                       ErrPrint("Failed to reactivate a slave\n");
-               }
-       } else if (slave_loaded_instance(slave) == 0) {
-               /*!
-                * \note
-                * If a slave has no more instances,
-                * Destroy it
-                */
-               slave = slave_unref(slave);
+    if ((slave->ctrl_option & PROVIDER_CTRL_MANUAL_REACTIVATION) == PROVIDER_CTRL_MANUAL_REACTIVATION) {
+       /*!
+        * \note
+        * In this case, the provider(Slave) should be reactivated by itself or user.
+        * The master will not reactivate it automatically.
+        */
+       DbgPrint("Manual reactivate option is turned on\n");
+    } else if (reactivate && slave_need_to_reactivate(slave) && setting_oom_level() == OOM_TYPE_NORMAL) {
+       int ret;
+
+       DbgPrint("Need to reactivate a slave\n");
+       ret = slave_activate(slave);
+       if (ret < 0 && ret != DBOX_STATUS_ERROR_ALREADY) {
+           ErrPrint("Failed to reactivate a slave\n");
        }
+    } else if (slave_loaded_instance(slave) == 0) {
+       /*!
+        * \note
+        * If a slave has no more instances,
+        * Destroy it
+        */
+       slave = slave_unref(slave);
+    }
 
-       return slave;
+    return slave;
 }
 
 HAPI struct slave_node *slave_deactivated_by_fault(struct slave_node *slave)
 {
-       int ret;
-       int reactivate = 1;
-       int reactivate_instances = 1;
+    int ret;
+    int reactivate = 1;
+    int reactivate_instances = 1;
+    int max_load;
 
-       if (!slave_is_activated(slave)) {
-               DbgPrint("Deactivating in progress\n");
-               if (slave_loaded_instance(slave) == 0) {
-                       slave = slave_unref(slave);
-               }
+    if (g_conf.slave_max_load < 0) {
+       max_load = DYNAMICBOX_CONF_SLAVE_MAX_LOAD;
+    } else {
+       max_load = g_conf.slave_max_load;
+    }
 
-               return slave;
+    if (!slave_is_activated(slave)) {
+       DbgPrint("Deactivating in progress\n");
+       if (slave_loaded_instance(slave) == 0) {
+           slave = slave_unref(slave);
        }
 
-       slave->fault_count++;
+       return slave;
+    }
 
-       (void)fault_check_pkgs(slave);
+    slave->fault_count++;
 
-       if (slave_pid(slave) > 0) {
-               DbgPrint("Try to terminate PID: %d\n", slave_pid(slave));
-               ret = aul_terminate_pid(slave_pid(slave));
-               if (ret < 0) {
-                       ErrPrint("Terminate failed, pid %d\n", slave_pid(slave));
-               }
+    (void)fault_check_pkgs(slave);
+
+    if (slave_pid(slave) > 0) {
+       DbgPrint("Try to terminate PID: %d\n", slave_pid(slave));
+       ret = aul_terminate_pid(slave_pid(slave));
+       if (ret < 0) {
+           ErrPrint("Terminate failed, pid %d\n", slave_pid(slave));
        }
+    }
 
 #if defined(_USE_ECORE_TIME_GET)
-       double faulted_at;
-
-       faulted_at = ecore_time_get();
-       if (faulted_at - slave->activated_at < MINIMUM_REACTIVATION_TIME) {
-               slave->critical_fault_count++;
-               if (!slave_loaded_instance(slave) || slave->critical_fault_count >= SLAVE_MAX_LOAD) {
-                       ErrPrint("Reactivation time is too fast and frequently occurred - Stop to auto reactivation\n");
-                       reactivate = 0;
-                       reactivate_instances = 0;
-                       slave->critical_fault_count = 0;
-                       /*!
-                        * \note
-                        * Fault callback can access the slave information.
-                        */
-                       invoke_fault_cb(slave);
-               } else {
-                       slave->critical_fault_count = 0;
-               }
+    double faulted_at;
+
+    faulted_at = ecore_time_get();
+    if (faulted_at - slave->activated_at < DYNAMICBOX_CONF_MINIMUM_REACTIVATION_TIME) {
+       slave->critical_fault_count++;
+
+       if (!slave_loaded_instance(slave) || slave->critical_fault_count >= max_load) {
+           ErrPrint("Reactivation time is too fast and frequently occurred - Stop to auto reactivation\n");
+           reactivate = 0;
+           reactivate_instances = 0;
+           slave->critical_fault_count = 0;
+           /*!
+            * \note
+            * Fault callback can access the slave information.
+            */
+           invoke_fault_cb(slave);
+       } else {
+           slave->critical_fault_count = 0;
        }
+    }
 #else
-       struct timeval faulted_at;
-
-       if (gettimeofday(&faulted_at, NULL) == 0) {
-               struct timeval rtv;
-
-               timersub(&faulted_at, &slave->activated_at, &rtv);
-               if (rtv.tv_sec < MINIMUM_REACTIVATION_TIME) {
-                       slave->critical_fault_count++;
-                       if (!slave_loaded_instance(slave) || slave->critical_fault_count >= SLAVE_MAX_LOAD) {
-                               ErrPrint("Reactivation time is too fast and frequently occurred - Stop to auto reactivation\n");
-                               reactivate = 0;
-                               reactivate_instances = 0;
-                               slave->critical_fault_count = 0;
-                               /*!
-                                * \note
-                                * Fault callback can access the slave information.
-                                */
-                               invoke_fault_cb(slave);
-                       }
-               } else {
-                       slave->critical_fault_count = 0;
-               }
+    struct timeval faulted_at;
+
+    if (gettimeofday(&faulted_at, NULL) == 0) {
+       struct timeval rtv;
+
+       timersub(&faulted_at, &slave->activated_at, &rtv);
+       if (rtv.tv_sec < DYNAMICBOX_CONF_MINIMUM_REACTIVATION_TIME) {
+           slave->critical_fault_count++;
+           if (!slave_loaded_instance(slave) || slave->critical_fault_count >= max_load) {
+               ErrPrint("Reactivation time is too fast and frequently occurred - Stop to auto reactivation\n");
+               reactivate = 0;
+               reactivate_instances = 0;
+               slave->critical_fault_count = 0;
+               /*!
+                * \note
+                * Fault callback can access the slave information.
+                */
+               invoke_fault_cb(slave);
+           }
        } else {
-               ErrPrint("Failed to get time of day: %s\n", strerror(errno));
+           slave->critical_fault_count = 0;
        }
+    } else {
+       ErrPrint("Failed to get time of day: %s\n", strerror(errno));
+    }
 #endif
 
-       slave_set_reactivation(slave, reactivate);
-       slave_set_reactivate_instances(slave, reactivate_instances);
+    slave_set_reactivation(slave, reactivate);
+    slave_set_reactivate_instances(slave, reactivate_instances);
 
-       slave = slave_deactivated(slave);
-       return slave;
+    slave = slave_deactivated(slave);
+    return slave;
 }
 
 HAPI const int const slave_is_activated(struct slave_node *slave)
 {
-       switch (slave->state) {
-       case SLAVE_REQUEST_TO_TERMINATE:
-       case SLAVE_TERMINATED:
-               return 0;
-       case SLAVE_REQUEST_TO_DISCONNECT:
-               /* This case should be treated as an activated state.
-                * To send the last request to the provider.
-                */
-       case SLAVE_REQUEST_TO_LAUNCH:
-                /* Not yet launched. but the slave incurred an unexpected error */
-       case SLAVE_REQUEST_TO_PAUSE:
-       case SLAVE_REQUEST_TO_RESUME:
-       case SLAVE_PAUSED:
-       case SLAVE_RESUMED:
-               return 1;
-       default:
-               return slave->pid != (pid_t)-1;
-       }
-
-       /* Could not be reach to here */
+    switch (slave->state) {
+    case SLAVE_REQUEST_TO_TERMINATE:
+    case SLAVE_TERMINATED:
        return 0;
+    case SLAVE_REQUEST_TO_DISCONNECT:
+       /* This case should be treated as an activated state.
+        * To send the last request to the provider.
+        */
+    case SLAVE_REQUEST_TO_LAUNCH:
+       /* Not yet launched. but the slave incurred an unexpected error */
+    case SLAVE_REQUEST_TO_PAUSE:
+    case SLAVE_REQUEST_TO_RESUME:
+    case SLAVE_PAUSED:
+    case SLAVE_RESUMED:
+       return 1;
+    default:
+       return slave->pid != (pid_t)-1;
+    }
+
+    /* Could not be reach to here */
+    return 0;
 }
 
 HAPI int slave_event_callback_add(struct slave_node *slave, enum slave_event event, int (*cb)(struct slave_node *, void *), void *data)
 {
-       struct event *ev;
-
-       ev = calloc(1, sizeof(*ev));
-       if (!ev) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       ev->slave = slave;
-       ev->cbdata = data;
-       ev->evt_cb = cb;
-
-       /*!
-        * \note
-        * Use the eina_list_prepend API.
-        * To keep the sequence of a callback invocation.
-        *
-        * Here is an example sequence.
-        *
-        * slave_event_callback_add(CALLBACK_01);
-        * slave_event_callback_add(CALLBACK_02);
-        * slave_event_callback_add(CALLBACK_03);
-        *
-        * Then the invoke_event_callback function will call the CALLBACKS as below sequence
-        *
-        * invoke_CALLBACK_03
-        * invoke_CALLBACK_02
-        * invoke_CALLBACK_01
-        */
-
-       switch (event) {
-       case SLAVE_EVENT_ACTIVATE:
-               slave->event_activate_list = eina_list_prepend(slave->event_activate_list, ev);
-               break;
-       case SLAVE_EVENT_DELETE:
-               slave->event_delete_list = eina_list_prepend(slave->event_delete_list, ev);
-               break;
-       case SLAVE_EVENT_DEACTIVATE:
-               slave->event_deactivate_list = eina_list_prepend(slave->event_deactivate_list, ev);
-               break;
-       case SLAVE_EVENT_PAUSE:
-               slave->event_pause_list = eina_list_prepend(slave->event_pause_list, ev);
-               break;
-       case SLAVE_EVENT_RESUME:
-               slave->event_resume_list = eina_list_prepend(slave->event_resume_list, ev);
-               break;
-       case SLAVE_EVENT_FAULT:
-               slave->event_fault_list = eina_list_prepend(slave->event_fault_list, ev);
-               break;
-       default:
-               DbgFree(ev);
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       return LB_STATUS_SUCCESS;
+    struct event *ev;
+
+    ev = calloc(1, sizeof(*ev));
+    if (!ev) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    ev->slave = slave;
+    ev->cbdata = data;
+    ev->evt_cb = cb;
+
+    /*!
+     * \note
+     * Use the eina_list_prepend API.
+     * To keep the sequence of a callback invocation.
+     *
+     * Here is an example sequence.
+     *
+     * slave_event_callback_add(CALLBACK_01);
+     * slave_event_callback_add(CALLBACK_02);
+     * slave_event_callback_add(CALLBACK_03);
+     *
+     * Then the invoke_event_callback function will call the CALLBACKS as below sequence
+     *
+     * invoke_CALLBACK_03
+     * invoke_CALLBACK_02
+     * invoke_CALLBACK_01
+     */
+
+    switch (event) {
+    case SLAVE_EVENT_ACTIVATE:
+       slave->event_activate_list = eina_list_prepend(slave->event_activate_list, ev);
+       break;
+    case SLAVE_EVENT_DELETE:
+       slave->event_delete_list = eina_list_prepend(slave->event_delete_list, ev);
+       break;
+    case SLAVE_EVENT_DEACTIVATE:
+       slave->event_deactivate_list = eina_list_prepend(slave->event_deactivate_list, ev);
+       break;
+    case SLAVE_EVENT_PAUSE:
+       slave->event_pause_list = eina_list_prepend(slave->event_pause_list, ev);
+       break;
+    case SLAVE_EVENT_RESUME:
+       slave->event_resume_list = eina_list_prepend(slave->event_resume_list, ev);
+       break;
+    case SLAVE_EVENT_FAULT:
+       slave->event_fault_list = eina_list_prepend(slave->event_fault_list, ev);
+       break;
+    default:
+       DbgFree(ev);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int slave_event_callback_del(struct slave_node *slave, enum slave_event event, int (*cb)(struct slave_node *, void *), void *data)
 {
-       struct event *ev;
-       Eina_List *l;
-       Eina_List *n;
-
-       switch (event) {
-       case SLAVE_EVENT_DEACTIVATE:
-               EINA_LIST_FOREACH_SAFE(slave->event_deactivate_list, l, n, ev) {
-                       if (ev->evt_cb == cb && ev->cbdata == data) {
-                               if (slave->in_event_process & SLAVE_EVENT_PROCESS_DEACTIVATE) {
-                                       ev->deleted = 1;
-                               } else {
-                                       slave->event_deactivate_list = eina_list_remove(slave->event_deactivate_list, ev);
-                                       DbgFree(ev);
-                               }
-                               return LB_STATUS_SUCCESS;
-                       }
+    struct event *ev;
+    Eina_List *l;
+    Eina_List *n;
+
+    switch (event) {
+    case SLAVE_EVENT_DEACTIVATE:
+       EINA_LIST_FOREACH_SAFE(slave->event_deactivate_list, l, n, ev) {
+           if (ev->evt_cb == cb && ev->cbdata == data) {
+               if (slave->in_event_process & SLAVE_EVENT_PROCESS_DEACTIVATE) {
+                   ev->deleted = 1;
+               } else {
+                   slave->event_deactivate_list = eina_list_remove(slave->event_deactivate_list, ev);
+                   DbgFree(ev);
                }
-               break;
-       case SLAVE_EVENT_DELETE:
-               EINA_LIST_FOREACH_SAFE(slave->event_delete_list, l, n, ev) {
-                       if (ev->evt_cb == cb && ev->cbdata == data) {
-                               if (slave->in_event_process & SLAVE_EVENT_PROCESS_DELETE) {
-                                       ev->deleted = 1;
-                               } else {
-                                       slave->event_delete_list = eina_list_remove(slave->event_delete_list, ev);
-                                       DbgFree(ev);
-                               }
-                               return LB_STATUS_SUCCESS;
-                       }
+               return DBOX_STATUS_ERROR_NONE;
+           }
+       }
+       break;
+    case SLAVE_EVENT_DELETE:
+       EINA_LIST_FOREACH_SAFE(slave->event_delete_list, l, n, ev) {
+           if (ev->evt_cb == cb && ev->cbdata == data) {
+               if (slave->in_event_process & SLAVE_EVENT_PROCESS_DELETE) {
+                   ev->deleted = 1;
+               } else {
+                   slave->event_delete_list = eina_list_remove(slave->event_delete_list, ev);
+                   DbgFree(ev);
                }
-               break;
-       case SLAVE_EVENT_ACTIVATE:
-               EINA_LIST_FOREACH_SAFE(slave->event_activate_list, l, n, ev) {
-                       if (ev->evt_cb == cb && ev->cbdata == data) {
-                               if (slave->in_event_process & SLAVE_EVENT_PROCESS_ACTIVATE) {
-                                       ev->deleted = 1;
-                               } else {
-                                       slave->event_activate_list = eina_list_remove(slave->event_activate_list, ev);
-                                       DbgFree(ev);
-                               }
-                               return LB_STATUS_SUCCESS;
-                       }
+               return DBOX_STATUS_ERROR_NONE;
+           }
+       }
+       break;
+    case SLAVE_EVENT_ACTIVATE:
+       EINA_LIST_FOREACH_SAFE(slave->event_activate_list, l, n, ev) {
+           if (ev->evt_cb == cb && ev->cbdata == data) {
+               if (slave->in_event_process & SLAVE_EVENT_PROCESS_ACTIVATE) {
+                   ev->deleted = 1;
+               } else {
+                   slave->event_activate_list = eina_list_remove(slave->event_activate_list, ev);
+                   DbgFree(ev);
                }
-               break;
-       case SLAVE_EVENT_PAUSE:
-               EINA_LIST_FOREACH_SAFE(slave->event_pause_list, l, n, ev) {
-                       if (ev->evt_cb == cb && ev->cbdata == data) {
-                               if (slave->in_event_process & SLAVE_EVENT_PROCESS_PAUSE) {
-                                       ev->deleted = 1;
-                               } else {
-                                       slave->event_pause_list = eina_list_remove(slave->event_pause_list, ev);
-                                       DbgFree(ev);
-                               }
-                               return LB_STATUS_SUCCESS;
-                       }
+               return DBOX_STATUS_ERROR_NONE;
+           }
+       }
+       break;
+    case SLAVE_EVENT_PAUSE:
+       EINA_LIST_FOREACH_SAFE(slave->event_pause_list, l, n, ev) {
+           if (ev->evt_cb == cb && ev->cbdata == data) {
+               if (slave->in_event_process & SLAVE_EVENT_PROCESS_PAUSE) {
+                   ev->deleted = 1;
+               } else {
+                   slave->event_pause_list = eina_list_remove(slave->event_pause_list, ev);
+                   DbgFree(ev);
                }
-               break;
-       case SLAVE_EVENT_RESUME:
-               EINA_LIST_FOREACH_SAFE(slave->event_resume_list, l, n, ev) {
-                       if (ev->evt_cb == cb && ev->cbdata == data) {
-                               if (slave->in_event_process & SLAVE_EVENT_PROCESS_RESUME) {
-                                       ev->deleted = 1;
-                               } else {
-                                       slave->event_resume_list = eina_list_remove(slave->event_resume_list, ev);
-                                       DbgFree(ev);
-                               }
-                               return LB_STATUS_SUCCESS;
-                       }
+               return DBOX_STATUS_ERROR_NONE;
+           }
+       }
+       break;
+    case SLAVE_EVENT_RESUME:
+       EINA_LIST_FOREACH_SAFE(slave->event_resume_list, l, n, ev) {
+           if (ev->evt_cb == cb && ev->cbdata == data) {
+               if (slave->in_event_process & SLAVE_EVENT_PROCESS_RESUME) {
+                   ev->deleted = 1;
+               } else {
+                   slave->event_resume_list = eina_list_remove(slave->event_resume_list, ev);
+                   DbgFree(ev);
                }
-               break;
-       case SLAVE_EVENT_FAULT:
-               EINA_LIST_FOREACH_SAFE(slave->event_fault_list, l, n, ev) {
-                       if (ev->evt_cb == cb && ev->cbdata == data) {
-                               if (slave->in_event_process & SLAVE_EVENT_PROCESS_FAULT) {
-                                       ev->deleted = 1;
-                               } else {
-                                       slave->event_fault_list = eina_list_remove(slave->event_fault_list, ev);
-                                       DbgFree(ev);
-                               }
-                               return LB_STATUS_SUCCESS;
-                       }
+               return DBOX_STATUS_ERROR_NONE;
+           }
+       }
+       break;
+    case SLAVE_EVENT_FAULT:
+       EINA_LIST_FOREACH_SAFE(slave->event_fault_list, l, n, ev) {
+           if (ev->evt_cb == cb && ev->cbdata == data) {
+               if (slave->in_event_process & SLAVE_EVENT_PROCESS_FAULT) {
+                   ev->deleted = 1;
+               } else {
+                   slave->event_fault_list = eina_list_remove(slave->event_fault_list, ev);
+                   DbgFree(ev);
                }
-               break;
-       default:
-               return LB_STATUS_ERROR_INVALID;
+               return DBOX_STATUS_ERROR_NONE;
+           }
        }
+       break;
+    default:
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       return LB_STATUS_ERROR_NOT_EXIST;
+    return DBOX_STATUS_ERROR_NOT_EXIST;
 }
 
 HAPI int slave_set_data(struct slave_node *slave, const char *tag, void *data)
 {
-       struct priv_data *priv;
+    struct priv_data *priv;
 
-       priv = calloc(1, sizeof(*priv));
-       if (!priv) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    priv = calloc(1, sizeof(*priv));
+    if (!priv) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       priv->tag = strdup(tag);
-       if (!priv->tag) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               DbgFree(priv);
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    priv->tag = strdup(tag);
+    if (!priv->tag) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       DbgFree(priv);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       priv->data = data;
-       slave->data_list = eina_list_append(slave->data_list, priv);
-       return LB_STATUS_SUCCESS;
+    priv->data = data;
+    slave->data_list = eina_list_append(slave->data_list, priv);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI void *slave_del_data(struct slave_node *slave, const char *tag)
 {
-       struct priv_data *priv;
-       void *data;
-       Eina_List *l;
-       Eina_List *n;
+    struct priv_data *priv;
+    void *data;
+    Eina_List *l;
+    Eina_List *n;
 
-       EINA_LIST_FOREACH_SAFE(slave->data_list, l, n, priv) {
-               if (!strcmp(priv->tag, tag)) {
-                       slave->data_list = eina_list_remove(slave->data_list, priv);
+    EINA_LIST_FOREACH_SAFE(slave->data_list, l, n, priv) {
+       if (!strcmp(priv->tag, tag)) {
+           slave->data_list = eina_list_remove(slave->data_list, priv);
 
-                       data = priv->data;
-                       DbgFree(priv->tag);
-                       DbgFree(priv);
-                       return data;
-               }
+           data = priv->data;
+           DbgFree(priv->tag);
+           DbgFree(priv);
+           return data;
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
 HAPI void *slave_data(struct slave_node *slave, const char *tag)
 {
-       struct priv_data *priv;
-       Eina_List *l;
+    struct priv_data *priv;
+    Eina_List *l;
 
-       EINA_LIST_FOREACH(slave->data_list, l, priv) {
-               if (!strcmp(priv->tag, tag)) {
-                       return priv->data;
-               }
+    EINA_LIST_FOREACH(slave->data_list, l, priv) {
+       if (!strcmp(priv->tag, tag)) {
+           return priv->data;
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
 HAPI struct slave_node *slave_find_by_pid(pid_t pid)
 {
-       Eina_List *l;
-       struct slave_node *slave;
+    Eina_List *l;
+    struct slave_node *slave;
 
-       EINA_LIST_FOREACH(s_info.slave_list, l, slave) {
-               if (slave_pid(slave) == pid) {
-                       return slave;
-               }
+    EINA_LIST_FOREACH(s_info.slave_list, l, slave) {
+       if (slave_pid(slave) == pid) {
+           return slave;
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
 HAPI struct slave_node *slave_find_by_name(const char *name)
 {
-       Eina_List *l;
-       struct slave_node *slave;
+    Eina_List *l;
+    struct slave_node *slave;
 
-       EINA_LIST_FOREACH(s_info.slave_list, l, slave) {
-               if (!strcmp(slave_name(slave), name)) {
-                       return slave;
-               }
+    EINA_LIST_FOREACH(s_info.slave_list, l, slave) {
+       if (!strcmp(slave_name(slave), name)) {
+           return slave;
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
-HAPI struct slave_node *slave_find_available(const char *abi, int secured, int network)
+HAPI struct slave_node *slave_find_available(const char *slave_pkgname, const char *abi, int secured, int network)
 {
-       Eina_List *l;
-       struct slave_node *slave;
+    Eina_List *l;
+    struct slave_node *slave;
 
-       EINA_LIST_FOREACH(s_info.slave_list, l, slave) {
-               if (slave->secured != secured) {
-                       continue;
-               }
+    EINA_LIST_FOREACH(s_info.slave_list, l, slave) {
+       if (slave->secured != secured) {
+           continue;
+       }
 
-               if ((slave->state == SLAVE_REQUEST_TO_TERMINATE || slave->state == SLAVE_REQUEST_TO_DISCONNECT) && slave->loaded_instance == 0) {
-                       /*!
-                        * \note
-                        * If a slave is in request_to_terminate state,
-                        * and the slave object has no more intances,
-                        * the slave object will be deleted soon.
-                        * so we cannot reuse it.
-                        *
-                        * This object is not usable.
-                        */
-                       continue;
-               }
+       if ((slave->state == SLAVE_REQUEST_TO_TERMINATE || slave->state == SLAVE_REQUEST_TO_DISCONNECT) && slave->loaded_instance == 0) {
+           /*!
+            * \note
+            * If a slave is in request_to_terminate state,
+            * and the slave object has no more intances,
+            * the slave object will be deleted soon.
+            * so we cannot reuse it.
+            *
+            * This object is not usable.
+            */
+           continue;
+       }
+
+       if (strcasecmp(slave->abi, abi)) {
+           continue;
+       }
 
-               if (strcasecmp(slave->abi, abi)) {
-                       continue;
+       if (strcasecmp(slave->pkgname, slave_pkgname)) {
+           continue;
+       }
+
+       if (slave->secured) {
+           if (slave->loaded_package == 0) {
+               DbgPrint("Found secured slave - has no instances (%s)\n", slave_name(slave));
+               return slave;
+           }
+       } else if (slave->network == network) {
+           DbgPrint("slave[%s] loaded_package[%d] net: [%d]\n", slave_name(slave), slave->loaded_package, slave->network);
+           if (!strcasecmp(abi, DYNAMICBOX_CONF_DEFAULT_ABI)) {
+               int max_load;
+               if (g_conf.slave_max_load < 0) {
+                   max_load = DYNAMICBOX_CONF_SLAVE_MAX_LOAD;
+               } else {
+                   max_load = g_conf.slave_max_load;
                }
 
-               if (slave->secured) {
-                       if (slave->loaded_package == 0) {
-                               DbgPrint("Found secured slave - has no instances (%s)\n", slave_name(slave));
-                               return slave;
-                       }
-               } else if (slave->network == network) {
-                       DbgPrint("slave[%s] loaded_package[%d] net: [%d]\n", slave_name(slave), slave->loaded_package, slave->network);
-                       if (!strcasecmp(abi, DEFAULT_ABI)) {
-                               if (slave->loaded_package < SLAVE_MAX_LOAD) {
-                                       return slave;
-                               }
-                       } else {
-                               return slave;
-                       }
+               if (slave->loaded_package < max_load) {
+                   return slave;
                }
+           } else {
+               return slave;
+           }
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
 HAPI struct slave_node *slave_find_by_pkgname(const char *pkgname)
 {
-       Eina_List *l;
-       struct slave_node *slave;
+    Eina_List *l;
+    struct slave_node *slave;
 
-       EINA_LIST_FOREACH(s_info.slave_list, l, slave) {
-               if (!strcmp(slave_pkgname(slave), pkgname)) {
-                       if (slave_pid(slave) == (pid_t)-1) {
-                               return slave;
-                       }
-               }
+    EINA_LIST_FOREACH(s_info.slave_list, l, slave) {
+       if (!strcmp(slave_pkgname(slave), pkgname)) {
+           if (slave_pid(slave) == (pid_t)-1) {
+               return slave;
+           }
        }
+    }
 
-       return NULL;
+    return NULL;
 }
 
 HAPI struct slave_node *slave_find_by_rpc_handle(int handle)
 {
-       Eina_List *l;
-       struct slave_node *slave;
+    Eina_List *l;
+    struct slave_node *slave;
 
-       if (handle <= 0) {
-               ErrPrint("Invalid RPC handle: %d\n", handle);
-               return NULL;
-       }
+    if (handle <= 0) {
+       ErrPrint("Invalid RPC handle: %d\n", handle);
+       return NULL;
+    }
 
-       EINA_LIST_FOREACH(s_info.slave_list, l, slave) {
-               if (slave_rpc_handle(slave) == handle) {
-                       return slave;
-               }
+    EINA_LIST_FOREACH(s_info.slave_list, l, slave) {
+       if (slave_rpc_handle(slave) == handle) {
+           return slave;
        }
+    }
 
-       /* Not found */
+    /* Not found */
+    return NULL;
+}
+
+HAPI char *slave_package_name(const char *abi, const char *lbid)
+{
+    char *s_pkgname;
+    const char *tmp;
+
+    tmp = abi_find_slave(abi);
+    if (!tmp) {
+       ErrPrint("Failed to find a proper pkgname of a slave\n");
        return NULL;
+    }
+
+    s_pkgname = util_replace_string(tmp, DYNAMICBOX_CONF_REPLACE_TAG_APPID, lbid);
+    if (!s_pkgname) {
+       DbgPrint("Failed to get replaced string\n");
+       s_pkgname = strdup(tmp);
+       if (!s_pkgname) {
+           ErrPrint("Heap: %s\n", strerror(errno));
+           return NULL;
+       }
+    }
+
+    return s_pkgname;
 }
 
 HAPI void slave_load_package(struct slave_node *slave)
 {
-       slave->loaded_package++;
+    slave->loaded_package++;
 }
 
 HAPI void slave_unload_package(struct slave_node *slave)
 {
-       if (!slave || slave->loaded_package == 0) {
-               ErrPrint("Slave loaded package is not correct\n");
-               return;
-       }
-               
-       slave->loaded_package--;
+    if (!slave || slave->loaded_package == 0) {
+       ErrPrint("Slave loaded package is not correct\n");
+       return;
+    }
+
+    slave->loaded_package--;
 }
 
 HAPI void slave_load_instance(struct slave_node *slave)
 {
-       slave->loaded_instance++;
-       DbgPrint("Instance: (%d)%d\n", slave_pid(slave), slave->loaded_instance);
+    slave->loaded_instance++;
+    DbgPrint("Instance: (%d)%d\n", slave_pid(slave), slave->loaded_instance);
 }
 
 HAPI int const slave_loaded_instance(struct slave_node *slave)
 {
-       return slave->loaded_instance;
+    return slave->loaded_instance;
 }
 
 HAPI int const slave_loaded_package(struct slave_node *slave)
 {
-       return slave->loaded_package;
+    return slave->loaded_package;
 }
 
 HAPI struct slave_node *slave_unload_instance(struct slave_node *slave)
 {
-       if (!slave || slave->loaded_instance == 0) {
-               ErrPrint("Slave loaded instance is not correct\n");
-               return slave;
-       }
+    if (!slave || slave->loaded_instance == 0) {
+       ErrPrint("Slave loaded instance is not correct\n");
+       return slave;
+    }
 
-       slave->loaded_instance--;
-       DbgPrint("Instance: (%d)%d\n", slave_pid(slave), slave->loaded_instance);
-       if (slave->loaded_instance == 0 && slave_is_activated(slave)) {
-               slave_set_reactivation(slave, 0);
-               slave_set_reactivate_instances(slave, 0);
+    slave->loaded_instance--;
+    DbgPrint("Instance: (%d)%d\n", slave_pid(slave), slave->loaded_instance);
+    if (slave->loaded_instance == 0 && slave_is_activated(slave)) {
+       slave_set_reactivation(slave, 0);
+       slave_set_reactivate_instances(slave, 0);
 
-               slave = slave_deactivate(slave, 0);
-       }
+       slave = slave_deactivate(slave, 0);
+    }
 
-       return slave;
+    return slave;
 }
 
 HAPI const int const slave_is_secured(const struct slave_node *slave)
 {
-       return slave->secured;
+    return slave->secured;
 }
 
 HAPI const char * const slave_name(const struct slave_node *slave)
 {
-       return slave->name;
+    return slave->name;
 }
 
 HAPI const char * const slave_abi(const struct slave_node *slave)
 {
-       return slave->abi;
+    return slave->abi;
 }
 
 HAPI const pid_t const slave_pid(const struct slave_node *slave)
 {
-       return slave->pid;
+    return slave->pid;
 }
 
 HAPI int slave_set_pid(struct slave_node *slave, pid_t pid)
 {
-       if (!slave) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (!slave) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       DbgPrint("Slave PID is updated to %d from %d\n", pid, slave_pid(slave));
+    DbgPrint("Slave PID is updated to %d from %d\n", pid, slave_pid(slave));
 
-       slave->pid = pid;
-       return LB_STATUS_SUCCESS;
+    slave->pid = pid;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static inline void invoke_resumed_cb(struct slave_node *slave)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct event *event;
+    Eina_List *l;
+    Eina_List *n;
+    struct event *event;
 
-       slave->in_event_process |= SLAVE_EVENT_PROCESS_RESUME;
-       EINA_LIST_FOREACH_SAFE(slave->event_resume_list, l, n, event) {
-               if (event->deleted || event->evt_cb(event->slave, event->cbdata) < 0 || event->deleted) {
-                       slave->event_resume_list = eina_list_remove(slave->event_resume_list, event);
-                       DbgFree(event);
-               }
+    slave->in_event_process |= SLAVE_EVENT_PROCESS_RESUME;
+    EINA_LIST_FOREACH_SAFE(slave->event_resume_list, l, n, event) {
+       if (event->deleted || event->evt_cb(event->slave, event->cbdata) < 0 || event->deleted) {
+           slave->event_resume_list = eina_list_remove(slave->event_resume_list, event);
+           DbgFree(event);
        }
-       slave->in_event_process &= ~SLAVE_EVENT_PROCESS_RESUME;
+    }
+    slave->in_event_process &= ~SLAVE_EVENT_PROCESS_RESUME;
 }
 
 static void resume_cb(struct slave_node *slave, const struct packet *packet, void *data)
 {
-       int ret;
+    int ret;
 
-       if (slave->state == SLAVE_REQUEST_TO_TERMINATE || slave->state == SLAVE_REQUEST_TO_DISCONNECT) {
-               DbgPrint("Slave is terminating now. ignore resume result\n");
-               return;
-       }
+    if (slave->state == SLAVE_REQUEST_TO_TERMINATE || slave->state == SLAVE_REQUEST_TO_DISCONNECT) {
+       DbgPrint("Slave is terminating now. ignore resume result\n");
+       return;
+    }
 
-       if (!packet) {
-               ErrPrint("Failed to change the state of the slave\n");
-               slave->state = SLAVE_PAUSED;
-               return;
-       }
+    if (!packet) {
+       ErrPrint("Failed to change the state of the slave\n");
+       slave->state = SLAVE_PAUSED;
+       return;
+    }
 
-       if (packet_get(packet, "i", &ret) != 1) {
-               ErrPrint("Invalid parameter\n");
-               return;
-       }
+    if (packet_get(packet, "i", &ret) != 1) {
+       ErrPrint("Invalid parameter\n");
+       return;
+    }
 
-       if (ret == 0) {
-               slave->state = SLAVE_RESUMED;
-               slave_rpc_ping_thaw(slave);
-               invoke_resumed_cb(slave);
-       }
+    if (ret == 0) {
+       slave->state = SLAVE_RESUMED;
+       slave_rpc_ping_thaw(slave);
+       invoke_resumed_cb(slave);
+    }
 }
 
 static inline void invoke_paused_cb(struct slave_node *slave)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct event *event;
+    Eina_List *l;
+    Eina_List *n;
+    struct event *event;
 
-       slave->in_event_process |= SLAVE_EVENT_PROCESS_PAUSE;
-       EINA_LIST_FOREACH_SAFE(slave->event_pause_list, l, n, event) {
-               if (event->deleted || event->evt_cb(event->slave, event->cbdata) < 0 || event->deleted) {
-                       slave->event_pause_list = eina_list_remove(slave->event_pause_list, event);
-                       DbgFree(event);
-               }
+    slave->in_event_process |= SLAVE_EVENT_PROCESS_PAUSE;
+    EINA_LIST_FOREACH_SAFE(slave->event_pause_list, l, n, event) {
+       if (event->deleted || event->evt_cb(event->slave, event->cbdata) < 0 || event->deleted) {
+           slave->event_pause_list = eina_list_remove(slave->event_pause_list, event);
+           DbgFree(event);
        }
-       slave->in_event_process &= ~SLAVE_EVENT_PROCESS_PAUSE;
+    }
+    slave->in_event_process &= ~SLAVE_EVENT_PROCESS_PAUSE;
 }
 
 static void pause_cb(struct slave_node *slave, const struct packet *packet, void *data)
 {
-       int ret;
+    int ret;
 
-       if (slave->state == SLAVE_REQUEST_TO_TERMINATE || slave->state == SLAVE_REQUEST_TO_DISCONNECT) {
-               DbgPrint("Slave is terminating now. ignore pause result\n");
-               return;
-       }
+    if (slave->state == SLAVE_REQUEST_TO_TERMINATE || slave->state == SLAVE_REQUEST_TO_DISCONNECT) {
+       DbgPrint("Slave is terminating now. ignore pause result\n");
+       return;
+    }
 
-       if (!packet) {
-               ErrPrint("Failed to change the state of the slave\n");
-               slave->state = SLAVE_RESUMED;
-               return;
-       }
+    if (!packet) {
+       ErrPrint("Failed to change the state of the slave\n");
+       slave->state = SLAVE_RESUMED;
+       return;
+    }
 
-       if (packet_get(packet, "i", &ret) != 1) {
-               ErrPrint("Invalid parameter\n");
-               return;
-       }
+    if (packet_get(packet, "i", &ret) != 1) {
+       ErrPrint("Invalid parameter\n");
+       return;
+    }
 
-       if (ret == 0) {
-               slave->state = SLAVE_PAUSED;
-               slave_rpc_ping_freeze(slave);
-               invoke_paused_cb(slave);
-       }
+    if (ret == 0) {
+       slave->state = SLAVE_PAUSED;
+       slave_rpc_ping_freeze(slave);
+       invoke_paused_cb(slave);
+    }
 }
 
 HAPI int slave_resume(struct slave_node *slave)
 {
-       double timestamp;
-       struct packet *packet;
-
-       switch (slave->state) {
-       case SLAVE_REQUEST_TO_DISCONNECT:
-       case SLAVE_REQUEST_TO_LAUNCH:
-       case SLAVE_REQUEST_TO_TERMINATE:
-       case SLAVE_TERMINATED:
-               return LB_STATUS_ERROR_INVALID;
-       case SLAVE_RESUMED:
-       case SLAVE_REQUEST_TO_RESUME:
-               return LB_STATUS_SUCCESS;
-       default:
-               break;
-       }
+    double timestamp;
+    struct packet *packet;
+    unsigned int cmd = CMD_RESUME;
 
-       timestamp = util_timestamp();
+    switch (slave->state) {
+    case SLAVE_REQUEST_TO_DISCONNECT:
+    case SLAVE_REQUEST_TO_LAUNCH:
+    case SLAVE_REQUEST_TO_TERMINATE:
+    case SLAVE_TERMINATED:
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    case SLAVE_RESUMED:
+    case SLAVE_REQUEST_TO_RESUME:
+       return DBOX_STATUS_ERROR_NONE;
+    default:
+       break;
+    }
 
-       packet = packet_create("resume", "d", timestamp);
-       if (!packet) {
-               ErrPrint("Failed to prepare param\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    timestamp = util_timestamp();
 
-       slave->state = SLAVE_REQUEST_TO_RESUME;
-       return slave_rpc_async_request(slave, NULL, packet, resume_cb, NULL, 0);
+    packet = packet_create((const char *)&cmd, "d", timestamp);
+    if (!packet) {
+       ErrPrint("Failed to prepare param\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    slave->state = SLAVE_REQUEST_TO_RESUME;
+    return slave_rpc_async_request(slave, NULL, packet, resume_cb, NULL, 0);
 }
 
 HAPI int slave_pause(struct slave_node *slave)
 {
-       double timestamp;
-       struct packet *packet;
-
-       switch (slave->state) {
-       case SLAVE_REQUEST_TO_DISCONNECT:
-       case SLAVE_REQUEST_TO_LAUNCH:
-       case SLAVE_REQUEST_TO_TERMINATE:
-       case SLAVE_TERMINATED:
-               return LB_STATUS_ERROR_INVALID;
-       case SLAVE_PAUSED:
-       case SLAVE_REQUEST_TO_PAUSE:
-               return LB_STATUS_SUCCESS;
-       default:
-               break;
-       }
+    double timestamp;
+    struct packet *packet;
+    unsigned int cmd = CMD_PAUSE;
 
-       timestamp = util_timestamp();
+    switch (slave->state) {
+    case SLAVE_REQUEST_TO_DISCONNECT:
+    case SLAVE_REQUEST_TO_LAUNCH:
+    case SLAVE_REQUEST_TO_TERMINATE:
+    case SLAVE_TERMINATED:
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    case SLAVE_PAUSED:
+    case SLAVE_REQUEST_TO_PAUSE:
+       return DBOX_STATUS_ERROR_NONE;
+    default:
+       break;
+    }
 
-       packet = packet_create("pause", "d", timestamp);
-       if (!packet) {
-               ErrPrint("Failed to prepare param\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    timestamp = util_timestamp();
+
+    packet = packet_create((const char *)&cmd, "d", timestamp);
+    if (!packet) {
+       ErrPrint("Failed to prepare param\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       slave->state = SLAVE_REQUEST_TO_PAUSE;
-       return slave_rpc_async_request(slave, NULL, packet, pause_cb, NULL, 0);
+    slave->state = SLAVE_REQUEST_TO_PAUSE;
+    return slave_rpc_async_request(slave, NULL, packet, pause_cb, NULL, 0);
 }
 
 HAPI const char *slave_pkgname(const struct slave_node *slave)
 {
-       return slave ? slave->pkgname : NULL;
+    return slave ? slave->pkgname : NULL;
 }
 
 HAPI enum slave_state slave_state(const struct slave_node *slave)
 {
-       return slave ? slave->state : SLAVE_ERROR;
+    return slave ? slave->state : SLAVE_ERROR;
 }
 
 HAPI const char *slave_state_string(const struct slave_node *slave)
 {
-       switch (slave->state) {
-       case SLAVE_REQUEST_TO_DISCONNECT:
-               return "RequestToDisconnect";
-       case SLAVE_REQUEST_TO_LAUNCH:
-               return "RequestToLaunch";
-       case SLAVE_REQUEST_TO_TERMINATE:
-               return "RequestToTerminate";
-       case SLAVE_TERMINATED:
-               return "Terminated";
-       case SLAVE_REQUEST_TO_PAUSE:
-               return "RequestToPause";
-       case SLAVE_REQUEST_TO_RESUME:
-               return "RequestToResume";
-       case SLAVE_PAUSED:
-               return "Paused";
-       case SLAVE_RESUMED:
-               return "Resumed";
-       case SLAVE_ERROR:
-               return "Error";
-       default:
-               break;
-       }
-
-       return "Unknown";
+    switch (slave->state) {
+    case SLAVE_REQUEST_TO_DISCONNECT:
+       return "RequestToDisconnect";
+    case SLAVE_REQUEST_TO_LAUNCH:
+       return "RequestToLaunch";
+    case SLAVE_REQUEST_TO_TERMINATE:
+       return "RequestToTerminate";
+    case SLAVE_TERMINATED:
+       return "Terminated";
+    case SLAVE_REQUEST_TO_PAUSE:
+       return "RequestToPause";
+    case SLAVE_REQUEST_TO_RESUME:
+       return "RequestToResume";
+    case SLAVE_PAUSED:
+       return "Paused";
+    case SLAVE_RESUMED:
+       return "Resumed";
+    case SLAVE_ERROR:
+       return "Error";
+    default:
+       break;
+    }
+
+    return "Unknown";
 }
 
 HAPI const void *slave_list(void)
 {
-       return s_info.slave_list;
+    return s_info.slave_list;
 }
 
 HAPI int const slave_fault_count(const struct slave_node *slave)
 {
-       return slave->fault_count;
+    return slave->fault_count;
 }
 
 HAPI double const slave_ttl(const struct slave_node *slave)
 {
-       if (!slave->ttl_timer) {
-               return 0.0f;
-       }
+    if (!slave->ttl_timer) {
+       return 0.0f;
+    }
 
-       return ecore_timer_pending_get(slave->ttl_timer);
+    return ecore_timer_pending_get(slave->ttl_timer);
 }
 
 HAPI void slave_set_reactivate_instances(struct slave_node *slave, int reactivate)
 {
-       slave->reactivate_instances = reactivate;
+    slave->reactivate_instances = reactivate;
 }
 
 HAPI int slave_need_to_reactivate_instances(struct slave_node *slave)
 {
-       return slave->reactivate_instances;
+    return slave->reactivate_instances;
 }
 
 HAPI void slave_set_reactivation(struct slave_node *slave, int flag)
 {
-       slave->reactivate_slave = flag;
+    slave->reactivate_slave = flag;
 }
 
 HAPI int slave_need_to_reactivate(struct slave_node *slave)
 {
-       return slave->reactivate_slave;
+    return slave->reactivate_slave;
 }
 
 HAPI int slave_network(const struct slave_node *slave)
 {
-       return slave->network;
+    return slave->network;
 }
 
 HAPI void slave_set_network(struct slave_node *slave, int network)
 {
-       slave->network = network;
+    slave->network = network;
 }
 
 HAPI int slave_deactivate_all(int reactivate, int reactivate_instances, int no_timer)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct slave_node *slave;
-       int cnt = 0;
+    Eina_List *l;
+    Eina_List *n;
+    struct slave_node *slave;
+    int cnt = 0;
 
-       s_info.deactivate_all_refcnt++;
-       if (s_info.deactivate_all_refcnt > 1) {
-               return 0;
-       }
-       DbgPrint("Deactivate all\n");
-
-       EINA_LIST_FOREACH_SAFE(s_info.slave_list, l, n, slave) {
-               slave_set_reactivate_instances(slave, reactivate_instances);
-               slave_set_reactivation(slave, reactivate);
+    s_info.deactivate_all_refcnt++;
+    if (s_info.deactivate_all_refcnt > 1) {
+       return 0;
+    }
+    DbgPrint("Deactivate all\n");
 
-               if (!slave_deactivate(slave, no_timer)) {
-                       s_info.slave_list = eina_list_remove(s_info.slave_list, slave);
-               }
+    EINA_LIST_FOREACH_SAFE(s_info.slave_list, l, n, slave) {
+       slave_set_reactivate_instances(slave, reactivate_instances);
+       slave_set_reactivation(slave, reactivate);
 
-               cnt++;
+       if (!slave_deactivate(slave, no_timer)) {
+           s_info.slave_list = eina_list_remove(s_info.slave_list, slave);
        }
 
-       return cnt;
+       cnt++;
+    }
+
+    return cnt;
 }
 
 HAPI int slave_activate_all(void)
 {
-       Eina_List *l;
-       struct slave_node *slave;
-       int cnt = 0;
+    Eina_List *l;
+    struct slave_node *slave;
+    int cnt = 0;
 
-       s_info.deactivate_all_refcnt--;
-       if (s_info.deactivate_all_refcnt > 0) {
-               return 0;
-       }
-       DbgPrint("Activate all\n");
+    s_info.deactivate_all_refcnt--;
+    if (s_info.deactivate_all_refcnt > 0) {
+       return 0;
+    }
+    DbgPrint("Activate all\n");
 
-       EINA_LIST_FOREACH(s_info.slave_list, l, slave) {
-               slave_activate(slave);
-               cnt++;
-       }
+    EINA_LIST_FOREACH(s_info.slave_list, l, slave) {
+       slave_activate(slave);
+       cnt++;
+    }
 
-       return cnt;
+    return cnt;
 }
 
 HAPI void slave_set_control_option(struct slave_node *slave, int ctrl)
 {
-       slave->ctrl_option = ctrl;
+    slave->ctrl_option = ctrl;
 }
 
 HAPI int slave_control_option(struct slave_node *slave)
 {
-       return slave->ctrl_option;
+    return slave->ctrl_option;
+}
+
+HAPI int slave_set_priority(struct slave_node *slave, int priority)
+{
+    pid_t pid;
+
+    if (!slave) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    pid = slave_pid(slave);
+    if (pid < 0) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    if (setpriority(PRIO_PROCESS, slave_pid(slave), priority) < 0) {
+       ErrPrint("setpriority: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
+}
+
+HAPI int slave_priority(struct slave_node *slave)
+{
+    pid_t pid;
+    int priority;
+
+    if (!slave) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    pid = slave_pid(slave);
+    if (pid < 0) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    priority = getpriority(PRIO_PROCESS, pid);
+    if (priority < 0) {
+       ErrPrint("getpriority: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    return priority;
 }
 
 /* End of a file */
index 7f64c9d..143daae 100644 (file)
 
 #include <packet.h>
 #include <com-core_packet.h>
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
+#include <dynamicbox_service.h>
+#include <dynamicbox_cmd_list.h>
+#include <dynamicbox_conf.h>
 
 #include "debug.h"
 #include "slave_life.h"
 #include "conf.h"
 
 struct slave_rpc {
-       Ecore_Timer *pong_timer;
-       int handle;
+    Ecore_Timer *pong_timer;
+    int handle;
 
-       unsigned long ping_count;
-       unsigned long next_ping_count;
-       Eina_List *pending_list;
+    unsigned long ping_count;
+    unsigned long next_ping_count;
+    Eina_List *pending_list;
 };
 
 struct command {
-       /* create_command, destroy_command will care these varaibles */
-       char *pkgname;
-       struct packet *packet;
-       struct slave_node *slave;
-       int ttl; /* If it fails to handle this, destroy this */
-
-       /* Don't need to care these data */
-       void (*ret_cb)(struct slave_node *slave, const struct packet *packet, void *cbdata);
-       void *cbdata;
+    /* create_command, destroy_command will care these varaibles */
+    char *pkgname;
+    struct packet *packet;
+    struct slave_node *slave;
+    int ttl; /* If it fails to handle this, destroy this */
+
+    /* Don't need to care these data */
+    void (*ret_cb)(struct slave_node *slave, const struct packet *packet, void *cbdata);
+    void *cbdata;
 };
 
 static struct info {
-       Eina_List *command_list;
-       Ecore_Timer *command_consuming_timer;
+    Eina_List *command_list;
+    Ecore_Timer *command_consuming_timer;
 } s_info = {
-       .command_list = NULL,
-       .command_consuming_timer = NULL,
+    .command_list = NULL,
+    .command_consuming_timer = NULL,
 };
 
 #define DEFAULT_CMD_TTL 3
 
-static inline void prepend_command(struct command *command);
+static void prepend_command(struct command *command);
 
 static inline struct command *create_command(struct slave_node *slave, const char *pkgname, struct packet *packet)
 {
-       struct command *command;
+    struct command *command;
 
-       command = calloc(1, sizeof(*command));
-       if (!command) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return NULL;
-       }
+    command = calloc(1, sizeof(*command));
+    if (!command) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
 
-       if (pkgname) {
-               command->pkgname = strdup(pkgname);
-               if (!command->pkgname) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       DbgFree(command);
-                       return NULL;
-               }
+    if (pkgname) {
+       command->pkgname = strdup(pkgname);
+       if (!command->pkgname) {
+           ErrPrint("Heap: %s\n", strerror(errno));
+           DbgFree(command);
+           return NULL;
        }
+    }
 
-       command->slave = slave_ref(slave); /*!< To prevent from destroying of the slave while communicating with the slave */
-       command->packet = packet_ref(packet);
-       command->ttl = DEFAULT_CMD_TTL;
+    command->slave = slave_ref(slave); /*!< To prevent from destroying of the slave while communicating with the slave */
+    command->packet = packet_ref(packet);
+    command->ttl = DEFAULT_CMD_TTL;
 
-       return command;
+    return command;
 }
 
 static inline void destroy_command(struct command *command)
 {
-       slave_unref(command->slave);
-       packet_unref(command->packet);
-       DbgFree(command->pkgname);
-       DbgFree(command);
+    slave_unref(command->slave);
+    packet_unref(command->packet);
+    DbgFree(command->pkgname);
+    DbgFree(command);
 }
 
 static inline struct command *pop_command(void)
 {
-       struct command *command;
+    struct command *command;
 
-       command = eina_list_nth(s_info.command_list, 0);
-       if (!command) {
-               return NULL;
-       }
+    command = eina_list_nth(s_info.command_list, 0);
+    if (!command) {
+       return NULL;
+    }
 
-       s_info.command_list = eina_list_remove(s_info.command_list, command);
-       return command;
+    s_info.command_list = eina_list_remove(s_info.command_list, command);
+    return command;
 }
 
 static int slave_async_cb(pid_t pid, int handle, const struct packet *packet, void *data)
 {
-       struct command *command = data;
-
-       if (!command) {
-               ErrPrint("Command is NIL\n");
-               return LB_STATUS_SUCCESS;
+    struct command *command = data;
+
+    if (!command) {
+       ErrPrint("Command is NIL\n");
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    /*!
+     * \note
+     * command->packet is not valid from here.
+     */
+    if (!slave_is_activated(command->slave)) {
+       ErrPrint("Slave is not activated (accidently dead)\n");
+       if (command->ret_cb) {
+           command->ret_cb(command->slave, packet, command->cbdata);
        }
+       goto out;
+    }
 
-       /*!
-        * \note
-        * command->packet is not valid from here.
-        */
-       if (!slave_is_activated(command->slave)) {
-               ErrPrint("Slave is not activated (accidently dead)\n");
-               if (command->ret_cb) {
-                       command->ret_cb(command->slave, packet, command->cbdata);
-               }
-               goto out;
+    if (!packet) {
+       DbgPrint("packet == NULL\n");
+       if (command->ret_cb) {
+           command->ret_cb(command->slave, packet, command->cbdata);
        }
 
-       if (!packet) {
-               DbgPrint("packet == NULL\n");
-               if (command->ret_cb) {
-                       command->ret_cb(command->slave, packet, command->cbdata);
-               }
-
-               /*
-                * \NOTE
-                * Slave will be deactivated from dead monitor if it lost its connections.
-                * So we don't need to care it again from here.
+       /*
+        * \NOTE
+        * Slave will be deactivated from dead monitor if it lost its connections.
+        * So we don't need to care it again from here.
 
-               command->slave = slave_deactivated_by_fault(command->slave);
+        command->slave = slave_deactivated_by_fault(command->slave);
 
-                */
-               goto out;
-       }
+        */
+       goto out;
+    }
 
-       if (command->ret_cb) {
-               command->ret_cb(command->slave, packet, command->cbdata);
-       }
+    if (command->ret_cb) {
+       command->ret_cb(command->slave, packet, command->cbdata);
+    }
 
 out:
-       destroy_command(command);
-       return LB_STATUS_SUCCESS;
+    destroy_command(command);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static Eina_Bool command_consumer_cb(void *data)
 {
-       struct command *command;
-       struct slave_rpc *rpc;
+    struct command *command;
+    struct slave_rpc *rpc;
 
-       command = pop_command();
-       if (!command) {
-               s_info.command_consuming_timer = NULL;
-               return ECORE_CALLBACK_CANCEL;
-       }
-
-       if (!slave_is_activated(command->slave)) {
-               ErrPrint("Slave is not activated: %s(%d)\n",
-                               slave_name(command->slave), slave_pid(command->slave));
-               goto errout;
-       }
-
-       if (command->pkgname) {
-               struct pkg_info *info;
-
-               info = package_find(command->pkgname);
-               if (info && package_is_fault(info)) {
-                       ErrPrint("info: %p (%s) is fault package\n", info, command->pkgname);
-                       // goto errout;
-               }
-       }
+    command = pop_command();
+    if (!command) {
+       s_info.command_consuming_timer = NULL;
+       return ECORE_CALLBACK_CANCEL;
+    }
 
-       rpc = slave_data(command->slave, "rpc");
-       if (!rpc || rpc->handle < 0) {
-               ErrPrint("Slave has no rpc info\n");
-               goto errout;
-       }
+    if (!slave_is_activated(command->slave)) {
+       ErrPrint("Slave is not activated: %s(%d)\n",
+               slave_name(command->slave), slave_pid(command->slave));
+       goto errout;
+    }
 
-       if (packet_type(command->packet) == PACKET_REQ_NOACK) {
-               if (com_core_packet_send_only(rpc->handle, command->packet) == 0) {
-                       /* Keep a slave alive, while processing events */
-                       slave_give_more_ttl(command->slave);
-                       destroy_command(command);
-                       return ECORE_CALLBACK_RENEW;
-               }
-       } else if (packet_type(command->packet) == PACKET_REQ) {
-               if (com_core_packet_async_send(rpc->handle, command->packet, 0.0f, slave_async_cb, command) == 0) {
-                       /* Keep a slave alive, while processing events */
-                       slave_give_more_ttl(command->slave);
-                       return ECORE_CALLBACK_RENEW;
-               }
-       }
+    if (command->pkgname) {
+       struct pkg_info *info;
 
-       /*!
-        * \WARN
-        * What happens at here?
-        * We are failed to send a packet!!!
-        * Let's try to send this again
-        */
-       /*!
-        * \todo
-        * Do we need to handle this error?
-        * Close current connection and make new one?
-        * how about pended command lists?
-        */
-       DbgPrint("Packet type: %d\n", packet_type(command->packet));
-       DbgPrint("Packet: %p\n", command->packet);
-       DbgPrint("Handle: %d\n", rpc->handle);
-       DbgPrint("PID: %d\n", slave_pid(command->slave));
-       DbgPrint("Name: %s\n", slave_name(command->slave));
-       DbgPrint("Package: %s\n", command->pkgname);
-       command->ttl--;
-       if (command->ttl == 0) {
-               DbgPrint("Discard packet (%d)\n", command->ttl);
-               destroy_command(command);
-       } else {
-               DbgPrint("Send again (%d)\n", command->ttl);
-               prepend_command(command);
-       }
-       return ECORE_CALLBACK_RENEW;
+       info = package_find(command->pkgname);
+       if (info && package_is_fault(info)) {
+           ErrPrint("info: %p (%s) is fault package\n", info, command->pkgname);
+           // goto errout;
+       }
+    }
+
+    rpc = slave_data(command->slave, "rpc");
+    if (!rpc || rpc->handle < 0) {
+       ErrPrint("Slave has no rpc info\n");
+       goto errout;
+    }
+
+    if (packet_type(command->packet) == PACKET_REQ_NOACK) {
+       if (com_core_packet_send_only(rpc->handle, command->packet) == 0) {
+           /* Keep a slave alive, while processing events */
+           slave_give_more_ttl(command->slave);
+           destroy_command(command);
+           return ECORE_CALLBACK_RENEW;
+       }
+    } else if (packet_type(command->packet) == PACKET_REQ) {
+       if (com_core_packet_async_send(rpc->handle, command->packet, 0.0f, slave_async_cb, command) == 0) {
+           /* Keep a slave alive, while processing events */
+           slave_give_more_ttl(command->slave);
+           return ECORE_CALLBACK_RENEW;
+       }
+    }
+
+    /*!
+     * \WARN
+     * What happens at here?
+     * We are failed to send a packet!!!
+     * Let's try to send this again
+     */
+    /*!
+     * \todo
+     * Do we need to handle this error?
+     * Close current connection and make new one?
+     * how about pended command lists?
+     */
+    DbgPrint("Packet type: %d\n", packet_type(command->packet));
+    DbgPrint("Packet: %p\n", command->packet);
+    DbgPrint("Handle: %d\n", rpc->handle);
+    DbgPrint("PID: %d\n", slave_pid(command->slave));
+    DbgPrint("Name: %s\n", slave_name(command->slave));
+    DbgPrint("Package: %s\n", command->pkgname);
+    command->ttl--;
+    if (command->ttl == 0) {
+       DbgPrint("Discard packet (%d)\n", command->ttl);
+       destroy_command(command);
+    } else {
+       DbgPrint("Send again (%d)\n", command->ttl);
+       prepend_command(command);
+    }
+    return ECORE_CALLBACK_RENEW;
 
 errout:
-       if (command->ret_cb) {
-               command->ret_cb(command->slave, NULL, command->cbdata);
-       }
+    if (command->ret_cb) {
+       command->ret_cb(command->slave, NULL, command->cbdata);
+    }
 
-       destroy_command(command);
-       return ECORE_CALLBACK_RENEW;
+    destroy_command(command);
+    return ECORE_CALLBACK_RENEW;
 }
 
-static inline void prepend_command(struct command *command)
+static void prepend_command(struct command *command)
 {
-       s_info.command_list = eina_list_prepend(s_info.command_list, command);
+    s_info.command_list = eina_list_prepend(s_info.command_list, command);
 
-       if (s_info.command_consuming_timer) {
-               return;
-       }
+    if (s_info.command_consuming_timer) {
+       return;
+    }
 
-       s_info.command_consuming_timer = ecore_timer_add(PACKET_TIME, command_consumer_cb, NULL);
-       if (!s_info.command_consuming_timer) {
-               ErrPrint("Failed to add command consumer\n");
-               s_info.command_list = eina_list_remove(s_info.command_list, command);
-               destroy_command(command);
-       }
+    s_info.command_consuming_timer = ecore_timer_add(DYNAMICBOX_CONF_PACKET_TIME, command_consumer_cb, NULL);
+    if (!s_info.command_consuming_timer) {
+       ErrPrint("Failed to add command consumer\n");
+       s_info.command_list = eina_list_remove(s_info.command_list, command);
+       destroy_command(command);
+    }
 }
 
-static inline void push_command(struct command *command)
+static void push_command(struct command *command)
 {
-       s_info.command_list = eina_list_append(s_info.command_list, command);
+    s_info.command_list = eina_list_append(s_info.command_list, command);
 
-       if (s_info.command_consuming_timer) {
-               return;
-       }
+    if (s_info.command_consuming_timer) {
+       return;
+    }
 
-       s_info.command_consuming_timer = ecore_timer_add(PACKET_TIME, command_consumer_cb, NULL);
-       if (!s_info.command_consuming_timer) {
-               ErrPrint("Failed to add command consumer\n");
-               s_info.command_list = eina_list_remove(s_info.command_list, command);
-               destroy_command(command);
-       }
+    s_info.command_consuming_timer = ecore_timer_add(DYNAMICBOX_CONF_PACKET_TIME, command_consumer_cb, NULL);
+    if (!s_info.command_consuming_timer) {
+       ErrPrint("Failed to add command consumer\n");
+       s_info.command_list = eina_list_remove(s_info.command_list, command);
+       destroy_command(command);
+    }
 }
 
 static int slave_deactivate_cb(struct slave_node *slave, void *data)
 {
-       struct slave_rpc *rpc;
-       struct command *command;
-       Eina_List *l;
-       Eina_List *n;
-
-       rpc = slave_data(slave, "rpc");
-       if (!rpc) {
-               /*!
-                * \note
-                * Return negative value will remove this callback from the event list of the slave
-                */
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       if (rpc->pong_timer) {
-               ecore_timer_del(rpc->pong_timer);
-               rpc->pong_timer = NULL;
-       } else {
-               ErrPrint("slave has no pong timer\n");
-       }
-
-       if (rpc->handle < 0) {
-               EINA_LIST_FREE(rpc->pending_list, command) {
-                       assert(command->slave == slave);
-                       if (command->ret_cb) {
-                               command->ret_cb(command->slave, NULL, command->cbdata);
-                       }
-                       destroy_command(command);
-               }
-       } else {
-               EINA_LIST_FOREACH_SAFE(s_info.command_list, l, n, command) {
-                       if (command->slave == slave) {
-                               s_info.command_list = eina_list_remove(s_info.command_list, command);
-                               if (command->ret_cb) {
-                                       command->ret_cb(command->slave, NULL, command->cbdata);
-                               }
-                               destroy_command(command);
-                       }
-               }
-       }
+    struct slave_rpc *rpc;
+    struct command *command;
+    Eina_List *l;
+    Eina_List *n;
 
+    rpc = slave_data(slave, "rpc");
+    if (!rpc) {
        /*!
         * \note
-        * Reset handle
+        * Return negative value will remove this callback from the event list of the slave
         */
-       DbgPrint("Reset handle for %d (%d)\n", slave_pid(slave), rpc->handle);
-       rpc->handle = -1;
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       /*!
-        * \todo
-        * Make statistics table
-        */
-       rpc->ping_count = 0;
-       rpc->next_ping_count = 1;
-       return LB_STATUS_SUCCESS;
+    if (rpc->pong_timer) {
+       ecore_timer_del(rpc->pong_timer);
+       rpc->pong_timer = NULL;
+    } else {
+       ErrPrint("slave has no pong timer\n");
+    }
+
+    if (rpc->handle < 0) {
+       EINA_LIST_FREE(rpc->pending_list, command) {
+           assert(command->slave == slave);
+           if (command->ret_cb) {
+               command->ret_cb(command->slave, NULL, command->cbdata);
+           }
+           destroy_command(command);
+       }
+    } else {
+       EINA_LIST_FOREACH_SAFE(s_info.command_list, l, n, command) {
+           if (command->slave == slave) {
+               s_info.command_list = eina_list_remove(s_info.command_list, command);
+               if (command->ret_cb) {
+                   command->ret_cb(command->slave, NULL, command->cbdata);
+               }
+               destroy_command(command);
+           }
+       }
+    }
+
+    /*!
+     * \note
+     * Reset handle
+     */
+    DbgPrint("Reset handle for %d (%d)\n", slave_pid(slave), rpc->handle);
+    rpc->handle = -1;
+
+    /*!
+     * \todo
+     * Make statistics table
+     */
+    rpc->ping_count = 0;
+    rpc->next_ping_count = 1;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static Eina_Bool ping_timeout_cb(void *data)
 {
-       struct slave_rpc *rpc;
-       struct slave_node *slave = data;
-
-       rpc = slave_data(slave, "rpc");
-       if (!rpc) {
-               ErrPrint("Slave RPC is not valid (%s)\n", slave_name(slave));
-               return ECORE_CALLBACK_CANCEL;
-       }
-
-       /*!
-        * \note
-        * Clear the pong_timer
-        */
-       rpc->pong_timer = NULL;
+    struct slave_rpc *rpc;
+    struct slave_node *slave = data;
 
-       if (!slave_is_activated(slave)) {
-               ErrPrint("Slave is not activated (%s)\n", slave_name(slave));
-               return ECORE_CALLBACK_CANCEL;
-       }
+    rpc = slave_data(slave, "rpc");
+    if (!rpc) {
+       ErrPrint("Slave RPC is not valid (%s)\n", slave_name(slave));
+       return ECORE_CALLBACK_CANCEL;
+    }
 
-       /*!
-        * Dead callback will handling this
-        */
-       DbgPrint("Slave PING TIMEOUT: %s(%d) : %p\n", slave_name(slave), slave_pid(slave), slave);
-       slave = slave_deactivated_by_fault(slave);
-       if (!slave) {
-               DbgPrint("Slave is deleted\n");
-       }
+    /*!
+     * \note
+     * Clear the pong_timer
+     */
+    rpc->pong_timer = NULL;
 
+    if (!slave_is_activated(slave)) {
+       ErrPrint("Slave is not activated (%s)\n", slave_name(slave));
        return ECORE_CALLBACK_CANCEL;
+    }
+
+    /*!
+     * Dead callback will handling this
+     */
+    DbgPrint("Slave PING TIMEOUT: %s(%d) : %p\n", slave_name(slave), slave_pid(slave), slave);
+    slave = slave_deactivated_by_fault(slave);
+    if (!slave) {
+       DbgPrint("Slave is deleted\n");
+    }
+
+    return ECORE_CALLBACK_CANCEL;
 }
 
 HAPI int slave_rpc_async_request(struct slave_node *slave, const char *pkgname, struct packet *packet, void (*ret_cb)(struct slave_node *slave, const struct packet *packet, void *data), void *data, int urgent)
 {
-       struct command *command;
-       struct slave_rpc *rpc;
+    struct command *command;
+    struct slave_rpc *rpc;
 
-       command = create_command(slave, pkgname, packet);
-       if (!command) {
-               ErrPrint("Failed to create command\n");
+    command = create_command(slave, pkgname, packet);
+    if (!command) {
+       ErrPrint("Failed to create command\n");
 
-               if (ret_cb) {
-                       ret_cb(slave, NULL, data);
-               }
-
-               packet_unref(packet);
-               return LB_STATUS_ERROR_MEMORY;
+       if (ret_cb) {
+           ret_cb(slave, NULL, data);
        }
 
-       command->ret_cb = ret_cb;
-       command->cbdata = data;
        packet_unref(packet);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       rpc = slave_data(slave, "rpc");
-       if (!rpc) {
-               ErrPrint("Slave has no RPC\n");
-               if (ret_cb) {
-                       ret_cb(slave, NULL, data);
-               }
-               destroy_command(command);
-               return LB_STATUS_ERROR_FAULT;
-       }
+    command->ret_cb = ret_cb;
+    command->cbdata = data;
+    packet_unref(packet);
 
-       if (rpc->handle < 0) {
-               DbgPrint("RPC handle is not ready to use it\n");
-               if (((slave_control_option(slave) & PROVIDER_CTRL_MANUAL_REACTIVATION) == PROVIDER_CTRL_MANUAL_REACTIVATION || slave_is_secured(slave))
-                        && !slave_is_activated(slave))
-               {
-                       int ret;
-                       DbgPrint("Activate slave forcely\n");
-                       ret = slave_activate(slave);
-                       if (ret < 0 && ret != LB_STATUS_ERROR_ALREADY) {
-
-                               if (ret_cb) {
-                                       ret_cb(slave, NULL, data);
-                               }
-
-                               destroy_command(command);
-                               return ret;
-                       }
-               }
+    rpc = slave_data(slave, "rpc");
+    if (!rpc) {
+       ErrPrint("Slave has no RPC\n");
+       if (ret_cb) {
+           ret_cb(slave, NULL, data);
+       }
+       destroy_command(command);
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    if (rpc->handle < 0) {
+       DbgPrint("RPC handle is not ready to use it\n");
+       if (((slave_control_option(slave) & PROVIDER_CTRL_MANUAL_REACTIVATION) == PROVIDER_CTRL_MANUAL_REACTIVATION || slave_is_secured(slave))
+               && !slave_is_activated(slave))
+       {
+           int ret;
+           DbgPrint("Activate slave forcely\n");
+           ret = slave_activate(slave);
+           if (ret < 0 && ret != DBOX_STATUS_ERROR_ALREADY) {
 
-               if (urgent) {
-                       rpc->pending_list = eina_list_prepend(rpc->pending_list, command);
-               } else {
-                       rpc->pending_list = eina_list_append(rpc->pending_list, command);
+               if (ret_cb) {
+                   ret_cb(slave, NULL, data);
                }
 
-               return LB_STATUS_SUCCESS;
+               destroy_command(command);
+               return ret;
+           }
        }
 
        if (urgent) {
-               prepend_command(command);
+           rpc->pending_list = eina_list_prepend(rpc->pending_list, command);
        } else {
-               push_command(command);
+           rpc->pending_list = eina_list_append(rpc->pending_list, command);
        }
 
-       return LB_STATUS_SUCCESS;
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    if (urgent) {
+       prepend_command(command);
+    } else {
+       push_command(command);
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int slave_rpc_request_only(struct slave_node *slave, const char *pkgname, struct packet *packet, int urgent)
 {
-       struct command *command;
-       struct slave_rpc *rpc;
-
-       command = create_command(slave, pkgname, packet);
-       if (!command) {
-               ErrPrint("Failed to create a command\n");
-               packet_unref(packet);
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    struct command *command;
+    struct slave_rpc *rpc;
 
-       command->ret_cb = NULL;
-       command->cbdata = NULL;
+    command = create_command(slave, pkgname, packet);
+    if (!command) {
+       ErrPrint("Failed to create a command\n");
        packet_unref(packet);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       rpc = slave_data(slave, "rpc");
-       if (!rpc) {
-               ErrPrint("Slave has no RPC\n");
-               destroy_command(command);
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       if (rpc->handle < 0) {
-               DbgPrint("RPC handle is not ready to use it\n");
-               if (((slave_control_option(slave) & PROVIDER_CTRL_MANUAL_REACTIVATION) == PROVIDER_CTRL_MANUAL_REACTIVATION || slave_is_secured(slave))
-                        && !slave_is_activated(slave))
-                {
-                       int ret;
-
-                       DbgPrint("Activate slave forcely\n");
-                       ret = slave_activate(slave);
-                       if (ret < 0 && ret != LB_STATUS_ERROR_ALREADY) {
-                               destroy_command(command);
-                               return ret;
-                       }
-               }
+    command->ret_cb = NULL;
+    command->cbdata = NULL;
+    packet_unref(packet);
 
-               if (urgent) {
-                       rpc->pending_list = eina_list_prepend(rpc->pending_list, command);
-               } else {
-                       rpc->pending_list = eina_list_append(rpc->pending_list, command);
-               }
-
-               return LB_STATUS_SUCCESS;
+    rpc = slave_data(slave, "rpc");
+    if (!rpc) {
+       ErrPrint("Slave has no RPC\n");
+       destroy_command(command);
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    if (rpc->handle < 0) {
+       DbgPrint("RPC handle is not ready to use it\n");
+       if (((slave_control_option(slave) & PROVIDER_CTRL_MANUAL_REACTIVATION) == PROVIDER_CTRL_MANUAL_REACTIVATION || slave_is_secured(slave))
+               && !slave_is_activated(slave))
+       {
+           int ret;
+
+           DbgPrint("Activate slave forcely\n");
+           ret = slave_activate(slave);
+           if (ret < 0 && ret != DBOX_STATUS_ERROR_ALREADY) {
+               destroy_command(command);
+               return ret;
+           }
        }
 
        if (urgent) {
-               prepend_command(command);
+           rpc->pending_list = eina_list_prepend(rpc->pending_list, command);
        } else {
-               push_command(command);
+           rpc->pending_list = eina_list_append(rpc->pending_list, command);
        }
 
-       return LB_STATUS_SUCCESS;
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    if (urgent) {
+       prepend_command(command);
+    } else {
+       push_command(command);
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int slave_rpc_update_handle(struct slave_node *slave, int handle)
 {
-       struct slave_rpc *rpc;
-       struct command *command;
-
-       rpc = slave_data(slave, "rpc");
-       if (!rpc) {
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       DbgPrint("SLAVE: New handle assigned for %d, %d\n", slave_pid(slave), handle);
-       rpc->handle = handle;
-       if (rpc->pong_timer) {
-               ecore_timer_del(rpc->pong_timer);
-       }
-
-       rpc->pong_timer = ecore_timer_add(DEFAULT_PING_TIME, ping_timeout_cb, slave);
-       if (!rpc->pong_timer) {
-               ErrPrint("Failed to add ping timer\n");
-       }
-
-       /*!
-        * \note
-        * slave_activated will call the activated callback.
-        * activated callback will try to recover the normal instances state.
-        * so the reset_fault should be called after slave_activated function.
-        */
-       slave_activated(slave);
-
-       EINA_LIST_FREE(rpc->pending_list, command) {
-               push_command(command);
-       }
-
-       return LB_STATUS_SUCCESS;
+    struct slave_rpc *rpc;
+    struct command *command;
+
+    rpc = slave_data(slave, "rpc");
+    if (!rpc) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    DbgPrint("SLAVE: New handle assigned for %d, %d\n", slave_pid(slave), handle);
+    rpc->handle = handle;
+    if (rpc->pong_timer) {
+       ecore_timer_del(rpc->pong_timer);
+    }
+
+    rpc->pong_timer = ecore_timer_add(DYNAMICBOX_CONF_DEFAULT_PING_TIME, ping_timeout_cb, slave);
+    if (!rpc->pong_timer) {
+       ErrPrint("Failed to add ping timer\n");
+    }
+
+    /*!
+     * \note
+     * slave_activated will call the activated callback.
+     * activated callback will try to recover the normal instances state.
+     * so the reset_fault should be called after slave_activated function.
+     */
+    slave_activated(slave);
+
+    EINA_LIST_FREE(rpc->pending_list, command) {
+       push_command(command);
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int slave_rpc_init(struct slave_node *slave)
 {
-       struct slave_rpc *rpc;
+    struct slave_rpc *rpc;
 
-       rpc = calloc(1, sizeof(*rpc));
-       if (!rpc) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    rpc = calloc(1, sizeof(*rpc));
+    if (!rpc) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       if (slave_set_data(slave, "rpc", rpc) < 0) {
-               DbgFree(rpc);
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    if (slave_set_data(slave, "rpc", rpc) < 0) {
+       DbgFree(rpc);
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       if (slave_event_callback_add(slave, SLAVE_EVENT_DEACTIVATE, slave_deactivate_cb, NULL) < 0) {
-               ErrPrint("Failed to add event callback\n");
-       }
+    if (slave_event_callback_add(slave, SLAVE_EVENT_DEACTIVATE, slave_deactivate_cb, NULL) < 0) {
+       ErrPrint("Failed to add event callback\n");
+    }
 
-       rpc->ping_count = 0;
-       rpc->next_ping_count = 1;
-       rpc->handle = -1;
+    rpc->ping_count = 0;
+    rpc->next_ping_count = 1;
+    rpc->handle = -1;
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int slave_rpc_fini(struct slave_node *slave)
 {
-       struct slave_rpc *rpc;
+    struct slave_rpc *rpc;
 
-       rpc = slave_del_data(slave, "rpc");
-       if (!rpc) {
-               return LB_STATUS_ERROR_INVALID;
-       }
+    rpc = slave_del_data(slave, "rpc");
+    if (!rpc) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       slave_event_callback_del(slave, SLAVE_EVENT_DEACTIVATE, slave_deactivate_cb, NULL);
+    slave_event_callback_del(slave, SLAVE_EVENT_DEACTIVATE, slave_deactivate_cb, NULL);
 
-       if (rpc->pong_timer) {
-               ecore_timer_del(rpc->pong_timer);
-       }
+    if (rpc->pong_timer) {
+       ecore_timer_del(rpc->pong_timer);
+    }
 
-       DbgFree(rpc);
-       return LB_STATUS_SUCCESS;
+    DbgFree(rpc);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int slave_rpc_ping(struct slave_node *slave)
 {
-       struct slave_rpc *rpc;
-
-       rpc = slave_data(slave, "rpc");
-       if (!rpc) {
-               ErrPrint("Slave RPC is not valid\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       if (!slave_is_activated(slave)) {
-               ErrPrint("Slave is not activated\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       rpc->ping_count++;
-       if (rpc->ping_count != rpc->next_ping_count) {
-               ErrPrint("Ping count is not correct\n");
-               rpc->next_ping_count = rpc->ping_count;
-       }
-       rpc->next_ping_count++;
-
-       ecore_timer_reset(rpc->pong_timer);
-       return LB_STATUS_SUCCESS;
+    struct slave_rpc *rpc;
+
+    rpc = slave_data(slave, "rpc");
+    if (!rpc) {
+       ErrPrint("Slave RPC is not valid\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    if (!slave_is_activated(slave)) {
+       ErrPrint("Slave is not activated\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    rpc->ping_count++;
+    if (rpc->ping_count != rpc->next_ping_count) {
+       ErrPrint("Ping count is not correct\n");
+       rpc->next_ping_count = rpc->ping_count;
+    }
+    rpc->next_ping_count++;
+
+    ecore_timer_reset(rpc->pong_timer);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int slave_rpc_ping_freeze(struct slave_node *slave)
 {
-       struct slave_rpc *rpc;
+    struct slave_rpc *rpc;
 
-       rpc = slave_data(slave, "rpc");
-       if (!rpc) {
-               ErrPrint("Slave RPC is not valid\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    rpc = slave_data(slave, "rpc");
+    if (!rpc) {
+       ErrPrint("Slave RPC is not valid\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (!slave_is_activated(slave)) {
-               ErrPrint("Slave is not activated\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (!slave_is_activated(slave)) {
+       ErrPrint("Slave is not activated\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       ecore_timer_freeze(rpc->pong_timer);
-       return LB_STATUS_SUCCESS;
+    ecore_timer_freeze(rpc->pong_timer);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int slave_rpc_ping_thaw(struct slave_node *slave)
 {
-       struct slave_rpc *rpc;
+    struct slave_rpc *rpc;
 
-       rpc = slave_data(slave, "rpc");
-       if (!rpc) {
-               ErrPrint("Slave RPC is not valid\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    rpc = slave_data(slave, "rpc");
+    if (!rpc) {
+       ErrPrint("Slave RPC is not valid\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (!slave_is_activated(slave)) {
-               ErrPrint("Slave is not activated\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (!slave_is_activated(slave)) {
+       ErrPrint("Slave is not activated\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       ecore_timer_thaw(rpc->pong_timer);
-       return LB_STATUS_SUCCESS;
+    ecore_timer_thaw(rpc->pong_timer);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI void slave_rpc_request_update(const char *pkgname, const char *id, const char *cluster, const char *category, const char *content, int force)
 {
-       struct slave_node *slave;
-       struct pkg_info *info;
-       struct packet *packet;
-
-       info = package_find(pkgname);
-       if (!info) {
-               ErrPrint("Failed to find a package\n");
-               return;
-       }
-
-       slave = package_slave(info);
-       if (!slave) {
-               ErrPrint("Failed to find a slave for %s\n", pkgname);
-               return;
-       }
-
-       packet = packet_create_noack("update_content", "sssssi", pkgname, id, cluster, category, content, force);
-       if (!packet) {
-               ErrPrint("Failed to create a new param\n");
-               return;
-       }
-
-       (void)slave_rpc_request_only(slave, pkgname, packet, 0);
+    struct slave_node *slave;
+    struct pkg_info *info;
+    struct packet *packet;
+    unsigned int cmd = CMD_UPDATE_CONTENT;
+
+    info = package_find(pkgname);
+    if (!info) {
+       ErrPrint("Failed to find a package\n");
+       return;
+    }
+
+    slave = package_slave(info);
+    if (!slave) {
+       ErrPrint("Failed to find a slave for %s\n", pkgname);
+       return;
+    }
+
+    packet = packet_create_noack((const char *)&cmd, "sssssi", pkgname, id, cluster, category, content, force);
+    if (!packet) {
+       ErrPrint("Failed to create a new param\n");
+       return;
+    }
+
+    (void)slave_rpc_request_only(slave, pkgname, packet, 0);
 }
 
 HAPI int slave_rpc_handle(struct slave_node *slave)
 {
-       struct slave_rpc *rpc;
+    struct slave_rpc *rpc;
 
-       rpc = slave_data(slave, "rpc");
-       if (!rpc) {
-               DbgPrint("Slave RPC is not initiated\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+    rpc = slave_data(slave, "rpc");
+    if (!rpc) {
+       DbgPrint("Slave RPC is not initiated\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       return rpc->handle;
+    return rpc->handle;
 }
 
 HAPI int slave_rpc_disconnect(struct slave_node *slave)
 {
-       struct packet *packet;
+    struct packet *packet;
+    unsigned int cmd = CMD_DISCONNECT;
 
-       packet = packet_create_noack("disconnect", "d", util_timestamp());
-       if (!packet) {
-               ErrPrint("Failed to create a packet\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
+    packet = packet_create_noack((const char *)&cmd, "d", util_timestamp());
+    if (!packet) {
+       ErrPrint("Failed to create a packet\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       DbgPrint("Send disconnection request packet\n");
-       return slave_rpc_request_only(slave, NULL, packet, 0);
+    DbgPrint("Send disconnection request packet\n");
+    return slave_rpc_request_only(slave, NULL, packet, 0);
 }
 
 /* End of a file */
index 7c95b1c..ecac445 100644 (file)
 #include <Eina.h>
 #include <Ecore.h>
 #if defined(HAVE_LIVEBOX)
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
+#include <dynamicbox_conf.h>
 #else
 #include "lite-errno.h"
+#define DYNAMICBOX_CONF_IMAGE_PATH "/tmp/"
 #endif
 
 #include "util.h"
 #include "conf.h"
 
 static struct info {
-       int emergency_mounted;
+    int emergency_mounted;
 } s_info = {
-       .emergency_mounted = 0,
+    .emergency_mounted = 0,
 };
 
 int errno;
 
 HAPI unsigned long util_string_hash(const char *str)
 {
-       unsigned long ret = 0;
+    unsigned long ret = 0;
 
-       while (*str) {
-               ret += (unsigned long)(*str++);
-       }
+    while (*str) {
+       ret += (unsigned long)(*str++);
+    }
 
-       ret %= 371773;
-       return ret;
+    ret %= 371773;
+    return ret;
 }
 
 HAPI double util_timestamp(void)
 {
 #if defined(_USE_ECORE_TIME_GET)
-       return ecore_time_get();
+    return ecore_time_get();
 #else
-       struct timeval tv;
-       if (gettimeofday(&tv, NULL) < 0) {
-               static unsigned long internal_count = 0;
-               ErrPrint("failed to get time of day: %s\n", strerror(errno));
-               tv.tv_sec = internal_count++;
-               tv.tv_usec = 0;
-       }
-
-       return (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0f;
+    struct timeval tv;
+    if (gettimeofday(&tv, NULL) < 0) {
+       static unsigned long internal_count = 0;
+       ErrPrint("failed to get time of day: %s\n", strerror(errno));
+       tv.tv_sec = internal_count++;
+       tv.tv_usec = 0;
+    }
+
+    return (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0f;
 #endif
 }
 
 HAPI int util_check_ext(const char *filename, const char *check_ptr)
 {
-       int name_len;
-
-       name_len = strlen(filename);
-       while (--name_len >= 0 && *check_ptr) {
-               if (filename[name_len] != *check_ptr) {
-                       return LB_STATUS_ERROR_INVALID;
-               }
-
-               check_ptr ++;
-       }
-
-       return LB_STATUS_SUCCESS;
-}
-
-static inline int check_native_livebox(const char *pkgname)
-{
-       int len;
-       char *path;
-
-       len = strlen(pkgname) * 2;
-       len += strlen(ROOT_PATH);
-       len += strlen("%s/libexec/liblive-%s.so");
-
-       path = malloc(len + 1);
-       if (!path) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       snprintf(path, len, "%s%s/libexec/liblive-%s.so", ROOT_PATH, pkgname, pkgname);
-       if (access(path, F_OK | R_OK) != 0) {
-               ErrPrint("%s is not a valid package\n", pkgname);
-               DbgFree(path);
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       DbgFree(path);
-       return LB_STATUS_SUCCESS;
-}
-
-static inline int check_web_livebox(const char *pkgname)
-{
-       int len;
-       char *path;
-
-       len = strlen(pkgname) * 2;
-       len += strlen("/opt/usr/apps/%s/res/wgt/livebox/index.html");
-
-       path = malloc(len + 1);
-       if (!path) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       snprintf(path, len, "/opt/usr/apps/%s/res/wgt/livebox/index.html", pkgname);
-       if (access(path, F_OK | R_OK) != 0) {
-               ErrPrint("%s is not a valid package\n", pkgname);
-               DbgFree(path);
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       DbgFree(path);
-       return LB_STATUS_SUCCESS;
-}
+    int name_len;
 
-HAPI int util_validate_livebox_package(const char *pkgname)
-{
-       if (!pkgname) {
-               ErrPrint("Invalid argument\n");
-               return LB_STATUS_ERROR_INVALID;
+    name_len = strlen(filename);
+    while (--name_len >= 0 && *check_ptr) {
+       if (filename[name_len] != *check_ptr) {
+           return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
 
-       if (!check_native_livebox(pkgname) || !check_web_livebox(pkgname)) {
-               return LB_STATUS_SUCCESS;
-       }
+       check_ptr ++;
+    }
 
-       return LB_STATUS_ERROR_INVALID;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int util_unlink(const char *filename)
 {
-       char *descfile;
-       int desclen;
-       int ret;
-
-       if (!filename) {
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       desclen = strlen(filename) + 6; /* .desc */
-       descfile = malloc(desclen);
-       if (!descfile) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       ret = snprintf(descfile, desclen, "%s.desc", filename);
-       if (ret < 0) {
-               ErrPrint("Error: %s\n", strerror(errno));
-               DbgFree(descfile);
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       (void)unlink(descfile);
+    char *descfile;
+    int desclen;
+    int ret;
+
+    if (!filename) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    desclen = strlen(filename) + 6; /* .desc */
+    descfile = malloc(desclen);
+    if (!descfile) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    ret = snprintf(descfile, desclen, "%s.desc", filename);
+    if (ret < 0) {
+       ErrPrint("Error: %s\n", strerror(errno));
        DbgFree(descfile);
-       (void)unlink(filename);
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       return LB_STATUS_SUCCESS;
+    (void)unlink(descfile);
+    DbgFree(descfile);
+    (void)unlink(filename);
+
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI char *util_slavename(void)
 {
-       char slavename[BUFSIZ];
-       static unsigned long idx = 0;
+    char slavename[BUFSIZ];
+    static unsigned long idx = 0;
 
-       snprintf(slavename, sizeof(slavename), "%lu_%lf", idx++, util_timestamp());
-       return strdup(slavename);
+    snprintf(slavename, sizeof(slavename), "%lu_%lf", idx++, util_timestamp());
+    return strdup(slavename);
 }
 
 HAPI const char *util_basename(const char *name)
 {
-       int length;
-       length = name ? strlen(name) : 0;
-       if (!length) {
-               return ".";
-       }
+    int length;
+    length = name ? strlen(name) : 0;
+    if (!length) {
+       return ".";
+    }
 
-       while (--length > 0 && name[length] != '/');
+    while (--length > 0 && name[length] != '/');
 
-       return length <= 0 ? name : (name + length + (name[length] == '/'));
+    return length <= 0 ? name : (name + length + (name[length] == '/'));
 }
 
 /*!
@@ -219,514 +156,512 @@ HAPI const char *util_basename(const char *name)
  */
 HAPI unsigned long long util_free_space(const char *path)
 {
-       struct statvfs st;
-       unsigned long long space;
-
-       if (statvfs(path, &st) < 0) {
-               ErrPrint("statvfs: %s\n", strerror(errno));
-               return 0lu;
-       }
-
-       space = (unsigned long long)st.f_bsize * (unsigned long long)st.f_bavail;
-       DbgPrint("Available size: %llu, f_bsize: %lu, f_bavail: %lu\n", space, st.f_bsize, st.f_bavail);
-       /*!
-        * \note
-        * Must have to check the overflow
-        */
-
-       return space;
+    struct statvfs st;
+    unsigned long long space;
+
+    if (statvfs(path, &st) < 0) {
+       ErrPrint("statvfs: %s\n", strerror(errno));
+       return 0lu;
+    }
+
+    space = (unsigned long long)st.f_bsize * (unsigned long long)st.f_bavail;
+    DbgPrint("Available size: %llu, f_bsize: %lu, f_bavail: %lu\n", space, st.f_bsize, st.f_bavail);
+    /*!
+     * \note
+     * Must have to check the overflow
+     */
+
+    return space;
 }
 
 static inline char *extend_heap(char *buffer, int *sz, int incsz)
 {
-       char *tmp;
+    char *tmp;
 
-       *sz += incsz;
-       tmp = realloc(buffer, *sz);
-       if (!tmp) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return NULL;
-       }
+    *sz += incsz;
+    tmp = realloc(buffer, *sz);
+    if (!tmp) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
 
-       return tmp;
+    return tmp;
 }
 
 HAPI char *util_replace_string(const char *src, const char *pattern, const char *replace)
 {
-       const char *ptr;
-       char *tmp;
-       char *ret = NULL;
-       int idx = 0;
-       int out_idx;
-       int out_sz;
-       enum {
-               STATE_START,
-               STATE_FIND,
-               STATE_CHECK,
-               STATE_END
-       } state;
-
-       if (!src || !pattern) {
-               return NULL;
-       }
-
-       out_sz = strlen(src);
-       ret = strdup(src);
-       if (!ret) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return NULL;
-       }
-
-       out_idx = 0;
-       for (state = STATE_START, ptr = src; state != STATE_END; ptr++) {
-               switch (state) {
-               case STATE_START:
-                       if (*ptr == '\0') {
-                               state = STATE_END;
-                       } else if (!isblank(*ptr)) {
-                               state = STATE_FIND;
-                               ptr--;
+    const char *ptr;
+    char *tmp;
+    char *ret = NULL;
+    int idx = 0;
+    int out_idx;
+    int out_sz;
+    enum {
+       STATE_START,
+       STATE_FIND,
+       STATE_CHECK,
+       STATE_END
+    } state;
+
+    if (!src || !pattern) {
+       return NULL;
+    }
+
+    out_sz = strlen(src);
+    ret = strdup(src);
+    if (!ret) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return NULL;
+    }
+
+    out_idx = 0;
+    for (state = STATE_START, ptr = src; state != STATE_END; ptr++) {
+       switch (state) {
+           case STATE_START:
+               if (*ptr == '\0') {
+                   state = STATE_END;
+               } else if (!isblank(*ptr)) {
+                   state = STATE_FIND;
+                   ptr--;
+               }
+               break;
+           case STATE_FIND:
+               if (*ptr == '\0') {
+                   state = STATE_END;
+               } else if (*ptr == *pattern) {
+                   state = STATE_CHECK;
+                   ptr--;
+                   idx = 0;
+               } else {
+                   ret[out_idx] = *ptr;
+                   out_idx++;
+                   if (out_idx == out_sz) {
+                       tmp = extend_heap(ret, &out_sz, strlen(replace) + 1);
+                       if (!tmp) {
+                           DbgFree(ret);
+                           return NULL;
                        }
-                       break;
-               case STATE_FIND:
-                       if (*ptr == '\0') {
-                               state = STATE_END;
-                       } else if (*ptr == *pattern) {
-                               state = STATE_CHECK;
-                               ptr--;
-                               idx = 0;
-                       } else {
-                               ret[out_idx] = *ptr;
-                               out_idx++;
-                               if (out_idx == out_sz) {
-                                       tmp = extend_heap(ret, &out_sz, strlen(replace) + 1);
-                                       if (!tmp) {
-                                               DbgFree(ret);
-                                               return NULL;
-                                       }
-                                       ret = tmp;
-                               }
+                       ret = tmp;
+                   }
+               }
+               break;
+           case STATE_CHECK:
+               if (!pattern[idx]) {
+                   /*!
+                    * If there is no space for copying the replacement,
+                    * Extend size of the return buffer.
+                    */
+                   if (out_sz - out_idx < strlen(replace) + 1) {
+                       tmp = extend_heap(ret, &out_sz, strlen(replace) + 1);
+                       if (!tmp) {
+                           DbgFree(ret);
+                           return NULL;
                        }
-                       break;
-               case STATE_CHECK:
-                       if (!pattern[idx]) {
-                               /*!
-                                * If there is no space for copying the replacement,
-                                * Extend size of the return buffer.
-                                */
-                               if (out_sz - out_idx < strlen(replace) + 1) {
-                                       tmp = extend_heap(ret, &out_sz, strlen(replace) + 1);
-                                       if (!tmp) {
-                                               DbgFree(ret);
-                                               return NULL;
-                                       }
-                                       ret = tmp;
-                               }
-
-                               strcpy(ret + out_idx, replace);
-                               out_idx += strlen(replace);
-
-                               state = STATE_FIND;
-                               ptr--;
-                       } else if (*ptr != pattern[idx]) {
-                               ptr -= idx;
-
-                               /* Copy the first matched character */
-                               ret[out_idx] = *ptr;
-                               out_idx++;
-                               if (out_idx == out_sz) {
-                                       tmp = extend_heap(ret, &out_sz, strlen(replace) + 1);
-                                       if (!tmp) {
-                                               DbgFree(ret);
-                                               return NULL;
-                                       }
-
-                                       ret = tmp;
-                               }
-
-                               state = STATE_FIND;
-                       } else {
-                               idx++;
+                       ret = tmp;
+                   }
+
+                   strcpy(ret + out_idx, replace);
+                   out_idx += strlen(replace);
+
+                   state = STATE_FIND;
+                   ptr--;
+               } else if (*ptr != pattern[idx]) {
+                   ptr -= idx;
+
+                   /* Copy the first matched character */
+                   ret[out_idx] = *ptr;
+                   out_idx++;
+                   if (out_idx == out_sz) {
+                       tmp = extend_heap(ret, &out_sz, strlen(replace) + 1);
+                       if (!tmp) {
+                           DbgFree(ret);
+                           return NULL;
                        }
-                       break;
-               default:
-                       break;
+
+                       ret = tmp;
+                   }
+
+                   state = STATE_FIND;
+               } else {
+                   idx++;
                }
+               break;
+           default:
+               break;
        }
+    }
 
-       return ret;
+    return ret;
 }
 
 HAPI const char *util_uri_to_path(const char *uri)
 {
-       int len;
+    int len;
 
-       len = strlen(SCHEMA_FILE);
-       if (strncasecmp(uri, SCHEMA_FILE, len)) {
-               return NULL;
-       }
+    len = strlen(SCHEMA_FILE);
+    if (strncasecmp(uri, SCHEMA_FILE, len)) {
+       return NULL;
+    }
 
-       return uri + len;
+    return uri + len;
 }
 
 HAPI double util_time_delay_for_compensation(double period)
 {
-       unsigned long long curtime;
-       unsigned long long _period;
-       unsigned long long remain;
-       struct timeval tv;
-       double ret;
-
-       if (period == 0.0f) {
-               DbgPrint("Period is ZERO\n");
-               return 0.0f;
-       }
-
-       if (gettimeofday(&tv, NULL) < 0){
-               ErrPrint("gettimeofday: %s\n", strerror(errno));
-               return period;
-       }
-
-       curtime = (unsigned long long)tv.tv_sec * 1000000llu + (unsigned long long)tv.tv_usec;
-
-       _period = (unsigned long long)(period * (double)1000000);
-       if (_period == 0llu) {
-               ErrPrint("%lf <> %llu\n", period, _period);
-               return period;
-       }
-
-       remain = curtime % _period;
-
-       ret = (double)remain / (double)1000000;
-       return period - ret;
+    unsigned long long curtime;
+    unsigned long long _period;
+    unsigned long long remain;
+    struct timeval tv;
+    double ret;
+
+    if (period == 0.0f) {
+       DbgPrint("Period is ZERO\n");
+       return 0.0f;
+    }
+
+    if (gettimeofday(&tv, NULL) < 0){
+       ErrPrint("gettimeofday: %s\n", strerror(errno));
+       return period;
+    }
+
+    curtime = (unsigned long long)tv.tv_sec * 1000000llu + (unsigned long long)tv.tv_usec;
+
+    _period = (unsigned long long)(period * (double)1000000);
+    if (_period == 0llu) {
+       ErrPrint("%lf <> %llu\n", period, _period);
+       return period;
+    }
+
+    remain = curtime % _period;
+
+    ret = (double)remain / (double)1000000;
+    return period - ret;
 }
 
 HAPI void *util_timer_add(double interval, Eina_Bool (*cb)(void *data), void *data)
 {
-       Ecore_Timer *timer;
-       double delay;
+    Ecore_Timer *timer;
+    double delay;
 
-       timer = ecore_timer_add(interval, cb, data);
-       if (!timer) {
-               return NULL;
-       }
+    timer = ecore_timer_add(interval, cb, data);
+    if (!timer) {
+       return NULL;
+    }
 
-       delay = util_time_delay_for_compensation(interval) - interval;
-       ecore_timer_delay(timer, delay);
-       DbgPrint("Compensate timer: %lf\n", delay);
+    delay = util_time_delay_for_compensation(interval) - interval;
+    ecore_timer_delay(timer, delay);
+    DbgPrint("Compensate timer: %lf\n", delay);
 
-       return timer;
+    return timer;
 }
 
 HAPI void util_timer_interval_set(void *timer, double interval)
 {
-       double delay;
-       ecore_timer_interval_set(timer, interval);
+    double delay;
+    ecore_timer_interval_set(timer, interval);
 
-       delay = util_time_delay_for_compensation(interval) - interval;
-       ecore_timer_delay(timer, delay);
+    delay = util_time_delay_for_compensation(interval) - interval;
+    ecore_timer_delay(timer, delay);
 }
 
 HAPI int util_unlink_files(const char *folder)
 {
-       struct stat info;
-       DIR *handle;
-       struct dirent *entry;
-       char *abspath;
-       int len;
-
-       if (lstat(folder, &info) < 0) {
-               ErrPrint("Error: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_IO;
-       }
+    struct stat info;
+    DIR *handle;
+    struct dirent *entry;
+    char *abspath;
+    int len;
 
-       if (!S_ISDIR(info.st_mode)) {
-               ErrPrint("Error: %s is not a folder", folder);
-               return LB_STATUS_ERROR_INVALID;
-       }
+    if (lstat(folder, &info) < 0) {
+       ErrPrint("Error: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
 
-       handle = opendir(folder);
-       if (!handle) {
-               ErrPrint("Error: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_IO;
-       }
+    if (!S_ISDIR(info.st_mode)) {
+       ErrPrint("Error: %s is not a folder", folder);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       while ((entry = readdir(handle))) {
-               if (!strcmp(entry->d_name, ".")) {
-                       continue;
-               }
+    handle = opendir(folder);
+    if (!handle) {
+       ErrPrint("Error: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_IO_ERROR;
+    }
 
-               if (!strcmp(entry->d_name, "..")) {
-                       continue;
-               }
-
-               len = strlen(folder) + strlen(entry->d_name) + 3;
-               abspath = calloc(1, len);
-               if (!abspath) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       continue;
-               }
-               snprintf(abspath, len - 1, "%s/%s", folder, entry->d_name);
+    while ((entry = readdir(handle))) {
+       if (!strcmp(entry->d_name, ".")) {
+           continue;
+       }
 
-               if (unlink(abspath) < 0) {
-                       DbgPrint("unlink: %s\n", strerror(errno));
-               }
+       if (!strcmp(entry->d_name, "..")) {
+           continue;
+       }
 
-               DbgFree(abspath);
+       len = strlen(folder) + strlen(entry->d_name) + 3;
+       abspath = calloc(1, len);
+       if (!abspath) {
+           ErrPrint("Heap: %s\n", strerror(errno));
+           continue;
        }
+       snprintf(abspath, len - 1, "%s/%s", folder, entry->d_name);
 
-       if (closedir(handle) < 0) {
-               ErrPrint("closedir: %s\n", strerror(errno));
+       if (unlink(abspath) < 0) {
+           DbgPrint("unlink: %s\n", strerror(errno));
        }
-       return LB_STATUS_SUCCESS;
+
+       DbgFree(abspath);
+    }
+
+    if (closedir(handle) < 0) {
+       ErrPrint("closedir: %s\n", strerror(errno));
+    }
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI void util_remove_emergency_disk(void)
 {
-       int ret;
-       ret = umount(IMAGE_PATH);
-       if (ret < 0) {
-               ErrPrint("umount: %s\n", strerror(errno));
-       }
-
-       DbgPrint("Try to unmount[%s] %d\n", IMAGE_PATH, ret);
-       s_info.emergency_mounted = 0;
+    int ret;
+    ret = umount(DYNAMICBOX_CONF_IMAGE_PATH);
+    if (ret < 0) {
+       ErrPrint("umount: %s\n", strerror(errno));
+    }
+
+    DbgPrint("Try to unmount[%s] %d\n", DYNAMICBOX_CONF_IMAGE_PATH, ret);
+    s_info.emergency_mounted = 0;
 }
 
 HAPI void util_prepare_emergency_disk(void)
 {
-       char *buf;
-       char *source = NULL;
-       char *type = NULL;
-       char *option = NULL;
-       char *ptr;
-       char *rollback_ptr;
-       int tag_idx;
-       int idx;
-       int len;
-       int ret;
-       static const char *tag[] = {
-               "source",
-               "type",
-               "option",
-               NULL,
-       };
-       enum tag_type {
-               TAG_SOURCE,
-               TAG_TYPE,
-               TAG_OPTION,
-               TAG_ERROR
-       };
-
-       buf = strdup(EMERGENCY_DISK);
-       if (!buf) {
-               ErrPrint("Failed to prepare emergency disk info\n");
-               return;
-       }
+    char *buf;
+    char *source = NULL;
+    char *type = NULL;
+    char *option = NULL;
+    char *ptr;
+    char *rollback_ptr;
+    int tag_idx;
+    int idx;
+    int len;
+    int ret;
+    static const char *tag[] = {
+       "source",
+       "type",
+       "option",
+       NULL,
+    };
+    enum tag_type {
+       TAG_SOURCE,
+       TAG_TYPE,
+       TAG_OPTION,
+       TAG_ERROR
+    };
+
+    buf = strdup(DYNAMICBOX_CONF_EMERGENCY_DISK);
+    if (!buf) {
+       ErrPrint("Failed to prepare emergency disk info\n");
+       return;
+    }
+
+    rollback_ptr = ptr = buf;
+    idx = 0;
+    tag_idx = 0;
+    len = strlen(ptr);
+
+    while (tag[tag_idx] != NULL && ptr != (buf + len)) {
+       if (tag[tag_idx][idx] == '\0') {
+           if (*ptr == '=' || isblank(*ptr)) {
+               switch (tag_idx) {
+                   case TAG_SOURCE:
+                       if (source) {
+                           ErrPrint("source[%s] is overrided\n", source);
+                       }
+
+                       while ((*ptr != '\0' && *ptr != ';') && (*ptr == '=' || isblank(*ptr))) {
+                           ptr++;
+                       }
 
-       rollback_ptr = ptr = buf;
-       idx = 0;
-       tag_idx = 0;
-       len = strlen(ptr);
-
-       while (tag[tag_idx] != NULL && ptr != (buf + len)) {
-               if (tag[tag_idx][idx] == '\0') {
-                       if (*ptr == '=' || isblank(*ptr)) {
-                               switch (tag_idx) {
-                               case TAG_SOURCE:
-                                       if (source) {
-                                               ErrPrint("source[%s] is overrided\n", source);
-                                       }
-
-                                       while ((*ptr != '\0' && *ptr != ';') && (*ptr == '=' || isblank(*ptr))) {
-                                               ptr++;
-                                       }
-
-                                       source = ptr;
-                                       while (*ptr != '\0' && *ptr != ';') {
-                                               ptr++;
-                                       }
-
-                                       if (*source == '\0') {
-                                               type = NULL;
-                                       }
-
-                                       *ptr = '\0';
-                                       rollback_ptr = ptr + 1;
-                                       idx = 0;
-                                       break;
-                               case TAG_TYPE:
-                                       if (type) {
-                                               ErrPrint("type[%s] is overrided\n", type);
-                                       }
-
-                                       while ((*ptr != '\0' && *ptr != ';') && (*ptr == '=' || isblank(*ptr))) {
-                                               ptr++;
-                                       }
-
-                                       type = ptr;
-                                       while (*ptr != '\0' && *ptr != ';') {
-                                               ptr++;
-                                       }
-
-                                       if (*type == '\0') {
-                                               type = NULL;
-                                       }
-
-                                       *ptr = '\0';
-                                       rollback_ptr = ptr + 1;
-                                       idx = 0;
-                                       break;
-                               case TAG_OPTION:
-                                       if (option) {
-                                               ErrPrint("option[%s] is overrided\n", option);
-                                       }
-
-                                       while ((*ptr != '\0' && *ptr != ';') && (*ptr == '=' || isblank(*ptr))) {
-                                               ptr++;
-                                       }
-
-                                       option = ptr;
-                                       while (*ptr != '\0' && *ptr != ';') {
-                                               ptr++;
-                                       }
-
-                                       if (*option == '\0') {
-                                               option = NULL;
-                                       }
-
-                                       *ptr = '\0';
-                                       rollback_ptr = ptr + 1;
-                                       idx = 0;
-                                       break;
-                               default:
-                                       break;
-                               }
-                       } else {
-                               ptr = rollback_ptr;
-                               tag_idx++;
-                               idx = 0;
+                       source = ptr;
+                       while (*ptr != '\0' && *ptr != ';') {
+                           ptr++;
                        }
-               } else if (tag[tag_idx][idx] != *ptr) {
-                       ptr = rollback_ptr;
-                       tag_idx++;
+
+                       if (*source == '\0') {
+                           type = NULL;
+                       }
+
+                       *ptr = '\0';
+                       rollback_ptr = ptr + 1;
                        idx = 0;
-               } else {
-                       ptr++;
-                       idx++;
-               } // tag
-       }
+                       break;
+                   case TAG_TYPE:
+                       if (type) {
+                           ErrPrint("type[%s] is overrided\n", type);
+                       }
 
-       DbgPrint("source[%s] type[%s] option[%s]\n", source, type, option);
+                       while ((*ptr != '\0' && *ptr != ';') && (*ptr == '=' || isblank(*ptr))) {
+                           ptr++;
+                       }
 
-       ret = mount(source, IMAGE_PATH, type, MS_NOSUID | MS_NOEXEC, option);
-       DbgFree(buf);
-       if (ret < 0) {
-               ErrPrint("Failed to mount: %s\n", strerror(errno));
-               return;
-       }
+                       type = ptr;
+                       while (*ptr != '\0' && *ptr != ';') {
+                           ptr++;
+                       }
+
+                       if (*type == '\0') {
+                           type = NULL;
+                       }
+
+                       *ptr = '\0';
+                       rollback_ptr = ptr + 1;
+                       idx = 0;
+                       break;
+                   case TAG_OPTION:
+                       if (option) {
+                           ErrPrint("option[%s] is overrided\n", option);
+                       }
+
+                       while ((*ptr != '\0' && *ptr != ';') && (*ptr == '=' || isblank(*ptr))) {
+                           ptr++;
+                       }
+
+                       option = ptr;
+                       while (*ptr != '\0' && *ptr != ';') {
+                           ptr++;
+                       }
+
+                       if (*option == '\0') {
+                           option = NULL;
+                       }
+
+                       *ptr = '\0';
+                       rollback_ptr = ptr + 1;
+                       idx = 0;
+                       break;
+                   default:
+                       break;
+               }
+           } else {
+               ptr = rollback_ptr;
+               tag_idx++;
+               idx = 0;
+           }
+       } else if (tag[tag_idx][idx] != *ptr) {
+           ptr = rollback_ptr;
+           tag_idx++;
+           idx = 0;
+       } else {
+           ptr++;
+           idx++;
+       } // tag
+    }
+
+    DbgPrint("source[%s] type[%s] option[%s]\n", source, type, option);
+
+    ret = mount(source, DYNAMICBOX_CONF_IMAGE_PATH, type, MS_NOSUID | MS_NOEXEC, option);
+    DbgFree(buf);
+    if (ret < 0) {
+       ErrPrint("Failed to mount: %s\n", strerror(errno));
+       return;
+    }
 
-       MINIMUM_SPACE = 0;
+    ErrPrint("Disk space is not enough, use the tmpfs. Currently required minimum space is %lu bytes\n", DYNAMICBOX_CONF_MINIMUM_SPACE);
+    if (chmod(DYNAMICBOX_CONF_IMAGE_PATH, 0750) < 0) {
+       ErrPrint("chmod: %s\n", strerror(errno));
+    }
 
-       ErrPrint("Disk space is not enough, use the tmpfs. Currently required minimum space is %lu bytes\n", MINIMUM_SPACE);
-       if (chmod(IMAGE_PATH, 0750) < 0) {
-               ErrPrint("chmod: %s\n", strerror(errno));
+    if (chown(DYNAMICBOX_CONF_IMAGE_PATH, 5000, 5000) < 0) {
+       ErrPrint("chown: %s\n", strerror(errno));
+    }
+
+    ret = smack_setlabel(DYNAMICBOX_CONF_IMAGE_PATH, DATA_SHARE_LABEL, SMACK_LABEL_ACCESS);
+    if (ret != 0) {
+       ErrPrint("Failed to set SMACK for %s (%d)\n", DYNAMICBOX_CONF_IMAGE_PATH, ret);
+    } else {
+       ret = smack_setlabel(DYNAMICBOX_CONF_IMAGE_PATH, "1", SMACK_LABEL_TRANSMUTE);
+       DbgPrint("[%s] is successfully created (t: %d)\n", DYNAMICBOX_CONF_IMAGE_PATH, ret);
+    }
+
+    if (mkdir(DYNAMICBOX_CONF_ALWAYS_PATH, 0755) < 0) {
+       ErrPrint("mkdir: (%s) %s\n", DYNAMICBOX_CONF_ALWAYS_PATH, strerror(errno));
+    } else {
+       if (chmod(DYNAMICBOX_CONF_ALWAYS_PATH, 0750) < 0) {
+           ErrPrint("chmod: %s\n", strerror(errno));
        }
 
-       if (chown(IMAGE_PATH, 5000, 5000) < 0) {
-               ErrPrint("chown: %s\n", strerror(errno));
+       if (chown(DYNAMICBOX_CONF_ALWAYS_PATH, 5000, 5000) < 0) {
+           ErrPrint("chown: %s\n", strerror(errno));
        }
 
-       ret = smack_setlabel(IMAGE_PATH, DATA_SHARE_LABEL, SMACK_LABEL_ACCESS);
+       ret = smack_setlabel(DYNAMICBOX_CONF_ALWAYS_PATH, DATA_SHARE_LABEL, SMACK_LABEL_ACCESS);
        if (ret != 0) {
-               ErrPrint("Failed to set SMACK for %s (%d)\n", IMAGE_PATH, ret);
+           ErrPrint("Failed to set SMACK for %s (%d)\n", DYNAMICBOX_CONF_ALWAYS_PATH, ret);
        } else {
-               ret = smack_setlabel(IMAGE_PATH, "1", SMACK_LABEL_TRANSMUTE);
-               DbgPrint("[%s] is successfully created (t: %d)\n", IMAGE_PATH, ret);
+           ret = smack_setlabel(DYNAMICBOX_CONF_ALWAYS_PATH, "1", SMACK_LABEL_TRANSMUTE);
+           DbgPrint("[%s] is successfully created (t: %d)\n", DYNAMICBOX_CONF_ALWAYS_PATH, ret);
        }
+    }
 
-       if (mkdir(ALWAYS_PATH, 0755) < 0) {
-               ErrPrint("mkdir: (%s) %s\n", ALWAYS_PATH, strerror(errno));
-       } else {
-               if (chmod(ALWAYS_PATH, 0750) < 0) {
-                       ErrPrint("chmod: %s\n", strerror(errno));
-               }
-
-               if (chown(ALWAYS_PATH, 5000, 5000) < 0) {
-                       ErrPrint("chown: %s\n", strerror(errno));
-               }
+    if (mkdir(DYNAMICBOX_CONF_READER_PATH, 0755) < 0) {
+       ErrPrint("mkdir: (%s) %s\n", DYNAMICBOX_CONF_READER_PATH, strerror(errno));
+    } else {
+       if (chmod(DYNAMICBOX_CONF_READER_PATH, 0750) < 0) {
+           ErrPrint("chmod: %s\n", strerror(errno));
+       }
 
-               ret = smack_setlabel(ALWAYS_PATH, DATA_SHARE_LABEL, SMACK_LABEL_ACCESS);
-               if (ret != 0) {
-                       ErrPrint("Failed to set SMACK for %s (%d)\n", ALWAYS_PATH, ret);
-               } else {
-                       ret = smack_setlabel(ALWAYS_PATH, "1", SMACK_LABEL_TRANSMUTE);
-                       DbgPrint("[%s] is successfully created (t: %d)\n", ALWAYS_PATH, ret);
-               }
+       if (chown(DYNAMICBOX_CONF_READER_PATH, 5000, 5000) < 0) {
+           ErrPrint("chown: %s\n", strerror(errno));
        }
 
-       if (mkdir(READER_PATH, 0755) < 0) {
-               ErrPrint("mkdir: (%s) %s\n", READER_PATH, strerror(errno));
+       ret = smack_setlabel(DYNAMICBOX_CONF_READER_PATH, DATA_SHARE_LABEL, SMACK_LABEL_ACCESS);
+       if (ret != 0) {
+           ErrPrint("Failed to set SMACK for %s (%d)\n", DYNAMICBOX_CONF_READER_PATH, ret);
        } else {
-               if (chmod(READER_PATH, 0750) < 0) {
-                       ErrPrint("chmod: %s\n", strerror(errno));
-               }
-
-               if (chown(READER_PATH, 5000, 5000) < 0) {
-                       ErrPrint("chown: %s\n", strerror(errno));
-               }
-
-               ret = smack_setlabel(READER_PATH, DATA_SHARE_LABEL, SMACK_LABEL_ACCESS);
-               if (ret != 0) {
-                       ErrPrint("Failed to set SMACK for %s (%d)\n", READER_PATH, ret);
-               } else {
-                       ret = smack_setlabel(READER_PATH, "1", SMACK_LABEL_TRANSMUTE);
-                       DbgPrint("[%s] is successfully created (t: %d)\n", READER_PATH, ret);
-               }
+           ret = smack_setlabel(DYNAMICBOX_CONF_READER_PATH, "1", SMACK_LABEL_TRANSMUTE);
+           DbgPrint("[%s] is successfully created (t: %d)\n", DYNAMICBOX_CONF_READER_PATH, ret);
        }
+    }
 
-       s_info.emergency_mounted = 1;
+    s_info.emergency_mounted = 1;
 }
 
 HAPI int util_emergency_disk_is_mounted(void)
 {
-       return s_info.emergency_mounted;
+    return s_info.emergency_mounted;
 }
 
 HAPI void util_setup_log_disk(void)
 {
-       int ret;
+    int ret;
 
-       if (access(SLAVE_LOG_PATH, R_OK | W_OK | X_OK) == 0) {
-               DbgPrint("[%s] is already accessible\n", SLAVE_LOG_PATH);
-               return;
-       }
+    if (access(DYNAMICBOX_CONF_LOG_PATH, R_OK | W_OK | X_OK) == 0) {
+       DbgPrint("[%s] is already accessible\n", DYNAMICBOX_CONF_LOG_PATH);
+       return;
+    }
 
-       DbgPrint("Initiate the critical log folder [%s]\n", SLAVE_LOG_PATH);
-       if (mkdir(SLAVE_LOG_PATH, 0755) < 0) {
-               ErrPrint("mkdir: %s\n", strerror(errno));
-       } else {
-               if (chmod(SLAVE_LOG_PATH, 0750) < 0) {
-                       ErrPrint("chmod: %s\n", strerror(errno));
-               }
+    DbgPrint("Initiate the critical log folder [%s]\n", DYNAMICBOX_CONF_LOG_PATH);
+    if (mkdir(DYNAMICBOX_CONF_LOG_PATH, 0755) < 0) {
+       ErrPrint("mkdir: %s\n", strerror(errno));
+    } else {
+       if (chmod(DYNAMICBOX_CONF_LOG_PATH, 0750) < 0) {
+           ErrPrint("chmod: %s\n", strerror(errno));
+       }
 
-               if (chown(SLAVE_LOG_PATH, 5000, 5000) < 0) {
-                       ErrPrint("chown: %s\n", strerror(errno));
-               }
+       if (chown(DYNAMICBOX_CONF_LOG_PATH, 5000, 5000) < 0) {
+           ErrPrint("chown: %s\n", strerror(errno));
+       }
 
-               ret = smack_setlabel(SLAVE_LOG_PATH, DATA_SHARE_LABEL, SMACK_LABEL_ACCESS);
-               if (ret != 0) {
-                       ErrPrint("Failed to set SMACK for %s (%d)\n", SLAVE_LOG_PATH, ret);
-               } else {
-                       ret = smack_setlabel(SLAVE_LOG_PATH, "1", SMACK_LABEL_TRANSMUTE);
-                       DbgPrint("[%s] is successfully created (t: %d)\n", SLAVE_LOG_PATH, ret);
-               }
+       ret = smack_setlabel(DYNAMICBOX_CONF_LOG_PATH, DATA_SHARE_LABEL, SMACK_LABEL_ACCESS);
+       if (ret != 0) {
+           ErrPrint("Failed to set SMACK for %s (%d)\n", DYNAMICBOX_CONF_LOG_PATH, ret);
+       } else {
+           ret = smack_setlabel(DYNAMICBOX_CONF_LOG_PATH, "1", SMACK_LABEL_TRANSMUTE);
+           DbgPrint("[%s] is successfully created (t: %d)\n", DYNAMICBOX_CONF_LOG_PATH, ret);
        }
+    }
 }
 
 HAPI int util_service_is_enabled(const char *tag)
 {
-       return !!strcasestr(SERVICES, tag);
+    return !!strcasestr(DYNAMICBOX_CONF_SERVICES, tag);
 }
 
 /* End of a file */
index a169f3f..053e4c1 100644 (file)
@@ -1,26 +1,26 @@
 #include "util.h"
 
 #if defined(HAVE_LIVEBOX)
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
 #else
 #include "lite-errno.h"
 #endif
 
 int util_screen_size_get(int *width, int *height)
 {
-       *width = 0;
-       *height = 0;
-       return LB_STATUS_ERROR_NOT_IMPLEMENTED;
+    *width = 0;
+    *height = 0;
+    return DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
 }
 
 int util_screen_init(void)
 {
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 int util_screen_fini(void)
 {
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 /* End of a file */
index cbf3764..ff1ffaf 100644 (file)
@@ -1,26 +1,40 @@
 #include <Ecore_X.h>
+#include <dlog.h>
 
 #if defined(HAVE_LIVEBOX)
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
 #else
 #include "lite-errno.h"
 #endif
 #include "util.h"
+#include "debug.h"
+
+static struct info {
+    int initialized;
+} s_info = {
+    .initialized = 0,
+};
 
 int util_screen_size_get(int *width, int *height)
 {
-       ecore_x_window_size_get(0, width, height);
-       return LB_STATUS_SUCCESS;
+    if (!s_info.initialized) {
+       ErrPrint("Not initialized\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+    ecore_x_window_size_get(0, width, height);
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 int util_screen_init(void)
 {
-       return ecore_x_init(NULL);
+    s_info.initialized = 1;
+    return ecore_x_init(NULL);
 }
 
 int util_screen_fini(void)
 {
-       return ecore_x_shutdown();
+    s_info.initialized = 0;
+    return ecore_x_shutdown();
 }
 
 /* End of a file */
index f188c49..a20322e 100644 (file)
@@ -20,7 +20,7 @@
 #include <dlog.h>
 #include <aul.h>
 
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
 #include <packet.h>
 
 #include <sys/smack.h>
@@ -33,7 +33,7 @@
 #include "conf.h"
 
 #ifndef SVC_PKG
-#define SVC_PKG                "org.tizen.data-provider-slave.icon"
+#define SVC_PKG                "com.samsung.data-provider-slave.icon"
 #endif
 
 #ifndef LAUNCH_TIMEOUT
 #endif
 
 static struct info {
-       Eina_List *pending_list;
-       Eina_List *context_list;
-       struct service_context *svc_ctx;
+    Eina_List *pending_list;
+    Eina_List *context_list;
+    struct service_context *svc_ctx;
 
-       struct tcb *svc_daemon;
-       int svc_daemon_is_launched;
-       int svc_daemon_pid;
+    struct tcb *svc_daemon;
+    int svc_daemon_is_launched;
+    int svc_daemon_pid;
 
-       struct service_event_item *launch_timer; 
-       struct service_event_item *delay_launcher;
-       struct service_event_item *ttl_timer;
+    struct service_event_item *launch_timer; 
+    struct service_event_item *delay_launcher;
+    struct service_event_item *ttl_timer;
 } s_info = {
-       .pending_list = NULL,
-       .context_list = NULL, /*!< \WARN: This is only used for SERVICE THREAD */
-       .svc_ctx = NULL, /*!< \WARN: This is only used for MAIN THREAD */
+    .pending_list = NULL,
+    .context_list = NULL, /*!< \WARN: This is only used for SERVICE THREAD */
+    .svc_ctx = NULL, /*!< \WARN: This is only used for MAIN THREAD */
 
-       .svc_daemon = NULL,
-       .svc_daemon_is_launched = 0,
-       .svc_daemon_pid = -1,
+    .svc_daemon = NULL,
+    .svc_daemon_is_launched = 0,
+    .svc_daemon_pid = -1,
 
-       .launch_timer = NULL,
-       .delay_launcher = NULL,
-       .ttl_timer = NULL,
+    .launch_timer = NULL,
+    .delay_launcher = NULL,
+    .ttl_timer = NULL,
 };
 
 struct pending_item {
-       struct tcb *tcb;
-       struct packet *packet;
+    struct tcb *tcb;
+    struct packet *packet;
 };
 
 struct context {
-       struct tcb *tcb;
-       double seq;
+    struct tcb *tcb;
+    double seq;
 };
 
 static int lazy_launcher_cb(struct service_context *svc_ctx, void *data);
 
 static int put_reply_tcb(struct tcb *tcb, double seq)
 {
-       struct context *ctx;
+    struct context *ctx;
 
-       ctx = malloc(sizeof(*ctx));
-       if (!ctx) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    ctx = malloc(sizeof(*ctx));
+    if (!ctx) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       ctx->tcb = tcb;
-       ctx->seq = seq;
+    ctx->tcb = tcb;
+    ctx->seq = seq;
 
-       s_info.context_list = eina_list_append(s_info.context_list, ctx);
+    s_info.context_list = eina_list_append(s_info.context_list, ctx);
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static inline struct tcb *get_reply_tcb(double seq)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct context *ctx;
-       struct tcb *tcb;
-
-       EINA_LIST_FOREACH_SAFE(s_info.context_list, l, n, ctx) {
-               if (ctx->seq != seq) {
-                       continue;
-               }
-
-               s_info.context_list = eina_list_remove(s_info.context_list, ctx);
-               tcb = ctx->tcb;
-               DbgFree(ctx);
-               return tcb;
+    Eina_List *l;
+    Eina_List *n;
+    struct context *ctx;
+    struct tcb *tcb;
+
+    EINA_LIST_FOREACH_SAFE(s_info.context_list, l, n, ctx) {
+       if (ctx->seq != seq) {
+           continue;
        }
 
-       return NULL;
+       s_info.context_list = eina_list_remove(s_info.context_list, ctx);
+       tcb = ctx->tcb;
+       DbgFree(ctx);
+       return tcb;
+    }
+
+    return NULL;
 }
 
 static inline int flush_pended_request(void)
 {
-       /*!
-        * Flush all pended requests
-        */
-       struct pending_item *item;
-       int ret;
-
-       EINA_LIST_FREE(s_info.pending_list, item) {
-               if (tcb_is_valid(s_info.svc_ctx, s_info.svc_daemon) >= 0) {
-                       ret = service_common_unicast_packet(s_info.svc_daemon, item->packet);
-               } else {
-                       ret = -EFAULT;
-               }
+    /*!
+     * Flush all pended requests
+     */
+    struct pending_item *item;
+    int ret;
+
+    EINA_LIST_FREE(s_info.pending_list, item) {
+       if (tcb_is_valid(s_info.svc_ctx, s_info.svc_daemon) >= 0) {
+           ret = service_common_unicast_packet(s_info.svc_daemon, item->packet);
+       } else {
+           ret = -EFAULT;
+       }
 
-               if (ret < 0) {
-                       if (tcb_is_valid(s_info.svc_ctx, item->tcb) >= 0) {
-                               struct packet *reply;
-                               reply = packet_create_reply(item->packet, "i", ret);
-                               if (service_common_unicast_packet(item->tcb, reply) < 0) {
-                                       ErrPrint("Unable to send packet\n");
-                               }
-                               packet_destroy(reply);
-                       }
-               } else {
-                       put_reply_tcb(item->tcb, packet_seq(item->packet));
+       if (ret < 0) {
+           if (tcb_is_valid(s_info.svc_ctx, item->tcb) >= 0) {
+               struct packet *reply;
+               reply = packet_create_reply(item->packet, "i", ret);
+               if (service_common_unicast_packet(item->tcb, reply) < 0) {
+                   ErrPrint("Unable to send packet\n");
                }
-               packet_unref(item->packet);
-               DbgFree(item);
+               packet_destroy(reply);
+           }
+       } else {
+           put_reply_tcb(item->tcb, packet_seq(item->packet));
        }
+       packet_unref(item->packet);
+       DbgFree(item);
+    }
 
-       return 0;
+    return 0;
 }
 
 static inline int put_pended_request(struct tcb *tcb, struct packet *packet)
 {
-       struct pending_item *item;
-
-       item = malloc(sizeof(*item));
-       if (!item) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       item->tcb = tcb;
-       item->packet = packet_ref(packet);
-       if (!item->packet) {
-               DbgFree(item);
-               ErrPrint("Unable to ref packet\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       s_info.pending_list = eina_list_append(s_info.pending_list, item);
-       return 0;
+    struct pending_item *item;
+
+    item = malloc(sizeof(*item));
+    if (!item) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    item->tcb = tcb;
+    item->packet = packet_ref(packet);
+    if (!item->packet) {
+       DbgFree(item);
+       ErrPrint("Unable to ref packet\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    s_info.pending_list = eina_list_append(s_info.pending_list, item);
+    return 0;
 }
 
 static int launch_timeout_cb(struct service_context *svc_ctx, void *data)
 {
-       struct pending_item *item;
-       struct packet *reply;
-
-       EINA_LIST_FREE(s_info.pending_list, item) {
-               if (tcb_is_valid(s_info.svc_ctx, item->tcb) >= 0) {
-                       reply = packet_create_reply(item->packet, "i", -EFAULT);
-                       if (!reply) {
-                               ErrPrint("Unable to create a packet\n");
-                       } else {
-                               int ret;
-
-                               ret = service_common_unicast_packet(item->tcb, reply);
-                               if (ret < 0) {
-                                       ErrPrint("Failed to send reply packet: %d\n", ret);
-                               }
-
-                               packet_destroy(reply);
-                       }
-               } else {
-                       ErrPrint("TCB is already terminated\n");
+    struct pending_item *item;
+    struct packet *reply;
+
+    EINA_LIST_FREE(s_info.pending_list, item) {
+       if (tcb_is_valid(s_info.svc_ctx, item->tcb) >= 0) {
+           reply = packet_create_reply(item->packet, "i", -EFAULT);
+           if (!reply) {
+               ErrPrint("Unable to create a packet\n");
+           } else {
+               int ret;
+
+               ret = service_common_unicast_packet(item->tcb, reply);
+               if (ret < 0) {
+                   ErrPrint("Failed to send reply packet: %d\n", ret);
                }
 
-               packet_unref(item->packet);
-               DbgFree(item);
+               packet_destroy(reply);
+           }
+       } else {
+           ErrPrint("TCB is already terminated\n");
        }
 
-       s_info.launch_timer = NULL;
-       s_info.svc_daemon_is_launched = 0;
-       s_info.svc_daemon_pid = -1;
-       return -ECANCELED; /* Delete this timer */
+       packet_unref(item->packet);
+       DbgFree(item);
+    }
+
+    s_info.launch_timer = NULL;
+    s_info.svc_daemon_is_launched = 0;
+    s_info.svc_daemon_pid = -1;
+    return -ECANCELED; /* Delete this timer */
 }
 
 static int launch_svc(struct service_context *svc_ctx)
 {
-       pid_t pid;
-       int ret = LB_STATUS_SUCCESS;
+    pid_t pid;
+    int ret = DBOX_STATUS_ERROR_NONE;
 
-       pid = aul_launch_app(SVC_PKG, NULL);
-       switch (pid) {
-#if defined(WEARABLE)
+    pid = aul_launch_app(SVC_PKG, NULL);
+    switch (pid) {
        case AUL_R_EHIDDENFORGUEST:     /**< App hidden for guest mode */
-#endif
        case AUL_R_ENOLAUNCHPAD:        /**< no launchpad */
        case AUL_R_EILLACC:             /**< Illegal Access */
        case AUL_R_EINVAL:              /**< Invalid argument */
        case AUL_R_ENOINIT:             /**< AUL handler NOT initialized */
        case AUL_R_ERROR:               /**< General error */
-               ErrPrint("Failed to launch an app: %s(%d)\n", SVC_PKG, pid);
-               ret = LB_STATUS_ERROR_FAULT;
-               break;
+           ErrPrint("Failed to launch an app: %s(%d)\n", SVC_PKG, pid);
+           ret = DBOX_STATUS_ERROR_FAULT;
+           break;
        case AUL_R_ETIMEOUT:            /**< Timeout */
        case AUL_R_ECOMM:               /**< Comunication Error */
        case AUL_R_ETERMINATING:        /**< application terminating */
        case AUL_R_ECANCELED:           /**< Operation canceled */
-               /* Need time to launch app again */
-               ErrPrint("Terminating now, try to launch this after few sec later: %s(%d)\n", SVC_PKG, pid);
-               s_info.svc_daemon_is_launched = 1;
-               s_info.delay_launcher = service_common_add_timer(svc_ctx, LAUNCH_TIMEOUT, lazy_launcher_cb, NULL);
-               if (!s_info.delay_launcher) {
-                       ErrPrint("Unable to add delay launcher\n");
-                       ret = LB_STATUS_ERROR_FAULT;
-               }
-               break;
+           /* Need time to launch app again */
+           ErrPrint("Terminating now, try to launch this after few sec later: %s(%d)\n", SVC_PKG, pid);
+           s_info.svc_daemon_is_launched = 1;
+           s_info.delay_launcher = service_common_add_timer(svc_ctx, LAUNCH_TIMEOUT, lazy_launcher_cb, NULL);
+           if (!s_info.delay_launcher) {
+               ErrPrint("Unable to add delay launcher\n");
+               ret = DBOX_STATUS_ERROR_FAULT;
+           }
+           break;
        case AUL_R_LOCAL:               /**< Launch by himself */
        case AUL_R_OK:                  /**< General success */
        default:
-               DbgPrint("Launched: %s(%d)\n", SVC_PKG, pid);
-               s_info.svc_daemon_is_launched = 1;
-               s_info.svc_daemon_pid = pid;
-               s_info.launch_timer = service_common_add_timer(svc_ctx, LAUNCH_TIMEOUT, launch_timeout_cb, NULL);
-               if (!s_info.launch_timer) {
-                       ErrPrint("Unable to create launch timer\n");
-               }
-       }
-
-       return ret;
+           DbgPrint("Launched: %s(%d)\n", SVC_PKG, pid);
+           s_info.svc_daemon_is_launched = 1;
+           s_info.svc_daemon_pid = pid;
+           s_info.launch_timer = service_common_add_timer(svc_ctx, LAUNCH_TIMEOUT, launch_timeout_cb, NULL);
+           if (!s_info.launch_timer) {
+               ErrPrint("Unable to create launch timer\n");
+           }
+    }
+
+    return ret;
 }
 
 static int lazy_launcher_cb(struct service_context *svc_ctx, void *data)
 {
-       s_info.delay_launcher = NULL;
+    s_info.delay_launcher = NULL;
 
-       (void)launch_svc(svc_ctx);
-       return -ECANCELED;
+    (void)launch_svc(svc_ctx);
+    return -ECANCELED;
 }
 
 static int ttl_timer_cb(struct service_context *svc_ctx, void *data)
 {
-       DbgPrint("TTL Timer is expired: PID(%d)\n", s_info.svc_daemon_pid);
-       (void)aul_terminate_pid(s_info.svc_daemon_pid);
-
-       s_info.ttl_timer = NULL;
-       s_info.svc_daemon_is_launched = 0;
-       s_info.svc_daemon_pid = -1;
-       s_info.svc_daemon = NULL;
-       return -ECANCELED;
+    DbgPrint("TTL Timer is expired: PID(%d)\n", s_info.svc_daemon_pid);
+    (void)aul_terminate_pid(s_info.svc_daemon_pid);
+
+    s_info.ttl_timer = NULL;
+    s_info.svc_daemon_is_launched = 0;
+    s_info.svc_daemon_pid = -1;
+    s_info.svc_daemon = NULL;
+    return -ECANCELED;
 }
 
 static int service_thread_main(struct tcb *tcb, struct packet *packet, void *data)
 {
-       struct packet *reply;
-       const char *cmd;
-       int ret;
+    struct packet *reply;
+    const char *cmd;
+    int ret;
+
+    if (!packet) {
+       DbgPrint("TCB %p is terminated (NIL packet), %d\n", tcb, s_info.svc_daemon_pid);
+
+       if (tcb == s_info.svc_daemon) {
+           s_info.svc_daemon = NULL;
+           s_info.svc_daemon_is_launched = 0;
+           s_info.svc_daemon_pid = -1;
+
+           if (s_info.ttl_timer) {
+               service_common_del_timer(tcb_svc_ctx(tcb), s_info.ttl_timer);
+               s_info.ttl_timer = NULL;
+           }
+       }
 
-       if (!packet) {
-               DbgPrint("TCB %p is terminated (NIL packet), %d\n", tcb, s_info.svc_daemon_pid);
+       return DBOX_STATUS_ERROR_NONE;
+    }
 
-               if (tcb == s_info.svc_daemon) {
-                       s_info.svc_daemon = NULL;
-                       s_info.svc_daemon_is_launched = 0;
-                       s_info.svc_daemon_pid = -1;
+    cmd = packet_command(packet);
+    if (!cmd) {
+       ErrPrint("Invalid packet\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-                       if (s_info.ttl_timer) {
-                               service_common_del_timer(tcb_svc_ctx(tcb), s_info.ttl_timer);
-                               s_info.ttl_timer = NULL;
-                       }
+    switch (packet_type(packet)) {
+       case PACKET_REQ:
+           if (!s_info.svc_daemon_is_launched) {
+               ret = launch_svc(tcb_svc_ctx(tcb));
+               if (ret != DBOX_STATUS_ERROR_NONE) {
+                   goto reply_out;
                }
+           }
 
-               return LB_STATUS_SUCCESS;
-       }
-
-       cmd = packet_command(packet);
-       if (!cmd) {
-               ErrPrint("Invalid packet\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       switch (packet_type(packet)) {
-       case PACKET_REQ:
-               if (!s_info.svc_daemon_is_launched) {
-                       ret = launch_svc(tcb_svc_ctx(tcb));
-                       if (ret != LB_STATUS_SUCCESS) {
-                               goto reply_out;
-                       }
+           if (!s_info.svc_daemon) {
+               ret = put_pended_request(tcb, packet);
+               if (ret < 0) {
+                   goto reply_out;
+               }
+           } else if (tcb_is_valid(s_info.svc_ctx, s_info.svc_daemon) >= 0) { 
+               ret = service_common_unicast_packet(s_info.svc_daemon, packet);
+               if (ret <0) {
+                   goto reply_out;
                }
 
-               if (!s_info.svc_daemon) {
-                       ret = put_pended_request(tcb, packet);
-                       if (ret < 0) {
-                               goto reply_out;
-                       }
-               } else if (tcb_is_valid(s_info.svc_ctx, s_info.svc_daemon) >= 0) { 
-                       ret = service_common_unicast_packet(s_info.svc_daemon, packet);
-                       if (ret <0) {
-                               goto reply_out;
-                       }
-
-                       put_reply_tcb(tcb, packet_seq(packet));
-
-                       if (s_info.ttl_timer && service_common_update_timer(s_info.ttl_timer, TTL_TIMEOUT) < 0) {
-                               ErrPrint("Failed to update timer\n");
-                       }
+               put_reply_tcb(tcb, packet_seq(packet));
+
+               if (s_info.ttl_timer && service_common_update_timer(s_info.ttl_timer, TTL_TIMEOUT) < 0) {
+                   ErrPrint("Failed to update timer\n");
                }
+           }
 
-               break;
+           break;
        case PACKET_REQ_NOACK:
-               if (!strcmp(cmd, "service_register")) {
-                       if (!s_info.svc_daemon_is_launched) {
-                               ErrPrint("Service daemon is not launched. but something tries to register a service\n");
-                               return LB_STATUS_ERROR_INVALID;
-                       }
-
-                       if (s_info.svc_daemon) {
-                               ErrPrint("Service daemon is already prepared\n");
-                               return LB_STATUS_ERROR_INVALID;
-                       }
-
-                       if (s_info.launch_timer) {
-                               service_common_del_timer(tcb_svc_ctx(tcb), s_info.launch_timer);
-                               s_info.launch_timer = NULL;
-                       }
-
-                       s_info.ttl_timer = service_common_add_timer(tcb_svc_ctx(tcb), TTL_TIMEOUT, ttl_timer_cb, NULL);
-                       if (!s_info.ttl_timer) {
-                               ErrPrint("Failed to add TTL timer\n");
-                               if (s_info.svc_daemon_pid > 0) {
-                                       ret = aul_terminate_pid(s_info.svc_daemon_pid);
-                                       ErrPrint("Terminate: %d\n", ret);
-                                       s_info.svc_daemon_pid = -1;
-                               }
-                               s_info.svc_daemon_is_launched = 0;
-                               return LB_STATUS_ERROR_FAULT;
-                       }
-                       DbgPrint("TTL Timer is added: %p\n", s_info.ttl_timer);
-
-                       s_info.svc_daemon = tcb;
-                       flush_pended_request();
+           if (!strcmp(cmd, "service_register")) {
+               if (!s_info.svc_daemon_is_launched) {
+                   ErrPrint("Service daemon is not launched. but something tries to register a service\n");
+                   return DBOX_STATUS_ERROR_INVALID_PARAMETER;
                }
-               break;
-       case PACKET_ACK:
-               tcb = get_reply_tcb(packet_seq(packet));
-               if (!tcb) {
-                       ErrPrint("Unable to find reply tcb\n");
-                       break;
+
+               if (s_info.svc_daemon) {
+                   ErrPrint("Service daemon is already prepared\n");
+                   return DBOX_STATUS_ERROR_INVALID_PARAMETER;
                }
 
-               if (tcb_is_valid(s_info.svc_ctx, tcb) < 0) {
-                       ErrPrint("TCB is not valid\n");
-                       break;
+               if (s_info.launch_timer) {
+                   service_common_del_timer(tcb_svc_ctx(tcb), s_info.launch_timer);
+                   s_info.launch_timer = NULL;
                }
 
-               ret = service_common_unicast_packet(tcb, packet);
-               if (ret < 0) {
-                       ErrPrint("Unable to forward the reply packet\n");
+               s_info.ttl_timer = service_common_add_timer(tcb_svc_ctx(tcb), TTL_TIMEOUT, ttl_timer_cb, NULL);
+               if (!s_info.ttl_timer) {
+                   ErrPrint("Failed to add TTL timer\n");
+                   if (s_info.svc_daemon_pid > 0) {
+                       ret = aul_terminate_pid(s_info.svc_daemon_pid);
+                       ErrPrint("Terminate: %d\n", ret);
+                       s_info.svc_daemon_pid = -1;
+                   }
+                   s_info.svc_daemon_is_launched = 0;
+                   return DBOX_STATUS_ERROR_FAULT;
                }
+               DbgPrint("TTL Timer is added: %p\n", s_info.ttl_timer);
+
+               s_info.svc_daemon = tcb;
+               flush_pended_request();
+           }
+           break;
+       case PACKET_ACK:
+           tcb = get_reply_tcb(packet_seq(packet));
+           if (!tcb) {
+               ErrPrint("Unable to find reply tcb\n");
                break;
+           }
+
+           if (tcb_is_valid(s_info.svc_ctx, tcb) < 0) {
+               ErrPrint("TCB is not valid\n");
+               break;
+           }
+
+           ret = service_common_unicast_packet(tcb, packet);
+           if (ret < 0) {
+               ErrPrint("Unable to forward the reply packet\n");
+           }
+           break;
        default:
-               ErrPrint("Packet type is not valid[%s]\n", cmd);
-               return LB_STATUS_ERROR_INVALID;
-       }
+           ErrPrint("Packet type is not valid[%s]\n", cmd);
+           return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 
 reply_out:
-       ErrPrint("Error: %d\n", ret);
-       reply = packet_create_reply(packet, "i", ret);
-       if (service_common_unicast_packet(tcb, reply) < 0) {
-               ErrPrint("Unable to send reply packet\n");
-       }
-       packet_destroy(reply);
-       return ret;
+    ErrPrint("Error: %d\n", ret);
+    reply = packet_create_reply(packet, "i", ret);
+    if (service_common_unicast_packet(tcb, reply) < 0) {
+       ErrPrint("Unable to send reply packet\n");
+    }
+    packet_destroy(reply);
+    return ret;
 }
 
 int utility_service_init(void)
 {
-       if (s_info.svc_ctx) {
-               ErrPrint("Already initialized\n");
-               return LB_STATUS_ERROR_ALREADY;
-       }
-
-       s_info.svc_ctx = service_common_create(UTILITY_SOCKET, service_thread_main, NULL);
-       if (!s_info.svc_ctx) {
-               ErrPrint("Unable to activate service thread\n");
-               return LB_STATUS_ERROR_FAULT;
+    if (s_info.svc_ctx) {
+       ErrPrint("Already initialized\n");
+       return DBOX_STATUS_ERROR_ALREADY;
+    }
+
+    s_info.svc_ctx = service_common_create(UTILITY_SOCKET, service_thread_main, NULL);
+    if (!s_info.svc_ctx) {
+       ErrPrint("Unable to activate service thread\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    if (smack_fsetlabel(service_common_fd(s_info.svc_ctx), UTILITY_SMACK_LABEL, SMACK_LABEL_IPOUT) != 0) {
+       if (errno != EOPNOTSUPP) {
+           ErrPrint("Unable to set SMACK label(%d)\n", errno);
+           service_common_destroy(s_info.svc_ctx);
+           s_info.svc_ctx = NULL;
+           return DBOX_STATUS_ERROR_FAULT;
        }
-
-       if (smack_fsetlabel(service_common_fd(s_info.svc_ctx), UTILITY_SMACK_LABEL, SMACK_LABEL_IPOUT) != 0) {
-               if (errno != EOPNOTSUPP) {
-                       ErrPrint("Unable to set SMACK label(%d)\n", errno);
-                       service_common_destroy(s_info.svc_ctx);
-                       s_info.svc_ctx = NULL;
-                       return LB_STATUS_ERROR_FAULT;
-               }
+    }
+
+    if (smack_fsetlabel(service_common_fd(s_info.svc_ctx), UTILITY_SMACK_LABEL, SMACK_LABEL_IPIN) != 0) {
+       if (errno != EOPNOTSUPP) {
+           ErrPrint("Unable to set SMACK label(%d)\n", errno);
+           service_common_destroy(s_info.svc_ctx);
+           s_info.svc_ctx = NULL;
+           return DBOX_STATUS_ERROR_FAULT;
        }
+    }
 
-       if (smack_fsetlabel(service_common_fd(s_info.svc_ctx), UTILITY_SMACK_LABEL, SMACK_LABEL_IPIN) != 0) {
-               if (errno != EOPNOTSUPP) {
-                       ErrPrint("Unable to set SMACK label(%d)\n", errno);
-                       service_common_destroy(s_info.svc_ctx);
-                       s_info.svc_ctx = NULL;
-                       return LB_STATUS_ERROR_FAULT;
-               }
-       }
-
-       DbgPrint("Successfully initiated\n");
-       return LB_STATUS_SUCCESS;
+    DbgPrint("Successfully initiated\n");
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 int utility_service_fini(void)
 {
-       if (!s_info.svc_ctx) {
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       service_common_destroy(s_info.svc_ctx);
-       s_info.svc_ctx = NULL;
-       DbgPrint("Successfully Finalized\n");
-       return LB_STATUS_SUCCESS;
+    if (!s_info.svc_ctx) {
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    service_common_destroy(s_info.svc_ctx);
+    s_info.svc_ctx = NULL;
+    DbgPrint("Successfully Finalized\n");
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 /* End of a file */
index 204a22d..a033d5f 100644 (file)
@@ -31,7 +31,8 @@
 
 #include <gio/gio.h>
 #include <dlog.h>
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
+#include <dynamicbox_conf.h>
 
 #include "conf.h"
 #include "debug.h"
 int errno;
 
 struct event_item {
-       int (*cb)(void *user_data);
-       void *user_data;
+    int (*cb)(void *user_data);
+    void *user_data;
 };
 
 static struct info {
-       Ecore_Event_Handler *create_handler;
-       Ecore_Event_Handler *destroy_handler;
-       Ecore_Event_Handler *client_handler;
+    Ecore_Event_Handler *create_handler;
+    Ecore_Event_Handler *destroy_handler;
+    Ecore_Event_Handler *client_handler;
 
-       Eina_List *pause_list;
-       Eina_List *resume_list;
+    Eina_List *pause_list;
+    Eina_List *resume_list;
 
-       int paused;
+    int paused;
 } s_info = {
-       .create_handler = NULL,
-       .destroy_handler = NULL,
-       .client_handler = NULL,
+    .create_handler = NULL,
+    .destroy_handler = NULL,
+    .client_handler = NULL,
 
-       .pause_list = NULL,
-       .resume_list = NULL,
+    .pause_list = NULL,
+    .resume_list = NULL,
 
-       .paused = 1, /*!< The provider is treated as paused process when it is launched */
+    .paused = 1, /*!< The provider is treated as paused process when it is launched */
 };
 
 static inline void touch_paused_file(void)
 {
-       int fd;
-       fd = creat(PAUSED_FILE, 0644);
-       if (fd >= 0) {
-               if (close(fd) < 0) {
-                       ErrPrint("close: %s\n", strerror(errno));
-               }
-       } else {
-               ErrPrint("Create .live.paused: %s\n", strerror(errno));
+    int fd;
+    fd = creat(DYNAMICBOX_CONF_PAUSED_FILE, 0644);
+    if (fd >= 0) {
+       if (close(fd) < 0) {
+           ErrPrint("close: %s\n", strerror(errno));
        }
+    } else {
+       ErrPrint("Create .live.paused: %s\n", strerror(errno));
+    }
 }
 
 static inline void remove_paused_file(void)
 {
-       if (unlink(PAUSED_FILE) < 0) {
-               ErrPrint("Unlink .live.paused: %s\n", strerror(errno));
-       }
+    if (unlink(DYNAMICBOX_CONF_PAUSED_FILE) < 0) {
+       ErrPrint("Unlink .live.paused: %s\n", strerror(errno));
+    }
 }
 
 static inline int get_pid(Ecore_X_Window win)
 {
-       int pid;
-       Ecore_X_Atom atom;
-       unsigned char *in_pid;
-       int num;
-
-       atom = ecore_x_atom_get("X_CLIENT_PID");
-       if (ecore_x_window_prop_property_get(win, atom, ECORE_X_ATOM_CARDINAL,
-                               sizeof(int), &in_pid, &num) == EINA_FALSE) {
-               if (ecore_x_netwm_pid_get(win, &pid) == EINA_FALSE) {
-                       ErrPrint("Failed to get PID from a window 0x%X\n", win);
-                       return LB_STATUS_ERROR_INVALID;
-               }
-       } else if (in_pid) {
-               pid = *(int *)in_pid;
-               DbgFree(in_pid);
-       } else {
-               ErrPrint("Failed to get PID\n");
-               return LB_STATUS_ERROR_INVALID;
+    int pid;
+    Ecore_X_Atom atom;
+    unsigned char *in_pid;
+    int num;
+
+    atom = ecore_x_atom_get("X_CLIENT_PID");
+    if (ecore_x_window_prop_property_get(win, atom, ECORE_X_ATOM_CARDINAL,
+               sizeof(int), &in_pid, &num) == EINA_FALSE) {
+       if (ecore_x_netwm_pid_get(win, &pid) == EINA_FALSE) {
+           ErrPrint("Failed to get PID from a window 0x%X\n", win);
+           return DBOX_STATUS_ERROR_INVALID_PARAMETER;
        }
-
-       return pid;
+    } else if (in_pid) {
+       pid = *(int *)in_pid;
+       DbgFree(in_pid);
+    } else {
+       ErrPrint("Failed to get PID\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    return pid;
 }
 
 static Eina_Bool create_cb(void *data, int type, void *event)
 {
-       Ecore_X_Event_Window_Create *info = event;
-       ecore_x_window_client_sniff(info->win);
-       return ECORE_CALLBACK_PASS_ON;
+    Ecore_X_Event_Window_Create *info = event;
+    ecore_x_window_client_sniff(info->win);
+    return ECORE_CALLBACK_PASS_ON;
 }
 
 static Eina_Bool destroy_cb(void *data, int type, void *event)
 {
-       // Ecore_X_Event_Window_Destroy *info = event;
-       return ECORE_CALLBACK_PASS_ON;
+    // Ecore_X_Event_Window_Destroy *info = event;
+    return ECORE_CALLBACK_PASS_ON;
 }
 
 HAPI void xmonitor_handle_state_changes(void)
 {
-       int paused;
-       Eina_List *l;
-       struct event_item *item;
+    int paused;
+    Eina_List *l;
+    struct event_item *item;
 
-       paused = client_is_all_paused() || setting_is_lcd_off();
-       if (s_info.paused == paused) {
-               return;
-       }
+    paused = client_is_all_paused() || setting_is_lcd_off();
+    if (s_info.paused == paused) {
+       return;
+    }
 
-       s_info.paused = paused;
+    s_info.paused = paused;
 
-       if (s_info.paused) {
-               EINA_LIST_FOREACH(s_info.pause_list, l, item) {
-                       if (item->cb) {
-                               item->cb(item->user_data);
-                       }
-               }
+    if (s_info.paused) {
+       EINA_LIST_FOREACH(s_info.pause_list, l, item) {
+           if (item->cb) {
+               item->cb(item->user_data);
+           }
+       }
 
-               touch_paused_file();
+       touch_paused_file();
 
-               sqlite3_release_memory(SQLITE_FLUSH_MAX);
-               malloc_trim(0);
-       } else {
-               remove_paused_file();
+       sqlite3_release_memory(DYNAMICBOX_CONF_SQLITE_FLUSH_MAX);
+       malloc_trim(0);
+    } else {
+       remove_paused_file();
 
-               EINA_LIST_FOREACH(s_info.resume_list, l, item) {
-                       if (item->cb) {
-                               item->cb(item->user_data);
-                       }
-               }
+       EINA_LIST_FOREACH(s_info.resume_list, l, item) {
+           if (item->cb) {
+               item->cb(item->user_data);
+           }
        }
+    }
 }
 
 HAPI int xmonitor_update_state(int target_pid)
 {
-       Ecore_X_Window win;
-       struct client_node *client;
-       int pid;
-
-       if (!USE_XMONITOR || target_pid < 0) {
-               return LB_STATUS_SUCCESS;
+    Ecore_X_Window win;
+    struct client_node *client;
+    int pid;
+
+    if (!DYNAMICBOX_CONF_USE_XMONITOR || target_pid < 0) {
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    win = ecore_x_window_focus_get();
+
+    pid = get_pid(win);
+    if (pid <= 0) {
+       DbgPrint("Focused window has no PID %X\n", win);
+       client = client_find_by_pid(target_pid);
+       if (client) {
+           DbgPrint("Client window has no focus now\n");
+           client_paused(client);
        }
-
-       win = ecore_x_window_focus_get();
-
-       pid = get_pid(win);
-       if (pid <= 0) {
-               DbgPrint("Focused window has no PID %X\n", win);
-               client = client_find_by_pid(target_pid);
-               if (client) {
-                       DbgPrint("Client window has no focus now\n");
-                       client_paused(client);
-               }
-               return LB_STATUS_ERROR_NOT_EXIST;
-       }
-
-       client = client_find_by_pid(pid);
-       if (!client) {
-               DbgPrint("Client %d is not registered yet\n", pid);
-               client = client_find_by_pid(target_pid);
-               if (client) {
-                       DbgPrint("Client window has no focus now\n");
-                       client_paused(client);
-               }
-               return LB_STATUS_ERROR_INVALID;
+       return DBOX_STATUS_ERROR_NOT_EXIST;
+    }
+
+    client = client_find_by_pid(pid);
+    if (!client) {
+       DbgPrint("Client %d is not registered yet\n", pid);
+       client = client_find_by_pid(target_pid);
+       if (client) {
+           DbgPrint("Client window has no focus now\n");
+           client_paused(client);
        }
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       if (target_pid != pid) {
-               DbgPrint("Client is paused\n");
-               client_paused(client);
-       } else {
-               DbgPrint("Client is resumed\n");
-               client_resumed(client);
-       }
+    if (target_pid != pid) {
+       DbgPrint("Client is paused\n");
+       client_paused(client);
+    } else {
+       DbgPrint("Client is resumed\n");
+       client_resumed(client);
+    }
 
-       xmonitor_handle_state_changes();
-       return LB_STATUS_SUCCESS;
+    xmonitor_handle_state_changes();
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static Eina_Bool client_cb(void *data, int type, void *event)
 {
-       Ecore_X_Event_Client_Message *info = event;
-       struct client_node *client;
-       char *name;
-       int pid;
-
-       pid = get_pid(info->win);
-       if (pid <= 0) {
-               return ECORE_CALLBACK_PASS_ON;
-       }
+    Ecore_X_Event_Client_Message *info = event;
+    struct client_node *client;
+    char *name;
+    int pid;
 
-       client = client_find_by_pid(pid);
-       if (!client) {
-               return ECORE_CALLBACK_PASS_ON;
-       }
-
-       name = ecore_x_atom_name_get(info->message_type);
-       if (!name) {
-               return ECORE_CALLBACK_PASS_ON;
-       }
+    pid = get_pid(info->win);
+    if (pid <= 0) {
+       return ECORE_CALLBACK_PASS_ON;
+    }
 
-       if (!strcmp(name, "_X_ILLUME_DEACTIVATE_WINDOW")) {
-               xmonitor_pause(client);
-       } else if (!strcmp(name, "_X_ILLUME_ACTIVATE_WINDOW")) {
-               xmonitor_resume(client);
-       } else {
-               /* ignore event */
-       }
+    client = client_find_by_pid(pid);
+    if (!client) {
+       return ECORE_CALLBACK_PASS_ON;
+    }
 
-       DbgFree(name);
+    name = ecore_x_atom_name_get(info->message_type);
+    if (!name) {
        return ECORE_CALLBACK_PASS_ON;
+    }
+
+    if (!strcmp(name, "_X_ILLUME_DEACTIVATE_WINDOW")) {
+       xmonitor_pause(client);
+    } else if (!strcmp(name, "_X_ILLUME_ACTIVATE_WINDOW")) {
+       xmonitor_resume(client);
+    } else {
+       /* ignore event */
+    }
+
+    DbgFree(name);
+    return ECORE_CALLBACK_PASS_ON;
 }
 
 static inline void sniff_all_windows(void)
 {
-       Ecore_X_Window root;
-       Ecore_X_Window ret;
-       struct stack_item *new_item;
-       struct stack_item *item;
-       Eina_List *win_stack;
-       //int pid;
-       struct stack_item {
-               Ecore_X_Window *wins;
-               int nr_of_wins;
-               int i;
-       };
-
-       root = ecore_x_window_root_first_get();
-       ecore_x_window_sniff(root);
-
-       new_item = malloc(sizeof(*new_item));
-       if (!new_item) {
-               ErrPrint("Error(%s)\n", strerror(errno));
-               return;
-       }
+    Ecore_X_Window root;
+    Ecore_X_Window ret;
+    struct stack_item *new_item;
+    struct stack_item *item;
+    Eina_List *win_stack;
+    //int pid;
+    struct stack_item {
+       Ecore_X_Window *wins;
+       int nr_of_wins;
+       int i;
+    };
+
+    root = ecore_x_window_root_first_get();
+    ecore_x_window_sniff(root);
+
+    new_item = malloc(sizeof(*new_item));
+    if (!new_item) {
+       ErrPrint("Error(%s)\n", strerror(errno));
+       return;
+    }
 
-       new_item->nr_of_wins = 0;
-       new_item->wins =
-               ecore_x_window_children_get(root, &new_item->nr_of_wins);
-       new_item->i = 0;
+    new_item->nr_of_wins = 0;
+    new_item->wins =
+       ecore_x_window_children_get(root, &new_item->nr_of_wins);
+    new_item->i = 0;
 
-       win_stack = NULL;
+    win_stack = NULL;
 
-       if (new_item->wins) {
-               win_stack = eina_list_append(win_stack, new_item);
-       } else {
-               DbgFree(new_item);
+    if (new_item->wins) {
+       win_stack = eina_list_append(win_stack, new_item);
+    } else {
+       DbgFree(new_item);
+    }
+
+    while ((item = eina_list_nth(win_stack, 0))) {
+       win_stack = eina_list_remove(win_stack, item);
+
+       if (!item->wins) {
+           DbgFree(item);
+           continue;
        }
 
-       while ((item = eina_list_nth(win_stack, 0))) {
-               win_stack = eina_list_remove(win_stack, item);
-
-               if (!item->wins) {
-                       DbgFree(item);
-                       continue;
-               }
-
-               while (item->i < item->nr_of_wins) {
-                       ret = item->wins[item->i];
-
-                       /*
-                        * Now we don't need to care about visibility of window,
-                        * just check whether it is registered or not.
-                        * (ecore_x_window_visible_get(ret))
-                        */
-                       ecore_x_window_client_sniff(ret);
-
-                       new_item = malloc(sizeof(*new_item));
-                       if (!new_item) {
-                               ErrPrint("Error %s\n", strerror(errno));
-                               item->i++;
-                               continue;
-                       }
-
-                       new_item->i = 0;
-                       new_item->nr_of_wins = 0;
-                       new_item->wins =
-                               ecore_x_window_children_get(ret,
-                                                       &new_item->nr_of_wins);
-                       if (new_item->wins) {
-                               win_stack =
-                                       eina_list_append(win_stack, new_item);
-                       } else {
-                               DbgFree(new_item);
-                       }
-
-                       item->i++;
-               }
-
-               DbgFree(item->wins);
-               DbgFree(item);
+       while (item->i < item->nr_of_wins) {
+           ret = item->wins[item->i];
+
+           /*
+            * Now we don't need to care about visibility of window,
+            * just check whether it is registered or not.
+            * (ecore_x_window_visible_get(ret))
+            */
+           ecore_x_window_client_sniff(ret);
+
+           new_item = malloc(sizeof(*new_item));
+           if (!new_item) {
+               ErrPrint("Error %s\n", strerror(errno));
+               item->i++;
+               continue;
+           }
+
+           new_item->i = 0;
+           new_item->nr_of_wins = 0;
+           new_item->wins =
+               ecore_x_window_children_get(ret,
+                       &new_item->nr_of_wins);
+           if (new_item->wins) {
+               win_stack =
+                   eina_list_append(win_stack, new_item);
+           } else {
+               DbgFree(new_item);
+           }
+
+           item->i++;
        }
 
-       return;
+       DbgFree(item->wins);
+       DbgFree(item);
+    }
+
+    return;
 }
 
 HAPI int xmonitor_pause(struct client_node *client)
 {
-       DbgPrint("%d is paused\n", client_pid(client));
-       client_paused(client);
-       xmonitor_handle_state_changes();
-       return LB_STATUS_SUCCESS;
+    DbgPrint("%d is paused\n", client_pid(client));
+    client_paused(client);
+    xmonitor_handle_state_changes();
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int xmonitor_resume(struct client_node *client)
 {
-       DbgPrint("%d is resumed\n", client_pid(client));
-       client_resumed(client);
-       xmonitor_handle_state_changes();
-       return LB_STATUS_SUCCESS;
+    DbgPrint("%d is resumed\n", client_pid(client));
+    client_resumed(client);
+    xmonitor_handle_state_changes();
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 static inline void disable_xmonitor(void)
 {
-       ecore_event_handler_del(s_info.create_handler);
-       ecore_event_handler_del(s_info.destroy_handler);
-       ecore_event_handler_del(s_info.client_handler);
+    ecore_event_handler_del(s_info.create_handler);
+    ecore_event_handler_del(s_info.destroy_handler);
+    ecore_event_handler_del(s_info.client_handler);
 
-       s_info.create_handler = NULL;
-       s_info.destroy_handler = NULL;
-       s_info.client_handler = NULL;
+    s_info.create_handler = NULL;
+    s_info.destroy_handler = NULL;
+    s_info.client_handler = NULL;
 }
 
 static inline int enable_xmonitor(void)
 {
-       if (ecore_x_composite_query() == EINA_FALSE) {
-               DbgPrint("====> COMPOSITOR IS NOT ENABLED\n");
-       }
-
-       s_info.create_handler =
-               ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CREATE,
-                                                       create_cb, NULL);
-       if (!s_info.create_handler) {
-               ErrPrint("Failed to add create event handler\n");
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       s_info.destroy_handler =
-               ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DESTROY,
-                                                       destroy_cb, NULL);
-       if (!s_info.destroy_handler) {
-               ErrPrint("Failed to add destroy event handler\n");
-               ecore_event_handler_del(s_info.create_handler);
-               s_info.create_handler = NULL;
-               return LB_STATUS_ERROR_FAULT;
-       }
-
-       s_info.client_handler =
-               ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE,
-                                                       client_cb, NULL);
-       if (!s_info.client_handler) {
-               ErrPrint("Failed to add focus out event handler\n");
-               ecore_event_handler_del(s_info.create_handler);
-               ecore_event_handler_del(s_info.destroy_handler);
-               s_info.create_handler = NULL;
-               s_info.destroy_handler = NULL;
-               return LB_STATUS_ERROR_FAULT;
-       }
+    if (ecore_x_composite_query() == EINA_FALSE) {
+       DbgPrint("====> COMPOSITOR IS NOT ENABLED\n");
+    }
+
+    s_info.create_handler =
+       ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CREATE,
+               create_cb, NULL);
+    if (!s_info.create_handler) {
+       ErrPrint("Failed to add create event handler\n");
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    s_info.destroy_handler =
+       ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DESTROY,
+               destroy_cb, NULL);
+    if (!s_info.destroy_handler) {
+       ErrPrint("Failed to add destroy event handler\n");
+       ecore_event_handler_del(s_info.create_handler);
+       s_info.create_handler = NULL;
+       return DBOX_STATUS_ERROR_FAULT;
+    }
+
+    s_info.client_handler =
+       ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE,
+               client_cb, NULL);
+    if (!s_info.client_handler) {
+       ErrPrint("Failed to add focus out event handler\n");
+       ecore_event_handler_del(s_info.create_handler);
+       ecore_event_handler_del(s_info.destroy_handler);
+       s_info.create_handler = NULL;
+       s_info.destroy_handler = NULL;
+       return DBOX_STATUS_ERROR_FAULT;
+    }
 
-       sniff_all_windows();
-       return LB_STATUS_SUCCESS;
+    sniff_all_windows();
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int xmonitor_init(void)
 {
-       if (USE_XMONITOR) {
-               int ret;
-               ret = enable_xmonitor();
-               if (ret < 0) {
-                       return ret;
-               }
+    if (DYNAMICBOX_CONF_USE_XMONITOR) {
+       int ret;
+       ret = enable_xmonitor();
+       if (ret < 0) {
+           return ret;
        }
+    }
 
-       s_info.paused = client_is_all_paused() || setting_is_lcd_off();
-       if (s_info.paused) {
-               touch_paused_file();
-       } else {
-               remove_paused_file();
-       }
+    s_info.paused = client_is_all_paused() || setting_is_lcd_off();
+    if (s_info.paused) {
+       touch_paused_file();
+    } else {
+       remove_paused_file();
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI void xmonitor_fini(void)
 {
-       if (USE_XMONITOR) {
-               disable_xmonitor();
-       }
+    if (DYNAMICBOX_CONF_USE_XMONITOR) {
+       disable_xmonitor();
+    }
 }
 
 HAPI int xmonitor_add_event_callback(enum xmonitor_event event, int (*cb)(void *user_data), void *user_data)
 {
-       struct event_item *item;
-
-       item = malloc(sizeof(*item));
-       if (!item) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
-
-       item->cb = cb;
-       item->user_data = user_data;
-
-       switch (event) {
-       case XMONITOR_PAUSED:
-               s_info.pause_list = eina_list_prepend(s_info.pause_list, item);
-               break;
-       case XMONITOR_RESUMED:
-               s_info.resume_list = eina_list_prepend(s_info.resume_list, item);
-               break;
-       default:
-               ErrPrint("Invalid event type\n");
-               DbgFree(item);
-               return LB_STATUS_ERROR_INVALID;
-       }
-
-       return LB_STATUS_SUCCESS;
+    struct event_item *item;
+
+    item = malloc(sizeof(*item));
+    if (!item) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
+
+    item->cb = cb;
+    item->user_data = user_data;
+
+    switch (event) {
+    case XMONITOR_PAUSED:
+       s_info.pause_list = eina_list_prepend(s_info.pause_list, item);
+       break;
+    case XMONITOR_RESUMED:
+       s_info.resume_list = eina_list_prepend(s_info.resume_list, item);
+       break;
+    default:
+       ErrPrint("Invalid event type\n");
+       DbgFree(item);
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int xmonitor_del_event_callback(enum xmonitor_event event, int (*cb)(void *user_data), void *user_data)
 {
-       struct event_item *item;
-       Eina_List *l;
-       Eina_List *n;
-
-       switch (event) {
-       case XMONITOR_PAUSED:
-               EINA_LIST_FOREACH_SAFE(s_info.pause_list, l, n, item) {
-                       if (item->cb == cb && item->user_data == user_data) {
-                               s_info.pause_list = eina_list_remove(s_info.pause_list, item);
-                               DbgFree(item);
-                               return LB_STATUS_SUCCESS;
-                       }
-               }
-               break;
-
-       case XMONITOR_RESUMED:
-               EINA_LIST_FOREACH_SAFE(s_info.resume_list, l, n, item) {
-                       if (item->cb == cb && item->user_data == user_data) {
-                               s_info.resume_list = eina_list_remove(s_info.resume_list, item);
-                               DbgFree(item);
-                               return LB_STATUS_SUCCESS;
-                       }
-               }
-               break;
-       default:
-               ErrPrint("Invalid event type\n");
-               return LB_STATUS_ERROR_INVALID;
+    struct event_item *item;
+    Eina_List *l;
+    Eina_List *n;
+
+    switch (event) {
+    case XMONITOR_PAUSED:
+       EINA_LIST_FOREACH_SAFE(s_info.pause_list, l, n, item) {
+           if (item->cb == cb && item->user_data == user_data) {
+               s_info.pause_list = eina_list_remove(s_info.pause_list, item);
+               DbgFree(item);
+               return DBOX_STATUS_ERROR_NONE;
+           }
+       }
+       break;
+
+    case XMONITOR_RESUMED:
+       EINA_LIST_FOREACH_SAFE(s_info.resume_list, l, n, item) {
+           if (item->cb == cb && item->user_data == user_data) {
+               s_info.resume_list = eina_list_remove(s_info.resume_list, item);
+               DbgFree(item);
+               return DBOX_STATUS_ERROR_NONE;
+           }
        }
+       break;
+    default:
+       ErrPrint("Invalid event type\n");
+       return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       return LB_STATUS_ERROR_NOT_EXIST;
+    return DBOX_STATUS_ERROR_NOT_EXIST;
 }
 
 HAPI int xmonitor_is_paused(void)
 {
-       return s_info.paused;
+    return s_info.paused;
 }
 
 /* End of a file */
index 488a3d3..bfe8016 100644 (file)
@@ -28,7 +28,7 @@
 
 #include <gio/gio.h>
 #include <dlog.h>
-#include <livebox-errno.h>
+#include <dynamicbox_errno.h>
 
 #include "conf.h"
 #include "debug.h"
 int errno;
 
 struct event_item {
-       int (*cb)(void *user_data);
-       void *user_data;
+    int (*cb)(void *user_data);
+    void *user_data;
 };
 
 static struct info {
-       Ecore_Event_Handler *create_handler;
-       Ecore_Event_Handler *destroy_handler;
-       Ecore_Event_Handler *client_handler;
+    Ecore_Event_Handler *create_handler;
+    Ecore_Event_Handler *destroy_handler;
+    Ecore_Event_Handler *client_handler;
 
-       Eina_List *pause_list;
-       Eina_List *resume_list;
+    Eina_List *pause_list;
+    Eina_List *resume_list;
 
-       int paused;
+    int paused;
 } s_info = {
-       .create_handler = NULL,
-       .destroy_handler = NULL,
-       .client_handler = NULL,
+    .create_handler = NULL,
+    .destroy_handler = NULL,
+    .client_handler = NULL,
 
-       .pause_list = NULL,
-       .resume_list = NULL,
+    .pause_list = NULL,
+    .resume_list = NULL,
 
-       .paused = 1, /*!< The provider is treated as paused process when it is launched */
+    .paused = 1, /*!< The provider is treated as paused process when it is launched */
 };
 
 static inline void touch_paused_file(void)
 {
-       int fd;
-       fd = creat(PAUSED_FILE, 0644);
-       if (fd >= 0) {
-               if (close(fd) < 0) {
-                       ErrPrint("close: %s\n", strerror(errno));
-               }
-       } else {
-               ErrPrint("Create .live.paused: %s\n", strerror(errno));
+    int fd;
+    fd = creat(PAUSED_FILE, 0644);
+    if (fd >= 0) {
+       if (close(fd) < 0) {
+           ErrPrint("close: %s\n", strerror(errno));
        }
+    } else {
+       ErrPrint("Create .live.paused: %s\n", strerror(errno));
+    }
 }
 
 static inline void remove_paused_file(void)
 {
-       if (unlink(PAUSED_FILE) < 0) {
-               ErrPrint("Unlink .live.paused: %s\n", strerror(errno));
-       }
+    if (unlink(PAUSED_FILE) < 0) {
+       ErrPrint("Unlink .live.paused: %s\n", strerror(errno));
+    }
 }
 
 HAPI void xmonitor_handle_state_changes(void)
 {
-       int paused;
-       Eina_List *l;
-       struct event_item *item;
-
-       paused = client_is_all_paused() || setting_is_lcd_off();
-       if (s_info.paused == paused) {
-               return;
+    int paused;
+    Eina_List *l;
+    struct event_item *item;
+
+    paused = client_is_all_paused() || setting_is_lcd_off();
+    if (s_info.paused == paused) {
+       return;
+    }
+
+    s_info.paused = paused;
+
+    if (s_info.paused) {
+       EINA_LIST_FOREACH(s_info.pause_list, l, item) {
+           if (item->cb) {
+               item->cb(item->user_data);
+           }
        }
 
-       s_info.paused = paused;
-
-       if (s_info.paused) {
-               EINA_LIST_FOREACH(s_info.pause_list, l, item) {
-                       if (item->cb) {
-                               item->cb(item->user_data);
-                       }
-               }
-
-               touch_paused_file();
+       touch_paused_file();
 
-               sqlite3_release_memory(SQLITE_FLUSH_MAX);
-               malloc_trim(0);
-       } else {
-               remove_paused_file();
+       sqlite3_release_memory(SQLITE_FLUSH_MAX);
+       malloc_trim(0);
+    } else {
+       remove_paused_file();
 
-               EINA_LIST_FOREACH(s_info.resume_list, l, item) {
-                       if (item->cb) {
-                               item->cb(item->user_data);
-                       }
-               }
+       EINA_LIST_FOREACH(s_info.resume_list, l, item) {
+           if (item->cb) {
+               item->cb(item->user_data);
+           }
        }
+    }
 }
 
 HAPI int xmonitor_update_state(int target_pid)
 {
-       struct client_node *client;
-
-       if (!USE_XMONITOR || target_pid < 0) {
-               return LB_STATUS_SUCCESS;
-       }
-
-       /*!
-        * \TODO
-        * Find the top(focuesd) window's PID
-        * Compare it with target_pid.
-        * If it is what we finding, call the
-        * xmonitor_pause or xmonitor_resume
-        */
-
-       xmonitor_handle_state_changes();
-       return LB_STATUS_SUCCESS;
+    struct client_node *client;
+
+    if (!USE_XMONITOR || target_pid < 0) {
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    /*!
+     * \TODO
+     * Find the top(focuesd) window's PID
+     * Compare it with target_pid.
+     * If it is what we finding, call the
+     * xmonitor_pause or xmonitor_resume
+     */
+
+    xmonitor_handle_state_changes();
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int xmonitor_pause(struct client_node *client)
 {
-       DbgPrint("%d is paused\n", client_pid(client));
-       client_paused(client);
-       xmonitor_handle_state_changes();
-       return LB_STATUS_SUCCESS;
+    DbgPrint("%d is paused\n", client_pid(client));
+    client_paused(client);
+    xmonitor_handle_state_changes();
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int xmonitor_resume(struct client_node *client)
 {
-       DbgPrint("%d is resumed\n", client_pid(client));
-       client_resumed(client);
-       xmonitor_handle_state_changes();
-       return LB_STATUS_SUCCESS;
+    DbgPrint("%d is resumed\n", client_pid(client));
+    client_resumed(client);
+    xmonitor_handle_state_changes();
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int xmonitor_init(void)
 {
-       if (USE_XMONITOR) {
-               return LB_STATUS_SUCCESS;
-       }
-
-       s_info.paused = client_is_all_paused() || setting_is_lcd_off();
-       if (s_info.paused) {
-               touch_paused_file();
-       } else {
-               remove_paused_file();
-       }
-
-       return LB_STATUS_SUCCESS;
+    if (USE_XMONITOR) {
+       return DBOX_STATUS_ERROR_NONE;
+    }
+
+    s_info.paused = client_is_all_paused() || setting_is_lcd_off();
+    if (s_info.paused) {
+       touch_paused_file();
+    } else {
+       remove_paused_file();
+    }
+
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI void xmonitor_fini(void)
 {
-       if (USE_XMONITOR) {
-       }
+    if (USE_XMONITOR) {
+    }
 }
 
 HAPI int xmonitor_add_event_callback(enum xmonitor_event event, int (*cb)(void *user_data), void *user_data)
 {
-       struct event_item *item;
+    struct event_item *item;
 
-       item = malloc(sizeof(*item));
-       if (!item) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return LB_STATUS_ERROR_MEMORY;
-       }
+    item = malloc(sizeof(*item));
+    if (!item) {
+       ErrPrint("Heap: %s\n", strerror(errno));
+       return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+    }
 
-       item->cb = cb;
-       item->user_data = user_data;
+    item->cb = cb;
+    item->user_data = user_data;
 
-       switch (event) {
+    switch (event) {
        case XMONITOR_PAUSED:
-               s_info.pause_list = eina_list_prepend(s_info.pause_list, item);
-               break;
+           s_info.pause_list = eina_list_prepend(s_info.pause_list, item);
+           break;
        case XMONITOR_RESUMED:
-               s_info.resume_list = eina_list_prepend(s_info.resume_list, item);
-               break;
+           s_info.resume_list = eina_list_prepend(s_info.resume_list, item);
+           break;
        default:
-               ErrPrint("Invalid event type\n");
-               DbgFree(item);
-               return LB_STATUS_ERROR_INVALID;
-       }
+           ErrPrint("Invalid event type\n");
+           DbgFree(item);
+           return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       return LB_STATUS_SUCCESS;
+    return DBOX_STATUS_ERROR_NONE;
 }
 
 HAPI int xmonitor_del_event_callback(enum xmonitor_event event, int (*cb)(void *user_data), void *user_data)
 {
-       struct event_item *item;
-       Eina_List *l;
-       Eina_List *n;
+    struct event_item *item;
+    Eina_List *l;
+    Eina_List *n;
 
-       switch (event) {
+    switch (event) {
        case XMONITOR_PAUSED:
-               EINA_LIST_FOREACH_SAFE(s_info.pause_list, l, n, item) {
-                       if (item->cb == cb && item->user_data == user_data) {
-                               s_info.pause_list = eina_list_remove(s_info.pause_list, item);
-                               DbgFree(item);
-                               return LB_STATUS_SUCCESS;
-                       }
+           EINA_LIST_FOREACH_SAFE(s_info.pause_list, l, n, item) {
+               if (item->cb == cb && item->user_data == user_data) {
+                   s_info.pause_list = eina_list_remove(s_info.pause_list, item);
+                   DbgFree(item);
+                   return DBOX_STATUS_ERROR_NONE;
                }
-               break;
+           }
+           break;
 
        case XMONITOR_RESUMED:
-               EINA_LIST_FOREACH_SAFE(s_info.resume_list, l, n, item) {
-                       if (item->cb == cb && item->user_data == user_data) {
-                               s_info.resume_list = eina_list_remove(s_info.resume_list, item);
-                               DbgFree(item);
-                               return LB_STATUS_SUCCESS;
-                       }
+           EINA_LIST_FOREACH_SAFE(s_info.resume_list, l, n, item) {
+               if (item->cb == cb && item->user_data == user_data) {
+                   s_info.resume_list = eina_list_remove(s_info.resume_list, item);
+                   DbgFree(item);
+                   return DBOX_STATUS_ERROR_NONE;
                }
-               break;
+           }
+           break;
        default:
-               ErrPrint("Invalid event type\n");
-               return LB_STATUS_ERROR_INVALID;
-       }
+           ErrPrint("Invalid event type\n");
+           return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+    }
 
-       return LB_STATUS_ERROR_NOT_EXIST;
+    return DBOX_STATUS_ERROR_NOT_EXIST;
 }
 
 HAPI int xmonitor_is_paused(void)
 {
-       return s_info.paused;
+    return s_info.paused;
 }
 
 /* End of a file */
index f94697a..d2b0274 100644 (file)
@@ -10,7 +10,7 @@ pkg_check_modules(info_pkgs REQUIRED
        ecore
        glib-2.0
        gio-2.0
-       livebox-service
+       dynamicbox_service
        xdamage
        xfixes
        x11
index 2077357..7f46e19 100644 (file)
@@ -40,7 +40,7 @@
 #include <com-core_packet.h>
 #include <com-core.h>
 
-#include <livebox-service.h>
+#include <dynamicbox_service.h>
 
 #include <Ecore.h>
 
@@ -63,6 +63,7 @@ struct package {
 
 struct instance {
        char *id;
+       char *buf_id;
        char *cluster;
        char *category;
        double period;
@@ -150,7 +151,7 @@ static Eina_Bool process_line_cb(void *data)
        return ECORE_CALLBACK_CANCEL;
 }
 
-static void prompt(const char *cmdline)
+static inline void prompt(const char *cmdline)
 {
        char *path;
 
@@ -205,6 +206,7 @@ static void inst_del_cb(struct node *node)
        }
 
        free(info->id);
+       free(info->buf_id);
        free(info->cluster);
        free(info->category);
        free(info->state);
@@ -270,7 +272,7 @@ static void ls(void)
 
                        info = node_data(node);
 
-                       printf(" %5.2f %6s %10s %10s %4dx%-4d ", info->period, info->state, info->cluster, info->category, info->width, info->height);
+                       printf(" %5.2f %s %6s %10s %10s %4dx%-4d ", info->period, info->buf_id, info->state, info->cluster, info->category, info->width, info->height);
                        snprintf(buf, sizeof(buf), "/opt/usr/share/live_magazine/reader/%s", node_name(node));
                        if (lstat(buf, &stat) < 0) {
                                printf("%3d ERR ", errno);
@@ -430,7 +432,7 @@ static void send_pkg_list(void)
        s_info.cmd = PKG_LIST;
        s_info.age++;
 
-       livebox_service_get_pkglist(pkglist_cb, s_info.targetdir);
+       dynamicbox_service_get_pkglist(pkglist_cb, s_info.targetdir);
 }
 
 static void send_inst_delete(void)
@@ -562,7 +564,7 @@ static void send_inst_list(const char *pkgname)
 
 static void help(void)
 {
-       printf("liveinfo - Livebox utility\n");
+       printf("liveinfo - DynamicBox utility\n");
        printf("------------------------------ [Option] ------------------------------\n");
        printf("-b Batch mode\n");
        printf("-x execute command\n");
@@ -699,60 +701,41 @@ static inline int do_stat(const char *cmd)
 
        switch (type){
        case PKG:
-               tmp = livebox_service_i18n_name(node_name(node), NULL);
+               tmp = dynamicbox_service_i18n_name(node_name(node), NULL);
                printf("Name: %s (", tmp);
                free(tmp);
 
-               i = livebox_service_is_enabled(node_name(node));
+               i = dynamicbox_service_is_enabled(node_name(node));
                printf("%s)\n", i ? "enabled" : "disabled");
 
-               tmp = livebox_service_i18n_icon(node_name(node), NULL);
+               tmp = dynamicbox_service_i18n_icon(node_name(node), NULL);
                printf("Icon: %s\n", tmp);
                free(tmp);
 
-               tmp = livebox_service_provider_name(node_name(node));
+               tmp = dynamicbox_service_provider_name(node_name(node));
                printf("Provider: %s (content:", tmp);
                free(tmp);
 
-               tmp = livebox_service_content(node_name(node));
+               tmp = dynamicbox_service_content(node_name(node));
                printf("%s)\n", tmp);
                free(tmp);
 
-               tmp = livebox_service_lb_script_path(node_name(node));
+               tmp = dynamicbox_service_dbox_script_path(node_name(node));
                printf("LB Script: %s (", tmp);
                free(tmp);
 
-               tmp = livebox_service_lb_script_group(node_name(node));
+               tmp = dynamicbox_service_dbox_script_group(node_name(node));
                printf("%s)\n", tmp);
                free(tmp);
 
-               tmp = livebox_service_pd_script_path(node_name(node));
+               tmp = dynamicbox_service_gbar_script_path(node_name(node));
                printf("PD Script: %s (", tmp);
                free(tmp);
 
-               tmp = livebox_service_pd_script_group(node_name(node));
+               tmp = dynamicbox_service_gbar_script_group(node_name(node));
                printf("%s)\n", tmp);
                free(tmp);
 
-               i = livebox_service_mouse_event(node_name(node), LB_SIZE_TYPE_1x1);
-               printf("[1x1] Mouse event: %s\n", i ? "enabled" : "disabled");
-               i = livebox_service_mouse_event(node_name(node), LB_SIZE_TYPE_2x1);
-               printf("[2x1] Mouse event: %s\n", i ? "enabled" : "disabled");
-               i = livebox_service_mouse_event(node_name(node), LB_SIZE_TYPE_2x2);
-               printf("[2x2] Mouse event: %s\n", i ? "enabled" : "disabled");
-               i = livebox_service_mouse_event(node_name(node), LB_SIZE_TYPE_4x1);
-               printf("[4x1] Mouse event: %s\n", i ? "enabled" : "disabled");
-               i = livebox_service_mouse_event(node_name(node), LB_SIZE_TYPE_4x2);
-               printf("[4x2] Mouse event: %s\n", i ? "enabled" : "disabled");
-               i = livebox_service_mouse_event(node_name(node), LB_SIZE_TYPE_4x3);
-               printf("[4x3] Mouse event: %s\n", i ? "enabled" : "disabled");
-               i = livebox_service_mouse_event(node_name(node), LB_SIZE_TYPE_4x4);
-               printf("[4x4] Mouse event: %s\n", i ? "enabled" : "disabled");
-               i = livebox_service_mouse_event(node_name(node), LB_SIZE_TYPE_4x5);
-               printf("[4x5] Mouse event: %s\n", i ? "enabled" : "disabled");
-               i = livebox_service_mouse_event(node_name(node), LB_SIZE_TYPE_4x6);
-               printf("[4x6] Mouse event: %s\n", i ? "enabled" : "disabled");
-
                break;
        case PROVIDER:
                printf("Not supported yet\n");
@@ -1452,8 +1435,10 @@ static void processing_line_buffer(const char *buffer)
        char pkgname[256];
        char abi[256];
        char inst_id[4096];
+       char buf_id[256];
        char cluster[256];
        char category[256];
+       char str_period[64];
        char state[10];
        int refcnt;
        int fault_count;
@@ -1589,11 +1574,13 @@ static void processing_line_buffer(const char *buffer)
                slaveinfo->ttl = ttl;
                break;
        case INST_LIST:
-               if (sscanf(buffer, "%[^ ] %[^ ] %[^ ] %lf %[^ ] %d %d", inst_id, cluster, category, &period, state, &width, &height) != 7) {
+               if (sscanf(buffer, "%[^ ] %[^ ] %[^ ] %[^ ] %[^ ] %[^ ] %d %d", inst_id, buf_id, cluster, category, str_period, state, &width, &height) != 8) {
                        printf("Invalid format : [%s]\n", buffer);
                        return;
                }
 
+               period = strtod(str_period, NULL);
+
                for (i = strlen(inst_id); i > 0 && inst_id[i] != '/'; i--);
                i += (inst_id[i] == '/');
 
@@ -1620,6 +1607,7 @@ static void processing_line_buffer(const char *buffer)
                node_set_age(node, s_info.age);
 
                free(instinfo->id);
+               free(instinfo->buf_id);
                free(instinfo->cluster);
                free(instinfo->category);
                free(instinfo->state);
@@ -1644,6 +1632,10 @@ static void processing_line_buffer(const char *buffer)
                        printf("Error: %s\n", strerror(errno));
                }
 
+               if (strlen(buf_id)) {
+                       instinfo->buf_id = strdup(buf_id);
+               }
+
                instinfo->period = period;
                instinfo->width = width;
                instinfo->height = height;
@@ -1933,7 +1925,7 @@ int main(int argc, char *argv[])
 
        com_core_add_event_callback(CONNECTOR_DISCONNECTED, disconnected_cb, NULL);
        com_core_add_event_callback(CONNECTOR_CONNECTED, connected_cb, NULL);
-       livebox_service_init();
+       dynamicbox_service_init();
 
        s_info.fd = com_core_packet_client_init(SOCKET_FILE, 0, s_table);
        if (s_info.fd < 0) {
@@ -1967,7 +1959,7 @@ int main(int argc, char *argv[])
        ecore_main_loop_begin();
 
        fini_directory();
-       livebox_service_fini();
+       dynamicbox_service_fini();
 
        if (s_info.fd > 0) {
                com_core_packet_client_fini(s_info.fd);