summaryrefslogtreecommitdiff
path: root/src/server.c
diff options
context:
space:
mode:
authorjk7744.park <jk7744.park@samsung.com>2015-02-01 13:06:58 +0900
committerjk7744.park <jk7744.park@samsung.com>2015-02-01 13:06:58 +0900
commit5c0922653889209693ca3f6495c50e6cf900cc1e (patch)
tree54957d4196c4f2428de14b558054cf3f33117a29 /src/server.c
parent61a319403b0dd277ab47a2e08a1ce6a6e1cd9e0a (diff)
downloaddata-provider-master-5c0922653889209693ca3f6495c50e6cf900cc1e.tar.gz
data-provider-master-5c0922653889209693ca3f6495c50e6cf900cc1e.tar.bz2
data-provider-master-5c0922653889209693ca3f6495c50e6cf900cc1e.zip
Diffstat (limited to 'src/server.c')
-rw-r--r--src/server.c5996
1 files changed, 3166 insertions, 2830 deletions
diff --git a/src/server.c b/src/server.c
index c70ef3b..8567ff6 100644
--- a/src/server.c
+++ b/src/server.c
@@ -18,6 +18,8 @@
#include <unistd.h>
#include <errno.h>
+#include <sys/smack.h>
+
#include <dlog.h>
#include <aul.h>
#include <Ecore.h>
@@ -25,8 +27,11 @@
#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"
@@ -49,12 +54,20 @@
#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_GBAR_OPEN_TAG "lazy,gbar,open"
+#define LAZY_GBAR_CLOSE_TAG "lazy,gbar,close"
-#define LAZY_PD_OPEN_TAG "lazy,pd,open"
-#define LAZY_PD_CLOSE_TAG "lazy,pd,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;
@@ -70,10 +83,16 @@ static struct info {
.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_DBOX,
+ TYPE_GBAR,
TYPE_ERROR
};
@@ -87,23 +106,103 @@ struct deleted_item {
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 event_cbdata *cbdata = data;
+
+ 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;
+}
+
+static Eina_Bool lazy_access_status_cb(void *data)
+{
+ struct event_cbdata *cbdata = data;
+
+ 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;
+}
+
+int send_delayed_key_status(struct inst_info *inst, int ret)
+{
+ struct event_cbdata *cbdata;
+
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ret = DBOX_STATUS_ERROR_OUT_OF_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 = DBOX_STATUS_ERROR_FAULT;
+ } else {
+ ret = DBOX_STATUS_ERROR_NONE;
+ }
+ }
+
+ return ret;
+}
+
+int send_delayed_access_status(struct inst_info *inst, int ret)
+{
+ struct event_cbdata *cbdata;
+
+ cbdata = malloc(sizeof(*cbdata));
+ if (!cbdata) {
+ ret = DBOX_STATUS_ERROR_OUT_OF_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 = DBOX_STATUS_ERROR_FAULT;
+ } else {
+ ret = DBOX_STATUS_ERROR_NONE;
+ }
+ }
+
+ 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_lb_buffer(inst);
+ buffer = instance_dbox_buffer(inst);
if (!buffer) {
ErrPrint("Instance[%s] has no buffer\n", instance_id(inst));
- ret = LB_STATUS_ERROR_FAULT;
+ 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;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
@@ -114,23 +213,23 @@ out:
return ret;
}
-static int forward_pd_event_packet(const struct pkg_info *pkg, struct inst_info *inst, const struct packet *packet)
+static int forward_gbar_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_pd_buffer(inst);
+ buffer = instance_gbar_buffer(inst);
if (!buffer) {
ErrPrint("Instance[%s] has no buffer\n", instance_id(inst));
- ret = LB_STATUS_ERROR_FAULT;
+ 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;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
@@ -141,80 +240,80 @@ out:
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)
+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;
- buffer = instance_pd_buffer(inst);
+ buffer = instance_gbar_buffer(inst);
if (!buffer) {
ErrPrint("Instance[%s] has no buffer\n", instance_id(inst));
- ret = LB_STATUS_ERROR_FAULT;
+ 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;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
- p = packet_create_noack(command, "ssdii", package_name(pkg), instance_id(inst), timestamp, x, y);
+ 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;
}
-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_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;
- buffer = instance_lb_buffer(inst);
+ buffer = instance_dbox_buffer(inst);
if (!buffer) {
ErrPrint("Instance[%s] has no buffer\n", instance_id(inst));
- ret = LB_STATUS_ERROR_FAULT;
+ 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;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
- p = packet_create_noack(command, "ssdii", package_name(pkg), instance_id(inst), timestamp, x, y);
+ 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;
}
-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_key_packet(const struct pkg_info *pkg, struct inst_info *inst, const char *command, double timestamp, unsigned int keycode)
{
int ret;
struct buffer_info *buffer;
struct slave_node *slave;
struct packet *p;
- buffer = instance_lb_buffer(inst);
+ buffer = instance_dbox_buffer(inst);
if (!buffer) {
ErrPrint("Instance[%s] has no buffer\n", instance_id(inst));
- ret = LB_STATUS_ERROR_FAULT;
+ 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;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
@@ -225,24 +324,24 @@ out:
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_key_packet(const struct pkg_info *pkg, struct inst_info *inst, const char *command, double timestamp, unsigned int keycode)
{
int ret;
struct buffer_info *buffer;
struct slave_node *slave;
struct packet *p;
- buffer = instance_lb_buffer(inst);
+ buffer = instance_dbox_buffer(inst);
if (!buffer) {
ErrPrint("Instance[%s] has no buffer\n", instance_id(inst));
- ret = LB_STATUS_ERROR_FAULT;
+ 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;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
@@ -253,49 +352,15 @@ out:
return ret;
}
-static Eina_Bool lazy_key_status_cb(void *data)
-{
- struct event_cbdata *cbdata = data;
-
- 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;
-}
-
-static Eina_Bool lazy_access_status_cb(void *data)
-{
- struct event_cbdata *cbdata = data;
-
- 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 slave_fault_open_script_cb(struct slave_node *slave, void *data)
{
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);
+ timer = instance_del_data(data, LAZY_GBAR_OPEN_TAG);
if (timer) {
ecore_timer_del(timer);
}
@@ -309,10 +374,10 @@ static int slave_fault_open_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_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);
+ timer = instance_del_data(data, GBAR_OPEN_MONITOR_TAG);
if (timer) {
ecore_timer_del(timer);
}
@@ -326,9 +391,9 @@ static int slave_fault_close_script_cb(struct slave_node *slave, void *data)
{
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);
+ timer = instance_del_data(data, LAZY_GBAR_CLOSE_TAG);
if (timer) {
ecore_timer_del(timer);
}
@@ -342,11 +407,11 @@ static int slave_fault_close_buffer_cb(struct slave_node *slave, void *data)
{
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);
+ timer = instance_del_data(data, LAZY_GBAR_CLOSE_TAG);
if (!timer) {
- timer = instance_del_data(data, PD_CLOSE_MONITOR_TAG);
+ timer = instance_del_data(data, GBAR_CLOSE_MONITOR_TAG);
}
if (timer) {
@@ -362,10 +427,10 @@ 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);
+ (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, PD_RESIZE_MONITOR_TAG);
+ timer = instance_del_data(data, GBAR_RESIZE_MONITOR_TAG);
if (timer) {
ecore_timer_del(timer);
}
@@ -375,87 +440,97 @@ static int slave_fault_resize_buffer_cb(struct slave_node *slave, void *data)
return -1; /* remove this handler */
}
-static int key_event_lb_route_cb(enum event_state state, struct event_data *event_info, void *data)
+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;
- const char *cmdstr;
+ unsigned int cmd;
+
+ if (!inst) {
+ DbgPrint("Instance is deleted.\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
pkg = instance_package(inst);
if (!pkg) {
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
slave = package_slave(pkg);
if (!slave) {
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
switch (state) {
case EVENT_STATE_ACTIVATE:
- cmdstr = "lb_key_down";
+ cmd = CMD_DBOX_KEY_DOWN;
break;
case EVENT_STATE_ACTIVATED:
- cmdstr = "lb_key_down";
+ cmd = CMD_DBOX_KEY_DOWN;
break;
case EVENT_STATE_DEACTIVATE:
- cmdstr = "lb_key_up";
+ cmd = CMD_DBOX_KEY_UP;
break;
default:
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- packet = packet_create_noack(cmdstr, "ssdi", package_name(pkg), instance_id(inst), util_timestamp(), event_info->keycode);
+ packet = packet_create_noack((const char *)&cmd, "ssdi", package_name(pkg), instance_id(inst), event_info->tv, event_info->keycode);
if (!packet) {
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
return slave_rpc_request_only(slave, package_name(pkg), packet, 0);
}
-static int mouse_event_lb_route_cb(enum event_state state, struct event_data *event_info, void *data)
+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;
- const char *cmdstr;
+ unsigned int cmd;
+
+ if (!inst) {
+ DbgPrint("Instance is deleted.\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
pkg = instance_package(inst);
if (!pkg) {
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
slave = package_slave(pkg);
if (!slave) {
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
switch (state) {
case EVENT_STATE_ACTIVATE:
- cmdstr = "lb_mouse_down";
+ cmd = CMD_DBOX_MOUSE_DOWN;
break;
case EVENT_STATE_ACTIVATED:
- cmdstr = "lb_mouse_move";
+ cmd = CMD_DBOX_MOUSE_MOVE;
break;
case EVENT_STATE_DEACTIVATE:
- cmdstr = "lb_mouse_up";
+ cmd = CMD_DBOX_MOUSE_UP;
break;
default:
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- packet = packet_create_noack(cmdstr, "ssdii", package_name(pkg), instance_id(inst), util_timestamp(), event_info->x, event_info->y);
+ 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 LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
return slave_rpc_request_only(slave, package_name(pkg), packet, 0);
}
-static int key_event_lb_consume_cb(enum event_state state, struct event_data *event_info, void *data)
+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;
@@ -467,25 +542,25 @@ static int key_event_lb_consume_cb(enum event_state state, struct event_data *ev
return 0;
}
- script = instance_lb_script(inst);
+ script = instance_dbox_script(inst);
if (!script) {
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
- timestamp = util_timestamp();
+ timestamp = event_info->tv;
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);
+ (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, LB_SCRIPT_KEY_DOWN, timestamp);
+ (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, LB_SCRIPT_MOUSE_UP, timestamp);
+ (void)script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_UP, timestamp);
break;
default:
ErrPrint("Unknown event\n");
@@ -495,7 +570,7 @@ static int key_event_lb_consume_cb(enum event_state state, struct event_data *ev
return 0;
}
-static int mouse_event_lb_consume_cb(enum event_state state, struct event_data *event_info, void *data)
+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;
@@ -507,25 +582,25 @@ static int mouse_event_lb_consume_cb(enum event_state state, struct event_data *
return 0;
}
- script = instance_lb_script(inst);
+ script = instance_dbox_script(inst);
if (!script) {
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
- timestamp = util_timestamp();
+ 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, LB_SCRIPT_MOUSE_DOWN, timestamp);
+ (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, LB_SCRIPT_MOUSE_MOVE, timestamp);
+ (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, LB_SCRIPT_MOUSE_UP, timestamp);
+ (void)script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_UP, timestamp);
break;
default:
break;
@@ -534,87 +609,97 @@ static int mouse_event_lb_consume_cb(enum event_state state, struct event_data *
return 0;
}
-static int key_event_pd_route_cb(enum event_state state, struct event_data *event_info, void *data)
+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;
- const char *cmdstr;
+ unsigned int cmd;
+
+ if (!inst) {
+ DbgPrint("Instance is deleted.\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
pkg = instance_package(inst);
if (!pkg) {
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
slave = package_slave(pkg);
if (!slave) {
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
switch (state) {
case EVENT_STATE_ACTIVATE:
- cmdstr = "pd_key_down";
+ cmd = CMD_GBAR_KEY_DOWN;
break;
case EVENT_STATE_ACTIVATED:
- cmdstr = "pd_key_down";
+ cmd = CMD_GBAR_KEY_DOWN;
break;
case EVENT_STATE_DEACTIVATE:
- cmdstr = "pd_key_up";
+ cmd = CMD_GBAR_KEY_UP;
break;
default:
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- packet = packet_create_noack(cmdstr, "ssdi", package_name(pkg), instance_id(inst), util_timestamp(), event_info->keycode);
+ packet = packet_create_noack((const char *)&cmd, "ssdi", package_name(pkg), instance_id(inst), event_info->tv, event_info->keycode);
if (!packet) {
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
return slave_rpc_request_only(slave, package_name(pkg), packet, 0);
}
-static int mouse_event_pd_route_cb(enum event_state state, struct event_data *event_info, void *data)
+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;
- const char *cmdstr;
+ unsigned int cmd;
+
+ if (!inst) {
+ DbgPrint("Instance is deleted.\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
pkg = instance_package(inst);
if (!pkg) {
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
slave = package_slave(pkg);
if (!slave) {
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
switch (state) {
case EVENT_STATE_ACTIVATE:
- cmdstr = "pd_mouse_down";
+ cmd = CMD_GBAR_MOUSE_DOWN;
break;
case EVENT_STATE_ACTIVATED:
- cmdstr = "pd_mouse_move";
+ cmd = CMD_GBAR_MOUSE_MOVE;
break;
case EVENT_STATE_DEACTIVATE:
- cmdstr = "pd_mouse_up";
+ cmd = CMD_GBAR_MOUSE_UP;
break;
default:
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
- packet = packet_create_noack(cmdstr, "ssdii", package_name(pkg), instance_id(inst), util_timestamp(), event_info->x, event_info->y);
+ 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 LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
return slave_rpc_request_only(slave, package_name(pkg), packet, 0);
}
-static int key_event_pd_consume_cb(enum event_state state, struct event_data *event_info, void *data)
+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;
@@ -626,25 +711,25 @@ static int key_event_pd_consume_cb(enum event_state state, struct event_data *ev
return 0;
}
- script = instance_pd_script(inst);
+ script = instance_gbar_script(inst);
if (!script) {
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
- timestamp = util_timestamp();
+ timestamp = event_info->tv;
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);
+ (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, LB_SCRIPT_KEY_DOWN, timestamp);
+ (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, LB_SCRIPT_KEY_UP, timestamp);
+ (void)script_handler_feed_event(script, DBOX_SCRIPT_KEY_UP, timestamp);
break;
default:
ErrPrint("Unknown event\n");
@@ -654,7 +739,7 @@ static int key_event_pd_consume_cb(enum event_state state, struct event_data *ev
return 0;
}
-static int mouse_event_pd_consume_cb(enum event_state state, struct event_data *event_info, void *data)
+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;
@@ -666,25 +751,25 @@ static int mouse_event_pd_consume_cb(enum event_state state, struct event_data *
return 0;
}
- script = instance_pd_script(inst);
+ script = instance_gbar_script(inst);
if (!script) {
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
- timestamp = util_timestamp();
+ 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, LB_SCRIPT_MOUSE_DOWN, timestamp);
+ (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, LB_SCRIPT_MOUSE_MOVE, timestamp);
+ (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, LB_SCRIPT_MOUSE_UP, timestamp);
+ (void)script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_UP, timestamp);
break;
default:
break;
@@ -696,19 +781,20 @@ static struct packet *client_acquire(pid_t pid, int handle, const struct packet
{
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 = LB_STATUS_ERROR_EXIST;
+ ret = DBOX_STATUS_ERROR_EXIST;
goto out;
}
- if (packet_get(packet, "d", &timestamp) != 1) {
+ if (packet_get(packet, "ds", &timestamp, &direct_addr) != 2) {
ErrPrint("Invalid arguemnt\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
@@ -717,14 +803,14 @@ static struct packet *client_acquire(pid_t pid, int handle, const struct packet
* \note
* client_create will invoke the client created callback
*/
- client = client_create(pid, handle);
+ client = client_create(pid, handle, direct_addr);
if (!client) {
ErrPrint("Failed to create a new client for %d\n", pid);
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
}
out:
- result = packet_create_reply(packet, "i", ret);
+ result = packet_create_reply(packet, "ii", ret, DYNAMICBOX_CONF_EXTRA_BUFFER_COUNT);
if (!result) {
ErrPrint("Failed to create a packet\n");
}
@@ -741,7 +827,7 @@ static struct packet *cilent_release(pid_t pid, int handle, const struct packet
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
@@ -765,18 +851,18 @@ static int validate_request(const char *pkgname, const char *id, struct inst_inf
inst = package_find_instance_by_id(pkgname, id);
if (!inst) {
ErrPrint("Instance is not exists (%s)\n", id);
- return LB_STATUS_ERROR_NOT_EXIST;
+ return DBOX_STATUS_ERROR_NOT_EXIST;
}
pkg = instance_package(inst);
if (!pkg) {
ErrPrint("System error - instance has no package?\n");
- return LB_STATUS_ERROR_INVALID;
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (package_is_fault(pkg)) {
ErrPrint("Faulted package: %s\n", pkgname);
- return LB_STATUS_ERROR_FAULT;
+ return DBOX_STATUS_ERROR_FAULT;
}
if (out_inst) {
@@ -787,7 +873,7 @@ static int validate_request(const char *pkgname, const char *id, struct inst_inf
*out_pkg = pkg;
}
- return LB_STATUS_SUCCESS;
+ return DBOX_STATUS_ERROR_NONE;
}
/*!< pid, pkgname, filename, event, timestamp, x, y, ret */
@@ -818,10 +904,10 @@ static struct packet *client_clicked(pid_t pid, int handle, const struct packet
/*!
* \NOTE:
* Trust the package name which are sent by the client.
- * The package has to be a livebox package name.
+ * The package has to be a dynamicbox package name.
*/
ret = validate_request(pkgname, id, &inst, NULL);
- if (ret == (int)LB_STATUS_SUCCESS) {
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
(void)instance_clicked(inst, event, timestamp, x, y);
}
@@ -843,19 +929,19 @@ static struct packet *client_update_mode(pid_t pid, int handle, const struct pac
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_INVALID;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, NULL);
- if (ret == (int)LB_STATUS_SUCCESS) {
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
/*!
* \note
* Send change update mode request to a slave
@@ -891,24 +977,24 @@ static struct packet *client_text_signal(pid_t pid, int handle, const struct pac
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ 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 livebox package name.
+ * The package has to be a dynamicbox package name.
*/
ret = validate_request(pkgname, id, &inst, NULL);
- if (ret == (int)LB_STATUS_SUCCESS) {
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
ret = instance_text_signal_emit(inst, emission, source, sx, sy, ex, ey);
}
@@ -931,7 +1017,7 @@ static Eina_Bool lazy_delete_cb(void *data)
* 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_unicast_deleted_event(item->inst, item->client, DBOX_STATUS_ERROR_NONE);
(void)instance_del_client(item->inst, item->client);
}
@@ -956,32 +1042,32 @@ static struct packet *client_delete(pid_t pid, int handle, const struct packet *
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
/*!
* \note
- * Below two types must has to be sync'd with livebox-viewer
+ * Below two types must has to be sync'd with dynamicbox-viewer
*
- * LB_DELETE_PERMANENTLY = 0x01,
- * LB_DELETE_TEMPORARY = 0x02,
+ * 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 livebox package name.
+ * The package has to be a dynamicbox package name.
*/
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ 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) {
@@ -997,7 +1083,7 @@ static struct packet *client_delete(pid_t pid, int handle, const struct packet *
if (package_is_fault(pkg)) {
DbgPrint("Faulted package. will be deleted soon: %s\n", id);
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
@@ -1008,7 +1094,7 @@ static struct packet *client_delete(pid_t pid, int handle, const struct packet *
item = malloc(sizeof(*item));
if (!item) {
ErrPrint("Heap: %s\n", strerror(errno));
- ret = LB_STATUS_ERROR_MEMORY;
+ ret = DBOX_STATUS_ERROR_OUT_OF_MEMORY;
} else {
/*!
* \NOTE:
@@ -1027,22 +1113,22 @@ static struct packet *client_delete(pid_t pid, int handle, const struct packet *
(void)client_unref(client);
(void)instance_unref(inst);
DbgFree(item);
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
} else {
- ret = LB_STATUS_SUCCESS;
+ ret = DBOX_STATUS_ERROR_NONE;
}
}
} else {
ErrPrint("Client has no permission\n");
- ret = LB_STATUS_ERROR_PERMISSION;
+ ret = DBOX_STATUS_ERROR_PERMISSION_DENIED;
}
} else {
switch (type) {
- case LB_DELETE_PERMANENTLY:
- ret = instance_destroy(inst, INSTANCE_DESTROY_DEFAULT);
+ case DBOX_DELETE_PERMANENTLY:
+ ret = instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
break;
- case LB_DELETE_TEMPORARY:
- ret = instance_destroy(inst, INSTANCE_DESTROY_TEMPORARY);
+ case DBOX_DELETE_TEMPORARY:
+ ret = instance_destroy(inst, DBOX_DESTROY_TYPE_TEMPORARY);
break;
default:
break;
@@ -1072,14 +1158,14 @@ static struct packet *client_resize(pid_t pid, int handle, const struct packet *
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
@@ -1088,15 +1174,15 @@ static struct packet *client_resize(pid_t pid, int handle, const struct packet *
/*!
* \NOTE:
* Trust the package name which are sent by the client.
- * The package has to be a livebox package name.
+ * The package has to be a dynamicbox package name.
*/
ret = validate_request(pkgname, id, &inst, NULL);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
goto out;
}
if (instance_client(inst) != client) {
- ret = LB_STATUS_ERROR_PERMISSION;
+ ret = DBOX_STATUS_ERROR_PERMISSION_DENIED;
} else {
ret = instance_resize(inst, w, h);
}
@@ -1130,32 +1216,32 @@ static struct packet *client_new(pid_t pid, int handle, const struct packet *pac
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ 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);
+ pid, timestamp, pkgname, content, cluster, category, period);
- lbid = package_lb_pkgname(pkgname);
+ lbid = package_dbox_pkgname(pkgname);
if (!lbid) {
- ErrPrint("This %s has no livebox package\n", pkgname);
- ret = LB_STATUS_ERROR_INVALID;
+ ErrPrint("This %s has no dynamicbox package\n", pkgname);
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
- mainappid = livebox_service_mainappid(lbid);
+ mainappid = dynamicbox_service_mainappid(lbid);
if (!package_is_enabled(mainappid)) {
DbgFree(mainappid);
DbgFree(lbid);
- ret = LB_STATUS_ERROR_DISABLED;
+ ret = DBOX_STATUS_ERROR_DISABLED;
goto out;
}
DbgFree(mainappid);
@@ -1163,11 +1249,11 @@ static struct packet *client_new(pid_t pid, int handle, const struct packet *pac
info = package_find(lbid);
if (!info) {
char *pkgid;
- pkgid = livebox_service_appid(lbid);
+ pkgid = dynamicbox_service_package_id(lbid);
if (!pkgid) {
DbgFree(mainappid);
DbgFree(lbid);
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
@@ -1176,17 +1262,17 @@ static struct packet *client_new(pid_t pid, int handle, const struct packet *pac
}
if (!info) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
} else if (package_is_fault(info)) {
- ret = LB_STATUS_ERROR_FAULT;
- } else if (util_free_space(IMAGE_PATH) <= MINIMUM_SPACE) {
+ ret = DBOX_STATUS_ERROR_FAULT;
+ } else if (util_free_space(DYNAMICBOX_CONF_IMAGE_PATH) <= DYNAMICBOX_CONF_MINIMUM_SPACE) {
ErrPrint("Not enough space\n");
- ret = LB_STATUS_ERROR_NO_SPACE;
+ ret = DBOX_STATUS_ERROR_NO_SPACE;
} else {
struct inst_info *inst;
- if (period > 0.0f && period < MINIMUM_PERIOD) {
- period = MINIMUM_PERIOD;
+ if (period > 0.0f && period < DYNAMICBOX_CONF_MINIMUM_PERIOD) {
+ period = DYNAMICBOX_CONF_MINIMUM_PERIOD;
}
inst = instance_create(client, timestamp, lbid, content, cluster, category, period, width, height);
@@ -1194,7 +1280,7 @@ static struct packet *client_new(pid_t pid, int handle, const struct packet *pac
* \note
* Using the "inst" without validate its value is at my disposal. ;)
*/
- ret = inst ? 0 : LB_STATUS_ERROR_FAULT;
+ ret = inst ? 0 : DBOX_STATUS_ERROR_FAULT;
}
DbgFree(lbid);
@@ -1213,36 +1299,36 @@ static struct packet *client_change_visibility(pid_t pid, int handle, const stru
struct client_node *client;
const char *pkgname;
const char *id;
- enum livebox_visible_state state;
+ 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 = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ 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 livebox package name.
+ * The package has to be a dynamicbox package name.
*/
ret = validate_request(pkgname, id, &inst, NULL);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
goto out;
}
if (instance_client(inst) != client) {
- ret = LB_STATUS_ERROR_PERMISSION;
+ ret = DBOX_STATUS_ERROR_PERMISSION_DENIED;
} else {
ret = instance_set_visible_state(inst, state);
}
@@ -1265,14 +1351,14 @@ static struct packet *client_set_period(pid_t pid, int handle, const struct pack
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
@@ -1281,15 +1367,15 @@ static struct packet *client_set_period(pid_t pid, int handle, const struct pack
/*!
* \NOTE:
* Trust the package name which are sent by the client.
- * The package has to be a livebox package name.
+ * The package has to be a dynamicbox package name.
*/
ret = validate_request(pkgname, id, &inst, NULL);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
goto out;
}
if (instance_client(inst) != client) {
- ret = LB_STATUS_ERROR_PERMISSION;
+ ret = DBOX_STATUS_ERROR_PERMISSION_DENIED;
} else {
ret = instance_set_period(inst, period);
}
@@ -1317,14 +1403,14 @@ static struct packet *client_change_group(pid_t pid, int handle, const struct pa
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
@@ -1333,15 +1419,15 @@ static struct packet *client_change_group(pid_t pid, int handle, const struct pa
/*!
* \NOTE:
* Trust the package name which are sent by the client.
- * The package has to be a livebox package name.
+ * The package has to be a dynamicbox package name.
*/
ret = validate_request(pkgname, id, &inst, NULL);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
goto out;
}
if (instance_client(inst) != client) {
- ret = LB_STATUS_ERROR_PERMISSION;
+ ret = DBOX_STATUS_ERROR_PERMISSION_DENIED;
} else {
ret = instance_change_group(inst, cluster, category);
}
@@ -1355,7 +1441,7 @@ out:
return result;
}
-static struct packet *client_pd_mouse_enter(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_gbar_mouse_enter(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -1370,39 +1456,39 @@ static struct packet *client_pd_mouse_enter(pid_t pid, int handle, const struct
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
script_handler_update_pointer(script, x, y, -1);
- script_handler_feed_event(script, LB_SCRIPT_MOUSE_IN, timestamp);
+ script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_IN, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -1410,7 +1496,7 @@ out:
return NULL;
}
-static struct packet *client_pd_mouse_leave(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_gbar_mouse_leave(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -1425,39 +1511,39 @@ static struct packet *client_pd_mouse_leave(pid_t pid, int handle, const struct
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
script_handler_update_pointer(script, x, y, -1);
- script_handler_feed_event(script, LB_SCRIPT_MOUSE_OUT, timestamp);
+ script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_OUT, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -1465,7 +1551,7 @@ out:
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 */
+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;
@@ -1480,39 +1566,39 @@ static struct packet *client_pd_mouse_down(pid_t pid, int handle, const struct p
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
script_handler_update_pointer(script, x, y, 1);
- script_handler_feed_event(script, LB_SCRIPT_MOUSE_DOWN, timestamp);
+ script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_DOWN, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -1520,7 +1606,7 @@ out:
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 */
+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;
@@ -1535,39 +1621,39 @@ static struct packet *client_pd_mouse_up(pid_t pid, int handle, const struct pac
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
script_handler_update_pointer(script, x, y, 0);
- script_handler_feed_event(script, LB_SCRIPT_MOUSE_UP, timestamp);
+ script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_UP, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -1575,7 +1661,7 @@ out:
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 */
+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;
@@ -1590,39 +1676,39 @@ static struct packet *client_pd_mouse_move(pid_t pid, int handle, const struct p
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
script_handler_update_pointer(script, x, y, -1);
- script_handler_feed_event(script, LB_SCRIPT_MOUSE_MOVE, timestamp);
+ script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_MOVE, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -1630,7 +1716,7 @@ out:
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 */
+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;
@@ -1645,39 +1731,39 @@ static struct packet *client_lb_mouse_move(pid_t pid, int handle, const struct p
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_lb_script(inst);
+ script = instance_dbox_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
script_handler_update_pointer(script, x, y, -1);
- script_handler_feed_event(script, LB_SCRIPT_MOUSE_MOVE, timestamp);
+ script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_MOVE, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -1687,12 +1773,28 @@ 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_pd_key_set(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_gbar_key_set(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -1707,35 +1809,45 @@ static struct packet *client_pd_key_set(pid_t pid, int handle, const struct pack
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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);
+ 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_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 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -1747,7 +1859,7 @@ out:
return result;
}
-static struct packet *client_pd_key_unset(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_gbar_key_unset(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -1762,35 +1874,47 @@ static struct packet *client_pd_key_unset(pid_t pid, int handle, const struct pa
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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);
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -1802,7 +1926,7 @@ out:
return result;
}
-static struct packet *client_lb_key_set(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_dbox_key_set(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -1817,35 +1941,45 @@ static struct packet *client_lb_key_set(pid_t pid, int handle, const struct pack
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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);
+ 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_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 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -1857,7 +1991,7 @@ out:
return result;
}
-static struct packet *client_lb_key_unset(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_dbox_key_unset(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -1872,35 +2006,47 @@ static struct packet *client_lb_key_unset(pid_t pid, int handle, const struct pa
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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);
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -1912,7 +2058,7 @@ out:
return result;
}
-static struct packet *client_lb_mouse_set(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_dbox_mouse_set(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -1927,41 +2073,65 @@ static struct packet *client_lb_mouse_set(pid_t pid, int handle, const struct pa
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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);
+ if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+ if (package_direct_input(pkg) == 0 || packet_set_fd((struct packet *)packet, event_input_fd()) < 0) {
+ 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 {
+ struct slave_node *slave;
+
+ DbgPrint("Direct input is enabled(set for %s:%d)\n", id, packet_fd(packet));
+ slave = package_slave(pkg);
+ if (slave) {
+ packet_ref((struct packet *)packet);
+ ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
+ } else {
+ ErrPrint("Unable to find a slave for %s\n", pkgname);
+ ret = DBOX_STATUS_ERROR_FAULT;
+ }
}
- } 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 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
return NULL;
}
-static struct packet *client_lb_mouse_unset(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_dbox_mouse_unset(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -1976,41 +2146,67 @@ static struct packet *client_lb_mouse_unset(pid_t pid, int handle, const struct
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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);
+ if (package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
+ if (package_direct_input(pkg) == 0) {
+ 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 {
+ struct slave_node *slave;
+
+ DbgPrint("Direct input is enabled(unset) for %s\n", id);
+ slave = package_slave(pkg);
+ if (slave) {
+ packet_ref((struct packet *)packet);
+ ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
+ } else {
+ ErrPrint("Unable to find a slave for %s\n", pkgname);
+ ret = DBOX_STATUS_ERROR_FAULT;
+ }
}
- } 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 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
return NULL;
}
-static struct packet *client_pd_mouse_set(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_gbar_mouse_set(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -2025,42 +2221,66 @@ static struct packet *client_pd_mouse_set(pid_t pid, int handle, const struct pa
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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);
+ if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+ if (package_direct_input(pkg) == 0 || packet_set_fd((struct packet *)packet, event_input_fd()) < 0) {
+ 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 {
+ struct slave_node *slave;
+
+ DbgPrint("Direct input is enabled(set for %s:%d)\n", id, packet_fd(packet));
+ slave = package_slave(pkg);
+ if (slave) {
+ packet_ref((struct packet *)packet);
+ ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
+ } else {
+ ErrPrint("Unable to find a slave for %s\n", pkgname);
+ ret = DBOX_STATUS_ERROR_FAULT;
+ }
}
- } 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 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
return NULL;
}
-static struct packet *client_lb_mouse_on_scroll(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_dbox_mouse_on_scroll(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -2075,39 +2295,39 @@ static struct packet *client_lb_mouse_on_scroll(pid_t pid, int handle, const str
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_lb_script(inst);
+ script = instance_dbox_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
script_handler_update_pointer(script, x, y, -1);
- script_handler_feed_event(script, LB_SCRIPT_MOUSE_ON_SCROLL, timestamp);
+ script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_ON_SCROLL, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -2115,7 +2335,7 @@ out:
return NULL;
}
-static struct packet *client_lb_mouse_off_scroll(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_dbox_mouse_off_scroll(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -2130,39 +2350,39 @@ static struct packet *client_lb_mouse_off_scroll(pid_t pid, int handle, const st
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_lb_script(inst);
+ script = instance_dbox_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
script_handler_update_pointer(script, x, y, -1);
- script_handler_feed_event(script, LB_SCRIPT_MOUSE_OFF_SCROLL, timestamp);
+ script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_OFF_SCROLL, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -2170,7 +2390,7 @@ out:
return NULL;
}
-static struct packet *client_lb_mouse_on_hold(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_dbox_mouse_on_hold(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -2185,39 +2405,39 @@ static struct packet *client_lb_mouse_on_hold(pid_t pid, int handle, const struc
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_lb_script(inst);
+ script = instance_dbox_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
script_handler_update_pointer(script, x, y, -1);
- script_handler_feed_event(script, LB_SCRIPT_MOUSE_ON_HOLD, timestamp);
+ script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_ON_HOLD, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -2225,7 +2445,7 @@ out:
return NULL;
}
-static struct packet *client_lb_mouse_off_hold(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_dbox_mouse_off_hold(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -2240,39 +2460,39 @@ static struct packet *client_lb_mouse_off_hold(pid_t pid, int handle, const stru
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_lb_script(inst);
+ script = instance_dbox_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
script_handler_update_pointer(script, x, y, -1);
- script_handler_feed_event(script, LB_SCRIPT_MOUSE_OFF_HOLD, timestamp);
+ script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_OFF_HOLD, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -2280,7 +2500,7 @@ out:
return NULL;
}
-static struct packet *client_pd_mouse_on_scroll(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_gbar_mouse_on_scroll(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -2295,39 +2515,39 @@ static struct packet *client_pd_mouse_on_scroll(pid_t pid, int handle, const str
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
script_handler_update_pointer(script, x, y, -1);
- script_handler_feed_event(script, LB_SCRIPT_MOUSE_ON_SCROLL, timestamp);
+ script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_ON_SCROLL, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -2335,7 +2555,7 @@ out:
return NULL;
}
-static struct packet *client_pd_mouse_off_scroll(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_gbar_mouse_off_scroll(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -2350,39 +2570,39 @@ static struct packet *client_pd_mouse_off_scroll(pid_t pid, int handle, const st
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
script_handler_update_pointer(script, x, y, -1);
- script_handler_feed_event(script, LB_SCRIPT_MOUSE_OFF_SCROLL, timestamp);
+ script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_OFF_SCROLL, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -2390,7 +2610,7 @@ out:
return NULL;
}
-static struct packet *client_pd_mouse_on_hold(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_gbar_mouse_on_hold(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -2405,39 +2625,39 @@ static struct packet *client_pd_mouse_on_hold(pid_t pid, int handle, const struc
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
script_handler_update_pointer(script, x, y, -1);
- script_handler_feed_event(script, LB_SCRIPT_MOUSE_ON_HOLD, timestamp);
+ script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_ON_HOLD, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -2445,7 +2665,7 @@ out:
return NULL;
}
-static struct packet *client_pd_mouse_off_hold(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_gbar_mouse_off_hold(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -2460,39 +2680,39 @@ static struct packet *client_pd_mouse_off_hold(pid_t pid, int handle, const stru
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
script_handler_update_pointer(script, x, y, -1);
- script_handler_feed_event(script, LB_SCRIPT_MOUSE_OFF_HOLD, timestamp);
+ script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_OFF_HOLD, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -2500,7 +2720,7 @@ out:
return NULL;
}
-static struct packet *client_pd_mouse_unset(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_gbar_mouse_unset(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -2515,41 +2735,67 @@ static struct packet *client_pd_mouse_unset(pid_t pid, int handle, const struct
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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);
+ if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+ if (package_direct_input(pkg) == 0) {
+ 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 {
+ struct slave_node *slave;
+
+ DbgPrint("Direct input is enabled(unset) for %s\n", id);
+ slave = package_slave(pkg);
+ if (slave) {
+ packet_ref((struct packet *)packet);
+ ret = slave_rpc_request_only(slave, pkgname, (struct packet *)packet, 0);
+ } else {
+ ErrPrint("Unable to find a slave for %s\n", pkgname);
+ ret = DBOX_STATUS_ERROR_FAULT;
+ }
}
- } 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 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
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 */
+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;
@@ -2564,39 +2810,39 @@ static struct packet *client_lb_mouse_enter(pid_t pid, int handle, const struct
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_lb_script(inst);
+ script = instance_dbox_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
script_handler_update_pointer(script, x, y, -1);
- script_handler_feed_event(script, LB_SCRIPT_MOUSE_IN, timestamp);
+ script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_IN, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -2604,7 +2850,7 @@ out:
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 */
+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;
@@ -2619,39 +2865,39 @@ static struct packet *client_lb_mouse_leave(pid_t pid, int handle, const struct
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_lb_script(inst);
+ script = instance_dbox_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
script_handler_update_pointer(script, x, y, -1);
- script_handler_feed_event(script, LB_SCRIPT_MOUSE_OUT, timestamp);
+ script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_OUT, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -2659,7 +2905,7 @@ out:
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 */
+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;
@@ -2674,39 +2920,39 @@ static struct packet *client_lb_mouse_down(pid_t pid, int handle, const struct p
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_lb_script(inst);
+ script = instance_dbox_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
script_handler_update_pointer(script, x, y, 1);
- script_handler_feed_event(script, LB_SCRIPT_MOUSE_DOWN, timestamp);
+ script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_DOWN, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -2714,7 +2960,7 @@ out:
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 */
+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;
@@ -2729,39 +2975,39 @@ static struct packet *client_lb_mouse_up(pid_t pid, int handle, const struct pac
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_lb_script(inst);
+ script = instance_dbox_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
script_handler_update_pointer(script, x, y, 0);
- script_handler_feed_event(script, LB_SCRIPT_MOUSE_UP, timestamp);
+ script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_UP, timestamp);
ret = 0;
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -2769,7 +3015,7 @@ out:
return NULL;
}
-static struct packet *client_pd_access_action_up(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_gbar_access_action(pid_t pid, int handle, const struct packet *packet)
{
struct packet *result;
struct client_node *client;
@@ -2777,65 +3023,48 @@ static struct packet *client_pd_access_action_up(pid_t pid, int handle, const st
const char *id;
int ret;
double timestamp;
- int x;
- int y;
+ 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 = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
- ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
- if (ret != 5) {
+ ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+ if (ret != 6) {
ErrPrint("Invalid parameter\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_pd_script(inst);
+ script = instance_gbar_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
- script_handler_update_pointer(script, x, y, 0);
- ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_ACTION, timestamp);
+ 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) {
- 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;
- }
- }
+ ret = send_delayed_access_status(inst, ret);
}
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -2847,7 +3076,7 @@ out:
return result;
}
-static struct packet *client_pd_access_action_down(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_gbar_access_scroll(pid_t pid, int handle, const struct packet *packet)
{
struct packet *result;
struct client_node *client;
@@ -2855,65 +3084,48 @@ static struct packet *client_pd_access_action_down(pid_t pid, int handle, const
const char *id;
int ret;
double timestamp;
- int x;
- int y;
+ 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 = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
- ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
- if (ret != 5) {
+ ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+ if (ret != 6) {
ErrPrint("Invalid parameter\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_pd_script(inst);
+ script = instance_gbar_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
- script_handler_update_pointer(script, x, y, 1);
- ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_ACTION, timestamp);
+ 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) {
- 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;
- }
- }
+ ret = send_delayed_access_status(inst, ret);
}
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -2925,7 +3137,7 @@ out:
return result;
}
-static struct packet *client_pd_access_scroll_down(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_gbar_access_value_change(pid_t pid, int handle, const struct packet *packet)
{
struct packet *result;
struct client_node *client;
@@ -2933,65 +3145,48 @@ static struct packet *client_pd_access_scroll_down(pid_t pid, int handle, const
const char *id;
int ret;
double timestamp;
- int x;
- int y;
+ 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 = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
- ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
- if (ret != 5) {
+ ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+ if (ret != 6) {
ErrPrint("Invalid parameter\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_pd_script(inst);
+ script = instance_gbar_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
- script_handler_update_pointer(script, x, y, 1);
- ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_SCROLL, timestamp);
+ 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) {
- 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;
- }
- }
+ ret = send_delayed_access_status(inst, ret);
}
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -3003,7 +3198,7 @@ out:
return result;
}
-static struct packet *client_pd_access_scroll_move(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_gbar_access_mouse(pid_t pid, int handle, const struct packet *packet)
{
struct packet *result;
struct client_node *client;
@@ -3011,65 +3206,48 @@ static struct packet *client_pd_access_scroll_move(pid_t pid, int handle, const
const char *id;
int ret;
double timestamp;
- int x;
- int y;
+ 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 = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
- ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
- if (ret != 5) {
+ ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+ if (ret != 6) {
ErrPrint("Invalid parameter\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_pd_script(inst);
+ script = instance_gbar_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
- script_handler_update_pointer(script, x, y, -1);
- ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_SCROLL, timestamp);
+ 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) {
- 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;
- }
- }
+ ret = send_delayed_access_status(inst, ret);
}
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -3081,7 +3259,7 @@ out:
return result;
}
-static struct packet *client_pd_access_scroll_up(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_gbar_access_back(pid_t pid, int handle, const struct packet *packet)
{
struct packet *result;
struct client_node *client;
@@ -3089,65 +3267,48 @@ static struct packet *client_pd_access_scroll_up(pid_t pid, int handle, const st
const char *id;
int ret;
double timestamp;
- int x;
- int y;
+ 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 = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
- ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
- if (ret != 5) {
+ ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+ if (ret != 6) {
ErrPrint("Invalid parameter\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_pd_script(inst);
+ script = instance_gbar_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
- script_handler_update_pointer(script, x, y, 0);
- ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_SCROLL, timestamp);
+ 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) {
- 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;
- }
- }
+ ret = send_delayed_access_status(inst, ret);
}
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -3159,74 +3320,58 @@ out:
return result;
}
-static struct packet *client_pd_access_unhighlight(pid_t pid, int handle, const struct packet *packet)
+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 x;
- int y;
- struct inst_info *inst = NULL;
- const struct pkg_info *pkg = NULL;
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 = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
- ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
- if (ret != 5) {
+ ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+ if (ret != 6) {
ErrPrint("Invalid parameter\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_pd_script(inst);
+ script = instance_gbar_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
- script_handler_update_pointer(script, x, y, -1);
- ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_UNHIGHLIGHT, timestamp);
+ 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) {
- 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;
- }
- }
+ ret = send_delayed_access_status(inst, ret);
}
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
+
out:
result = packet_create_reply(packet, "i", ret);
if (!result) {
@@ -3236,7 +3381,7 @@ out:
return result;
}
-static struct packet *client_pd_access_hl(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_gbar_access_read(pid_t pid, int handle, const struct packet *packet)
{
struct packet *result;
struct client_node *client;
@@ -3244,65 +3389,48 @@ static struct packet *client_pd_access_hl(pid_t pid, int handle, const struct pa
const char *id;
int ret;
double timestamp;
- int x;
- int y;
+ 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 = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
- ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
- if (ret != 5) {
+ ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+ if (ret != 6) {
ErrPrint("Invalid parameter\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_pd_script(inst);
+ script = instance_gbar_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
- script_handler_update_pointer(script, x, y, -1);
- ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_HIGHLIGHT, timestamp);
+ 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) {
- 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;
- }
- }
+ ret = send_delayed_access_status(inst, ret);
}
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -3314,7 +3442,7 @@ out:
return result;
}
-static struct packet *client_pd_access_hl_prev(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_gbar_access_enable(pid_t pid, int handle, const struct packet *packet)
{
struct packet *result;
struct client_node *client;
@@ -3322,65 +3450,51 @@ static struct packet *client_pd_access_hl_prev(pid_t pid, int handle, const stru
const char *id;
int ret;
double timestamp;
- int x;
- int y;
+ 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 = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
- ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
- if (ret != 5) {
+ ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+ if (ret != 6) {
ErrPrint("Invalid parameter\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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;
- script = instance_pd_script(inst);
+ script = instance_gbar_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_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;
+ type = (event.type == 0) ? DBOX_SCRIPT_ACCESS_DISABLE : DBOX_SCRIPT_ACCESS_ENABLE;
- 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;
- }
- }
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -3392,7 +3506,7 @@ out:
return result;
}
-static struct packet *client_pd_access_hl_next(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_gbar_access_hl(pid_t pid, int handle, const struct packet *packet)
{
struct packet *result;
struct client_node *client;
@@ -3400,70 +3514,67 @@ static struct packet *client_pd_access_hl_next(pid_t pid, int handle, const stru
const char *id;
int ret;
double timestamp;
- int x;
- int y;
+ 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 = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
- ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
- if (ret != 5) {
+ ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+ if (ret != 6) {
ErrPrint("Invalid parameter\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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;
- script = instance_pd_script(inst);
+ script = instance_gbar_script(inst);
if (!script) {
- ErrPrint("Script is not created yet\n");
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_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;
+ 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;
+ }
- 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);
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -3475,7 +3586,7 @@ out:
return result;
}
-static struct packet *client_pd_access_activate(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_gbar_access_activate(pid_t pid, int handle, const struct packet *packet)
{
struct packet *result;
struct client_node *client;
@@ -3483,65 +3594,48 @@ static struct packet *client_pd_access_activate(pid_t pid, int handle, const str
const char *id;
int ret;
double timestamp;
- int x;
- int y;
+ 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 = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
- ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
- if (ret != 5) {
+ ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+ if (ret != 6) {
ErrPrint("Invalid parameter\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_pd_script(inst);
+ script = instance_gbar_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
- script_handler_update_pointer(script, x, y, -1);
- ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_ACTIVATE, timestamp);
+ 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) {
- 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;
- }
- }
+ ret = send_delayed_access_status(inst, ret);
}
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -3553,7 +3647,7 @@ out:
return result;
}
-static struct packet *client_pd_key_focus_in(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_gbar_key_focus_in(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -3568,57 +3662,41 @@ static struct packet *client_pd_key_focus_in(pid_t pid, int handle, const struct
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_pd_script(inst);
+ script = instance_gbar_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
script_handler_update_keycode(script, keycode);
- ret = script_handler_feed_event(script, LB_SCRIPT_KEY_FOCUS_IN, timestamp);
+ ret = script_handler_feed_event(script, DBOX_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;
- }
- }
+ ret = send_delayed_key_status(inst, ret);
}
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -3630,7 +3708,7 @@ out:
return result;
}
-static struct packet *client_pd_key_focus_out(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_gbar_key_focus_out(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -3645,57 +3723,41 @@ static struct packet *client_pd_key_focus_out(pid_t pid, int handle, const struc
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_pd_script(inst);
+ script = instance_gbar_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
script_handler_update_keycode(script, keycode);
- ret = script_handler_feed_event(script, LB_SCRIPT_KEY_FOCUS_OUT, timestamp);
+ ret = script_handler_feed_event(script, DBOX_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;
- }
- }
+ ret = send_delayed_key_status(inst, ret);
}
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -3707,7 +3769,7 @@ out:
return result;
}
-static struct packet *client_pd_key_down(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_gbar_key_down(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -3722,57 +3784,41 @@ static struct packet *client_pd_key_down(pid_t pid, int handle, const struct pac
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_pd_script(inst);
+ script = instance_gbar_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
script_handler_update_keycode(script, keycode);
- ret = script_handler_feed_event(script, LB_SCRIPT_KEY_DOWN, timestamp);
+ ret = script_handler_feed_event(script, DBOX_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;
- }
- }
+ ret = send_delayed_key_status(inst, ret);
}
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -3793,18 +3839,18 @@ static struct packet *client_pause_request(pid_t pid, int handle, const struct p
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is paused - manually reported\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
ret = packet_get(packet, "d", &timestamp);
if (ret != 1) {
ErrPrint("Invalid parameter\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
- if (USE_XMONITOR) {
+ if (DYNAMICBOX_CONF_USE_XMONITOR) {
DbgPrint("XMONITOR enabled. ignore client paused request\n");
} else {
xmonitor_pause(client);
@@ -3832,7 +3878,7 @@ static struct packet *client_resume_request(pid_t pid, int handle, const struct
goto out;
}
- if (USE_XMONITOR) {
+ if (DYNAMICBOX_CONF_USE_XMONITOR) {
DbgPrint("XMONITOR enabled. ignore client resumed request\n");
} else {
xmonitor_resume(client);
@@ -3842,7 +3888,7 @@ out:
return NULL;
}
-static struct packet *client_pd_key_up(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_gbar_key_up(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -3857,57 +3903,41 @@ static struct packet *client_pd_key_up(pid_t pid, int handle, const struct packe
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_pd_script(inst);
+ script = instance_gbar_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
script_handler_update_keycode(script, keycode);
- ret = script_handler_feed_event(script, LB_SCRIPT_KEY_UP, timestamp);
+ ret = script_handler_feed_event(script, DBOX_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;
- }
- }
+ ret = send_delayed_key_status(inst, ret);
}
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -3919,7 +3949,7 @@ out:
return result;
}
-static struct packet *client_lb_access_hl(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_dbox_access_hl(pid_t pid, int handle, const struct packet *packet)
{
struct packet *result;
struct client_node *client;
@@ -3927,65 +3957,67 @@ static struct packet *client_lb_access_hl(pid_t pid, int handle, const struct pa
const char *id;
int ret;
double timestamp;
- int x;
- int y;
+ 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 = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
- ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
- if (ret != 5) {
+ ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+ if (ret != 6) {
ErrPrint("Parameter is not matched\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_lb_script(inst);
+ script = instance_dbox_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_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;
+ 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 (!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;
- }
- }
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -3997,7 +4029,7 @@ out:
return result;
}
-static struct packet *client_lb_access_hl_prev(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_dbox_access_action(pid_t pid, int handle, const struct packet *packet)
{
struct packet *result;
struct client_node *client;
@@ -4005,65 +4037,54 @@ static struct packet *client_lb_access_hl_prev(pid_t pid, int handle, const stru
const char *id;
int ret;
double timestamp;
- int x;
- int y;
- struct inst_info *inst;
- const struct pkg_info *pkg;
+ 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 exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ ErrPrint("Client %d is not exist\n", pid);
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
- ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
- if (ret != 5) {
+ ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+ if (ret != 6) {
ErrPrint("Parameter is not matched\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_lb_script(inst);
+ script = instance_dbox_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ErrPrint("Instance has no script\n");
+ ret = DBOX_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);
+ 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) {
- 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;
- }
- }
+ ret = send_delayed_access_status(inst, ret);
}
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -4075,7 +4096,7 @@ out:
return result;
}
-static struct packet *client_lb_access_hl_next(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_dbox_access_scroll(pid_t pid, int handle, const struct packet *packet)
{
struct packet *result;
struct client_node *client;
@@ -4083,65 +4104,54 @@ static struct packet *client_lb_access_hl_next(pid_t pid, int handle, const stru
const char *id;
int ret;
double timestamp;
- int x;
- int y;
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 exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ ErrPrint("Client %d is not exist\n", pid);
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
- ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
- if (ret != 5) {
+ ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+ if (ret != 6) {
ErrPrint("Parameter is not matched\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_lb_script(inst);
+ script = instance_dbox_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ErrPrint("Instance has no script\n");
+ ret = DBOX_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);
+ 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) {
- 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;
- }
- }
+ ret = send_delayed_access_status(inst, ret);
}
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -4153,7 +4163,7 @@ out:
return result;
}
-static struct packet *client_lb_access_action_up(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_dbox_access_value_change(pid_t pid, int handle, const struct packet *packet)
{
struct packet *result;
struct client_node *client;
@@ -4163,69 +4173,52 @@ static struct packet *client_lb_access_action_up(pid_t pid, int handle, const st
double timestamp;
struct inst_info *inst = NULL;
const struct pkg_info *pkg = NULL;
- int x;
- int y;
+ struct access_info event;
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exist\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
- ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
- if (ret != 5) {
+ ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+ if (ret != 6) {
ErrPrint("Parameter is not matched\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
goto out;
}
- if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
- ret = forward_lb_access_packet(pkg, inst, packet_command(packet), timestamp, x, y);
+ 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_lb_type(pkg) == LB_TYPE_SCRIPT) {
+ } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
struct script_info *script;
- script = instance_lb_script(inst);
+ script = instance_dbox_script(inst);
if (!script) {
ErrPrint("Instance has no script\n");
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
- script_handler_update_pointer(script, x, y, 0);
- ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_ACTION, timestamp);
+ 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) {
- 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;
- }
- }
+ ret = send_delayed_access_status(inst, ret);
}
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -4237,7 +4230,7 @@ out:
return result;
}
-static struct packet *client_lb_access_action_down(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_dbox_access_mouse(pid_t pid, int handle, const struct packet *packet)
{
struct packet *result;
struct client_node *client;
@@ -4245,71 +4238,54 @@ static struct packet *client_lb_access_action_down(pid_t pid, int handle, const
const char *id;
int ret;
double timestamp;
- struct inst_info *inst;
- const struct pkg_info *pkg;
- int x;
- int y;
+ 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 = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
- ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
- if (ret != 5) {
+ ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+ if (ret != 6) {
ErrPrint("Parameter is not matched\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
goto out;
}
- if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
- ret = forward_lb_access_packet(pkg, inst, packet_command(packet), timestamp, x, y);
+ 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_lb_type(pkg) == LB_TYPE_SCRIPT) {
+ } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
struct script_info *script;
- script = instance_lb_script(inst);
+ script = instance_dbox_script(inst);
if (!script) {
ErrPrint("Instance has no script\n");
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
- script_handler_update_pointer(script, x, y, 1);
- ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_ACTION, timestamp);
+ 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) {
- 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;
- }
- }
+ ret = send_delayed_access_status(inst, ret);
}
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -4321,7 +4297,7 @@ out:
return result;
}
-static struct packet *client_lb_access_unhighlight(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_dbox_access_back(pid_t pid, int handle, const struct packet *packet)
{
struct packet *result;
struct client_node *client;
@@ -4329,65 +4305,54 @@ static struct packet *client_lb_access_unhighlight(pid_t pid, int handle, const
const char *id;
int ret;
double timestamp;
- int x;
- int y;
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 exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ ErrPrint("Client %d is not exist\n", pid);
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
- ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
- if (ret != 5) {
+ ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+ if (ret != 6) {
ErrPrint("Parameter is not matched\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_lb_script(inst);
+ script = instance_dbox_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ErrPrint("Instance has no script\n");
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
- script_handler_update_pointer(script, x, y, -1);
- ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_UNHIGHLIGHT, timestamp);
+ 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) {
- 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;
- }
- }
+ ret = send_delayed_access_status(inst, ret);
}
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -4399,7 +4364,7 @@ out:
return result;
}
-static struct packet *client_lb_access_scroll_down(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_dbox_access_over(pid_t pid, int handle, const struct packet *packet)
{
struct packet *result;
struct client_node *client;
@@ -4409,69 +4374,52 @@ static struct packet *client_lb_access_scroll_down(pid_t pid, int handle, const
double timestamp;
struct inst_info *inst = NULL;
const struct pkg_info *pkg = NULL;
- int x;
- int y;
+ struct access_info event;
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exist\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
- ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
- if (ret != 5) {
+ ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+ if (ret != 6) {
ErrPrint("Parameter is not matched\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
goto out;
}
- if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
- ret = forward_lb_access_packet(pkg, inst, packet_command(packet), timestamp, x, y);
+ 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_lb_type(pkg) == LB_TYPE_SCRIPT) {
+ } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
struct script_info *script;
- script = instance_lb_script(inst);
+ script = instance_dbox_script(inst);
if (!script) {
ErrPrint("Instance has no script\n");
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
- script_handler_update_pointer(script, x, y, 1);
- ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_SCROLL, timestamp);
+ 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) {
- 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;
- }
- }
+ ret = send_delayed_access_status(inst, ret);
}
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -4483,7 +4431,7 @@ out:
return result;
}
-static struct packet *client_lb_access_scroll_move(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_dbox_access_read(pid_t pid, int handle, const struct packet *packet)
{
struct packet *result;
struct client_node *client;
@@ -4493,69 +4441,52 @@ static struct packet *client_lb_access_scroll_move(pid_t pid, int handle, const
double timestamp;
struct inst_info *inst = NULL;
const struct pkg_info *pkg = NULL;
- int x;
- int y;
+ struct access_info event;
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exist\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
- ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
- if (ret != 5) {
+ ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+ if (ret != 6) {
ErrPrint("Parameter is not matched\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
goto out;
}
- if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
- ret = forward_lb_access_packet(pkg, inst, packet_command(packet), timestamp, x, y);
+ 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_lb_type(pkg) == LB_TYPE_SCRIPT) {
+ } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
struct script_info *script;
- script = instance_lb_script(inst);
+ script = instance_dbox_script(inst);
if (!script) {
ErrPrint("Instance has no script\n");
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
- script_handler_update_pointer(script, x, y, -1);
- ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_SCROLL, timestamp);
+ 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) {
- 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;
- }
- }
+ ret = send_delayed_access_status(inst, ret);
}
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -4567,7 +4498,7 @@ out:
return result;
}
-static struct packet *client_lb_access_scroll_up(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_dbox_access_enable(pid_t pid, int handle, const struct packet *packet)
{
struct packet *result;
struct client_node *client;
@@ -4575,71 +4506,57 @@ static struct packet *client_lb_access_scroll_up(pid_t pid, int handle, const st
const char *id;
int ret;
double timestamp;
- struct inst_info *inst;
- const struct pkg_info *pkg;
- int x;
- int y;
+ 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 = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
- ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
- if (ret != 5) {
+ ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+ if (ret != 6) {
ErrPrint("Parameter is not matched\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
goto out;
}
- if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
- ret = forward_lb_access_packet(pkg, inst, packet_command(packet), timestamp, x, y);
+ 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_lb_type(pkg) == LB_TYPE_SCRIPT) {
+ } else if (package_dbox_type(pkg) == DBOX_TYPE_SCRIPT) {
struct script_info *script;
+ int type;
- script = instance_lb_script(inst);
+ script = instance_dbox_script(inst);
if (!script) {
ErrPrint("Instance has no script\n");
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_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;
+ type = (event.type == 0) ? DBOX_SCRIPT_ACCESS_DISABLE : DBOX_SCRIPT_ACCESS_ENABLE;
- 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;
- }
- }
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -4651,7 +4568,7 @@ out:
return result;
}
-static struct packet *client_lb_access_activate(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_dbox_access_activate(pid_t pid, int handle, const struct packet *packet)
{
struct packet *result;
struct client_node *client;
@@ -4659,66 +4576,49 @@ static struct packet *client_lb_access_activate(pid_t pid, int handle, const str
const char *id;
int ret;
double timestamp;
- int x;
- int y;
+ 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 = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
- ret = packet_get(packet, "ssdii", &pkgname, &id, &timestamp, &x, &y);
- if (ret != 5) {
+ ret = packet_get(packet, "ssdiii", &pkgname, &id, &timestamp, &event.x, &event.y, &event.type);
+ if (ret != 6) {
ErrPrint("Parameter is not matched\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_lb_script(inst);
+ script = instance_dbox_script(inst);
if (!script) {
ErrPrint("Instance has no script\n");
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
- script_handler_update_pointer(script, x, y, -1);
- ret = script_handler_feed_event(script, LB_SCRIPT_ACCESS_ACTIVATE, timestamp);
+ 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) {
- 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;
- }
- }
+ ret = send_delayed_access_status(inst, ret);
}
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -4730,7 +4630,7 @@ out:
return result;
}
-static struct packet *client_lb_key_down(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_dbox_key_down(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -4745,57 +4645,41 @@ static struct packet *client_lb_key_down(pid_t pid, int handle, const struct pac
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_lb_script(inst);
+ script = instance_dbox_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
script_handler_update_keycode(script, keycode);
- ret = script_handler_feed_event(script, LB_SCRIPT_KEY_DOWN, timestamp);
+ ret = script_handler_feed_event(script, DBOX_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;
- }
- }
+ ret = send_delayed_key_status(inst, ret);
}
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -4807,7 +4691,7 @@ out:
return result;
}
-static struct packet *client_lb_key_focus_in(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_dbox_key_focus_in(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -4822,57 +4706,41 @@ static struct packet *client_lb_key_focus_in(pid_t pid, int handle, const struct
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_lb_script(inst);
+ script = instance_dbox_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
script_handler_update_keycode(script, keycode);
- ret = script_handler_feed_event(script, LB_SCRIPT_KEY_FOCUS_IN, timestamp);
+ ret = script_handler_feed_event(script, DBOX_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;
- }
- }
+ ret = send_delayed_key_status(inst, ret);
}
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -4884,7 +4752,7 @@ out:
return result;
}
-static struct packet *client_lb_key_focus_out(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_dbox_key_focus_out(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -4899,57 +4767,41 @@ static struct packet *client_lb_key_focus_out(pid_t pid, int handle, const struc
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_lb_script(inst);
+ script = instance_dbox_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
script_handler_update_keycode(script, keycode);
- ret = script_handler_feed_event(script, LB_SCRIPT_KEY_FOCUS_OUT, timestamp);
+ ret = script_handler_feed_event(script, DBOX_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;
- }
- }
+ ret = send_delayed_key_status(inst, ret);
}
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -4961,7 +4813,7 @@ out:
return result;
}
-static struct packet *client_lb_key_up(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_dbox_key_up(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
const char *pkgname;
@@ -4976,57 +4828,41 @@ static struct packet *client_lb_key_up(pid_t pid, int handle, const struct packe
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
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) {
+ 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_lb_script(inst);
+ script = instance_dbox_script(inst);
if (!script) {
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
script_handler_update_keycode(script, keycode);
- ret = script_handler_feed_event(script, LB_SCRIPT_KEY_UP, timestamp);
+ ret = script_handler_feed_event(script, DBOX_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;
- }
- }
+ ret = send_delayed_key_status(inst, ret);
}
} else {
ErrPrint("Unsupported package\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -5045,7 +4881,77 @@ static int release_pixmap_cb(struct client_node *client, void *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 */
+
+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;
+ }
+
+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;
@@ -5060,37 +4966,37 @@ static struct packet *client_lb_acquire_pixmap(pid_t pid, int handle, const stru
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_INVALID;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, NULL);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
goto out;
}
- buffer = instance_lb_buffer(inst);
+ buffer = instance_dbox_buffer(inst);
if (!buffer) {
struct script_info *script_info;
- script_info = instance_lb_script(inst);
+ script_info = instance_dbox_script(inst);
if (!script_info) {
- ErrPrint("Unable to get LB buffer: %s\n", id);
- ret = LB_STATUS_ERROR_FAULT;
+ 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 = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
}
@@ -5098,7 +5004,7 @@ static struct packet *client_lb_acquire_pixmap(pid_t pid, int handle, const stru
buf_ptr = buffer_handler_pixmap_ref(buffer);
if (!buf_ptr) {
ErrPrint("Failed to ref pixmap\n");
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
@@ -5108,7 +5014,7 @@ static struct packet *client_lb_acquire_pixmap(pid_t pid, int handle, const stru
buffer_handler_pixmap_unref(buf_ptr);
} else {
pixmap = buffer_handler_pixmap(buffer);
- ret = LB_STATUS_SUCCESS;
+ ret = DBOX_STATUS_ERROR_NONE;
}
out:
@@ -5120,7 +5026,7 @@ out:
return result;
}
-static struct packet *client_lb_release_pixmap(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_dbox_release_pixmap(pid_t pid, int handle, const struct packet *packet)
{
const char *pkgname;
const char *id;
@@ -5142,7 +5048,7 @@ static struct packet *client_lb_release_pixmap(pid_t pid, int handle, const stru
}
ret = validate_request(pkgname, id, NULL, NULL);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
DbgPrint("It seems that the instance is already deleted: %s\n", id);
}
@@ -5157,11 +5063,13 @@ static struct packet *client_lb_release_pixmap(pid_t pid, int handle, const stru
}
out:
- /*! \note No reply packet */
+ /**
+ * @note No reply packet
+ */
return NULL;
}
-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 */
+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;
@@ -5172,46 +5080,114 @@ static struct packet *client_pd_acquire_pixmap(pid_t pid, int handle, const stru
int pixmap = 0;
void *buf_ptr;
struct buffer_info *buffer;
+ int idx;
client = client_find_by_rpc_handle(handle);
if (!client) {
- ret = LB_STATUS_ERROR_INVALID;
+ 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;
+ }
+
+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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
ErrPrint("Parameter is not matched\n");
goto out;
}
ret = validate_request(pkgname, id, &inst, NULL);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
goto out;
}
- if (instance_get_data(inst, PD_RESIZE_MONITOR_TAG)) {
- ret = LB_STATUS_ERROR_BUSY;
+ if (instance_get_data(inst, GBAR_RESIZE_MONITOR_TAG)) {
+ ret = DBOX_STATUS_ERROR_BUSY;
goto out;
}
- buffer = instance_pd_buffer(inst);
+ buffer = instance_gbar_buffer(inst);
if (!buffer) {
struct script_info *script_info;
- script_info = instance_pd_script(inst);
+ script_info = instance_gbar_script(inst);
if (!script_info) {
- ErrPrint("Unable to get LB buffer: %s\n", id);
- ret = LB_STATUS_ERROR_FAULT;
+ 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 = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
}
@@ -5219,7 +5195,7 @@ static struct packet *client_pd_acquire_pixmap(pid_t pid, int handle, const stru
buf_ptr = buffer_handler_pixmap_ref(buffer);
if (!buf_ptr) {
ErrPrint("Failed to ref pixmap\n");
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
@@ -5229,7 +5205,7 @@ static struct packet *client_pd_acquire_pixmap(pid_t pid, int handle, const stru
buffer_handler_pixmap_unref(buf_ptr);
} else {
pixmap = buffer_handler_pixmap(buffer);
- ret = LB_STATUS_SUCCESS;
+ ret = DBOX_STATUS_ERROR_NONE;
}
out:
@@ -5241,7 +5217,7 @@ out:
return result;
}
-static struct packet *client_pd_release_pixmap(pid_t pid, int handle, const struct packet *packet)
+static struct packet *client_gbar_release_pixmap(pid_t pid, int handle, const struct packet *packet)
{
const char *pkgname;
const char *id;
@@ -5263,7 +5239,7 @@ static struct packet *client_pd_release_pixmap(pid_t pid, int handle, const stru
}
ret = validate_request(pkgname, id, NULL, NULL);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
DbgPrint("It seems that the instance is already deleted: %s\n", id);
}
@@ -5295,7 +5271,7 @@ static struct packet *client_pinup_changed(pid_t pid, int handle, const struct p
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
pinup = 0;
goto out;
}
@@ -5303,13 +5279,13 @@ static struct packet *client_pinup_changed(pid_t pid, int handle, const struct p
ret = packet_get(packet, "ssi", &pkgname, &id, &pinup);
if (ret != 3) {
ErrPrint("Parameter is not matched\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
pinup = 0;
goto out;
}
ret = validate_request(pkgname, id, &inst, NULL);
- if (ret == (int)LB_STATUS_SUCCESS) {
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
ret = instance_set_pinup(inst, pinup);
}
@@ -5322,11 +5298,11 @@ out:
return result;
}
-static Eina_Bool lazy_pd_created_cb(void *inst)
+static Eina_Bool lazy_gbar_created_cb(void *inst)
{
struct pkg_info *pkg;
- if (!instance_del_data(inst, LAZY_PD_OPEN_TAG)) {
+ if (!instance_del_data(inst, LAZY_GBAR_OPEN_TAG)) {
ErrPrint("lazy,pd,open is already deleted.\n");
return ECORE_CALLBACK_CANCEL;
}
@@ -5343,25 +5319,25 @@ static Eina_Bool lazy_pd_created_cb(void *inst)
/*!
* After unref instance first,
- * if the instance is not destroyed, try to notify the created PD event to the client.
+ * 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_pd_created(inst, LB_STATUS_SUCCESS);
+ ret = instance_client_gbar_created(inst, DBOX_STATUS_ERROR_NONE);
if (ret < 0) {
- DbgPrint("Send PD Create event (%d) to client\n", ret);
+ DbgPrint("Send GBAR Create event (%d) to client\n", ret);
}
}
return ECORE_CALLBACK_CANCEL;
}
-static Eina_Bool lazy_pd_destroyed_cb(void *inst)
+static Eina_Bool lazy_gbar_destroyed_cb(void *inst)
{
struct pkg_info *pkg;
struct slave_node *slave;
- if (!instance_del_data(inst, LAZY_PD_CLOSE_TAG)) {
+ if (!instance_del_data(inst, LAZY_GBAR_CLOSE_TAG)) {
ErrPrint("lazy,pd,close is already deleted.\n");
return ECORE_CALLBACK_CANCEL;
}
@@ -5370,10 +5346,10 @@ static Eina_Bool lazy_pd_destroyed_cb(void *inst)
if (pkg) {
slave = package_slave(pkg);
if (slave) {
- if (package_pd_type(pkg) == PD_TYPE_SCRIPT) {
+ 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_pd_type(pkg) == PD_TYPE_BUFFER) {
+ } 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);
}
@@ -5382,20 +5358,20 @@ static Eina_Bool lazy_pd_destroyed_cb(void *inst)
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);
+ ret = instance_client_gbar_destroyed(inst, DBOX_STATUS_ERROR_NONE);
if (ret < 0) {
- ErrPrint("Failed sending PD Destroy event (%d)\n", ret);
+ ErrPrint("Failed sending GBAR Destroy event (%d)\n", ret);
}
}
return ECORE_CALLBACK_CANCEL;
}
-static struct packet *client_pd_move(pid_t pid, int handle, const struct packet *packet) /* pkgname, id, x, y */
+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;
@@ -5409,44 +5385,44 @@ static struct packet *client_pd_move(pid_t pid, int handle, const struct packet
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
goto out;
}
- if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
- instance_slave_set_pd_pos(inst, x, y);
+ 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_pd_type(pkg) == PD_TYPE_SCRIPT) {
+ } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) {
int ix;
int iy;
- 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);
+ 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 PD type\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ErrPrint("Invalid GBAR type\n");
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
- DbgPrint("Update PD position: %d\n", ret);
+ DbgPrint("Update GBAR position: %d\n", ret);
return NULL;
}
-static Eina_Bool pd_open_monitor_cb(void *inst)
+static Eina_Bool gbar_open_monitor_cb(void *inst)
{
struct pkg_info *pkg;
@@ -5460,15 +5436,15 @@ static Eina_Bool pd_open_monitor_cb(void *inst)
}
}
- (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_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("PD Open request is timed-out (%lf)\n", PD_REQUEST_TIMEOUT);
+ ErrPrint("GBAR Open request is timed-out (%lf)\n", DYNAMICBOX_CONF_GBAR_REQUEST_TIMEOUT);
return ECORE_CALLBACK_CANCEL;
}
-static Eina_Bool pd_close_monitor_cb(void *inst)
+static Eina_Bool gbar_close_monitor_cb(void *inst)
{
struct pkg_info *pkg;
@@ -5482,14 +5458,14 @@ static Eina_Bool pd_close_monitor_cb(void *inst)
}
}
- (void)instance_client_pd_destroyed(inst, LB_STATUS_ERROR_TIMEOUT);
- (void)instance_del_data(inst, PD_CLOSE_MONITOR_TAG);
+ (void)instance_client_gbar_destroyed(inst, DBOX_STATUS_ERROR_TIMEOUT);
+ (void)instance_del_data(inst, GBAR_CLOSE_MONITOR_TAG);
(void)instance_unref(inst);
- ErrPrint("PD Close request is not processed in %lf seconds\n", PD_REQUEST_TIMEOUT);
+ ErrPrint("GBAR Close request is not processed in %lf seconds\n", DYNAMICBOX_CONF_GBAR_REQUEST_TIMEOUT);
return ECORE_CALLBACK_CANCEL;
}
-static Eina_Bool pd_resize_monitor_cb(void *inst)
+static Eina_Bool gbar_resize_monitor_cb(void *inst)
{
struct pkg_info *pkg;
@@ -5502,15 +5478,15 @@ static Eina_Bool pd_resize_monitor_cb(void *inst)
}
}
- (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_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("PD Resize request is not processed in %lf seconds\n", PD_REQUEST_TIMEOUT);
+ 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_pd(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, ret */
+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;
@@ -5519,7 +5495,7 @@ static struct packet *client_create_pd(pid_t pid, int handle, const struct packe
int ret;
struct inst_info *inst = NULL;
const struct pkg_info *pkg = NULL;
- Ecore_Timer *pd_monitor;
+ Ecore_Timer *gbar_monitor;
double x;
double y;
@@ -5528,76 +5504,76 @@ static struct packet *client_create_pd(pid_t pid, int handle, const struct packe
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
goto out;
}
- 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);
+ 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_pd_destroyed_cb(inst);
+ lazy_gbar_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;
+
+ 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, PD_CLOSE_MONITOR_TAG)) {
- DbgPrint("PD Close request is already in process\n");
- ret = LB_STATUS_ERROR_BUSY;
+ 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, PD_RESIZE_MONITOR_TAG)) {
- DbgPrint("PD resize request is already in process\n");
- ret = LB_STATUS_ERROR_BUSY;
+ 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_pd_pos(inst, x, y);
+ 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_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) {
+ 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_pd(inst, client, LB_CLOSE_PD_FAULT);
+ tmp_ret = instance_slave_close_gbar(inst, client, DBOX_CLOSE_GBAR_FAULT);
if (tmp_ret < 0) {
- ErrPrint("Unable to send script event for openning PD [%s], %d\n", pkgname, tmp_ret);
+ ErrPrint("Unable to send script event for openning GBAR [%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) {
+ 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 PD Open monitor\n");
+ ErrPrint("Failed to create a timer for GBAR Open monitor\n");
} else {
struct slave_node *slave;
- (void)instance_set_data(inst, PD_OPEN_MONITOR_TAG, pd_monitor);
+ (void)instance_set_data(inst, GBAR_OPEN_MONITOR_TAG, gbar_monitor);
slave = package_slave(pkg);
if (!slave) {
@@ -5605,32 +5581,32 @@ static struct packet *client_create_pd(pid_t pid, int handle, const struct packe
goto out;
}
- if (slave_event_callback_add(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_open_buffer_cb, inst) != LB_STATUS_SUCCESS) {
+ 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 PD [%s]\n", pkgname);
+ ErrPrint("Unable to send request for openning GBAR [%s]\n", pkgname);
}
/*!
* \note
- * PD craeted event will be send by the acquire_buffer function.
+ * GBAR craeted event will be send by the acquire_buffer function.
* Because the slave will make request the acquire_buffer to
- * render the PD
+ * render the GBAR
*
- * instance_client_pd_created(inst);
+ * instance_client_gbar_created(inst);
*/
- } else if (package_pd_type(instance_package(inst)) == PD_TYPE_SCRIPT) {
+ } else if (package_gbar_type(instance_package(inst)) == GBAR_TYPE_SCRIPT) {
int ix;
int iy;
- pd_monitor = instance_get_data(inst, LAZY_PD_CLOSE_TAG);
- if (pd_monitor) {
- ecore_timer_del(pd_monitor);
+ 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_pd_destroyed_cb(inst);
+ lazy_gbar_destroyed_cb(inst);
}
/*!
@@ -5639,24 +5615,24 @@ static struct packet *client_create_pd(pid_t pid, int handle, const struct packe
* 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
+ * but the script mode doesn't need slave for rendering default view of GBAR
* 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);
+ 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_pd_script(inst), ix, iy, 0);
+ script_handler_update_pointer(instance_gbar_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);
+ ret = instance_slave_open_gbar(inst, client);
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+ ret = script_handler_load(instance_gbar_script(inst), 1);
/*!
* \note
- * Send the PD created event to the clients,
+ * Send the GBAR created event to the clients,
*/
- if (ret == (int)LB_STATUS_SUCCESS) {
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
/*!
* \note
@@ -5670,7 +5646,7 @@ static struct packet *client_create_pd(pid_t pid, int handle, const struct packe
* \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.
+ * 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
@@ -5678,13 +5654,13 @@ static struct packet *client_create_pd(pid_t pid, int handle, const struct packe
* 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);
+ 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);
- ret = instance_slave_close_pd(inst, client, LB_CLOSE_PD_NORMAL);
- ErrPrint("Close PD %d\n", ret);
+ ret = instance_slave_close_gbar(inst, client, DBOX_CLOSE_GBAR_NORMAL);
+ ErrPrint("Close GBAR %d\n", ret);
inst = instance_unref(inst);
if (!inst) {
@@ -5693,11 +5669,11 @@ static struct packet *client_create_pd(pid_t pid, int handle, const struct packe
ErrPrint("Instance: %s\n", pkgname);
- ret = LB_STATUS_ERROR_FAULT;
+ ret = DBOX_STATUS_ERROR_FAULT;
} else {
struct slave_node *slave;
- (void)instance_set_data(inst, LAZY_PD_OPEN_TAG, pd_monitor);
+ (void)instance_set_data(inst, LAZY_GBAR_OPEN_TAG, gbar_monitor);
slave = package_slave(pkg);
if (!slave) {
@@ -5705,23 +5681,23 @@ static struct packet *client_create_pd(pid_t pid, int handle, const struct packe
goto out;
}
- if (slave_event_callback_add(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_open_script_cb, inst) != LB_STATUS_SUCCESS) {
+ 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_pd(inst, client, LB_CLOSE_PD_FAULT);
+ 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 PD(%s): %d\n", pkgname, ret);
+ ErrPrint("Unable open GBAR(%s): %d\n", pkgname, ret);
}
} else {
- ErrPrint("Invalid PD TYPE\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ErrPrint("Invalid GBAR TYPE\n");
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -5733,7 +5709,7 @@ out:
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_destroy_gbar(pid_t pid, int handle, const struct packet *packet) /* pid, pkgname, filename, ret */
{
struct client_node *client;
struct packet *result;
@@ -5742,7 +5718,7 @@ static struct packet *client_destroy_pd(pid_t pid, int handle, const struct pack
int ret;
struct inst_info *inst = NULL;
const struct pkg_info *pkg = NULL;
- Ecore_Timer *pd_monitor;
+ Ecore_Timer *gbar_monitor;
struct slave_node *slave;
DbgPrint("PERF_DBOX\n");
@@ -5750,41 +5726,41 @@ static struct packet *client_destroy_pd(pid_t pid, int handle, const struct pack
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ 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 = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
goto out;
}
slave = package_slave(pkg);
if (!slave) {
- ret = LB_STATUS_ERROR_INVALID;
+ 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;
+ 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("PD owner mimatched\n");
- ret = LB_STATUS_ERROR_PERMISSION;
+ ErrPrint("GBAR owner mimatched\n");
+ ret = DBOX_STATUS_ERROR_PERMISSION_DENIED;
}
- } 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);
+ } 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");
@@ -5798,45 +5774,45 @@ static struct packet *client_destroy_pd(pid_t pid, int handle, const struct pack
* 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);
+ ret = instance_client_gbar_created(inst, DBOX_STATUS_ERROR_CANCEL);
if (ret < 0) {
- ErrPrint("PD client create event: %d\n", ret);
+ ErrPrint("GBAR client create event: %d\n", ret);
}
- ret = instance_client_pd_destroyed(inst, LB_STATUS_SUCCESS);
+ ret = instance_client_gbar_destroyed(inst, DBOX_STATUS_ERROR_NONE);
if (ret < 0) {
- ErrPrint("PD client destroy event: %d\n", ret);
+ ErrPrint("GBAR 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);
+ 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("PD close signal emit failed: %d\n", ret);
+ ErrPrint("GBAR close signal emit failed: %d\n", ret);
}
- ret = instance_slave_close_pd(inst, client, LB_CLOSE_PD_NORMAL);
+ ret = instance_slave_close_gbar(inst, client, DBOX_CLOSE_GBAR_NORMAL);
if (ret < 0) {
- ErrPrint("PD close request failed: %d\n", ret);
+ ErrPrint("GBAR close request failed: %d\n", ret);
}
- ecore_timer_del(pd_monitor);
+ ecore_timer_del(gbar_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)) {
+ } 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 = LB_STATUS_ERROR_ALREADY;
+ ret = DBOX_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);
+ 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(pd_monitor);
+ ecore_timer_del(gbar_monitor);
inst = instance_unref(inst);
if (!inst) {
@@ -5847,17 +5823,17 @@ static struct packet *client_destroy_pd(pid_t pid, int handle, const struct pack
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);
+ 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("PD close signal emit failed: %d\n", ret);
+ ErrPrint("GBAR close signal emit failed: %d\n", ret);
}
- ret = instance_slave_close_pd(inst, client, LB_CLOSE_PD_NORMAL);
+ ret = instance_slave_close_gbar(inst, client, DBOX_CLOSE_GBAR_NORMAL);
if (ret < 0) {
- ErrPrint("PD close request failed: %d\n", ret);
+ ErrPrint("GBAR 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) {
+ 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) {
@@ -5865,22 +5841,22 @@ static struct packet *client_destroy_pd(pid_t pid, int handle, const struct pack
}
} else {
DbgPrint("Resize is aborted\n");
- (void)instance_set_data(inst, LAZY_PD_CLOSE_TAG, pd_monitor);
+ (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 {
- pd_monitor = ecore_timer_add(PD_REQUEST_TIMEOUT, pd_close_monitor_cb, instance_ref(inst));
- if (!pd_monitor) {
+ 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 PD\n");
+ ErrPrint("Instance is deleted while closing GBAR\n");
}
} else {
DbgPrint("Add close monitor\n");
- (void)instance_set_data(inst, PD_CLOSE_MONITOR_TAG, pd_monitor);
+ (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");
}
@@ -5890,22 +5866,22 @@ static struct packet *client_destroy_pd(pid_t pid, int handle, const struct pack
/*!
* \note
* release_buffer will be called by the slave after this routine.
- * It will send the "pd_destroyed" event to the client
+ * It will send the "gbar_destroyed" event to the client
*
- * instance_client_pd_destroyed(inst, LB_STATUS_SUCCESS);
+ * instance_client_gbar_destroyed(inst, DBOX_STATUS_ERROR_NONE);
*
- * Or the "pd_close_monitor_cb" or "lazy_pd_destroyed_cb" will be called.
+ * Or the "gbar_close_monitor_cb" or "lazy_gbar_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);
+ } 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_pd_script(inst), 1);
+ ret = script_handler_unload(instance_gbar_script(inst), 1);
if (ret < 0) {
ErrPrint("Unable to unload the script: %s, %d\n", pkgname, ret);
}
@@ -5915,16 +5891,16 @@ static struct packet *client_destroy_pd(pid_t pid, int handle, const struct pack
* 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);
+ ret = instance_slave_close_gbar(inst, client, DBOX_CLOSE_GBAR_NORMAL);
if (ret < 0) {
- ErrPrint("Unable to close the PD: %s, %d\n", pkgname, ret);
+ ErrPrint("Unable to close the GBAR: %s, %d\n", pkgname, ret);
}
/*!
* \note
- * Send the destroyed PD event to the client
+ * Send the destroyed GBAR event to the client
*/
- if (ret == (int)LB_STATUS_SUCCESS) {
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
/*!
* \note
* 13-05-28
@@ -5932,24 +5908,24 @@ static struct packet *client_destroy_pd(pid_t pid, int handle, const struct pack
* 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) {
+ 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_PD_CLOSE_TAG, pd_monitor);
+ (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 PD TYPE\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ErrPrint("Invalid GBAR TYPE\n");
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
out:
@@ -5972,7 +5948,7 @@ static struct packet *client_activate_package(pid_t pid, int handle, const struc
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
pkgname = "";
goto out;
}
@@ -5980,7 +5956,7 @@ static struct packet *client_activate_package(pid_t pid, int handle, const struc
ret = packet_get(packet, "s", &pkgname);
if (ret != 1) {
ErrPrint("Parameter is not matched\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
pkgname = "";
goto out;
}
@@ -5989,18 +5965,18 @@ static struct packet *client_activate_package(pid_t pid, int handle, const struc
/*!
* \NOTE:
- * Validate the livebox package name.
+ * Validate the dynamicbox package name.
*/
- if (!package_is_lb_pkgname(pkgname)) {
- ErrPrint("%s is not a valid livebox package\n", pkgname);
+ if (!package_is_dbox_pkgname(pkgname)) {
+ ErrPrint("%s is not a valid dynamicbox package\n", pkgname);
pkgname = "";
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
info = package_find(pkgname);
if (!info) {
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
} else {
ret = package_clear_fault(info);
}
@@ -6024,19 +6000,19 @@ static struct packet *client_subscribed(pid_t pid, int handle, const struct pack
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
ret = packet_get(packet, "ss", &cluster, &category);
if (ret != 2) {
ErrPrint("Invalid argument\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
DbgPrint("[%d] cluster[%s] category[%s]\n", pid, cluster, category);
- if (!strlen(cluster) || !strcasecmp(cluster, DEFAULT_CLUSTER)) {
+ if (!strlen(cluster) || !strcasecmp(cluster, DYNAMICBOX_CONF_DEFAULT_CLUSTER)) {
ErrPrint("Invalid cluster name\n");
goto out;
}
@@ -6065,29 +6041,29 @@ static struct packet *client_delete_cluster(pid_t pid, int handle, const struct
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
ret = packet_get(packet, "s", &cluster);
if (ret != 1) {
ErrPrint("Invalid parameters\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
DbgPrint("pid[%d] cluster[%s]\n", pid, cluster);
- if (!strlen(cluster) || !strcasecmp(cluster, DEFAULT_CLUSTER)) {
+ if (!strlen(cluster) || !strcasecmp(cluster, DYNAMICBOX_CONF_DEFAULT_CLUSTER)) {
ErrPrint("Invalid cluster: %s\n", cluster);
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
/*!
* \todo
*/
- ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+ ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
out:
result = packet_create_reply(packet, "i", ret);
@@ -6115,7 +6091,7 @@ static inline int update_pkg_cb(struct category *category, const char *pkgname,
slave_rpc_request_update(pkgname, "", c_name, s_name, NULL, force);
/* Just try to create a new package */
- if (util_free_space(IMAGE_PATH) > MINIMUM_SPACE) {
+ if (util_free_space(DYNAMICBOX_CONF_IMAGE_PATH) > DYNAMICBOX_CONF_MINIMUM_SPACE) {
double timestamp;
struct inst_info *inst;
@@ -6126,7 +6102,7 @@ static inline int update_pkg_cb(struct category *category, const char *pkgname,
* 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);
+ 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");
}
@@ -6157,7 +6133,7 @@ static struct packet *client_update(pid_t pid, int handle, const struct packet *
}
ret = validate_request(pkgname, id, &inst, NULL);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
goto out;
}
@@ -6200,7 +6176,7 @@ static struct packet *client_refresh_group(pid_t pid, int handle, const struct p
DbgPrint("[%d] cluster[%s] category[%s]\n", pid, cluster_id, category_id);
- if (!strlen(cluster_id) || !strcasecmp(cluster_id, DEFAULT_CLUSTER)) {
+ if (!strlen(cluster_id) || !strcasecmp(cluster_id, DYNAMICBOX_CONF_DEFAULT_CLUSTER)) {
ErrPrint("Invalid cluster name: %s\n", cluster_id);
goto out;
}
@@ -6238,28 +6214,28 @@ static struct packet *client_delete_category(pid_t pid, int handle, const struct
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
ret = packet_get(packet, "ss", &cluster, &category);
if (ret != 2) {
ErrPrint("Invalid paramenters\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
DbgPrint("pid[%d] cluster[%s] category[%s]\n", pid, cluster, category);
- if (!strlen(cluster) || !strcasecmp(cluster, DEFAULT_CLUSTER)) {
+ if (!strlen(cluster) || !strcasecmp(cluster, DYNAMICBOX_CONF_DEFAULT_CLUSTER)) {
ErrPrint("Invalid cluster: %s\n", cluster);
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
/*!
* \todo
*/
- ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+ ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
out:
result = packet_create_reply(packet, "i", ret);
@@ -6280,20 +6256,20 @@ static struct packet *client_unsubscribed(pid_t pid, int handle, const struct pa
client = client_find_by_rpc_handle(handle);
if (!client) {
ErrPrint("Client %d is not exists\n", pid);
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
ret = packet_get(packet, "ss", &cluster, &category);
if (ret != 2) {
ErrPrint("Invalid argument\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
DbgPrint("[%d] cluster[%s] category[%s]\n", pid, cluster, category);
- if (!strlen(cluster) || !strcasecmp(cluster, DEFAULT_CLUSTER)) {
+ if (!strlen(cluster) || !strcasecmp(cluster, DYNAMICBOX_CONF_DEFAULT_CLUSTER)) {
ErrPrint("Invalid cluster name: %s\n", cluster);
goto out;
}
@@ -6333,7 +6309,7 @@ static struct packet *slave_hello(pid_t pid, int handle, const struct packet *pa
}
if (!slave) {
- if (DEBUG_MODE) {
+ if (DYNAMICBOX_CONF_DEBUG_MODE || g_conf.debug_mode) {
char pkgname[pathconf("/", _PC_PATH_MAX)];
const char *abi;
@@ -6348,11 +6324,11 @@ static struct packet *slave_hello(pid_t pid, int handle, const struct packet *pa
if (!slave) {
abi = abi_find_by_pkgname(pkgname);
if (!abi) {
- abi = DEFAULT_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);
+ slave = slave_create(slavename, 1, abi, pkgname, 0, NULL);
if (!slave) {
ErrPrint("Failed to create a new slave for %s\n", slavename);
goto out;
@@ -6364,7 +6340,7 @@ static struct packet *slave_hello(pid_t pid, int handle, const struct packet *pa
abi = slave_abi(slave);
if (!abi) {
ErrPrint("ABI is not valid: %s\n", slavename);
- abi = DEFAULT_ABI;
+ abi = DYNAMICBOX_CONF_DEFAULT_ABI;
}
}
@@ -6379,7 +6355,7 @@ static struct packet *slave_hello(pid_t pid, int handle, const struct packet *pa
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);
+ ret = aul_terminate_pid_async(pid);
CRITICAL_LOG("Terminate %d (ret: %d)\n", pid, ret);
}
goto out;
@@ -6481,7 +6457,7 @@ out:
return NULL;
}
-static struct packet *slave_lb_update_begin(pid_t pid, int handle, const struct packet *packet)
+static struct packet *slave_dbox_update_begin(pid_t pid, int handle, const struct packet *packet)
{
struct slave_node *slave;
struct inst_info *inst;
@@ -6506,7 +6482,7 @@ static struct packet *slave_lb_update_begin(pid_t pid, int handle, const struct
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
goto out;
}
@@ -6515,9 +6491,9 @@ static struct packet *slave_lb_update_begin(pid_t pid, int handle, const struct
goto out;
}
- if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
- ret = instance_lb_update_begin(inst, priority, content, title);
- if (ret == (int)LB_STATUS_SUCCESS) {
+ 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 {
@@ -6528,7 +6504,7 @@ out:
return NULL;
}
-static struct packet *slave_lb_update_end(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;
@@ -6550,7 +6526,7 @@ static struct packet *slave_lb_update_end(pid_t pid, int handle, const struct pa
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
goto out;
}
@@ -6559,9 +6535,9 @@ static struct packet *slave_lb_update_end(pid_t pid, int handle, const struct pa
goto out;
}
- if (package_lb_type(pkg) == LB_TYPE_BUFFER) {
- ret = instance_lb_update_end(inst);
- if (ret == (int)LB_STATUS_SUCCESS) {
+ 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 {
@@ -6572,7 +6548,7 @@ out:
return NULL;
}
-static struct packet *slave_pd_update_begin(pid_t pid, int handle, const struct packet *packet)
+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;
@@ -6594,7 +6570,7 @@ static struct packet *slave_pd_update_begin(pid_t pid, int handle, const struct
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
goto out;
}
@@ -6603,8 +6579,8 @@ static struct packet *slave_pd_update_begin(pid_t pid, int handle, const struct
goto out;
}
- if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
- (void)instance_pd_update_begin(inst);
+ if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+ (void)instance_gbar_update_begin(inst);
} else {
ErrPrint("Invalid request[%s]\n", id);
}
@@ -6635,7 +6611,7 @@ static struct packet *slave_key_status(pid_t pid, int handle, const struct packe
}
ret = validate_request(pkgname, id, &inst, NULL);
- if (ret == (int)LB_STATUS_SUCCESS) {
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
if (instance_state(inst) == INST_DESTROYED) {
ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
} else {
@@ -6669,7 +6645,7 @@ static struct packet *slave_access_status(pid_t pid, int handle, const struct pa
}
ret = validate_request(pkgname, id, &inst, NULL);
- if (ret == (int)LB_STATUS_SUCCESS) {
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
if (instance_state(inst) == INST_DESTROYED) {
ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
} else {
@@ -6681,7 +6657,7 @@ out:
return NULL;
}
-static struct packet *slave_close_pd(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;
struct inst_info *inst;
@@ -6703,7 +6679,7 @@ static struct packet *slave_close_pd(pid_t pid, int handle, const struct packet
}
ret = validate_request(pkgname, id, &inst, NULL);
- if (ret == (int)LB_STATUS_SUCCESS) {
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
if (instance_state(inst) == INST_DESTROYED) {
ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
} else {
@@ -6715,7 +6691,7 @@ out:
return NULL;
}
-static struct packet *slave_pd_update_end(pid_t pid, int handle, const struct packet *packet)
+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;
@@ -6737,7 +6713,7 @@ static struct packet *slave_pd_update_end(pid_t pid, int handle, const struct pa
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
goto out;
}
@@ -6746,8 +6722,8 @@ static struct packet *slave_pd_update_end(pid_t pid, int handle, const struct pa
goto out;
}
- if (package_pd_type(pkg) == PD_TYPE_BUFFER) {
- (void)instance_pd_update_end(inst);
+ if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
+ (void)instance_gbar_update_end(inst);
} else {
ErrPrint("Invalid request[%s]\n", id);
}
@@ -6810,18 +6786,15 @@ out:
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_extra_info(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;
@@ -6832,28 +6805,64 @@ static struct packet *slave_updated(pid_t pid, int handle, const struct packet *
goto out;
}
- 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");
+ 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)LB_STATUS_SUCCESS) {
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
if (instance_state(inst) == INST_DESTROYED) {
ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
goto out;
}
- instance_set_lb_info(inst, priority, content_info, title);
+ 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;
+}
- switch (package_lb_type(instance_package(inst))) {
- case LB_TYPE_SCRIPT:
- script_handler_resize(instance_lb_script(inst), w, h);
+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 {
@@ -6865,14 +6874,13 @@ static struct packet *slave_updated(pid_t pid, int handle, const struct packet *
ErrPrint("unlink: %s - %s\n", strerror(errno), safe_filename);
}
break;
- case LB_TYPE_BUFFER:
+ case DBOX_TYPE_BUFFER:
default:
/*!
* \check
* text format (inst)
*/
- instance_set_lb_size(inst, w, h);
- instance_lb_updated_by_instance(inst, safe_filename);
+ instance_dbox_updated_by_instance(inst, safe_filename, x, y, w, h);
break;
}
@@ -6905,7 +6913,7 @@ static struct packet *slave_hold_scroll(pid_t pid, int handle, const struct pack
}
ret = validate_request(pkgname, id, &inst, NULL);
- if (ret == (int)LB_STATUS_SUCCESS) {
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
if (instance_state(inst) == INST_DESTROYED) {
ErrPrint("Package[%s] instance is already destroyed\n", pkgname);
} else {
@@ -6917,12 +6925,57 @@ 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;
+}
+
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;
@@ -6932,14 +6985,14 @@ static struct packet *slave_desc_updated(pid_t pid, int handle, const struct pac
goto out;
}
- ret = packet_get(packet, "sss", &pkgname, &id, &descfile);
- if (ret != 3) {
+ 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 != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
goto out;
}
@@ -6948,17 +7001,17 @@ static struct packet *slave_desc_updated(pid_t pid, int handle, const struct pac
goto out;
}
- switch (package_pd_type(instance_package(inst))) {
- case PD_TYPE_SCRIPT:
+ 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_pd_script(inst))) {
+ if (script_handler_is_loaded(instance_gbar_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);
+ 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);
@@ -6990,8 +7043,8 @@ static struct packet *slave_deleted(pid_t pid, int handle, const struct packet *
}
ret = validate_request(pkgname, id, &inst, NULL);
- if (ret == (int)LB_STATUS_SUCCESS) {
- ret = instance_destroyed(inst, LB_STATUS_SUCCESS);
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
+ ret = instance_destroyed(inst, DBOX_STATUS_ERROR_NONE);
}
out:
@@ -7019,7 +7072,7 @@ static struct packet *slave_acquire_buffer(pid_t pid, int handle, const struct p
if (!slave) {
ErrPrint("Failed to find a slave\n");
id = "";
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
@@ -7027,38 +7080,38 @@ static struct packet *slave_acquire_buffer(pid_t pid, int handle, const struct p
if (ret != 6) {
ErrPrint("Invalid argument\n");
id = "";
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
id = "";
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
goto out;
}
- ret = LB_STATUS_ERROR_INVALID;
+ 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_LB && package_lb_type(pkg) == LB_TYPE_BUFFER) {
+ if (target == TYPE_DBOX && package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
struct buffer_info *info;
- info = instance_lb_buffer(inst);
+ info = instance_dbox_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;
+ if (!instance_create_dbox_buffer(inst, pixel_size)) {
+ ErrPrint("Failed to create a DBOX buffer\n");
+ ret = DBOX_STATUS_ERROR_FAULT;
goto out;
}
- info = instance_lb_buffer(inst);
+ info = instance_dbox_buffer(inst);
if (!info) {
- ErrPrint("LB buffer is not valid\n");
+ ErrPrint("DBOX buffer is not valid\n");
/*!
* \NOTE
* ret value should not be changed.
@@ -7070,22 +7123,22 @@ static struct packet *slave_acquire_buffer(pid_t pid, int handle, const struct p
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);
+ 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_PD && package_pd_type(pkg) == PD_TYPE_BUFFER) {
+ } else if (target == TYPE_GBAR && package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
struct buffer_info *info;
- Ecore_Timer *pd_monitor;
+ Ecore_Timer *gbar_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;
+ 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");
@@ -7097,30 +7150,30 @@ static struct packet *slave_acquire_buffer(pid_t pid, int handle, const struct p
slave_event_callback_del(slave, SLAVE_EVENT_DEACTIVATE, slave_fault_open_buffer_cb, inst);
}
- ecore_timer_del(pd_monitor);
+ ecore_timer_del(gbar_monitor);
inst = instance_unref(inst);
if (!inst) {
ErrPrint("Instance refcnt is ZERO: %s\n", pkgname);
goto out;
}
- info = instance_pd_buffer(inst);
+ info = instance_gbar_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);
+ 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_pd_buffer(inst);
+ info = instance_gbar_buffer(inst);
if (!info) {
- ErrPrint("PD buffer is not valid\n");
+ ErrPrint("GBAR buffer is not valid\n");
/*!
* \NOTE
* ret value should not be changed.
*/
- instance_client_pd_created(inst, ret);
+ instance_client_gbar_created(inst, ret);
goto out;
}
}
@@ -7128,24 +7181,151 @@ static struct packet *slave_acquire_buffer(pid_t pid, int handle, const struct p
ret = buffer_handler_resize(info, w, h);
ret = buffer_handler_load(info);
if (ret == 0) {
- instance_set_pd_size(inst, w, h);
+ instance_set_gbar_size(inst, w, h);
id = buffer_handler_id(info);
} else {
ErrPrint("Failed to load a buffer (%d)\n", ret);
}
/*!
- * Send the PD created event to the client
+ * Send the GBAR created event to the client
*/
if (!is_resize) {
- instance_client_pd_created(inst, ret);
+ instance_client_gbar_created(inst, ret);
}
}
out:
result = packet_create_reply(packet, "is", ret, id);
if (!result) {
- ErrPrint("Failed to create a packet\n");
+ 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;
+ }
+
+ 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;
+ }
+
+ 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;
+ }
+
+ 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 = 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:
+ result = packet_create_reply(packet, "is", ret, id);
+ if (!result) {
+ ErrPrint("Failed to create a reply packet\n");
}
return result;
@@ -7167,7 +7347,7 @@ static struct packet *slave_resize_buffer(pid_t pid, int handle, const struct pa
slave = slave_find_by_pid(pid);
if (!slave) {
ErrPrint("Failed to find a slave\n");
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
id = "";
goto out;
}
@@ -7175,18 +7355,19 @@ static struct packet *slave_resize_buffer(pid_t pid, int handle, const struct pa
ret = packet_get(packet, "issii", &type, &pkgname, &id, &w, &h);
if (ret != 5) {
ErrPrint("Invalid argument\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
id = "";
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
id = "";
- if (ret != LB_STATUS_SUCCESS) {
+
+ if (ret != DBOX_STATUS_ERROR_NONE) {
goto out;
}
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
/*!
* \note
* Reset "id", It will be re-used from here
@@ -7197,10 +7378,10 @@ static struct packet *slave_resize_buffer(pid_t pid, int handle, const struct pa
goto out;
}
- if (type == TYPE_LB && package_lb_type(pkg) == LB_TYPE_BUFFER) {
+ if (type == TYPE_DBOX && package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
struct buffer_info *info;
- info = instance_lb_buffer(inst);
+ info = instance_dbox_buffer(inst);
if (!info) {
goto out;
}
@@ -7210,15 +7391,15 @@ static struct packet *slave_resize_buffer(pid_t pid, int handle, const struct pa
* \note
* id is resued for newly assigned ID
*/
- if (ret == (int)LB_STATUS_SUCCESS) {
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
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);
+ 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_PD && package_pd_type(pkg) == PD_TYPE_BUFFER) {
+ } else if (type == TYPE_GBAR && package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
struct buffer_info *info;
- info = instance_pd_buffer(inst);
+ info = instance_gbar_buffer(inst);
if (!info) {
goto out;
}
@@ -7228,9 +7409,9 @@ static struct packet *slave_resize_buffer(pid_t pid, int handle, const struct pa
* \note
* id is resued for newly assigned ID
*/
- if (ret == (int)LB_STATUS_SUCCESS) {
+ if (ret == (int)DBOX_STATUS_ERROR_NONE) {
id = buffer_handler_id(info);
- instance_set_pd_size(inst, w, h);
+ instance_set_gbar_size(inst, w, h);
}
}
@@ -7257,1285 +7438,1440 @@ static struct packet *slave_release_buffer(pid_t pid, int handle, const struct p
slave = slave_find_by_pid(pid);
if (!slave) {
ErrPrint("Failed to find a slave\n");
- ret = LB_STATUS_ERROR_NOT_EXIST;
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
goto out;
}
if (packet_get(packet, "iss", &type, &pkgname, &id) != 3) {
ErrPrint("Inavlid argument\n");
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
goto out;
}
ret = validate_request(pkgname, id, &inst, &pkg);
- if (ret != LB_STATUS_SUCCESS) {
+ if (ret != DBOX_STATUS_ERROR_NONE) {
goto out;
}
- ret = LB_STATUS_ERROR_INVALID;
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- if (type == TYPE_LB && package_lb_type(pkg) == LB_TYPE_BUFFER) {
+ if (type == TYPE_DBOX && package_dbox_type(pkg) == DBOX_TYPE_BUFFER) {
struct buffer_info *info;
- info = instance_lb_buffer(inst);
+ info = instance_dbox_buffer(inst);
ret = buffer_handler_unload(info);
- } else if (type == TYPE_PD && package_pd_type(pkg) == PD_TYPE_BUFFER) {
+ } else if (type == TYPE_GBAR && package_gbar_type(pkg) == GBAR_TYPE_BUFFER) {
struct buffer_info *info;
- Ecore_Timer *pd_monitor;
+ Ecore_Timer *gbar_monitor;
- pd_monitor = instance_del_data(inst, PD_CLOSE_MONITOR_TAG);
- if (!pd_monitor && !package_is_fault(pkg)) {
+ 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
+ /**
+ * @note
* In this case just keep going to release buffer,
- * Even if a user(client) doesn't wants to destroy the PD.
+ * Even if a user(client) doesn't wants to destroy the GBAR.
*
- * If the slave tries to destroy PD buffer, it should be
+ * 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_pd_destroyed function will be ignored
+ * instance_client_gbar_destroyed function will be ignored
* by pd.need_to_send_close_event flag.
- * which will be checked by instance_client_pd_destroyed function.
+ * which will be checked by instance_client_gbar_destroyed function.
*/
- /*!
- * \note
+ /**
+ * @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,
+ * 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 PD again.
+ * 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 PD.
+ * Treat it as a fault. and close the GBAR.
*/
- info = instance_pd_buffer(inst);
+ info = instance_gbar_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");
+ 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 {
- (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) {
+ (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 (pd_monitor) {
- /*!
- * \note
- * If the instance has pd_monitor, the pd close requested from client via client_destroy_pd.
+ 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(pd_monitor);
+ ecore_timer_del(gbar_monitor);
inst = instance_unref(inst);
if (!inst) {
ErrPrint("Instance is released: %s\n", pkgname);
- ret = LB_STATUS_ERROR_FAULT;
+ 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
- */
+ @note
+ This case means that the package is faulted so the service provider tries to release the buffer
+ */
- info = instance_pd_buffer(inst);
+ info = instance_gbar_buffer(inst);
ret = buffer_handler_unload(info);
- /*!
- * \note
- * Send the PD destroyed event to the client
+ /**
+ * @note
+ * Send the GBAR destroyed event to the client
*/
- instance_client_pd_destroyed(inst, ret);
+ instance_client_gbar_destroyed(inst, ret);
+ }
}
- }
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 packet\n");
+ }
+
+ return result;
}
- return result;
-}
+ static struct packet *slave_release_extra_buffer(pid_t pid, int handle, const struct packet *packet)
+ {
+ struct slave_node *slave;
+ struct packet *result;
+ const char *id;
+ struct buffer_info *info = NULL;
+ int ret;
+ int idx;
+ int type;
+ const char *pkgname;
+ struct inst_info *inst;
+ const struct pkg_info *pkg;
-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;
- const char *id;
- double period;
- int ret;
+ slave = slave_find_by_pid(pid);
+ if (!slave) {
+ ErrPrint("Slave %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("Invalid packet\n");
- ret = LB_STATUS_ERROR_INVALID;
- 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);
+ 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) {
+ 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 (info) {
+ ret = buffer_handler_unload(info);
+ }
+
+out:
+ result = packet_create_reply(packet, "i", ret);
+ if (!result) {
+ ErrPrint("Failed to create a reply packet\n");
+ }
+
+ return result;
}
- if (!strlen(id)) {
+ static struct packet *service_instance_count(pid_t pid, int handle, const struct packet *packet)
+ {
+ struct packet *result;
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;
+ int ret;
- 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;
+ ret = packet_get(packet, "sssd", &pkgname, &cluster, &category, &timestamp);
+ if (ret != 4) {
+ ErrPrint("Invalid packet\n");
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ goto out;
+ }
+
+ pkg_list = (Eina_List *)package_list();
+
+ ret = 0;
+ EINA_LIST_FOREACH(pkg_list, l, pkg) {
+ if (pkgname && pkgname[0]) {
+ if (strcmp(package_name(pkg), pkgname)) {
+ continue;
+ }
+ }
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);
+ 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++;
}
}
- } 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);
+out:
+ result = packet_create_reply(packet, "i", ret);
+ if (!result) {
+ ErrPrint("Failed to create a packet\n");
}
- }
- 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");
+ return result;
}
- return result;
-}
+ 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;
+ const char *id;
+ double period;
+ int ret;
-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;
- const char *pkgname;
- const char *id;
- const char *cluster;
- const char *category;
- const char *content;
- int force;
- char *lbid;
- int ret;
+ ret = packet_get(packet, "ssd", &pkgname, &id, &period);
+ if (ret != 3) {
+ ErrPrint("Invalid packet\n");
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ goto out;
+ }
- 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;
- }
+ if (!strlen(id)) {
+ struct pkg_info *pkg;
- lbid = package_lb_pkgname(pkgname);
- if (!lbid) {
- ErrPrint("Invalid package %s\n", pkgname);
- ret = LB_STATUS_ERROR_INVALID;
- goto out;
- }
+ 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;
+
+ 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)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;
+ }
- pkg = package_find(lbid);
- if (!pkg) {
- ret = LB_STATUS_ERROR_NOT_EXIST;
- DbgFree(lbid);
- goto out;
- }
+ ret = instance_set_period(inst, period);
+ }
+ }
- if (package_is_fault(pkg)) {
- ret = LB_STATUS_ERROR_FAULT;
- DbgFree(lbid);
- goto out;
- }
+ 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");
+ }
- inst_list = package_instance_list(pkg);
- if (!eina_list_count(inst_list)) {
- ret = LB_STATUS_ERROR_NOT_EXIST;
- DbgFree(lbid);
- goto out;
+ return result;
}
- if (id && strlen(id)) {
- Eina_List *l;
- struct inst_info *inst;
+ 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;
+ const char *pkgname;
+ const char *id;
+ const char *cluster;
+ const char *category;
+ const char *content;
+ int force;
+ char *lbid;
+ int ret;
- 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 = packet_get(packet, "sssssi", &pkgname, &id, &cluster, &category, &content, &force);
+ if (ret != 6) {
+ ErrPrint("Invalid Packet\n");
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ goto out;
}
- if (ret == (int)LB_STATUS_ERROR_NOT_EXIST) {
+ lbid = package_dbox_pkgname(pkgname);
+ if (!lbid) {
+ ErrPrint("Invalid package %s\n", pkgname);
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ goto out;
+ }
+
+ pkg = package_find(lbid);
+ if (!pkg) {
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
DbgFree(lbid);
goto out;
}
- }
- /*!
- * \TODO
- * Validate the update requstor.
- */
- slave_rpc_request_update(lbid, id, cluster, category, content, force);
- DbgFree(lbid);
- ret = LB_STATUS_SUCCESS;
+ if (package_is_fault(pkg)) {
+ ret = DBOX_STATUS_ERROR_FAULT;
+ DbgFree(lbid);
+ goto out;
+ }
-out:
- result = packet_create_reply(packet, "i", ret);
- if (!result) {
- ErrPrint("Failed to create a packet\n");
- }
+ inst_list = package_instance_list(pkg);
+ if (!eina_list_count(inst_list)) {
+ ret = DBOX_STATUS_ERROR_NOT_EXIST;
+ DbgFree(lbid);
+ goto out;
+ }
- return result;
-}
+ if (id && strlen(id)) {
+ Eina_List *l;
+ struct inst_info *inst;
-static struct packet *liveinfo_hello(pid_t pid, int handle, const struct packet *packet)
-{
- struct liveinfo *info;
- struct packet *result;
- int ret;
- const char *fifo_name;
- double timestamp;
+ 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;
+ }
+ }
- DbgPrint("Request arrived from %d\n", pid);
+ if (ret == (int)DBOX_STATUS_ERROR_NOT_EXIST) {
+ DbgFree(lbid);
+ goto out;
+ }
+ }
- if (packet_get(packet, "d", &timestamp) != 1) {
- ErrPrint("Invalid packet\n");
- fifo_name = "";
- ret = LB_STATUS_ERROR_INVALID;
- goto out;
- }
+ /*!
+ * \TODO
+ * Validate the update requstor.
+ */
+ slave_rpc_request_update(lbid, id, cluster, category, content, force);
+ DbgFree(lbid);
+ ret = DBOX_STATUS_ERROR_NONE;
- info = liveinfo_create(pid, handle);
- if (!info) {
- ErrPrint("Failed to create a liveinfo object\n");
- fifo_name = "";
- ret = LB_STATUS_ERROR_INVALID;
- goto out;
+out:
+ result = packet_create_reply(packet, "i", ret);
+ if (!result) {
+ ErrPrint("Failed to create a packet\n");
+ }
+
+ return result;
}
- ret = 0;
- fifo_name = liveinfo_filename(info);
- DbgPrint("FIFO Created: %s (Serve for %d)\n", fifo_name, pid);
+ static struct packet *liveinfo_hello(pid_t pid, int handle, const struct packet *packet)
+ {
+ struct liveinfo *info;
+ struct packet *result;
+ int ret;
+ const char *fifo_name;
+ double timestamp;
+
+ DbgPrint("Request arrived from %d\n", pid);
+
+ if (packet_get(packet, "d", &timestamp) != 1) {
+ 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 = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ goto out;
+ }
+
+ ret = 0;
+ fifo_name = liveinfo_filename(info);
+ DbgPrint("FIFO Created: %s (Serve for %d)\n", fifo_name, pid);
out:
- result = packet_create_reply(packet, "si", fifo_name, ret);
- if (!result) {
- ErrPrint("Failed to create a result packet\n");
- }
+ result = packet_create_reply(packet, "si", fifo_name, ret);
+ if (!result) {
+ ErrPrint("Failed to create a result packet\n");
+ }
- return result;
-}
+ return result;
+ }
-static Eina_Bool lazy_slave_list_cb(void *info)
-{
- FILE *fp;
- Eina_List *list;
- Eina_List *l;
- struct slave_node *slave;
+ static Eina_Bool lazy_slave_list_cb(void *info)
+ {
+ FILE *fp;
+ Eina_List *list;
+ Eina_List *l;
+ struct slave_node *slave;
- liveinfo_open_fifo(info);
- fp = liveinfo_fifo(info);
- if (!fp) {
+ liveinfo_open_fifo(info);
+ fp = liveinfo_fifo(info);
+ if (!fp) {
+ 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, "EOD\n");
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, "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)
+ {
+ struct liveinfo *info;
+ double timestamp;
-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;
+ }
- if (packet_get(packet, "d", &timestamp) != 1) {
- ErrPrint("Invalid argument\n");
- goto out;
- }
+ info = liveinfo_find_by_pid(pid);
+ if (!info) {
+ ErrPrint("Invalid request\n");
+ goto out;
+ }
- info = liveinfo_find_by_pid(pid);
- if (!info) {
- ErrPrint("Invalid request\n");
- goto out;
+ lazy_slave_list_cb(info);
+out:
+ return NULL;
}
- lazy_slave_list_cb(info);
-out:
- return NULL;
-}
+ static inline const char *visible_state_string(enum dynamicbox_visible_state state)
+ {
+ switch (state) {
+ case DBOX_SHOW:
+ return "Show";
+ case DBOX_HIDE:
+ return "Hide";
+ case DBOX_HIDE_WITH_PAUSE:
+ return "Paused";
+ default:
+ break;
+ }
-static inline const char *visible_state_string(enum livebox_visible_state state)
-{
- switch (state) {
- case LB_SHOW:
- return "Show";
- case LB_HIDE:
- return "Hide";
- case LB_HIDE_WITH_PAUSE:
- return "Paused";
- default:
- break;
+ return "Unknown";
}
- return "Unknown";
-}
+ static Eina_Bool inst_list_cb(void *info)
+ {
+ FILE *fp;
+ char *pkgname;
+ struct pkg_info *pkg;
+ Eina_List *l;
+ Eina_List *inst_list;
+ struct inst_info *inst;
-static Eina_Bool inst_list_cb(void *info)
-{
- FILE *fp;
- char *pkgname;
- struct pkg_info *pkg;
- Eina_List *l;
- Eina_List *inst_list;
- struct inst_info *inst;
+ pkgname = liveinfo_data(info);
+ if (!pkgname) {
+ return ECORE_CALLBACK_CANCEL;
+ }
- pkgname = liveinfo_data(info);
- if (!pkgname) {
- 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;
+ }
- liveinfo_open_fifo(info);
- fp = liveinfo_fifo(info);
- if (!fp) {
- ErrPrint("Invalid fp\n");
- liveinfo_close_fifo(info);
- free(pkgname);
- return ECORE_CALLBACK_CANCEL;
- }
+ if (!package_is_dbox_pkgname(pkgname)) {
+ ErrPrint("Invalid package name\n");
+ free(pkgname);
+ goto close_out;
+ }
- if (!package_is_lb_pkgname(pkgname)) {
- ErrPrint("Invalid package name\n");
+ pkg = package_find(pkgname);
free(pkgname);
- goto close_out;
- }
+ if (!pkg) {
+ ErrPrint("Package is not exists\n");
+ goto close_out;
+ }
- pkg = package_find(pkgname);
- free(pkgname);
- if (!pkg) {
- 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 %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:
+ fprintf(fp, "EOD\n");
+ liveinfo_close_fifo(info);
- 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));
+ return ECORE_CALLBACK_CANCEL;
}
-close_out:
- fprintf(fp, "EOD\n");
- liveinfo_close_fifo(info);
+ static struct packet *liveinfo_inst_list(pid_t pid, int handle, const struct packet *packet)
+ {
+ const char *pkgname;
+ char *dup_pkgname;
+ struct liveinfo *info;
- return ECORE_CALLBACK_CANCEL;
-}
+ if (packet_get(packet, "s", &pkgname) != 1) {
+ ErrPrint("Invalid argument\n");
+ goto out;
+ }
-static struct packet *liveinfo_inst_list(pid_t pid, int handle, const struct packet *packet)
-{
- const char *pkgname;
- char *dup_pkgname;
- struct liveinfo *info;
+ info = liveinfo_find_by_pid(pid);
+ if (!info) {
+ ErrPrint("Invalid request\n");
+ goto out;
+ }
- if (packet_get(packet, "s", &pkgname) != 1) {
- ErrPrint("Invalid argument\n");
- goto out;
- }
+ dup_pkgname = strdup(pkgname);
+ if (!dup_pkgname) {
+ ErrPrint("Invalid request\n");
+ goto out;
+ }
- info = liveinfo_find_by_pid(pid);
- if (!info) {
- ErrPrint("Invalid request\n");
- goto out;
- }
+ liveinfo_set_data(info, dup_pkgname);
+ inst_list_cb(info);
- dup_pkgname = strdup(pkgname);
- if (!dup_pkgname) {
- ErrPrint("Invalid request\n");
- goto out;
+out:
+ return NULL;
}
- liveinfo_set_data(info, dup_pkgname);
- inst_list_cb(info);
+ static Eina_Bool pkg_list_cb(void *info)
+ {
+ FILE *fp;
+ Eina_List *l;
+ Eina_List *list;
+ Eina_List *inst_list;
+ struct pkg_info *pkg;
+ struct slave_node *slave;
+ const char *slavename;
+ pid_t pid;
-out:
- return NULL;
-}
+ 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;
+ }
-static Eina_Bool pkg_list_cb(void *info)
-{
- FILE *fp;
- Eina_List *l;
- Eina_List *list;
- Eina_List *inst_list;
- struct pkg_info *pkg;
- struct slave_node *slave;
- const char *slavename;
- pid_t pid;
+ 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 = "";
+ }
- liveinfo_open_fifo(info);
- fp = liveinfo_fifo(info);
- if (!fp) {
- DbgPrint("Failed to open a pipe\n");
+ 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;
}
- 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)
- );
- }
-
- 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)
+ {
+ struct liveinfo *info;
+ double timestamp;
-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;
+ }
- if (packet_get(packet, "d", &timestamp) != 1) {
- ErrPrint("Invalid argument\n");
- goto out;
- }
+ DbgPrint("Package List: %lf\n", timestamp);
- DbgPrint("Package List: %lf\n", timestamp);
+ info = liveinfo_find_by_pid(pid);
+ if (!info) {
+ ErrPrint("Invalid request\n");
+ goto out;
+ }
- info = liveinfo_find_by_pid(pid);
- if (!info) {
- ErrPrint("Invalid request\n");
- goto out;
+ pkg_list_cb(info);
+out:
+ return NULL;
}
- pkg_list_cb(info);
-out:
- return NULL;
-}
+ static struct packet *liveinfo_slave_ctrl(pid_t pid, int handle, const struct packet *packet)
+ {
+ return NULL;
+ }
-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)
+ {
+ FILE *fp;
+ liveinfo_open_fifo(info);
+ fp = liveinfo_fifo(info);
+ if (!fp) {
+ liveinfo_close_fifo(info);
+ return ECORE_CALLBACK_CANCEL;
+ }
-static Eina_Bool pkg_ctrl_rmpack_cb(void *info)
-{
- FILE *fp;
- liveinfo_open_fifo(info);
- fp = liveinfo_fifo(info);
- if (!fp) {
+ fprintf(fp, "%d\n", ENOSYS);
+ fprintf(fp, "EOD\n");
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)
+ {
+ FILE *fp;
-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_open_fifo(info);
- fp = liveinfo_fifo(info);
- if (!fp) {
+ fprintf(fp, "%d\n", (int)liveinfo_data(info));
+ fprintf(fp, "EOD\n");
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)
+ {
+ FILE *fp;
-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_open_fifo(info);
- fp = liveinfo_fifo(info);
- if (!fp) {
+ fprintf(fp, "%d\n", (int)liveinfo_data(info));
+ fprintf(fp, "EOD\n");
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)
-{
- struct liveinfo *info;
- char *cmd;
- char *pkgname;
- char *id;
-
- if (packet_get(packet, "sss", &cmd, &pkgname, &id) != 3) {
- ErrPrint("Invalid argument\n");
- goto out;
- }
-
- info = liveinfo_find_by_pid(pid);
- if (!info) {
- ErrPrint("Invalid request\n");
- goto out;
- }
+ 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 (!strcmp(cmd, "rmpack")) {
- 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);
+ if (packet_get(packet, "sss", &cmd, &pkgname, &id) != 3) {
+ ErrPrint("Invalid argument\n");
+ goto out;
}
- 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);
- } else {
- struct pkg_info *pkg;
+ info = liveinfo_find_by_pid(pid);
+ if (!info) {
+ ErrPrint("Invalid request\n");
+ goto out;
+ }
- pkg = instance_package(inst);
- if (!pkg) {
- liveinfo_set_data(info, (void *)EFAULT);
+ if (!strcmp(cmd, "rmpack")) {
+ 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)package_faulted(pkg, 1);
+ (void)instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
liveinfo_set_data(info, (void *)0);
}
- }
-
- pkg_ctrl_faultinst_cb(info);
- }
-
-out:
- return NULL;
-}
-
-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;
- }
- 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)
-{
- struct liveinfo *info;
- char *cmd;
- char *var;
- char *val;
- int ret = LB_STATUS_ERROR_INVALID;
-
- if (packet_get(packet, "sss", &cmd, &var, &val) != 3) {
- ErrPrint("Invalid argument\n");
- goto out;
- }
+ 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);
+ } else {
+ struct pkg_info *pkg;
- info = liveinfo_find_by_pid(pid);
- if (!info) {
- ErrPrint("Invalid request\n");
- goto out;
- }
+ pkg = instance_package(inst);
+ if (!pkg) {
+ liveinfo_set_data(info, (void *)EFAULT);
+ } else {
+ (void)package_faulted(pkg, 1);
+ liveinfo_set_data(info, (void *)0);
+ }
+ }
- if (!strcasecmp(var, "debug")) {
- if (!strcasecmp(cmd, "set")) {
- g_conf.debug_mode = !strcasecmp(val, "on");
- } else if (!strcasecmp(cmd, "get")) {
+ pkg_ctrl_faultinst_cb(info);
}
- 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;
- }
-
- liveinfo_set_data(info, (void *)ret);
- master_ctrl_cb(info);
out:
- return NULL;
-}
-
-static struct method s_info_table[] = {
- {
- .cmd = "liveinfo_hello",
- .handler = liveinfo_hello,
- },
- {
- .cmd = "slave_list",
- .handler = liveinfo_slave_list,
- },
- {
- .cmd = "pkg_list",
- .handler = liveinfo_pkg_list,
- },
- {
- .cmd = "inst_list",
- .handler = liveinfo_inst_list,
- },
- {
- .cmd = "slave_ctrl",
- .handler = liveinfo_slave_ctrl,
- },
- {
- .cmd = "pkg_ctrl",
- .handler = liveinfo_pkg_ctrl,
- },
- {
- .cmd = "master_ctrl",
- .handler = liveinfo_master_ctrl,
- },
- {
- .cmd = NULL,
- .handler = NULL,
- },
-};
-
-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 = "lb_mouse_move",
- .handler = client_lb_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 = "pd_mouse_up",
- .handler = client_pd_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 = "lb_mouse_up",
- .handler = client_lb_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 = "pd_mouse_leave",
- .handler = client_pd_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 = "lb_mouse_leave",
- .handler = client_lb_mouse_leave, /* pid, pkgname, filename, width, height, timestamp, x, y, ret */
- },
- {
- .cmd = "lb_mouse_set",
- .handler = client_lb_mouse_set,
- },
- {
- .cmd = "lb_mouse_unset",
- .handler = client_lb_mouse_unset,
- },
- {
- .cmd = "pd_mouse_set",
- .handler = client_pd_mouse_set,
- },
- {
- .cmd = "pd_mouse_unset",
- .handler = client_pd_mouse_unset,
- },
- {
- .cmd = "lb_mouse_on_scroll",
- .handler = client_lb_mouse_on_scroll,
- },
- {
- .cmd = "lb_mouse_off_scroll",
- .handler = client_lb_mouse_off_scroll,
- },
- {
- .cmd = "pd_mouse_on_scroll",
- .handler = client_pd_mouse_on_scroll,
- },
- {
- .cmd = "pd_mouse_off_scroll",
- .handler = client_pd_mouse_off_scroll,
- },
- {
- .cmd = "lb_mouse_on_hold",
- .handler = client_lb_mouse_on_hold,
- },
- {
- .cmd = "lb_mouse_off_hold",
- .handler = client_lb_mouse_off_hold,
- },
- {
- .cmd = "pd_mouse_on_hold",
- .handler = client_pd_mouse_on_hold,
- },
- {
- .cmd = "pd_mouse_off_hold",
- .handler = client_pd_mouse_off_hold,
- },
- {
- .cmd = "change,visibility",
- .handler = client_change_visibility,
- },
- {
- .cmd = "lb_acquire_pixmap",
- .handler = client_lb_acquire_pixmap,
- },
- {
- .cmd = "lb_release_pixmap",
- .handler = client_lb_release_pixmap,
- },
- {
- .cmd = "pd_acquire_pixmap",
- .handler = client_pd_acquire_pixmap,
- },
- {
- .cmd = "pd_release_pixmap",
- .handler = client_pd_release_pixmap,
- },
- {
- .cmd = "acquire",
- .handler = client_acquire, /*!< pid, ret */
- },
- {
- .cmd = "release",
- .handler = cilent_release, /*!< pid, ret */
- },
- {
- .cmd = "clicked",
- .handler = client_clicked, /*!< pid, pkgname, filename, event, timestamp, x, y, ret */
- },
- {
- .cmd = "text_signal",
- .handler = client_text_signal, /* pid, pkgname, filename, emission, source, s, sy, ex, ey, ret */
- },
- {
- .cmd = "delete",
- .handler = client_delete, /* pid, pkgname, filename, ret */
- },
- {
- .cmd = "resize",
- .handler = client_resize, /* pid, pkgname, filename, w, h, ret */
- },
- {
- .cmd = "new",
- .handler = client_new, /* pid, timestamp, pkgname, content, cluster, category, period, ret */
- },
- {
- .cmd = "set_period",
- .handler = client_set_period, /* pid, pkgname, filename, period, ret, period */
- },
- {
- .cmd = "change_group",
- .handler = client_change_group, /* pid, pkgname, filename, cluster, category, ret */
- },
- {
- .cmd = "pinup_changed",
- .handler = client_pinup_changed, /* pid, pkgname, filename, pinup, ret */
- },
- {
- .cmd = "create_pd",
- .handler = client_create_pd, /* pid, pkgname, filename, ret */
- },
- {
- .cmd = "pd_move",
- .handler = client_pd_move, /* pkgname, id, x, y */
- },
- {
- .cmd = "destroy_pd",
- .handler = client_destroy_pd, /* pid, pkgname, filename, ret */
- },
- {
- .cmd = "activate_package",
- .handler = client_activate_package, /* pid, pkgname, ret */
- },
- {
- .cmd = "subscribe", /* pid, cluster, sub-cluster */
- .handler = client_subscribed,
- },
- {
- .cmd = "unsubscribe", /* pid, cluster, sub-cluster */
- .handler = client_unsubscribed,
- },
- {
- .cmd = "delete_cluster",
- .handler = client_delete_cluster,
- },
- {
- .cmd = "delete_category",
- .handler = client_delete_category,
- },
- {
- .cmd = "refresh_group",
- .handler = client_refresh_group,
- },
- {
- .cmd = "update",
- .handler = client_update,
- },
-
- {
- .cmd = "pd_access_hl",
- .handler = client_pd_access_hl,
- },
- {
- .cmd = "pd_access_hl_prev",
- .handler = client_pd_access_hl_prev,
- },
- {
- .cmd = "pd_access_hl_next",
- .handler = client_pd_access_hl_next,
- },
- {
- .cmd = "pd_access_activate",
- .handler = client_pd_access_activate,
- },
- {
- .cmd = "pd_access_action_up",
- .handler = client_pd_access_action_up,
- },
- {
- .cmd = "pd_access_action_down",
- .handler = client_pd_access_action_down,
- },
- {
- .cmd = "pd_access_unhighlight",
- .handler = client_pd_access_unhighlight,
- },
- {
- .cmd = "pd_access_scroll_down",
- .handler = client_pd_access_scroll_down,
- },
- {
- .cmd = "pd_access_scroll_move",
- .handler = client_pd_access_scroll_move,
- },
- {
- .cmd = "pd_access_scroll_up",
- .handler = client_pd_access_scroll_up,
- },
+ return NULL;
+ }
+ static Eina_Bool master_ctrl_cb(void *info)
{
- .cmd = "lb_access_hl",
- .handler = client_lb_access_hl,
- },
- {
- .cmd = "lb_access_hl_prev",
- .handler = client_lb_access_hl_prev,
- },
- {
- .cmd = "lb_access_hl_next",
- .handler = client_lb_access_hl_next,
- },
- {
- .cmd = "lb_access_activate",
- .handler = client_lb_access_activate,
- },
- {
- .cmd = "lb_access_action_up",
- .handler = client_lb_access_action_up,
- },
- {
- .cmd = "lb_access_action_down",
- .handler = client_lb_access_action_down,
- },
- {
- .cmd = "lb_access_unhighlight",
- .handler = client_lb_access_unhighlight,
- },
- {
- .cmd = "lb_access_scroll_down",
- .handler = client_lb_access_scroll_down,
- },
- {
- .cmd = "lb_access_scroll_move",
- .handler = client_lb_access_scroll_move,
- },
- {
- .cmd = "lb_access_scroll_up",
- .handler = client_lb_access_scroll_up,
- },
+ FILE *fp;
- {
- .cmd = "lb_key_down",
- .handler = client_lb_key_down,
- },
- {
- .cmd = "lb_key_up",
- .handler = client_lb_key_up,
- },
- {
- .cmd = "lb_key_focus_in",
- .handler = client_lb_key_focus_in,
- },
- {
- .cmd = "lb_key_focus_out",
- .handler = client_lb_key_focus_out,
- },
- {
- .cmd = "lb_key_set",
- .handler = client_lb_key_set,
- },
- {
- .cmd = "lb_key_unset",
- .handler = client_lb_key_unset,
- },
+ liveinfo_open_fifo(info);
+ fp = liveinfo_fifo(info);
+ if (!fp) {
+ liveinfo_close_fifo(info);
+ return ECORE_CALLBACK_CANCEL;
+ }
+ fprintf(fp, "%d\nEOD\n", (int)liveinfo_data(info));
+ liveinfo_close_fifo(info);
- {
- .cmd = "pd_key_down",
- .handler = client_pd_key_down,
- },
- {
- .cmd = "pd_key_up",
- .handler = client_pd_key_up,
- },
- {
- .cmd = "pd_key_focus_in",
- .handler = client_pd_key_focus_in,
- },
- {
- .cmd = "pd_key_focus_out",
- .handler = client_pd_key_focus_out,
- },
- {
- .cmd = "pd_key_set",
- .handler = client_pd_key_set,
- },
- {
- .cmd = "pd_key_unset",
- .handler = client_pd_key_unset,
- },
+ return ECORE_CALLBACK_CANCEL;
+ }
+ static struct packet *liveinfo_master_ctrl(pid_t pid, int handle, const struct packet *packet)
{
- .cmd = "client_paused",
- .handler = client_pause_request,
- },
- {
- .cmd = "client_resumed",
- .handler = client_resume_request,
- },
+ struct liveinfo *info;
+ char *cmd;
+ char *var;
+ char *val;
+ int ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+
+ if (packet_get(packet, "sss", &cmd, &var, &val) != 3) {
+ ErrPrint("Invalid argument\n");
+ goto out;
+ }
- {
- .cmd = "update_mode",
- .handler = client_update_mode,
- },
+ info = liveinfo_find_by_pid(pid);
+ if (!info) {
+ ErrPrint("Invalid request\n");
+ goto out;
+ }
- {
- .cmd = NULL,
- .handler = NULL,
- },
-};
+ 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;
+ } 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;
+ }
-static struct method s_service_table[] = {
- {
- .cmd = "service_update",
- .handler = service_update,
- },
- {
- .cmd = "service_change_period",
- .handler = service_change_period,
- },
- {
- .cmd = NULL,
- .handler = NULL,
- },
-};
+ liveinfo_set_data(info, (void *)ret);
+ master_ctrl_cb(info);
-static struct method s_slave_table[] = {
- {
- .cmd = "call",
- .handler = slave_call, /* slave_name, pkgname, filename, function, ret */
- },
- {
- .cmd = "ret",
- .handler = slave_ret, /* slave_name, pkgname, filename, function, ret */
- },
- {
- .cmd = "updated",
- .handler = slave_updated, /* slave_name, pkgname, filename, width, height, priority, ret */
- },
- {
- .cmd = "desc_updated",
- .handler = slave_desc_updated, /* slave_name, pkgname, filename, decsfile, ret */
- },
- {
- .cmd = "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 = "resize_buffer",
- .handler = slave_resize_buffer,
- },
- {
- .cmd = "release_buffer",
- .handler = slave_release_buffer, /* slave_name, id - ret */
- },
- {
- .cmd = "faulted",
- .handler = slave_faulted, /* slave_name, pkgname, id, funcname */
- },
+out:
+ return NULL;
+ }
+
+ static struct method s_info_table[] = {
+ {
+ .cmd = CMD_STR_INFO_HELLO,
+ .handler = liveinfo_hello,
+ },
+ {
+ .cmd = CMD_STR_INFO_SLAVE_LIST,
+ .handler = liveinfo_slave_list,
+ },
+ {
+ .cmd = CMD_STR_INFO_PKG_LIST,
+ .handler = liveinfo_pkg_list,
+ },
+ {
+ .cmd = CMD_STR_INFO_INST_LIST,
+ .handler = liveinfo_inst_list,
+ },
+ {
+ .cmd = CMD_STR_INFO_SLAVE_CTRL,
+ .handler = liveinfo_slave_ctrl,
+ },
+ {
+ .cmd = CMD_STR_INFO_PKG_CTRL,
+ .handler = liveinfo_pkg_ctrl,
+ },
+ {
+ .cmd = CMD_STR_INFO_MASTER_CTRL,
+ .handler = liveinfo_master_ctrl,
+ },
+ {
+ .cmd = NULL,
+ .handler = NULL,
+ },
+ };
+
+ static struct method s_client_table[] = {
+ {
+ .cmd = CMD_STR_GBAR_MOUSE_MOVE,
+ .handler = client_gbar_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 = CMD_STR_GBAR_MOUSE_DOWN,
+ .handler = client_gbar_mouse_down, /* pid, pkgname, id, 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 = CMD_STR_DBOX_MOUSE_DOWN,
+ .handler = client_dbox_mouse_down, /* 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 = CMD_STR_GBAR_MOUSE_ENTER,
+ .handler = client_gbar_mouse_enter, /* 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 = CMD_STR_DBOX_MOUSE_ENTER,
+ .handler = client_dbox_mouse_enter, /* 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 = CMD_STR_DBOX_MOUSE_ON_SCROLL,
+ .handler = client_dbox_mouse_on_scroll,
+ },
+ {
+ .cmd = CMD_STR_DBOX_MOUSE_OFF_SCROLL,
+ .handler = client_dbox_mouse_off_scroll,
+ },
+ {
+ .cmd = CMD_STR_GBAR_MOUSE_ON_SCROLL,
+ .handler = client_gbar_mouse_on_scroll,
+ },
+ {
+ .cmd = CMD_STR_GBAR_MOUSE_OFF_SCROLL,
+ .handler = client_gbar_mouse_off_scroll,
+ },
+ {
+ .cmd = CMD_STR_DBOX_MOUSE_ON_HOLD,
+ .handler = client_dbox_mouse_on_hold,
+ },
+ {
+ .cmd = CMD_STR_DBOX_MOUSE_OFF_HOLD,
+ .handler = client_dbox_mouse_off_hold,
+ },
+ {
+ .cmd = CMD_STR_GBAR_MOUSE_ON_HOLD,
+ .handler = client_gbar_mouse_on_hold,
+ },
+ {
+ .cmd = CMD_STR_GBAR_MOUSE_OFF_HOLD,
+ .handler = client_gbar_mouse_off_hold,
+ },
+ {
+ .cmd = CMD_STR_CLICKED,
+ .handler = client_clicked, /*!< pid, pkgname, filename, event, timestamp, x, y, ret */
+ },
+ {
+ .cmd = CMD_STR_TEXT_SIGNAL,
+ .handler = client_text_signal, /* pid, pkgname, filename, emission, source, s, sy, ex, ey, ret */
+ },
+ {
+ .cmd = CMD_STR_DELETE,
+ .handler = client_delete, /* pid, pkgname, filename, ret */
+ },
+ {
+ .cmd = CMD_STR_RESIZE,
+ .handler = client_resize, /* pid, pkgname, filename, w, h, ret */
+ },
+ {
+ .cmd = CMD_STR_NEW,
+ .handler = client_new, /* pid, timestamp, pkgname, content, cluster, category, period, ret */
+ },
+ {
+ .cmd = CMD_STR_SET_PERIOD,
+ .handler = client_set_period, /* pid, pkgname, filename, period, ret, period */
+ },
+ {
+ .cmd = CMD_STR_CHANGE_GROUP,
+ .handler = client_change_group, /* pid, pkgname, filename, cluster, category, ret */
+ },
+ {
+ .cmd = CMD_STR_GBAR_MOVE,
+ .handler = client_gbar_move, /* pkgname, id, x, y */
+ },
+ {
+ .cmd = CMD_STR_GBAR_ACCESS_HL,
+ .handler = client_gbar_access_hl,
+ },
+ {
+ .cmd = CMD_STR_GBAR_ACCESS_ACTIVATE,
+ .handler = client_gbar_access_activate,
+ },
+ {
+ .cmd = CMD_STR_GBAR_ACCESS_ACTION,
+ .handler = client_gbar_access_action,
+ },
+ {
+ .cmd = CMD_STR_GBAR_ACCESS_SCROLL,
+ .handler = client_gbar_access_scroll,
+ },
+ {
+ .cmd = CMD_STR_GBAR_ACCESS_VALUE_CHANGE,
+ .handler = client_gbar_access_value_change,
+ },
+ {
+ .cmd = CMD_STR_GBAR_ACCESS_MOUSE,
+ .handler = client_gbar_access_mouse,
+ },
+ {
+ .cmd = CMD_STR_GBAR_ACCESS_BACK,
+ .handler = client_gbar_access_back,
+ },
+ {
+ .cmd = CMD_STR_GBAR_ACCESS_OVER,
+ .handler = client_gbar_access_over,
+ },
+ {
+ .cmd = CMD_STR_GBAR_ACCESS_READ,
+ .handler = client_gbar_access_read,
+ },
+ {
+ .cmd = CMD_STR_GBAR_ACCESS_ENABLE,
+ .handler = client_gbar_access_enable,
+ },
+
+ {
+ .cmd = CMD_STR_DBOX_ACCESS_HL,
+ .handler = client_dbox_access_hl,
+ },
+ {
+ .cmd = CMD_STR_DBOX_ACCESS_ACTIVATE,
+ .handler = client_dbox_access_activate,
+ },
+ {
+ .cmd = CMD_STR_DBOX_ACCESS_ACTION,
+ .handler = client_dbox_access_action,
+ },
+ {
+ .cmd = CMD_STR_DBOX_ACCESS_SCROLL,
+ .handler = client_dbox_access_scroll,
+ },
+ {
+ .cmd = CMD_STR_DBOX_ACCESS_VALUE_CHANGE,
+ .handler = client_dbox_access_value_change,
+ },
+ {
+ .cmd = CMD_STR_DBOX_ACCESS_MOUSE,
+ .handler = client_dbox_access_mouse,
+ },
+ {
+ .cmd = CMD_STR_DBOX_ACCESS_BACK,
+ .handler = client_dbox_access_back,
+ },
+ {
+ .cmd = CMD_STR_DBOX_ACCESS_OVER,
+ .handler = client_dbox_access_over,
+ },
+ {
+ .cmd = CMD_STR_DBOX_ACCESS_READ,
+ .handler = client_dbox_access_read,
+ },
+ {
+ .cmd = CMD_STR_DBOX_ACCESS_ENABLE,
+ .handler = client_dbox_access_enable,
+ },
+ {
+ .cmd = CMD_STR_DBOX_KEY_DOWN,
+ .handler = client_dbox_key_down,
+ },
+ {
+ .cmd = CMD_STR_DBOX_KEY_UP,
+ .handler = client_dbox_key_up,
+ },
+ {
+ .cmd = CMD_STR_DBOX_KEY_FOCUS_IN,
+ .handler = client_dbox_key_focus_in,
+ },
+ {
+ .cmd = CMD_STR_DBOX_KEY_FOCUS_OUT,
+ .handler = client_dbox_key_focus_out,
+ },
+ {
+ .cmd = CMD_STR_GBAR_KEY_DOWN,
+ .handler = client_gbar_key_down,
+ },
+ {
+ .cmd = CMD_STR_GBAR_KEY_UP,
+ .handler = client_gbar_key_up,
+ },
+ {
+ .cmd = CMD_STR_GBAR_KEY_FOCUS_IN,
+ .handler = client_gbar_key_focus_in,
+ },
+ {
+ .cmd = CMD_STR_GBAR_KEY_FOCUS_OUT,
+ .handler = client_gbar_key_focus_out,
+ },
+ {
+ .cmd = CMD_STR_UPDATE_MODE,
+ .handler = client_update_mode,
+ },
+ // Cut HERE. Above list must be sync'd with provider list.
+
+ {
+ .cmd = CMD_STR_DBOX_MOUSE_SET,
+ .handler = client_dbox_mouse_set,
+ },
+ {
+ .cmd = CMD_STR_DBOX_MOUSE_UNSET,
+ .handler = client_dbox_mouse_unset,
+ },
+ {
+ .cmd = CMD_STR_GBAR_MOUSE_SET,
+ .handler = client_gbar_mouse_set,
+ },
+ {
+ .cmd = CMD_STR_GBAR_MOUSE_UNSET,
+ .handler = client_gbar_mouse_unset,
+ },
+ {
+ .cmd = CMD_STR_CHANGE_VISIBILITY,
+ .handler = client_change_visibility,
+ },
+ {
+ .cmd = CMD_STR_DBOX_ACQUIRE_PIXMAP,
+ .handler = client_dbox_acquire_pixmap,
+ },
+ {
+ .cmd = CMD_STR_DBOX_RELEASE_PIXMAP,
+ .handler = client_dbox_release_pixmap,
+ },
+ {
+ .cmd = CMD_STR_GBAR_ACQUIRE_PIXMAP,
+ .handler = client_gbar_acquire_pixmap,
+ },
+ {
+ .cmd = CMD_STR_GBAR_RELEASE_PIXMAP,
+ .handler = client_gbar_release_pixmap,
+ },
+ {
+ .cmd = CMD_STR_ACQUIRE,
+ .handler = client_acquire, /*!< pid, ret */
+ },
+ {
+ .cmd = CMD_STR_RELEASE,
+ .handler = cilent_release, /*!< pid, ret */
+ },
+ {
+ .cmd = CMD_STR_PINUP_CHANGED,
+ .handler = client_pinup_changed, /* pid, pkgname, filename, pinup, ret */
+ },
+ {
+ .cmd = CMD_STR_CREATE_GBAR,
+ .handler = client_create_gbar, /* pid, pkgname, filename, ret */
+ },
+ {
+ .cmd = CMD_STR_DESTROY_GBAR,
+ .handler = client_destroy_gbar, /* pid, pkgname, filename, ret */
+ },
+ {
+ .cmd = CMD_STR_ACTIVATE_PACKAGE,
+ .handler = client_activate_package, /* pid, pkgname, ret */
+ },
+ {
+ .cmd = CMD_STR_SUBSCRIBE, /* pid, cluster, sub-cluster */
+ .handler = client_subscribed,
+ },
+ {
+ .cmd = CMD_STR_UNSUBSCRIBE, /* pid, cluster, sub-cluster */
+ .handler = client_unsubscribed,
+ },
+ {
+ .cmd = CMD_STR_DELETE_CLUSTER,
+ .handler = client_delete_cluster,
+ },
+ {
+ .cmd = CMD_STR_DELETE_CATEGORY,
+ .handler = client_delete_category,
+ },
+ {
+ .cmd = CMD_STR_REFRESH_GROUP,
+ .handler = client_refresh_group,
+ },
+ {
+ .cmd = CMD_STR_UPDATE,
+ .handler = client_update,
+ },
+
+ {
+ .cmd = CMD_STR_DBOX_KEY_SET,
+ .handler = client_dbox_key_set,
+ },
+ {
+ .cmd = CMD_STR_DBOX_KEY_UNSET,
+ .handler = client_dbox_key_unset,
+ },
+
+ {
+ .cmd = CMD_STR_GBAR_KEY_SET,
+ .handler = client_gbar_key_set,
+ },
+ {
+ .cmd = CMD_STR_GBAR_KEY_UNSET,
+ .handler = client_gbar_key_unset,
+ },
+
+ {
+ .cmd = CMD_STR_CLIENT_PAUSED,
+ .handler = client_pause_request,
+ },
+ {
+ .cmd = CMD_STR_CLIENT_RESUMED,
+ .handler = client_resume_request,
+ },
+ {
+ .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,
+ },
+ };
+
+ static struct method s_service_table[] = {
+ {
+ .cmd = CMD_STR_SERVICE_UPDATE,
+ .handler = service_update,
+ },
+ {
+ .cmd = CMD_STR_SERVICE_CHANGE_PERIOD,
+ .handler = service_change_period,
+ },
+ {
+ .cmd = CMD_STR_SERVICE_INST_CNT,
+ .handler = service_instance_count,
+ },
+ {
+ .cmd = NULL,
+ .handler = NULL,
+ },
+ };
+
+ static struct method s_slave_table[] = {
+ {
+ .cmd = CMD_STR_UPDATED,
+ .handler = slave_updated, /* slave_name, pkgname, filename, width, height, ret */
+ },
+ {
+ .cmd = CMD_STR_DESC_UPDATED,
+ .handler = slave_desc_updated, /* slave_name, pkgname, filename, decsfile, ret */
+ },
+ {
+ .cmd = CMD_STR_EXTRA_UPDATED,
+ .handler = slave_extra_updated,
+ },
+ {
+ .cmd = CMD_STR_EXTRA_INFO,
+ .handler = slave_extra_info, /* slave_name, pkgname, filename, priority, content_info, title, icon, name */
+ },
+ {
+ .cmd = CMD_STR_DELETED,
+ .handler = slave_deleted, /* slave_name, pkgname, filename, ret */
+ },
+ {
+ .cmd = CMD_STR_FAULTED,
+ .handler = slave_faulted, /* slave_name, pkgname, id, funcname */
+ },
+ {
+ .cmd = CMD_STR_SCROLL,
+ .handler = slave_hold_scroll, /* slave_name, pkgname, id, seize */
+ },
+
+ {
+ .cmd = CMD_STR_DBOX_UPDATE_BEGIN,
+ .handler = slave_dbox_update_begin,
+ },
+ {
+ .cmd = CMD_STR_DBOX_UPDATE_END,
+ .handler = slave_dbox_update_end,
+ },
+ {
+ .cmd = CMD_STR_GBAR_UPDATE_BEGIN,
+ .handler = slave_gbar_update_begin,
+ },
+ {
+ .cmd = CMD_STR_GBAR_UPDATE_END,
+ .handler = slave_gbar_update_end,
+ },
+
+ {
+ .cmd = CMD_STR_ACCESS_STATUS,
+ .handler = slave_access_status,
+ },
+ {
+ .cmd = CMD_STR_KEY_STATUS,
+ .handler = slave_key_status,
+ },
+ {
+ .cmd = CMD_STR_CLOSE_GBAR,
+ .handler = slave_close_gbar,
+ },
+
+ {
+ .cmd = CMD_STR_CALL,
+ .handler = slave_call, /* slave_name, pkgname, filename, function, ret */
+ },
+ {
+ .cmd = CMD_STR_RET,
+ .handler = slave_ret, /* slave_name, pkgname, filename, function, ret */
+ },
+ {
+ .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 = CMD_STR_RELEASE_BUFFER,
+ .handler = slave_release_buffer, /* slave_name, id - ret */
+ },
+ {
+ .cmd = CMD_STR_HELLO,
+ .handler = slave_hello, /* slave_name, ret */
+ },
+ {
+ .cmd = CMD_STR_PING,
+ .handler = slave_ping, /* slave_name, ret */
+ },
+ {
+ .cmd = CMD_STR_CTRL,
+ .handler = slave_ctrl, /* control bits */
+ },
+
+ {
+ .cmd = CMD_STR_ACQUIRE_XBUFFER,
+ .handler = slave_acquire_extra_buffer,
+ },
+ {
+ .cmd = CMD_STR_RELEASE_XBUFFER,
+ .handler = slave_release_extra_buffer,
+ },
+
+ {
+ .cmd = NULL,
+ .handler = NULL,
+ },
+ };
+
+ HAPI int server_init(void)
{
- .cmd = "scroll",
- .handler = slave_hold_scroll, /* slave_name, pkgname, id, seize */
- },
+ com_core_packet_use_thread(DYNAMICBOX_CONF_COM_CORE_THREAD);
- {
- .cmd = "lb_update_begin",
- .handler = slave_lb_update_begin,
- },
- {
- .cmd = "lb_update_end",
- .handler = slave_lb_update_end,
- },
- {
- .cmd = "pd_update_begin",
- .handler = slave_pd_update_begin,
- },
- {
- .cmd = "pd_update_end",
- .handler = slave_pd_update_end,
- },
+ if (unlink(INFO_SOCKET) < 0) {
+ ErrPrint("info socket: %s\n", strerror(errno));
+ }
- {
- .cmd = "access_status",
- .handler = slave_access_status,
- },
- {
- .cmd = "key_status",
- .handler = slave_key_status,
- },
- {
- .cmd = "close_pd",
- .handler = slave_close_pd,
- },
+ if (unlink(SLAVE_SOCKET) < 0) {
+ ErrPrint("slave socket: %s\n", strerror(errno));
+ }
- {
- .cmd = "hello",
- .handler = slave_hello, /* slave_name, ret */
- },
- {
- .cmd = "ping",
- .handler = slave_ping, /* slave_name, ret */
- },
- {
- .cmd = "ctrl",
- .handler = slave_ctrl, /* control bits */
- },
+ if (unlink(CLIENT_SOCKET) < 0) {
+ ErrPrint("client socket: %s\n", strerror(errno));
+ }
- {
- .cmd = NULL,
- .handler = NULL,
- },
-};
+ if (unlink(SERVICE_SOCKET) < 0) {
+ ErrPrint("service socket: %s\n", strerror(errno));
+ }
-HAPI int server_init(void)
-{
- com_core_packet_use_thread(COM_CORE_THREAD);
+ 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");
+ }
- if (unlink(INFO_SOCKET) < 0) {
- ErrPrint("info socket: %s\n", strerror(errno));
- }
+ 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");
+ }
- if (unlink(SLAVE_SOCKET) < 0) {
- ErrPrint("slave socket: %s\n", strerror(errno));
- }
+ smack_fsetlabel(s_info.slave_fd, "data-provider-master::provider", SMACK_LABEL_IPIN);
+ smack_fsetlabel(s_info.slave_fd, "data-provider-master::provider", SMACK_LABEL_IPOUT);
- if (unlink(CLIENT_SOCKET) < 0) {
- ErrPrint("client socket: %s\n", strerror(errno));
- }
+ 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");
+ }
- if (unlink(SERVICE_SOCKET) < 0) {
- ErrPrint("service socket: %s\n", strerror(errno));
- }
+ smack_fsetlabel(s_info.client_fd, "data-provider-master::client", SMACK_LABEL_IPIN);
+ smack_fsetlabel(s_info.client_fd, "data-provider-master::client", SMACK_LABEL_IPOUT);
- 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");
- }
+ /*!
+ * \note
+ * remote://:8208
+ * Skip address to use the NULL.
+ */
+ 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");
+ }
- 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");
- }
+ smack_fsetlabel(s_info.remote_client_fd, "data-provider-master::client", SMACK_LABEL_IPIN);
+ smack_fsetlabel(s_info.remote_client_fd, "data-provider-master::client", SMACK_LABEL_IPOUT);
- 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");
- }
+ 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");
+ }
- /*!
- * \note
- * remote://:8208
- * Skip address to use the NULL.
- */
- 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");
- }
+ smack_fsetlabel(s_info.service_fd, "data-provider-master", SMACK_LABEL_IPIN);
+ smack_fsetlabel(s_info.service_fd, "data-provider-master", SMACK_LABEL_IPOUT);
- 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");
- }
+ if (chmod(INFO_SOCKET, 0600) < 0) {
+ ErrPrint("info socket: %s\n", strerror(errno));
+ }
- if (chmod(INFO_SOCKET, 0600) < 0) {
- ErrPrint("info socket: %s\n", strerror(errno));
- }
+ if (chmod(SLAVE_SOCKET, 0666) < 0) {
+ ErrPrint("slave socket: %s\n", strerror(errno));
+ }
- if (chmod(SLAVE_SOCKET, 0666) < 0) {
- ErrPrint("slave socket: %s\n", strerror(errno));
- }
+ if (chmod(CLIENT_SOCKET, 0666) < 0) {
+ ErrPrint("client socket: %s\n", strerror(errno));
+ }
- if (chmod(CLIENT_SOCKET, 0666) < 0) {
- ErrPrint("client socket: %s\n", strerror(errno));
- }
+ if (chmod(SERVICE_SOCKET, 0666) < 0) {
+ ErrPrint("service socket: %s\n", strerror(errno));
+ }
- if (chmod(SERVICE_SOCKET, 0666) < 0) {
- ErrPrint("service socket: %s\n", strerror(errno));
+ return 0;
}
- return 0;
-}
+ 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;
+ }
-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;
- }
+ if (s_info.slave_fd > 0) {
+ com_core_packet_server_fini(s_info.slave_fd);
+ s_info.slave_fd = -1;
+ }
- if (s_info.slave_fd > 0) {
- 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;
+ }
- if (s_info.client_fd > 0) {
- 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;
+ }
- if (s_info.remote_client_fd > 0) {
- 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;
+ }
- if (s_info.service_fd > 0) {
- com_core_packet_server_fini(s_info.service_fd);
- s_info.service_fd = -1;
+ return 0;
}
- return 0;
-}
-
-/* End of a file */
+ /* End of a file */