extern int setting_init(void);
extern int setting_fini(void);
+enum oom_event_type {
+ OOM_TYPE_NORMAL = 0x00,
+ OOM_TYPE_LOW = 0x01,
+ OOM_ERROR = 0xFF
+};
+
+extern int setting_add_oom_event_callback(int (*handler)(enum oom_event_type type, void *data), void *data);
+extern int setting_del_oom_event_callback(int (*handler)(enum oom_event_type type, void *data), void *data);
+extern enum oom_event_type setting_oom_level(void);
+
/* End of a file */
DbgPrint("Command: [%s], Packet type[%d]\n", command, packet_type(packet));
switch (packet_type(packet)) {
- case PACKET_REQ:
- /* Need to send reply packet */
- for (i = 0; service_req_table[i].cmd; i++) {
- if (strcmp(service_req_table[i].cmd, command)) {
- continue;
- }
+ case PACKET_REQ:
+ /* Need to send reply packet */
+ for (i = 0; service_req_table[i].cmd; i++) {
+ if (strcmp(service_req_table[i].cmd, command)) {
+ continue;
+ }
#if ENABLE_BS_ACCESS_CONTROL
- if (_is_valid_permission(tcb_fd(tcb), &(service_req_table[i])) == 1) {
- service_req_table[i].handler(tcb, packet, data);
- } else {
- _handler_access_control_error(tcb, packet);
- }
-#else
- _is_valid_permission(tcb_fd(tcb), &(service_req_table[i]));
+ if (_is_valid_permission(tcb_fd(tcb), &(service_req_table[i])) == 1) {
service_req_table[i].handler(tcb, packet, data);
-#endif
- break;
+ } else {
+ _handler_access_control_error(tcb, packet);
}
-
- break;
- case PACKET_REQ_NOACK:
- break;
- case PACKET_ACK:
+#else
+ _is_valid_permission(tcb_fd(tcb), &(service_req_table[i]));
+ service_req_table[i].handler(tcb, packet, data);
+#endif
break;
- default:
- ErrPrint("Packet type is not valid[%s]\n", command);
- return -EINVAL;
+ }
+
+ break;
+ case PACKET_REQ_NOACK:
+ break;
+ case PACKET_ACK:
+ break;
+ default:
+ ErrPrint("Packet type is not valid[%s]\n", command);
+ return -EINVAL;
}
/*!
}
switch (info->type) {
- case DBOX_FB_TYPE_FILE:
- ret = load_file_buffer(info);
+ case DBOX_FB_TYPE_FILE:
+ ret = load_file_buffer(info);
- if (script_handler_buffer_info(instance_gbar_script(info->inst)) != info && instance_gbar_buffer(info->inst) != info) {
- type = DBOX_TYPE_DBOX;
- }
- info->lock_info = dynamicbox_service_create_lock(instance_id(info->inst), type, DBOX_LOCK_WRITE);
- break;
- case DBOX_FB_TYPE_SHM:
- ret = load_shm_buffer(info);
+ if (script_handler_buffer_info(instance_gbar_script(info->inst)) != info && instance_gbar_buffer(info->inst) != info) {
+ type = DBOX_TYPE_DBOX;
+ }
+ info->lock_info = dynamicbox_service_create_lock(instance_id(info->inst), type, DBOX_LOCK_WRITE);
+ break;
+ case DBOX_FB_TYPE_SHM:
+ ret = load_shm_buffer(info);
- if (script_handler_buffer_info(instance_gbar_script(info->inst)) != info && instance_gbar_buffer(info->inst) != info) {
- type = DBOX_TYPE_DBOX;
- }
- info->lock_info = dynamicbox_service_create_lock(instance_id(info->inst), type, DBOX_LOCK_WRITE);
- break;
- case DBOX_FB_TYPE_PIXMAP:
- ret = load_pixmap_buffer(info);
- break;
- default:
- ErrPrint("Invalid buffer\n");
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- break;
+ if (script_handler_buffer_info(instance_gbar_script(info->inst)) != info && instance_gbar_buffer(info->inst) != info) {
+ type = DBOX_TYPE_DBOX;
+ }
+ info->lock_info = dynamicbox_service_create_lock(instance_id(info->inst), type, DBOX_LOCK_WRITE);
+ break;
+ case DBOX_FB_TYPE_PIXMAP:
+ ret = load_pixmap_buffer(info);
+ break;
+ default:
+ ErrPrint("Invalid buffer\n");
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ break;
}
return ret;
}
switch (info->type) {
- case DBOX_FB_TYPE_FILE:
- dynamicbox_service_destroy_lock(info->lock_info);
- info->lock_info = NULL;
- ret = unload_file_buffer(info);
- break;
- case DBOX_FB_TYPE_SHM:
- dynamicbox_service_destroy_lock(info->lock_info);
- info->lock_info = NULL;
- ret = unload_shm_buffer(info);
- break;
- case DBOX_FB_TYPE_PIXMAP:
- ret = unload_pixmap_buffer(info);
- break;
- default:
- ErrPrint("Invalid buffer\n");
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- break;
+ case DBOX_FB_TYPE_FILE:
+ dynamicbox_service_destroy_lock(info->lock_info);
+ info->lock_info = NULL;
+ ret = unload_file_buffer(info);
+ break;
+ case DBOX_FB_TYPE_SHM:
+ dynamicbox_service_destroy_lock(info->lock_info);
+ info->lock_info = NULL;
+ ret = unload_shm_buffer(info);
+ break;
+ case DBOX_FB_TYPE_PIXMAP:
+ ret = unload_pixmap_buffer(info);
+ break;
+ default:
+ ErrPrint("Invalid buffer\n");
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ break;
}
if (ret == 0) {
dynamicbox_fb_t handle;
switch (dynamicbox_fb_type) {
- case DBOX_FB_TYPE_SHM:
- handle = raw_open_shm((int)resource);
- break;
- case DBOX_FB_TYPE_FILE:
- handle = raw_open_file(resource);
- break;
- case DBOX_FB_TYPE_PIXMAP:
- handle = raw_open_pixmap((unsigned int)resource);
- break;
- default:
- handle = NULL;
- break;
+ case DBOX_FB_TYPE_SHM:
+ handle = raw_open_shm((int)resource);
+ break;
+ case DBOX_FB_TYPE_FILE:
+ handle = raw_open_file(resource);
+ break;
+ case DBOX_FB_TYPE_PIXMAP:
+ handle = raw_open_pixmap((unsigned int)resource);
+ break;
+ default:
+ handle = NULL;
+ break;
}
return handle;
}
switch (buffer->type) {
- case DBOX_FB_TYPE_SHM:
- ret = raw_close_shm(buffer);
- break;
- case DBOX_FB_TYPE_FILE:
- ret = raw_close_file(buffer);
- break;
- case DBOX_FB_TYPE_PIXMAP:
- ret = raw_close_pixmap(buffer);
- break;
- default:
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- break;
+ case DBOX_FB_TYPE_SHM:
+ ret = raw_close_shm(buffer);
+ break;
+ case DBOX_FB_TYPE_FILE:
+ ret = raw_close_file(buffer);
+ break;
+ case DBOX_FB_TYPE_PIXMAP:
+ ret = raw_close_pixmap(buffer);
+ break;
+ default:
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ break;
}
return ret;
}
switch (info->type) {
- case DBOX_FB_TYPE_FILE:
- case DBOX_FB_TYPE_SHM:
- stride = info->w * info->pixel_size;
+ case DBOX_FB_TYPE_FILE:
+ case DBOX_FB_TYPE_SHM:
+ stride = info->w * info->pixel_size;
+ break;
+ case DBOX_FB_TYPE_PIXMAP:
+ buffer = info->buffer;
+ if (!buffer) {
+ stride = DBOX_STATUS_ERROR_INVALID_PARAMETER;
break;
- case DBOX_FB_TYPE_PIXMAP:
- buffer = info->buffer;
- if (!buffer) {
- stride = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- break;
- }
-
- gem = (struct gem_data *)buffer->data;
- if (!gem) {
- stride = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- break;
- }
-
- if (!gem->dri2_buffer) {
- /*
- * Uhm...
- */
- ErrPrint("dri2_buffer info is not ready yet!\n");
- stride = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- break;
- }
+ }
- stride = gem->dri2_buffer->pitch;
+ gem = (struct gem_data *)buffer->data;
+ if (!gem) {
+ stride = DBOX_STATUS_ERROR_INVALID_PARAMETER;
break;
- default:
+ }
+
+ if (!gem->dri2_buffer) {
+ /*
+ * Uhm...
+ */
+ ErrPrint("dri2_buffer info is not ready yet!\n");
stride = DBOX_STATUS_ERROR_INVALID_PARAMETER;
break;
+ }
+
+ stride = gem->dri2_buffer->pitch;
+ break;
+ default:
+ stride = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ break;
}
return stride;
}
switch (type) {
- case DBOX_FB_TYPE_SHM:
- if (pixel_size != DYNAMICBOX_CONF_DEFAULT_PIXELS) {
- DbgPrint("SHM only supportes %d bytes pixels (requested: %d)\n", DYNAMICBOX_CONF_DEFAULT_PIXELS, pixel_size);
- pixel_size = DYNAMICBOX_CONF_DEFAULT_PIXELS;
- }
+ case DBOX_FB_TYPE_SHM:
+ if (pixel_size != DYNAMICBOX_CONF_DEFAULT_PIXELS) {
+ DbgPrint("SHM only supportes %d bytes pixels (requested: %d)\n", DYNAMICBOX_CONF_DEFAULT_PIXELS, pixel_size);
+ pixel_size = DYNAMICBOX_CONF_DEFAULT_PIXELS;
+ }
- info->id = strdup(SCHEMA_SHM "-1");
- if (!info->id) {
- ErrPrint("Heap: %s\n", strerror(errno));
- DbgFree(info);
- return NULL;
- }
- break;
- case DBOX_FB_TYPE_FILE:
- if (pixel_size != DYNAMICBOX_CONF_DEFAULT_PIXELS) {
- DbgPrint("FILE only supportes %d bytes pixels (requested: %d)\n", DYNAMICBOX_CONF_DEFAULT_PIXELS, pixel_size);
- pixel_size = DYNAMICBOX_CONF_DEFAULT_PIXELS;
- }
+ info->id = strdup(SCHEMA_SHM "-1");
+ if (!info->id) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ DbgFree(info);
+ return NULL;
+ }
+ break;
+ case DBOX_FB_TYPE_FILE:
+ if (pixel_size != DYNAMICBOX_CONF_DEFAULT_PIXELS) {
+ DbgPrint("FILE only supportes %d bytes pixels (requested: %d)\n", DYNAMICBOX_CONF_DEFAULT_PIXELS, pixel_size);
+ pixel_size = DYNAMICBOX_CONF_DEFAULT_PIXELS;
+ }
- info->id = strdup(SCHEMA_FILE "/tmp/.live.undefined");
- if (!info->id) {
- ErrPrint("Heap: %s\n", strerror(errno));
- DbgFree(info);
- return NULL;
- }
- break;
- case DBOX_FB_TYPE_PIXMAP:
- info->id = strdup(SCHEMA_PIXMAP "0:0");
- if (!info->id) {
- ErrPrint("Heap: %s\n", strerror(errno));
- DbgFree(info);
- return NULL;
- }
- break;
- default:
- ErrPrint("Invalid type\n");
+ info->id = strdup(SCHEMA_FILE "/tmp/.live.undefined");
+ if (!info->id) {
+ ErrPrint("Heap: %s\n", strerror(errno));
DbgFree(info);
return NULL;
+ }
+ break;
+ case DBOX_FB_TYPE_PIXMAP:
+ info->id = strdup(SCHEMA_PIXMAP "0:0");
+ if (!info->id) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ DbgFree(info);
+ return NULL;
+ }
+ break;
+ default:
+ ErrPrint("Invalid type\n");
+ DbgFree(info);
+ return NULL;
}
info->lock_info = NULL;
}
switch (info->type) {
- case BUFFER_TYPE_FILE:
- ret = load_file_buffer(info);
- (void)create_lock_file(info);
- break;
- case BUFFER_TYPE_SHM:
- ret = load_shm_buffer(info);
- (void)create_lock_file(info);
- break;
- case BUFFER_TYPE_PIXMAP:
- default:
- ErrPrint("Invalid buffer\n");
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- break;
+ case BUFFER_TYPE_FILE:
+ ret = load_file_buffer(info);
+ (void)create_lock_file(info);
+ break;
+ case BUFFER_TYPE_SHM:
+ ret = load_shm_buffer(info);
+ (void)create_lock_file(info);
+ break;
+ case BUFFER_TYPE_PIXMAP:
+ default:
+ ErrPrint("Invalid buffer\n");
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ break;
}
return ret;
}
switch (info->type) {
- case BUFFER_TYPE_FILE:
- (void)destroy_lock_file(info);
- ret = unload_file_buffer(info);
- break;
- case BUFFER_TYPE_SHM:
- (void)destroy_lock_file(info);
- ret = unload_shm_buffer(info);
- break;
- case BUFFER_TYPE_PIXMAP:
- default:
- ErrPrint("Invalid buffer\n");
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- break;
+ case BUFFER_TYPE_FILE:
+ (void)destroy_lock_file(info);
+ ret = unload_file_buffer(info);
+ break;
+ case BUFFER_TYPE_SHM:
+ (void)destroy_lock_file(info);
+ ret = unload_shm_buffer(info);
+ break;
+ case BUFFER_TYPE_PIXMAP:
+ default:
+ ErrPrint("Invalid buffer\n");
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ break;
}
if (ret == 0) {
struct buffer *handle;
switch (buffer_type) {
- case BUFFER_TYPE_SHM:
- handle = raw_open_shm((int)resource);
- break;
- case BUFFER_TYPE_FILE:
- handle = raw_open_file(resource);
- break;
- case BUFFER_TYPE_PIXMAP:
- default:
- handle = NULL;
- break;
+ case BUFFER_TYPE_SHM:
+ handle = raw_open_shm((int)resource);
+ break;
+ case BUFFER_TYPE_FILE:
+ handle = raw_open_file(resource);
+ break;
+ case BUFFER_TYPE_PIXMAP:
+ default:
+ handle = NULL;
+ break;
}
return handle;
int ret;
switch (buffer->type) {
- case BUFFER_TYPE_SHM:
- ret = raw_close_shm(buffer);
- break;
- case BUFFER_TYPE_FILE:
- ret = raw_close_file(buffer);
- break;
- case BUFFER_TYPE_PIXMAP:
- default:
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- break;
+ case BUFFER_TYPE_SHM:
+ ret = raw_close_shm(buffer);
+ break;
+ case BUFFER_TYPE_FILE:
+ ret = raw_close_file(buffer);
+ break;
+ case BUFFER_TYPE_PIXMAP:
+ default:
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ break;
}
return ret;
}
switch (type) {
- case BUFFER_TYPE_SHM:
- if (pixel_size != DEFAULT_PIXELS) {
- DbgPrint("SHM only supportes %d bytes pixels (requested: %d)\n", DEFAULT_PIXELS, pixel_size);
- pixel_size = DEFAULT_PIXELS;
- }
-
- info->id = strdup(SCHEMA_SHM "-1");
- if (!info->id) {
- ErrPrint("Heap: %s\n", strerror(errno));
- DbgFree(info);
- return NULL;
- }
- break;
- case BUFFER_TYPE_FILE:
- if (pixel_size != DEFAULT_PIXELS) {
- DbgPrint("FILE only supportes %d bytes pixels (requested: %d)\n", DEFAULT_PIXELS, pixel_size);
- pixel_size = DEFAULT_PIXELS;
- }
-
- info->id = strdup(SCHEMA_FILE "/tmp/.live.undefined");
- if (!info->id) {
- ErrPrint("Heap: %s\n", strerror(errno));
- DbgFree(info);
- return NULL;
- }
- break;
- case BUFFER_TYPE_PIXMAP:
- default:
- ErrPrint("Invalid type\n");
+ case BUFFER_TYPE_SHM:
+ if (pixel_size != DEFAULT_PIXELS) {
+ DbgPrint("SHM only supportes %d bytes pixels (requested: %d)\n", DEFAULT_PIXELS, pixel_size);
+ pixel_size = DEFAULT_PIXELS;
+ }
+
+ info->id = strdup(SCHEMA_SHM "-1");
+ if (!info->id) {
+ ErrPrint("Heap: %s\n", strerror(errno));
DbgFree(info);
return NULL;
+ }
+ break;
+ case BUFFER_TYPE_FILE:
+ if (pixel_size != DEFAULT_PIXELS) {
+ DbgPrint("FILE only supportes %d bytes pixels (requested: %d)\n", DEFAULT_PIXELS, pixel_size);
+ pixel_size = DEFAULT_PIXELS;
+ }
+
+ info->id = strdup(SCHEMA_FILE "/tmp/.live.undefined");
+ if (!info->id) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ DbgFree(info);
+ return NULL;
+ }
+ break;
+ case BUFFER_TYPE_PIXMAP:
+ default:
+ ErrPrint("Invalid type\n");
+ DbgFree(info);
+ return NULL;
}
info->lock = NULL;
*/
switch (event) {
- case CLIENT_EVENT_DEACTIVATE:
- client->event_deactivate_list = eina_list_prepend(client->event_deactivate_list, item);
- break;
- case CLIENT_EVENT_ACTIVATE:
- client->event_activate_list = eina_list_prepend(client->event_activate_list, item);
- break;
- default:
- DbgFree(item);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ case CLIENT_EVENT_DEACTIVATE:
+ client->event_deactivate_list = eina_list_prepend(client->event_deactivate_list, item);
+ break;
+ case CLIENT_EVENT_ACTIVATE:
+ client->event_activate_list = eina_list_prepend(client->event_activate_list, item);
+ break;
+ default:
+ DbgFree(item);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return DBOX_STATUS_ERROR_NONE;
}
switch (event) {
- case CLIENT_EVENT_DEACTIVATE:
- EINA_LIST_FOREACH_SAFE(client->event_deactivate_list, l, n, item) {
- if (item->cb == cb && item->data == data) {
- if (client->in_event_process & CLIENT_EVENT_PROCESS_DEACTIVATE) {
- item->deleted = 1;
- } else {
- client->event_deactivate_list = eina_list_remove(client->event_deactivate_list, item);
- DbgFree(item);
- }
- return DBOX_STATUS_ERROR_NONE;
+ case CLIENT_EVENT_DEACTIVATE:
+ EINA_LIST_FOREACH_SAFE(client->event_deactivate_list, l, n, item) {
+ if (item->cb == cb && item->data == data) {
+ if (client->in_event_process & CLIENT_EVENT_PROCESS_DEACTIVATE) {
+ item->deleted = 1;
+ } else {
+ client->event_deactivate_list = eina_list_remove(client->event_deactivate_list, item);
+ DbgFree(item);
}
+ return DBOX_STATUS_ERROR_NONE;
}
- break;
-
- case CLIENT_EVENT_ACTIVATE:
- EINA_LIST_FOREACH_SAFE(client->event_activate_list, l, n, item) {
- if (item->cb == cb && item->data == data) {
- if (client->in_event_process & CLIENT_EVENT_PROCESS_ACTIVATE) {
- item->deleted = 1;
- } else {
- client->event_activate_list = eina_list_remove(client->event_activate_list, item);
- DbgFree(item);
- }
- return DBOX_STATUS_ERROR_NONE;
+ }
+ break;
+
+ case CLIENT_EVENT_ACTIVATE:
+ EINA_LIST_FOREACH_SAFE(client->event_activate_list, l, n, item) {
+ if (item->cb == cb && item->data == data) {
+ if (client->in_event_process & CLIENT_EVENT_PROCESS_ACTIVATE) {
+ item->deleted = 1;
+ } else {
+ client->event_activate_list = eina_list_remove(client->event_activate_list, item);
+ DbgFree(item);
}
+ return DBOX_STATUS_ERROR_NONE;
}
- break;
+ }
+ break;
- default:
- ErrPrint("Invalid event\n");
- break;
+ default:
+ ErrPrint("Invalid event\n");
+ break;
}
return DBOX_STATUS_ERROR_NOT_EXIST;
handler->deleted = 0;
switch (event_type) {
- case CLIENT_GLOBAL_EVENT_CREATE:
- s_info.create_event_list = eina_list_prepend(s_info.create_event_list, handler);
- break;
- case CLIENT_GLOBAL_EVENT_DESTROY:
- s_info.destroy_event_list = eina_list_prepend(s_info.destroy_event_list, handler);
- break;
- default:
- DbgFree(handler);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ case CLIENT_GLOBAL_EVENT_CREATE:
+ s_info.create_event_list = eina_list_prepend(s_info.create_event_list, handler);
+ break;
+ case CLIENT_GLOBAL_EVENT_DESTROY:
+ s_info.destroy_event_list = eina_list_prepend(s_info.destroy_event_list, handler);
+ break;
+ default:
+ DbgFree(handler);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return DBOX_STATUS_ERROR_NONE;
struct global_event_item *item;
switch (event_type) {
- case CLIENT_GLOBAL_EVENT_CREATE:
- EINA_LIST_FOREACH_SAFE(s_info.create_event_list, l, n, item) {
- if (item->cb == cb && item->cbdata == data) {
- if (s_info.in_event_process & GLOBAL_EVENT_PROCESS_CREATE) {
- item->deleted = 1;
- } else {
- s_info.create_event_list = eina_list_remove(s_info.create_event_list, item);
- DbgFree(item);
- }
- return DBOX_STATUS_ERROR_NONE;
+ case CLIENT_GLOBAL_EVENT_CREATE:
+ EINA_LIST_FOREACH_SAFE(s_info.create_event_list, l, n, item) {
+ if (item->cb == cb && item->cbdata == data) {
+ if (s_info.in_event_process & GLOBAL_EVENT_PROCESS_CREATE) {
+ item->deleted = 1;
+ } else {
+ s_info.create_event_list = eina_list_remove(s_info.create_event_list, item);
+ DbgFree(item);
}
+ return DBOX_STATUS_ERROR_NONE;
}
- break;
- case CLIENT_GLOBAL_EVENT_DESTROY:
- EINA_LIST_FOREACH_SAFE(s_info.destroy_event_list, l, n, item) {
- if (item->cb == cb && item->cbdata == data) {
- if (s_info.in_event_process & GLOBAL_EVENT_PROCESS_DESTROY) {
- item->deleted = 1;
- } else {
- s_info.destroy_event_list = eina_list_remove(s_info.destroy_event_list, item);
- DbgFree(item);
- }
- return DBOX_STATUS_ERROR_NONE;
+ }
+ break;
+ case CLIENT_GLOBAL_EVENT_DESTROY:
+ EINA_LIST_FOREACH_SAFE(s_info.destroy_event_list, l, n, item) {
+ if (item->cb == cb && item->cbdata == data) {
+ if (s_info.in_event_process & GLOBAL_EVENT_PROCESS_DESTROY) {
+ item->deleted = 1;
+ } else {
+ s_info.destroy_event_list = eina_list_remove(s_info.destroy_event_list, item);
+ DbgFree(item);
}
+ return DBOX_STATUS_ERROR_NONE;
}
- break;
- default:
- break;
+ }
+ break;
+ default:
+ break;
}
return DBOX_STATUS_ERROR_NOT_EXIST;
if (slave) {
if (slave_pid(slave) != (pid_t)-1) {
switch (slave_state(slave)) {
- case SLAVE_REQUEST_TO_DISCONNECT:
- DbgPrint("Disconnected from %d\n", slave_pid(slave));
- case SLAVE_REQUEST_TO_TERMINATE:
- slave = slave_deactivated(slave);
- break;
- default:
- slave = slave_deactivated_by_fault(slave);
- break;
+ case SLAVE_REQUEST_TO_DISCONNECT:
+ DbgPrint("Disconnected from %d\n", slave_pid(slave));
+ case SLAVE_REQUEST_TO_TERMINATE:
+ slave = slave_deactivated(slave);
+ break;
+ default:
+ slave = slave_deactivated_by_fault(slave);
+ break;
}
}
}
switch (type) {
- case REQUEST_TYPE_FILE:
- item->data.filename = strdup(data);
- if (!item->data.filename) {
- ErrPrint("Heap: %s\n", strerror(errno));
- DbgFree(item);
- return NULL;
- }
- break;
- case REQUEST_TYPE_PIXMAP:
- item->data.pixmap = (unsigned int)data;
- break;
- case REQUEST_TYPE_SHM:
- item->data.shm = (int)data;
- break;
- default:
- ErrPrint("Invalid type of request\n");
+ case REQUEST_TYPE_FILE:
+ item->data.filename = strdup(data);
+ if (!item->data.filename) {
+ ErrPrint("Heap: %s\n", strerror(errno));
DbgFree(item);
return NULL;
+ }
+ break;
+ case REQUEST_TYPE_PIXMAP:
+ item->data.pixmap = (unsigned int)data;
+ break;
+ case REQUEST_TYPE_SHM:
+ item->data.shm = (int)data;
+ break;
+ default:
+ ErrPrint("Invalid type of request\n");
+ DbgFree(item);
+ return NULL;
}
item->type = type;
static inline int destroy_request_item(struct request_item *item)
{
switch (item->type) {
- case REQUEST_TYPE_FILE:
- DbgFree(item->data.filename);
- break;
- case REQUEST_TYPE_SHM:
- case REQUEST_TYPE_PIXMAP:
- break;
- default:
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ case REQUEST_TYPE_FILE:
+ DbgFree(item->data.filename);
+ break;
+ case REQUEST_TYPE_SHM:
+ case REQUEST_TYPE_PIXMAP:
+ break;
+ default:
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
DbgFree(item);
}
switch (packet_type(packet)) {
- case PACKET_REQ:
- for (i = 0; cmd_table[i].cmd; i++) {
- /*!
- * Protocol sequence
- * FILE REQUEST COMMAND (Client -> Server)
- * REPLY FOR REQUEST (Client <- Server)
- * PUSH FILE (Client <- Server)
- *
- * Client & Server must has to keep this communication sequence.
- */
- if (strcmp(cmd, cmd_table[i].cmd)) {
- continue;
- }
+ case PACKET_REQ:
+ for (i = 0; cmd_table[i].cmd; i++) {
+ /*!
+ * Protocol sequence
+ * FILE REQUEST COMMAND (Client -> Server)
+ * REPLY FOR REQUEST (Client <- Server)
+ * PUSH FILE (Client <- Server)
+ *
+ * Client & Server must has to keep this communication sequence.
+ */
+ if (strcmp(cmd, cmd_table[i].cmd)) {
+ continue;
+ }
- item = NULL;
- ret = cmd_table[i].request_handler(tcb, packet, &item);
+ item = NULL;
+ ret = cmd_table[i].request_handler(tcb, packet, &item);
- reply = packet_create_reply(packet, "i", ret);
- if (!reply) {
- ErrPrint("Failed to create a reply packet\n");
- break;
- }
+ reply = packet_create_reply(packet, "i", ret);
+ if (!reply) {
+ ErrPrint("Failed to create a reply packet\n");
+ break;
+ }
- if (service_common_unicast_packet(tcb, reply) < 0) {
- ErrPrint("Unable to send reply packet\n");
- }
+ if (service_common_unicast_packet(tcb, reply) < 0) {
+ ErrPrint("Unable to send reply packet\n");
+ }
- packet_destroy(reply);
+ packet_destroy(reply);
- /*!
- * \note
- * After send the reply packet, file push thread can sending a file
- */
- if (ret != DBOX_STATUS_ERROR_NONE || !item) {
- break;
- }
+ /*!
+ * \note
+ * After send the reply packet, file push thread can sending a file
+ */
+ if (ret != DBOX_STATUS_ERROR_NONE || !item) {
+ break;
+ }
+
+ CRITICAL_SECTION_BEGIN(&s_info.request_list_lock);
+ s_info.request_list = eina_list_append(s_info.request_list, item);
+ CRITICAL_SECTION_END(&s_info.request_list_lock);
+
+ ret = write(s_info.request_pipe[PIPE_WRITE], &ch, sizeof(ch));
+ if (ret < 0) {
+ ErrPrint("write: %s\n", strerror(errno));
CRITICAL_SECTION_BEGIN(&s_info.request_list_lock);
- s_info.request_list = eina_list_append(s_info.request_list, item);
+ s_info.request_list = eina_list_remove(s_info.request_list, item);
CRITICAL_SECTION_END(&s_info.request_list_lock);
- ret = write(s_info.request_pipe[PIPE_WRITE], &ch, sizeof(ch));
- if (ret < 0) {
- ErrPrint("write: %s\n", strerror(errno));
-
- CRITICAL_SECTION_BEGIN(&s_info.request_list_lock);
- s_info.request_list = eina_list_remove(s_info.request_list, item);
- CRITICAL_SECTION_END(&s_info.request_list_lock);
-
- destroy_request_item(item);
- /*!
- * \note for the client
- * In this case, the client can waiting files forever.
- * So the client must has to wait only a few seconds.
- * If the client could not get the any data in that time,
- * it should cancel the waiting.
- */
- }
+ destroy_request_item(item);
+ /*!
+ * \note for the client
+ * In this case, the client can waiting files forever.
+ * So the client must has to wait only a few seconds.
+ * If the client could not get the any data in that time,
+ * it should cancel the waiting.
+ */
}
+ }
- break;
- case PACKET_REQ_NOACK:
- case PACKET_ACK:
- /* File service has no this case, it is passive service type */
- ErrPrint("Invalid packet.\n");
- break;
- default:
- break;
+ break;
+ case PACKET_REQ_NOACK:
+ case PACKET_ACK:
+ /* File service has no this case, it is passive service type */
+ ErrPrint("Invalid packet.\n");
+ break;
+ default:
+ break;
}
return DBOX_STATUS_ERROR_NONE;
/* cluster{category} */
switch (state) {
- case CLUSTER:
- cluster = group_find_cluster(name);
- if (!cluster) {
- cluster = group_create_cluster(name);
- }
-
- if (!cluster) {
- ErrPrint("Failed to get cluster\n");
- DbgFree(name);
- return DBOX_STATUS_ERROR_FAULT;
- }
+ case CLUSTER:
+ cluster = group_find_cluster(name);
+ if (!cluster) {
+ cluster = group_create_cluster(name);
+ }
- state = CATEGORY;
- break;
+ if (!cluster) {
+ ErrPrint("Failed to get cluster\n");
+ DbgFree(name);
+ return DBOX_STATUS_ERROR_FAULT;
+ }
- case CATEGORY:
- category = group_find_category(cluster, name);
- if (!category) {
- category = group_create_category(cluster, name);
- }
+ state = CATEGORY;
+ break;
- if (!category) {
- ErrPrint("Failed to get category\n");
- DbgFree(name);
- return DBOX_STATUS_ERROR_FAULT;
- }
-
- info = group_create_context_info(category, pkgname);
- if (!info) {
- ErrPrint("Failed to create ctx info\n");
- DbgFree(name);
- return DBOX_STATUS_ERROR_FAULT;
- }
+ case CATEGORY:
+ category = group_find_category(cluster, name);
+ if (!category) {
+ category = group_create_category(cluster, name);
+ }
- state = CONTEXT_ITEM;
- break;
+ if (!category) {
+ ErrPrint("Failed to get category\n");
+ DbgFree(name);
+ return DBOX_STATUS_ERROR_FAULT;
+ }
- case CONTEXT_ITEM:
- item = group_add_context_item(info, name);
- if (!item) {
- ErrPrint("Failed to create a context item\n");
- DbgFree(name);
- return DBOX_STATUS_ERROR_FAULT;
- }
+ info = group_create_context_info(category, pkgname);
+ if (!info) {
+ ErrPrint("Failed to create ctx info\n");
+ DbgFree(name);
+ return DBOX_STATUS_ERROR_FAULT;
+ }
- state = CONTEXT_OPTION_KEY;
- break;
+ state = CONTEXT_ITEM;
+ break;
- case CONTEXT_OPTION_KEY:
- case CONTEXT_OPTION_VALUE:
- default:
- ErrPrint("Invalid state\n");
+ case CONTEXT_ITEM:
+ item = group_add_context_item(info, name);
+ if (!item) {
+ ErrPrint("Failed to create a context item\n");
DbgFree(name);
return DBOX_STATUS_ERROR_FAULT;
+ }
+
+ state = CONTEXT_OPTION_KEY;
+ break;
+
+ case CONTEXT_OPTION_KEY:
+ case CONTEXT_OPTION_VALUE:
+ default:
+ ErrPrint("Invalid state\n");
+ DbgFree(name);
+ return DBOX_STATUS_ERROR_FAULT;
}
DbgFree(name);
}
switch (state) {
- case CLUSTER:
- if (is_open != 0) {
- ErrPrint("Invalid state\n");
- DbgFree(name);
- return DBOX_STATUS_ERROR_FAULT;
- }
- cluster = group_find_cluster(name);
- if (!cluster) {
- cluster = group_create_cluster(name);
- }
+ case CLUSTER:
+ if (is_open != 0) {
+ ErrPrint("Invalid state\n");
+ DbgFree(name);
+ return DBOX_STATUS_ERROR_FAULT;
+ }
+ cluster = group_find_cluster(name);
+ if (!cluster) {
+ cluster = group_create_cluster(name);
+ }
- if (!cluster) {
- ErrPrint("Failed to get cluster\n");
- DbgFree(name);
- return DBOX_STATUS_ERROR_FAULT;
- }
+ if (!cluster) {
+ ErrPrint("Failed to get cluster\n");
+ DbgFree(name);
+ return DBOX_STATUS_ERROR_FAULT;
+ }
- state = CATEGORY;
- break;
+ state = CATEGORY;
+ break;
- case CATEGORY:
- if (is_open != 1) {
- ErrPrint("Invalid state\n");
- DbgFree(name);
- return DBOX_STATUS_ERROR_FAULT;
- }
+ case CATEGORY:
+ if (is_open != 1) {
+ ErrPrint("Invalid state\n");
+ DbgFree(name);
+ return DBOX_STATUS_ERROR_FAULT;
+ }
+ category = group_find_category(cluster, name);
+ if (!category) {
+ category = group_create_category(cluster, name);
+ }
+
+ if (!category) {
+ ErrPrint("Failed to get category\n");
+ DbgFree(name);
+ return DBOX_STATUS_ERROR_FAULT;
+ }
+
+ info = group_create_context_info(category, pkgname);
+ if (!info) {
+ ErrPrint("Failed to create ctx info\n");
+ DbgFree(name);
+ return DBOX_STATUS_ERROR_FAULT;
+ }
+
+ state = CONTEXT_ITEM;
+ break;
+ case CONTEXT_ITEM:
+ if (is_open == 1) {
category = group_find_category(cluster, name);
if (!category) {
category = group_create_category(cluster, name);
DbgFree(name);
return DBOX_STATUS_ERROR_FAULT;
}
-
- state = CONTEXT_ITEM;
- break;
- case CONTEXT_ITEM:
- if (is_open == 1) {
- category = group_find_category(cluster, name);
- if (!category) {
- category = group_create_category(cluster, name);
- }
-
- if (!category) {
- ErrPrint("Failed to get category\n");
- DbgFree(name);
- return DBOX_STATUS_ERROR_FAULT;
- }
-
- info = group_create_context_info(category, pkgname);
- if (!info) {
- ErrPrint("Failed to create ctx info\n");
- DbgFree(name);
- return DBOX_STATUS_ERROR_FAULT;
- }
- } else if (is_open == 2) {
- item = group_add_context_item(info, name);
- if (!item) {
- ErrPrint("Failed to create a context item\n");
- DbgFree(name);
- return DBOX_STATUS_ERROR_FAULT;
- }
- state = CONTEXT_OPTION_KEY;
- } else {
- ErrPrint("Invalid state\n");
+ } else if (is_open == 2) {
+ item = group_add_context_item(info, name);
+ if (!item) {
+ ErrPrint("Failed to create a context item\n");
DbgFree(name);
return DBOX_STATUS_ERROR_FAULT;
}
+ state = CONTEXT_OPTION_KEY;
+ } else {
+ ErrPrint("Invalid state\n");
+ DbgFree(name);
+ return DBOX_STATUS_ERROR_FAULT;
+ }
- break;
- case CONTEXT_OPTION_VALUE:
- if (is_open != 3) {
- ErrPrint("Invalid state\n");
- DbgFree(name);
- return DBOX_STATUS_ERROR_FAULT;
- }
+ break;
+ case CONTEXT_OPTION_VALUE:
+ if (is_open != 3) {
+ ErrPrint("Invalid state\n");
+ DbgFree(name);
+ return DBOX_STATUS_ERROR_FAULT;
+ }
- if (group_add_option(item, key, name) < 0) {
- ErrPrint("Failed to add a new option: %s - %s\n", key, name);
- }
+ if (group_add_option(item, key, name) < 0) {
+ ErrPrint("Failed to add a new option: %s - %s\n", key, name);
+ }
- DbgFree(key);
- key = NULL;
+ DbgFree(key);
+ key = NULL;
- state = CONTEXT_OPTION_KEY;
- break;
- case CONTEXT_OPTION_KEY:
- default:
- ErrPrint("Invalid state (%s)\n", name);
- DbgFree(name);
- return DBOX_STATUS_ERROR_FAULT;
+ state = CONTEXT_OPTION_KEY;
+ break;
+ case CONTEXT_OPTION_KEY:
+ default:
+ ErrPrint("Invalid state (%s)\n", name);
+ DbgFree(name);
+ return DBOX_STATUS_ERROR_FAULT;
}
DbgFree(name);
}
switch (state) {
- case CATEGORY:
+ case CATEGORY:
+ category = group_find_category(cluster, name);
+ if (!category) {
+ category = group_create_category(cluster, name);
+ }
+
+ if (!category) {
+ ErrPrint("Failed to get category\n");
+ DbgFree(name);
+ return DBOX_STATUS_ERROR_FAULT;
+ }
+
+ info = group_create_context_info(category, pkgname);
+ if (!info) {
+ ErrPrint("Failed to create ctx info\n");
+ DbgFree(name);
+ return DBOX_STATUS_ERROR_FAULT;
+ }
+
+ state = CLUSTER;
+ break;
+ case CONTEXT_ITEM:
+ if (is_open == 1) {
category = group_find_category(cluster, name);
if (!category) {
category = group_create_category(cluster, name);
}
state = CLUSTER;
- break;
- case CONTEXT_ITEM:
- if (is_open == 1) {
- category = group_find_category(cluster, name);
- if (!category) {
- category = group_create_category(cluster, name);
- }
-
- if (!category) {
- ErrPrint("Failed to get category\n");
- DbgFree(name);
- return DBOX_STATUS_ERROR_FAULT;
- }
-
- info = group_create_context_info(category, pkgname);
- if (!info) {
- ErrPrint("Failed to create ctx info\n");
- DbgFree(name);
- return DBOX_STATUS_ERROR_FAULT;
- }
-
- state = CLUSTER;
- } else if (is_open == 2) {
- state = CATEGORY;
- } else {
- ErrPrint("Invalid state\n");
- DbgFree(name);
- return DBOX_STATUS_ERROR_FAULT;
- }
- break;
- case CONTEXT_OPTION_VALUE:
- if (is_open != 2) {
- ErrPrint("Invalid state (%s)\n", name);
- DbgFree(name);
- return DBOX_STATUS_ERROR_FAULT;
- }
+ } else if (is_open == 2) {
+ state = CATEGORY;
+ } else {
+ ErrPrint("Invalid state\n");
+ DbgFree(name);
+ return DBOX_STATUS_ERROR_FAULT;
+ }
+ break;
+ case CONTEXT_OPTION_VALUE:
+ if (is_open != 2) {
+ ErrPrint("Invalid state (%s)\n", name);
+ DbgFree(name);
+ return DBOX_STATUS_ERROR_FAULT;
+ }
- if (group_add_option(item, key, name) < 0) {
- ErrPrint("Failed to add a new option: %s - %s\n", key, name);
- }
+ if (group_add_option(item, key, name) < 0) {
+ ErrPrint("Failed to add a new option: %s - %s\n", key, name);
+ }
- DbgFree(key);
- key = NULL;
+ DbgFree(key);
+ key = NULL;
- state = CONTEXT_ITEM;
- break;
- case CONTEXT_OPTION_KEY:
- case CLUSTER:
- default:
- ErrPrint("Invalid state (%s)\n", name);
- break;
+ state = CONTEXT_ITEM;
+ break;
+ case CONTEXT_OPTION_KEY:
+ case CLUSTER:
+ default:
+ ErrPrint("Invalid state (%s)\n", name);
+ break;
}
DbgFree(name);
int ret;
switch (inst->visible) {
- case DBOX_SHOW:
- case DBOX_HIDE:
- instance_thaw_updator(inst);
-
- ret = 0;
- break;
- case DBOX_HIDE_WITH_PAUSE:
- ret = pause_dynamicbox(inst);
-
- instance_freeze_updator(inst);
- break;
- default:
- ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- break;
+ case DBOX_SHOW:
+ case DBOX_HIDE:
+ instance_thaw_updator(inst);
+
+ ret = 0;
+ break;
+ case DBOX_HIDE_WITH_PAUSE:
+ ret = pause_dynamicbox(inst);
+
+ instance_freeze_updator(inst);
+ break;
+ default:
+ ret = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ break;
}
DbgPrint("Visible state is recovered to %d\n", ret);
}
switch (type) {
- case INSTANCE_EVENT_DESTROY:
- EINA_LIST_FOREACH(inst->delete_event_list, l, item) {
- if (item->event_cb == event_cb && item->data == data) {
- return 1;
- }
+ case INSTANCE_EVENT_DESTROY:
+ EINA_LIST_FOREACH(inst->delete_event_list, l, item) {
+ if (item->event_cb == event_cb && item->data == data) {
+ return 1;
}
+ }
- break;
- default:
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ break;
+ default:
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return 0;
}
switch (type) {
- case INSTANCE_EVENT_DESTROY:
- item = malloc(sizeof(*item));
- if (!item) {
- ErrPrint("Heap: %s\n", strerror(errno));
- return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
- }
+ case INSTANCE_EVENT_DESTROY:
+ item = malloc(sizeof(*item));
+ if (!item) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ }
- item->event_cb = event_cb;
- item->data = data;
- item->deleted = 0;
+ item->event_cb = event_cb;
+ item->data = data;
+ item->deleted = 0;
- inst->delete_event_list = eina_list_append(inst->delete_event_list, item);
- break;
- default:
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ inst->delete_event_list = eina_list_append(inst->delete_event_list, item);
+ break;
+ default:
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return DBOX_STATUS_ERROR_NONE;
struct event_item *item;
switch (type) {
- case INSTANCE_EVENT_DESTROY:
- EINA_LIST_FOREACH_SAFE(inst->delete_event_list, l, n, item) {
- if (item->event_cb == event_cb && item->data == data) {
- if (inst->in_event_process & INST_EVENT_PROCESS_DELETE) {
- item->deleted = 1;
- } else {
- inst->delete_event_list = eina_list_remove(inst->delete_event_list, item);
- DbgFree(item);
- }
- return DBOX_STATUS_ERROR_NONE;
+ case INSTANCE_EVENT_DESTROY:
+ EINA_LIST_FOREACH_SAFE(inst->delete_event_list, l, n, item) {
+ if (item->event_cb == event_cb && item->data == data) {
+ if (inst->in_event_process & INST_EVENT_PROCESS_DELETE) {
+ item->deleted = 1;
+ } else {
+ inst->delete_event_list = eina_list_remove(inst->delete_event_list, item);
+ DbgFree(item);
}
+ return DBOX_STATUS_ERROR_NONE;
}
- break;
- default:
- break;
+ }
+ break;
+ default:
+ break;
}
return DBOX_STATUS_ERROR_NOT_EXIST;
inst->info = info;
- if (package_secured(info)) {
+ if (package_secured(info) || DYNAMICBOX_CONF_SLAVE_LIMIT_TO_TTL) {
if (inst->dbox.period > 0.0f) {
inst->update_timer = util_timer_add(inst->dbox.period, update_timer_cb, inst);
if (!inst->update_timer) {
}
switch (ret) {
- case 0:
- /*!
- * \note
- * Successfully unloaded
- */
- switch (inst->requested_state) {
- case INST_ACTIVATED:
- instance_state_reset(inst);
- instance_reactivate(inst);
- break;
- case INST_DESTROYED:
- if (inst->unicast_delete_event) {
- instance_unicast_deleted_event(inst, NULL, ret);
- } else {
- instance_broadcast_deleted_event(inst, ret);
- }
- instance_state_reset(inst);
- instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
- default:
- /*!< Unable to reach here */
- break;
- }
-
+ case 0:
+ /*!
+ * \note
+ * Successfully unloaded
+ */
+ switch (inst->requested_state) {
+ case INST_ACTIVATED:
+ instance_state_reset(inst);
+ instance_reactivate(inst);
break;
- case DBOX_STATUS_ERROR_INVALID_PARAMETER:
- /*!
- * \note
- * Slave has no instance of this package.
- */
- case DBOX_STATUS_ERROR_NOT_EXIST:
- /*!
- * \note
- * This instance's previous state is only can be the INST_ACTIVATED.
- * So we should care the slave_unload_instance from here.
- * And we should send notification to clients, about this is deleted.
- */
- /*!
- * \note
- * Slave has no instance of this.
- * In this case, ignore the requested_state
- * Because, this instance is already met a problem.
- */
- default:
- /*!
- * \note
- * Failed to unload this instance.
- * This is not possible, slave will always return DBOX_STATUS_ERROR_NOT_EXIST, DBOX_STATUS_ERROR_INVALID_PARAMETER, or 0.
- * but care this exceptional case.
- */
- instance_broadcast_deleted_event(inst, ret);
+ case INST_DESTROYED:
+ if (inst->unicast_delete_event) {
+ instance_unicast_deleted_event(inst, NULL, ret);
+ } else {
+ instance_broadcast_deleted_event(inst, ret);
+ }
instance_state_reset(inst);
instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+ default:
+ /*!< Unable to reach here */
break;
+ }
+
+ break;
+ case DBOX_STATUS_ERROR_INVALID_PARAMETER:
+ /*!
+ * \note
+ * Slave has no instance of this package.
+ */
+ case DBOX_STATUS_ERROR_NOT_EXIST:
+ /*!
+ * \note
+ * This instance's previous state is only can be the INST_ACTIVATED.
+ * So we should care the slave_unload_instance from here.
+ * And we should send notification to clients, about this is deleted.
+ */
+ /*!
+ * \note
+ * Slave has no instance of this.
+ * In this case, ignore the requested_state
+ * Because, this instance is already met a problem.
+ */
+ default:
+ /*!
+ * \note
+ * Failed to unload this instance.
+ * This is not possible, slave will always return DBOX_STATUS_ERROR_NOT_EXIST, DBOX_STATUS_ERROR_INVALID_PARAMETER, or 0.
+ * but care this exceptional case.
+ */
+ instance_broadcast_deleted_event(inst, ret);
+ instance_state_reset(inst);
+ instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+ break;
}
out:
}
switch (ret) {
- case 0: /*!< normally created */
- inst->state = INST_ACTIVATED;
- switch (inst->requested_state) {
- case INST_DESTROYED:
- instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
- break;
- case INST_ACTIVATED:
- inst->is_pinned_up = is_pinned_up;
- dbox_type = package_dbox_type(inst->info);
- gbar_type = package_gbar_type(inst->info);
-
- /*!
- * \note
- * Optimization point.
- * In case of the BUFFER type,
- * the slave will request the buffer to render its contents.
- * so the buffer will be automatcially recreated when it gots the
- * buffer request packet.
- * so load a buffer from here is not neccessary.
- * I should to revise it and concrete the concept.
- * Just leave it only for now.
- */
-
- if (dbox_type == DBOX_TYPE_SCRIPT && inst->dbox.canvas.script) {
- script_handler_load(inst->dbox.canvas.script, 0);
- } else if (dbox_type == DBOX_TYPE_BUFFER && inst->dbox.canvas.buffer) {
- buffer_handler_load(inst->dbox.canvas.buffer);
- }
-
- if (gbar_type == GBAR_TYPE_SCRIPT && inst->gbar.canvas.script && inst->gbar.is_opened_for_reactivate) {
- double x, y;
- /*!
- * \note
- * We should to send a request to open a GBAR to slave.
- * if we didn't send it, the slave will not recognize the state of a GBAR.
- * We have to keep the view of GBAR seamless even if the dynamicbox is reactivated.
- * To do that, send open request from here.
- */
- ret = instance_slave_open_gbar(inst, NULL);
- instance_slave_get_gbar_pos(inst, &x, &y);
-
- /*!
- * \note
- * In this case, master already loads the GBAR script.
- * So just send the gbar,show event to the slave again.
- */
- ret = instance_signal_emit(inst, "gbar,show", instance_id(inst), 0.0, 0.0, 0.0, 0.0, x, y, 0);
- } else if (gbar_type == GBAR_TYPE_BUFFER && inst->gbar.canvas.buffer && inst->gbar.is_opened_for_reactivate) {
- double x, y;
-
- buffer_handler_load(inst->gbar.canvas.buffer);
- instance_slave_get_gbar_pos(inst, &x, &y);
-
- /*!
- * \note
- * We should to send a request to open a GBAR to slave.
- * if we didn't send it, the slave will not recognize the state of a GBAR.
- * We have to keep the view of GBAR seamless even if the dynamicbox is reactivated.
- * To do that, send open request from here.
- */
- ret = instance_slave_open_gbar(inst, NULL);
-
- /*!
- * \note
- * In this case, just send the gbar,show event for keeping the compatibility
- */
- ret = instance_signal_emit(inst, "gbar,show", instance_id(inst), 0.0, 0.0, 0.0, 0.0, x, y, 0);
- }
-
- /*!
- * \note
- * After create an instance again,
- * Send resize request to the dynamicbox.
- * instance_resize(inst, inst->dbox.width, inst->dbox.height);
- *
- * renew request will resize the dynamicbox while creating it again
- */
-
- /*!
- * \note
- * This function will check the visiblity of a dynamicbox and
- * make decision whether it thaw the update timer or not.
- */
- instance_recover_visible_state(inst);
- default:
- break;
- }
+ case 0: /*!< normally created */
+ inst->state = INST_ACTIVATED;
+ switch (inst->requested_state) {
+ case INST_DESTROYED:
+ instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
break;
+ case INST_ACTIVATED:
+ inst->is_pinned_up = is_pinned_up;
+ dbox_type = package_dbox_type(inst->info);
+ gbar_type = package_gbar_type(inst->info);
+
+ /*!
+ * \note
+ * Optimization point.
+ * In case of the BUFFER type,
+ * the slave will request the buffer to render its contents.
+ * so the buffer will be automatcially recreated when it gots the
+ * buffer request packet.
+ * so load a buffer from here is not neccessary.
+ * I should to revise it and concrete the concept.
+ * Just leave it only for now.
+ */
+
+ if (dbox_type == DBOX_TYPE_SCRIPT && inst->dbox.canvas.script) {
+ script_handler_load(inst->dbox.canvas.script, 0);
+ } else if (dbox_type == DBOX_TYPE_BUFFER && inst->dbox.canvas.buffer) {
+ buffer_handler_load(inst->dbox.canvas.buffer);
+ }
+
+ if (gbar_type == GBAR_TYPE_SCRIPT && inst->gbar.canvas.script && inst->gbar.is_opened_for_reactivate) {
+ double x, y;
+ /*!
+ * \note
+ * We should to send a request to open a GBAR to slave.
+ * if we didn't send it, the slave will not recognize the state of a GBAR.
+ * We have to keep the view of GBAR seamless even if the dynamicbox is reactivated.
+ * To do that, send open request from here.
+ */
+ ret = instance_slave_open_gbar(inst, NULL);
+ instance_slave_get_gbar_pos(inst, &x, &y);
+
+ /*!
+ * \note
+ * In this case, master already loads the GBAR script.
+ * So just send the gbar,show event to the slave again.
+ */
+ ret = instance_signal_emit(inst, "gbar,show", instance_id(inst), 0.0, 0.0, 0.0, 0.0, x, y, 0);
+ } else if (gbar_type == GBAR_TYPE_BUFFER && inst->gbar.canvas.buffer && inst->gbar.is_opened_for_reactivate) {
+ double x, y;
+
+ buffer_handler_load(inst->gbar.canvas.buffer);
+ instance_slave_get_gbar_pos(inst, &x, &y);
+
+ /*!
+ * \note
+ * We should to send a request to open a GBAR to slave.
+ * if we didn't send it, the slave will not recognize the state of a GBAR.
+ * We have to keep the view of GBAR seamless even if the dynamicbox is reactivated.
+ * To do that, send open request from here.
+ */
+ ret = instance_slave_open_gbar(inst, NULL);
+
+ /*!
+ * \note
+ * In this case, just send the gbar,show event for keeping the compatibility
+ */
+ ret = instance_signal_emit(inst, "gbar,show", instance_id(inst), 0.0, 0.0, 0.0, 0.0, x, y, 0);
+ }
+
+ /*!
+ * \note
+ * After create an instance again,
+ * Send resize request to the dynamicbox.
+ * instance_resize(inst, inst->dbox.width, inst->dbox.height);
+ *
+ * renew request will resize the dynamicbox while creating it again
+ */
+
+ /*!
+ * \note
+ * This function will check the visiblity of a dynamicbox and
+ * make decision whether it thaw the update timer or not.
+ */
+ instance_recover_visible_state(inst);
default:
- instance_broadcast_deleted_event(inst, ret);
- instance_state_reset(inst);
- instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
break;
+ }
+ break;
+ default:
+ instance_broadcast_deleted_event(inst, ret);
+ instance_state_reset(inst);
+ instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+ break;
}
out:
}
switch (ret) {
- case 1: /*!< need to create */
- if (util_free_space(DYNAMICBOX_CONF_IMAGE_PATH) > DYNAMICBOX_CONF_MINIMUM_SPACE) {
- struct inst_info *new_inst;
- new_inst = instance_create(inst->client, util_timestamp(), package_name(inst->info),
- inst->content, inst->cluster, inst->category,
- inst->dbox.period, 0, 0);
- if (!new_inst) {
- ErrPrint("Failed to create a new instance\n");
- }
- } else {
- ErrPrint("Not enough space\n");
+ case 1: /*!< need to create */
+ if (util_free_space(DYNAMICBOX_CONF_IMAGE_PATH) > DYNAMICBOX_CONF_MINIMUM_SPACE) {
+ struct inst_info *new_inst;
+ new_inst = instance_create(inst->client, util_timestamp(), package_name(inst->info),
+ inst->content, inst->cluster, inst->category,
+ inst->dbox.period, 0, 0);
+ if (!new_inst) {
+ ErrPrint("Failed to create a new instance\n");
}
- case 0: /*!< normally created */
- /*!
- * \note
- * Anyway this instance is loaded to the slave,
- * just increase the loaded instance counter
- * And then reset jobs.
+ } else {
+ ErrPrint("Not enough space\n");
+ }
+ case 0: /*!< normally created */
+ /*!
+ * \note
+ * Anyway this instance is loaded to the slave,
+ * just increase the loaded instance counter
+ * And then reset jobs.
+ */
+ instance_set_dbox_size(inst, w, h);
+ instance_set_dbox_info(inst, priority, content, title);
+
+ inst->state = INST_ACTIVATED;
+
+ switch (inst->requested_state) {
+ case INST_DESTROYED:
+ /**
+ * In this case, we should destroy the instance.
*/
- instance_set_dbox_size(inst, w, h);
- instance_set_dbox_info(inst, priority, content, title);
-
- inst->state = INST_ACTIVATED;
-
- switch (inst->requested_state) {
- case INST_DESTROYED:
- /**
- * In this case, we should destroy the instance.
- */
- instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
- break;
- case INST_ACTIVATED:
- default:
- /**
- * @note
- * DBOX should be created at the create time
- */
- inst->is_pinned_up = is_pinned_up;
- if (package_dbox_type(inst->info) == DBOX_TYPE_SCRIPT) {
- if (inst->dbox.width == 0 && inst->dbox.height == 0) {
- dynamicbox_service_get_size(DBOX_SIZE_TYPE_1x1, &inst->dbox.width, &inst->dbox.height);
- }
-
- inst->dbox.canvas.script = script_handler_create(inst,
- package_dbox_path(inst->info),
- package_dbox_group(inst->info),
- inst->dbox.width, inst->dbox.height);
-
- if (!inst->dbox.canvas.script) {
- ErrPrint("Failed to create DBOX\n");
- } else {
- script_handler_load(inst->dbox.canvas.script, 0);
- }
- } else if (package_dbox_type(inst->info) == DBOX_TYPE_BUFFER) {
- instance_create_dbox_buffer(inst, DYNAMICBOX_CONF_DEFAULT_PIXELS);
- }
-
- if (package_gbar_type(inst->info) == GBAR_TYPE_SCRIPT) {
- if (inst->gbar.width == 0 && inst->gbar.height == 0) {
- instance_set_gbar_size(inst, package_gbar_width(inst->info), package_gbar_height(inst->info));
- }
-
- inst->gbar.canvas.script = script_handler_create(inst,
- package_gbar_path(inst->info),
- package_gbar_group(inst->info),
- inst->gbar.width, inst->gbar.height);
-
- if (!inst->gbar.canvas.script) {
- ErrPrint("Failed to create GBAR\n");
- }
- } else if (package_gbar_type(inst->info) == GBAR_TYPE_BUFFER) {
- instance_create_gbar_buffer(inst, DYNAMICBOX_CONF_DEFAULT_PIXELS);
- }
-
- instance_broadcast_created_event(inst);
-
- instance_thaw_updator(inst);
- break;
- }
+ instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
break;
+ case INST_ACTIVATED:
default:
- instance_unicast_deleted_event(inst, NULL, ret);
- instance_state_reset(inst);
- instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+ /**
+ * @note
+ * DBOX should be created at the create time
+ */
+ inst->is_pinned_up = is_pinned_up;
+ if (package_dbox_type(inst->info) == DBOX_TYPE_SCRIPT) {
+ if (inst->dbox.width == 0 && inst->dbox.height == 0) {
+ dynamicbox_service_get_size(DBOX_SIZE_TYPE_1x1, &inst->dbox.width, &inst->dbox.height);
+ }
+
+ inst->dbox.canvas.script = script_handler_create(inst,
+ package_dbox_path(inst->info),
+ package_dbox_group(inst->info),
+ inst->dbox.width, inst->dbox.height);
+
+ if (!inst->dbox.canvas.script) {
+ ErrPrint("Failed to create DBOX\n");
+ } else {
+ script_handler_load(inst->dbox.canvas.script, 0);
+ }
+ } else if (package_dbox_type(inst->info) == DBOX_TYPE_BUFFER) {
+ instance_create_dbox_buffer(inst, DYNAMICBOX_CONF_DEFAULT_PIXELS);
+ }
+
+ if (package_gbar_type(inst->info) == GBAR_TYPE_SCRIPT) {
+ if (inst->gbar.width == 0 && inst->gbar.height == 0) {
+ instance_set_gbar_size(inst, package_gbar_width(inst->info), package_gbar_height(inst->info));
+ }
+
+ inst->gbar.canvas.script = script_handler_create(inst,
+ package_gbar_path(inst->info),
+ package_gbar_group(inst->info),
+ inst->gbar.width, inst->gbar.height);
+
+ if (!inst->gbar.canvas.script) {
+ ErrPrint("Failed to create GBAR\n");
+ }
+ } else if (package_gbar_type(inst->info) == GBAR_TYPE_BUFFER) {
+ instance_create_gbar_buffer(inst, DYNAMICBOX_CONF_DEFAULT_PIXELS);
+ }
+
+ instance_broadcast_created_event(inst);
+
+ instance_thaw_updator(inst);
break;
+ }
+ break;
+ default:
+ instance_unicast_deleted_event(inst, NULL, ret);
+ instance_state_reset(inst);
+ instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+ break;
}
out:
}
switch (inst->state) {
- case INST_REQUEST_TO_ACTIVATE:
- case INST_REQUEST_TO_DESTROY:
- case INST_REQUEST_TO_REACTIVATE:
- inst->requested_state = INST_DESTROYED;
- return DBOX_STATUS_ERROR_NONE;
- case INST_INIT:
- inst->state = INST_DESTROYED;
- inst->requested_state = INST_DESTROYED;
- (void)instance_unref(inst);
- return DBOX_STATUS_ERROR_NONE;
- case INST_DESTROYED:
- inst->requested_state = INST_DESTROYED;
- return DBOX_STATUS_ERROR_NONE;
- default:
- break;
+ case INST_REQUEST_TO_ACTIVATE:
+ case INST_REQUEST_TO_DESTROY:
+ case INST_REQUEST_TO_REACTIVATE:
+ inst->requested_state = INST_DESTROYED;
+ return DBOX_STATUS_ERROR_NONE;
+ case INST_INIT:
+ inst->state = INST_DESTROYED;
+ inst->requested_state = INST_DESTROYED;
+ (void)instance_unref(inst);
+ return DBOX_STATUS_ERROR_NONE;
+ case INST_DESTROYED:
+ inst->requested_state = INST_DESTROYED;
+ return DBOX_STATUS_ERROR_NONE;
+ default:
+ break;
}
packet = packet_create((const char *)&cmd, "ssi", package_name(inst->info), inst->id, type);
DbgPrint("Reload instance (%s)\n", instance_id(inst));
switch (inst->state) {
- case INST_REQUEST_TO_ACTIVATE:
- case INST_REQUEST_TO_REACTIVATE:
- return DBOX_STATUS_ERROR_NONE;
- case INST_INIT:
- ret = instance_activate(inst);
- if (ret < 0) {
- ErrPrint("Failed to activate instance: %d (%s)\n", ret, instance_id(inst));
- }
- return DBOX_STATUS_ERROR_NONE;
- case INST_DESTROYED:
- case INST_REQUEST_TO_DESTROY:
- DbgPrint("Instance is destroying now\n");
- return DBOX_STATUS_ERROR_NONE;
- default:
- break;
+ case INST_REQUEST_TO_ACTIVATE:
+ case INST_REQUEST_TO_REACTIVATE:
+ return DBOX_STATUS_ERROR_NONE;
+ case INST_INIT:
+ ret = instance_activate(inst);
+ if (ret < 0) {
+ ErrPrint("Failed to activate instance: %d (%s)\n", ret, instance_id(inst));
+ }
+ return DBOX_STATUS_ERROR_NONE;
+ case INST_DESTROYED:
+ case INST_REQUEST_TO_DESTROY:
+ DbgPrint("Instance is destroying now\n");
+ return DBOX_STATUS_ERROR_NONE;
+ default:
+ break;
}
packet = packet_create((const char *)&cmd, "ssi", package_name(inst->info), inst->id, type);
}
switch (inst->state) {
- case INST_REQUEST_TO_DESTROY:
- case INST_REQUEST_TO_ACTIVATE:
- case INST_REQUEST_TO_REACTIVATE:
- inst->requested_state = INST_ACTIVATED;
- return DBOX_STATUS_ERROR_NONE;
- case INST_DESTROYED:
- case INST_ACTIVATED:
- return DBOX_STATUS_ERROR_NONE;
- case INST_INIT:
- default:
- break;
+ case INST_REQUEST_TO_DESTROY:
+ case INST_REQUEST_TO_ACTIVATE:
+ case INST_REQUEST_TO_REACTIVATE:
+ inst->requested_state = INST_ACTIVATED;
+ return DBOX_STATUS_ERROR_NONE;
+ case INST_DESTROYED:
+ case INST_ACTIVATED:
+ return DBOX_STATUS_ERROR_NONE;
+ case INST_INIT:
+ default:
+ break;
}
packet = packet_create((const char *)&cmd, "sssiidssiisiis",
}
switch (inst->state) {
- case INST_REQUEST_TO_REACTIVATE:
- case INST_REQUEST_TO_ACTIVATE:
- case INST_REQUEST_TO_DESTROY:
- inst->requested_state = INST_ACTIVATED;
- return DBOX_STATUS_ERROR_NONE;
- case INST_ACTIVATED:
- case INST_DESTROYED:
- return DBOX_STATUS_ERROR_NONE;
- case INST_INIT:
- default:
- break;
+ case INST_REQUEST_TO_REACTIVATE:
+ case INST_REQUEST_TO_ACTIVATE:
+ case INST_REQUEST_TO_DESTROY:
+ inst->requested_state = INST_ACTIVATED;
+ return DBOX_STATUS_ERROR_NONE;
+ case INST_ACTIVATED:
+ case INST_DESTROYED:
+ return DBOX_STATUS_ERROR_NONE;
+ case INST_INIT:
+ default:
+ break;
}
packet = packet_create((const char *)&cmd, "sssiidssisiis",
}
switch (package_dbox_type(inst->info)) {
- case DBOX_TYPE_BUFFER:
- if (!inst->dbox.canvas.buffer) {
- ErrPrint("Buffer is null [%s]\n", inst->id);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
- fbfile = buffer_handler_id(inst->dbox.canvas.buffer);
- break;
- case DBOX_TYPE_SCRIPT:
- if (!inst->dbox.canvas.script) {
- ErrPrint("Script is null [%s]\n", inst->id);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
- fbfile = script_handler_buffer_id(inst->dbox.canvas.script);
- break;
- default:
- ErrPrint("Invalid request[%s]\n", inst->id);
+ case DBOX_TYPE_BUFFER:
+ if (!inst->dbox.canvas.buffer) {
+ ErrPrint("Buffer is null [%s]\n", inst->id);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+ fbfile = buffer_handler_id(inst->dbox.canvas.buffer);
+ break;
+ case DBOX_TYPE_SCRIPT:
+ if (!inst->dbox.canvas.script) {
+ ErrPrint("Script is null [%s]\n", inst->id);
return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+ fbfile = script_handler_buffer_id(inst->dbox.canvas.script);
+ break;
+ default:
+ ErrPrint("Invalid request[%s]\n", inst->id);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
packet = packet_create_noack((const char *)&cmd, "ssdsss", package_name(inst->info), inst->id, priority, content, title, fbfile);
}
switch (package_dbox_type(inst->info)) {
- case DBOX_TYPE_BUFFER:
- if (!inst->dbox.canvas.buffer) {
- ErrPrint("Buffer is null [%s]\n", inst->id);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
- break;
- case DBOX_TYPE_SCRIPT:
- if (!inst->dbox.canvas.script) {
- ErrPrint("Script is null [%s]\n", inst->id);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
- break;
- default:
- ErrPrint("Invalid request[%s]\n", inst->id);
+ case DBOX_TYPE_BUFFER:
+ if (!inst->dbox.canvas.buffer) {
+ ErrPrint("Buffer is null [%s]\n", inst->id);
return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+ break;
+ case DBOX_TYPE_SCRIPT:
+ if (!inst->dbox.canvas.script) {
+ ErrPrint("Script is null [%s]\n", inst->id);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+ break;
+ default:
+ ErrPrint("Invalid request[%s]\n", inst->id);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
packet = packet_create_noack((const char *)&cmd, "ss", package_name(inst->info), inst->id);
}
switch (package_gbar_type(inst->info)) {
- case GBAR_TYPE_BUFFER:
- if (!inst->gbar.canvas.buffer) {
- ErrPrint("Buffer is null [%s]\n", inst->id);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
- fbfile = buffer_handler_id(inst->gbar.canvas.buffer);
- break;
- case GBAR_TYPE_SCRIPT:
- if (!inst->gbar.canvas.script) {
- ErrPrint("Script is null [%s]\n", inst->id);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
- fbfile = script_handler_buffer_id(inst->gbar.canvas.script);
- break;
- default:
- ErrPrint("Invalid request[%s]\n", inst->id);
+ case GBAR_TYPE_BUFFER:
+ if (!inst->gbar.canvas.buffer) {
+ ErrPrint("Buffer is null [%s]\n", inst->id);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+ fbfile = buffer_handler_id(inst->gbar.canvas.buffer);
+ break;
+ case GBAR_TYPE_SCRIPT:
+ if (!inst->gbar.canvas.script) {
+ ErrPrint("Script is null [%s]\n", inst->id);
return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+ fbfile = script_handler_buffer_id(inst->gbar.canvas.script);
+ break;
+ default:
+ ErrPrint("Invalid request[%s]\n", inst->id);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
packet = packet_create_noack((const char *)&cmd, "sss", package_name(inst->info), inst->id, fbfile);
}
switch (package_gbar_type(inst->info)) {
- case GBAR_TYPE_BUFFER:
- if (!inst->gbar.canvas.buffer) {
- ErrPrint("Buffer is null [%s]\n", inst->id);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
- break;
- case GBAR_TYPE_SCRIPT:
- if (!inst->gbar.canvas.script) {
- ErrPrint("Script is null [%s]\n", inst->id);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
- break;
- default:
- ErrPrint("Invalid request[%s]\n", inst->id);
+ case GBAR_TYPE_BUFFER:
+ if (!inst->gbar.canvas.buffer) {
+ ErrPrint("Buffer is null [%s]\n", inst->id);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+ break;
+ case GBAR_TYPE_SCRIPT:
+ if (!inst->gbar.canvas.script) {
+ ErrPrint("Script is null [%s]\n", inst->id);
return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+ break;
+ default:
+ ErrPrint("Invalid request[%s]\n", inst->id);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
packet = packet_create_noack((const char *)&cmd, "ss", package_name(inst->info), inst->id);
}
switch (package_gbar_type(inst->info)) {
- case GBAR_TYPE_SCRIPT:
- id = script_handler_buffer_id(inst->gbar.canvas.script);
- break;
- case GBAR_TYPE_BUFFER:
- id = buffer_handler_id(inst->gbar.canvas.buffer);
- break;
- case GBAR_TYPE_TEXT:
- default:
- id = "";
- break;
+ case GBAR_TYPE_SCRIPT:
+ id = script_handler_buffer_id(inst->gbar.canvas.script);
+ break;
+ case GBAR_TYPE_BUFFER:
+ id = buffer_handler_id(inst->gbar.canvas.buffer);
+ break;
+ case GBAR_TYPE_TEXT:
+ default:
+ id = "";
+ break;
}
packet = packet_create_noack((const char *)&cmd, "ssssiiii", package_name(inst->info), inst->id, id, descfile, x, y, w, h);
}
switch (state) {
- case DBOX_SHOW:
- case DBOX_HIDE:
- if (inst->visible == DBOX_HIDE_WITH_PAUSE) {
- if (resume_dynamicbox(inst) == 0) {
- inst->visible = state;
- }
-
- instance_thaw_updator(inst);
- } else {
+ case DBOX_SHOW:
+ case DBOX_HIDE:
+ if (inst->visible == DBOX_HIDE_WITH_PAUSE) {
+ if (resume_dynamicbox(inst) == 0) {
inst->visible = state;
}
- break;
- case DBOX_HIDE_WITH_PAUSE:
- if (pause_dynamicbox(inst) == 0) {
- inst->visible = DBOX_HIDE_WITH_PAUSE;
- }
+ instance_thaw_updator(inst);
+ } else {
+ inst->visible = state;
+ }
+ break;
- instance_freeze_updator(inst);
- break;
+ case DBOX_HIDE_WITH_PAUSE:
+ if (pause_dynamicbox(inst) == 0) {
+ inst->visible = DBOX_HIDE_WITH_PAUSE;
+ }
- default:
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ instance_freeze_updator(inst);
+ break;
+
+ default:
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return DBOX_STATUS_ERROR_NONE;
cbdata->period = period;
cbdata->inst = instance_ref(inst);
- if (package_secured(inst->info)) {
+ if (package_secured(inst->info) || DYNAMICBOX_CONF_SLAVE_LIMIT_TO_TTL) {
/*!
* \note
* Secured dynamicbox doesn't need to send its update period to the slave.
HAPI int instance_destroyed(struct inst_info *inst, int reason)
{
switch (inst->state) {
- case INST_INIT:
- case INST_REQUEST_TO_ACTIVATE:
- if (inst->unicast_delete_event) {
- /*!
- * \note
- * No other clients know the existence of this instance,
- * only who added this knows it.
- * So send deleted event to only it.
- */
- DbgPrint("Send deleted event - unicast - %p\n", inst->client);
- instance_unicast_deleted_event(inst, NULL, reason);
- } else {
- instance_broadcast_deleted_event(inst, reason);
- }
- instance_state_reset(inst);
- instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
- break;
- case INST_REQUEST_TO_REACTIVATE:
- case INST_REQUEST_TO_DESTROY:
- case INST_ACTIVATED:
- DbgPrint("Send deleted event - multicast\n");
+ case INST_INIT:
+ case INST_REQUEST_TO_ACTIVATE:
+ if (inst->unicast_delete_event) {
+ /*!
+ * \note
+ * No other clients know the existence of this instance,
+ * only who added this knows it.
+ * So send deleted event to only it.
+ */
+ DbgPrint("Send deleted event - unicast - %p\n", inst->client);
+ instance_unicast_deleted_event(inst, NULL, reason);
+ } else {
instance_broadcast_deleted_event(inst, reason);
- instance_state_reset(inst);
- instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
- case INST_DESTROYED:
- break;
- default:
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+ instance_state_reset(inst);
+ instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+ break;
+ case INST_REQUEST_TO_REACTIVATE:
+ case INST_REQUEST_TO_DESTROY:
+ case INST_ACTIVATED:
+ DbgPrint("Send deleted event - multicast\n");
+ instance_broadcast_deleted_event(inst, reason);
+ instance_state_reset(inst);
+ instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+ case INST_DESTROYED:
+ break;
+ default:
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return DBOX_STATUS_ERROR_NONE;
}
switch (inst->state) {
+ case INST_ACTIVATED:
+ case INST_REQUEST_TO_REACTIVATE:
+ case INST_REQUEST_TO_DESTROY:
+ switch (inst->requested_state) {
case INST_ACTIVATED:
- case INST_REQUEST_TO_REACTIVATE:
- case INST_REQUEST_TO_DESTROY:
- switch (inst->requested_state) {
- case INST_ACTIVATED:
- DbgPrint("Req. to RE-ACTIVATED (%s)\n", package_name(inst->info));
- instance_state_reset(inst);
- instance_reactivate(inst);
- ret = 1;
- break;
- case INST_DESTROYED:
- DbgPrint("Req. to DESTROYED (%s)\n", package_name(inst->info));
- instance_state_reset(inst);
- instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
- break;
- default:
- break;
- }
+ DbgPrint("Req. to RE-ACTIVATED (%s)\n", package_name(inst->info));
+ instance_state_reset(inst);
+ instance_reactivate(inst);
+ ret = 1;
+ break;
+ case INST_DESTROYED:
+ DbgPrint("Req. to DESTROYED (%s)\n", package_name(inst->info));
+ instance_state_reset(inst);
+ instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+ break;
+ default:
break;
+ }
+ break;
+ case INST_INIT:
+ case INST_REQUEST_TO_ACTIVATE:
+ switch (inst->requested_state) {
+ case INST_ACTIVATED:
case INST_INIT:
- case INST_REQUEST_TO_ACTIVATE:
- switch (inst->requested_state) {
- case INST_ACTIVATED:
- case INST_INIT:
- DbgPrint("Req. to ACTIVATED (%s)\n", package_name(inst->info));
- instance_state_reset(inst);
- if (instance_activate(inst) < 0) {
- DbgPrint("Failed to reactivate the instance\n");
- instance_broadcast_deleted_event(inst, DBOX_STATUS_ERROR_FAULT);
- instance_state_reset(inst);
- instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
- } else {
- ret = 1;
- }
- break;
- case INST_DESTROYED:
- DbgPrint("Req. to DESTROYED (%s)\n", package_name(inst->info));
- instance_state_reset(inst);
- instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
- break;
- default:
- break;
+ DbgPrint("Req. to ACTIVATED (%s)\n", package_name(inst->info));
+ instance_state_reset(inst);
+ if (instance_activate(inst) < 0) {
+ DbgPrint("Failed to reactivate the instance\n");
+ instance_broadcast_deleted_event(inst, DBOX_STATUS_ERROR_FAULT);
+ instance_state_reset(inst);
+ instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+ } else {
+ ret = 1;
}
break;
case INST_DESTROYED:
+ DbgPrint("Req. to DESTROYED (%s)\n", package_name(inst->info));
+ instance_state_reset(inst);
+ instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+ break;
default:
break;
+ }
+ break;
+ case INST_DESTROYED:
+ default:
+ break;
}
return ret;
DbgPrint("CLIENT FAULT: Req. to DESTROYED (%s)\n", package_name(inst->info));
switch (inst->state) {
- case INST_INIT:
- case INST_ACTIVATED:
- case INST_REQUEST_TO_REACTIVATE:
- case INST_REQUEST_TO_DESTROY:
- case INST_REQUEST_TO_ACTIVATE:
- instance_state_reset(inst);
- instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
- break;
- case INST_DESTROYED:
- break;
+ case INST_INIT:
+ case INST_ACTIVATED:
+ case INST_REQUEST_TO_REACTIVATE:
+ case INST_REQUEST_TO_DESTROY:
+ case INST_REQUEST_TO_ACTIVATE:
+ instance_state_reset(inst);
+ instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+ break;
+ case INST_DESTROYED:
+ break;
}
return DBOX_STATUS_ERROR_NONE;
}
switch (inst->state) {
+ case INST_ACTIVATED:
+ case INST_REQUEST_TO_REACTIVATE:
+ case INST_REQUEST_TO_DESTROY:
+ switch (inst->requested_state) {
+ case INST_INIT:
case INST_ACTIVATED:
- case INST_REQUEST_TO_REACTIVATE:
- case INST_REQUEST_TO_DESTROY:
- switch (inst->requested_state) {
- case INST_INIT:
- case INST_ACTIVATED:
- DbgPrint("Req. to ACTIVATED (%s)\n", package_name(inst->info));
- ret = 1;
- break;
- case INST_DESTROYED:
- DbgPrint("Req. to DESTROYED (%s)\n", package_name(inst->info));
- instance_state_reset(inst);
- instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
- break;
- default:
- break;
- }
+ DbgPrint("Req. to ACTIVATED (%s)\n", package_name(inst->info));
+ ret = 1;
break;
+ case INST_DESTROYED:
+ DbgPrint("Req. to DESTROYED (%s)\n", package_name(inst->info));
+ instance_state_reset(inst);
+ instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+ break;
+ default:
+ break;
+ }
+ break;
+ case INST_INIT:
+ case INST_REQUEST_TO_ACTIVATE:
+ switch (inst->requested_state) {
case INST_INIT:
- case INST_REQUEST_TO_ACTIVATE:
- switch (inst->requested_state) {
- case INST_INIT:
- case INST_ACTIVATED:
- DbgPrint("Req. to ACTIVATED (%s)\n", package_name(inst->info));
- ret = 1;
- break;
- case INST_DESTROYED:
- DbgPrint("Req. to DESTROYED (%s)\n", package_name(inst->info));
- instance_state_reset(inst);
- instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
- break;
- default:
- break;
- }
+ case INST_ACTIVATED:
+ DbgPrint("Req. to ACTIVATED (%s)\n", package_name(inst->info));
+ ret = 1;
break;
case INST_DESTROYED:
+ DbgPrint("Req. to DESTROYED (%s)\n", package_name(inst->info));
+ instance_state_reset(inst);
+ instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+ break;
default:
break;
+ }
+ break;
+ case INST_DESTROYED:
+ default:
+ break;
}
return ret;
}
switch (package_gbar_type(inst->info)) {
- case GBAR_TYPE_SCRIPT:
- buf_id = script_handler_buffer_id(inst->gbar.canvas.script);
- break;
- case GBAR_TYPE_BUFFER:
- buf_id = buffer_handler_id(inst->gbar.canvas.buffer);
- break;
- case GBAR_TYPE_TEXT:
- default:
- buf_id = "";
- break;
+ case GBAR_TYPE_SCRIPT:
+ buf_id = script_handler_buffer_id(inst->gbar.canvas.script);
+ break;
+ case GBAR_TYPE_BUFFER:
+ buf_id = buffer_handler_id(inst->gbar.canvas.buffer);
+ break;
+ case GBAR_TYPE_TEXT:
+ default:
+ buf_id = "";
+ break;
}
inst->gbar.need_to_send_close_event = (status == 0);
state = INIT;
while ((ch = getc(fp)) != EOF && state != ERROR) {
switch (state) {
- case INIT:
- if (isspace(ch)) {
- continue;
- }
- if (ch == '[') {
- state = GROUP;
- idx = 0;
- } else {
+ case INIT:
+ if (isspace(ch)) {
+ continue;
+ }
+ if (ch == '[') {
+ state = GROUP;
+ idx = 0;
+ } else {
+ state = ERROR;
+ }
+ break;
+ case GROUP:
+ if (ch == ']') {
+ if (idx == 0) {
state = ERROR;
- }
- break;
- case GROUP:
- if (ch == ']') {
- if (idx == 0) {
- state = ERROR;
- } else {
- group[idx] = '\0';
- state = TAG;
- idx = 0;
- ptr = NULL;
- }
- } else if (idx < MAX_ABI) {
- group[idx++] = ch;
} else {
- ErrPrint("Overflow\n");
- state = ERROR;
+ group[idx] = '\0';
+ state = TAG;
+ idx = 0;
+ ptr = NULL;
}
- break;
- case TAG:
- if (ptr == NULL) {
- if (idx == 0) {
- if (isspace(ch)) {
- continue;
- }
-
- /* New group started */
- if (ch == '[') {
- ungetc(ch, fp);
- state = INIT;
- continue;
- }
+ } else if (idx < MAX_ABI) {
+ group[idx++] = ch;
+ } else {
+ ErrPrint("Overflow\n");
+ state = ERROR;
+ }
+ break;
+ case TAG:
+ if (ptr == NULL) {
+ if (idx == 0) {
+ if (isspace(ch)) {
+ continue;
}
- ptr = field[idx];
+ /* New group started */
+ if (ch == '[') {
+ ungetc(ch, fp);
+ state = INIT;
+ continue;
+ }
}
- if (ptr == NULL) {
- ErrPrint("unknown tag\n");
- state = ERROR;
- continue;
- }
+ ptr = field[idx];
+ }
- if (*ptr == '\0' && ch == '=') {
- /* MATCHED */
- state = VALUE;
- tag_id = idx;
- idx = 0;
- ptr = NULL;
- } else if (*ptr == ch) {
- ptr++;
- } else {
- ungetc(ch, fp);
+ if (ptr == NULL) {
+ ErrPrint("unknown tag\n");
+ state = ERROR;
+ continue;
+ }
+
+ if (*ptr == '\0' && ch == '=') {
+ /* MATCHED */
+ state = VALUE;
+ tag_id = idx;
+ idx = 0;
+ ptr = NULL;
+ } else if (*ptr == ch) {
+ ptr++;
+ } else {
+ ungetc(ch, fp);
+ ptr--;
+ while (ptr >= field[idx]) {
+ ungetc(*ptr, fp);
ptr--;
- while (ptr >= field[idx]) {
- ungetc(*ptr, fp);
- ptr--;
- }
- ptr = NULL;
- idx++;
- }
- break;
- case VALUE:
- switch (tag_id) {
- case PKGNAME:
- if (idx == 0) { /* LTRIM */
- if (isspace(ch)) {
- continue;
- }
-
- pkgname[idx] = ch;
- idx++;
- } else if (isspace(ch)) {
- int ret;
- pkgname[idx] = '\0';
-
- ret = abi_add_entry(group, pkgname);
- if (ret != 0) {
- ErrPrint("Failed to add %s for %s\n", pkgname, group);
- }
-
- state = TAG;
- idx = 0;
- } else if (idx < MAX_PKGNAME) {
- pkgname[idx] = ch;
- idx++;
- } else {
- ErrPrint("Overflow\n");
- state = ERROR;
- }
- break;
- default:
- break;
}
- break;
- case ERROR:
- default:
- break;
- }
- }
-
- if (state == VALUE) {
- switch (tag_id) {
+ ptr = NULL;
+ idx++;
+ }
+ break;
+ case VALUE:
+ switch (tag_id) {
case PKGNAME:
- if (idx) {
+ if (idx == 0) { /* LTRIM */
+ if (isspace(ch)) {
+ continue;
+ }
+
+ pkgname[idx] = ch;
+ idx++;
+ } else if (isspace(ch)) {
int ret;
pkgname[idx] = '\0';
+
ret = abi_add_entry(group, pkgname);
if (ret != 0) {
ErrPrint("Failed to add %s for %s\n", pkgname, group);
}
+
+ state = TAG;
+ idx = 0;
+ } else if (idx < MAX_PKGNAME) {
+ pkgname[idx] = ch;
+ idx++;
+ } else {
+ ErrPrint("Overflow\n");
+ state = ERROR;
}
break;
default:
break;
+ }
+ break;
+ case ERROR:
+ default:
+ break;
+ }
+ }
+
+ if (state == VALUE) {
+ switch (tag_id) {
+ case PKGNAME:
+ if (idx) {
+ int ret;
+ pkgname[idx] = '\0';
+ ret = abi_add_entry(group, pkgname);
+ if (ret != 0) {
+ ErrPrint("Failed to add %s for %s\n", pkgname, group);
+ }
+ }
+ break;
+ default:
+ break;
}
}
}
switch (packet_type(packet)) {
- case PACKET_REQ:
- /* Need to send reply packet */
- DbgPrint("%p REQ: Command: [%s]\n", tcb, command);
+ case PACKET_REQ:
+ /* Need to send reply packet */
+ DbgPrint("%p REQ: Command: [%s]\n", tcb, command);
- for (i = 0; service_req_table[i].cmd; i++) {
- if (strcmp(service_req_table[i].cmd, command)) {
- continue;
- }
+ for (i = 0; service_req_table[i].cmd; i++) {
+ if (strcmp(service_req_table[i].cmd, command)) {
+ continue;
+ }
- if (_persmission_check(tcb_fd(tcb), &(service_req_table[i])) == 1) {
- service_req_table[i].handler(tcb, packet, data);
- } else {
- if (service_req_table[i].handler_access_error != NULL) {
- service_req_table[i].handler_access_error(tcb, packet);
- }
+ if (_persmission_check(tcb_fd(tcb), &(service_req_table[i])) == 1) {
+ service_req_table[i].handler(tcb, packet, data);
+ } else {
+ if (service_req_table[i].handler_access_error != NULL) {
+ service_req_table[i].handler_access_error(tcb, packet);
}
- break;
}
-
break;
- case PACKET_REQ_NOACK:
- break;
- case PACKET_ACK:
- break;
- default:
- ErrPrint("Packet type is not valid[%s]\n", command);
- return -EINVAL;
+ }
+
+ break;
+ case PACKET_REQ_NOACK:
+ break;
+ case PACKET_ACK:
+ break;
+ default:
+ ErrPrint("Packet type is not valid[%s]\n", command);
+ return -EINVAL;
}
/*!
(void)slave_event_callback_add(info->slave, SLAVE_EVENT_ACTIVATE, slave_activated_cb, info);
(void)slave_event_callback_add(info->slave, SLAVE_EVENT_FAULT, slave_fault_cb, info);
- if (info->secured) {
+ if (info->secured || DYNAMICBOX_CONF_SLAVE_LIMIT_TO_TTL) {
(void)slave_event_callback_add(info->slave, SLAVE_EVENT_PAUSE, slave_paused_cb, info);
(void)slave_event_callback_add(info->slave, SLAVE_EVENT_RESUME, slave_resumed_cb, info);
slave_event_callback_del(info->slave, SLAVE_EVENT_DEACTIVATE, slave_deactivated_cb, info);
slave_event_callback_del(info->slave, SLAVE_EVENT_ACTIVATE, slave_activated_cb, info);
- if (info->secured) {
+ if (info->secured || DYNAMICBOX_CONF_SLAVE_LIMIT_TO_TTL) {
slave_event_callback_del(info->slave, SLAVE_EVENT_PAUSE, slave_paused_cb, info);
slave_event_callback_del(info->slave, SLAVE_EVENT_RESUME, slave_resumed_cb, info);
EINA_LIST_FOREACH(info->inst_list, i_l, inst) {
switch (instance_state(inst)) {
- case INST_INIT:
- /* Will be send a created event after the instance gets created event */
- break;
- case INST_ACTIVATED: /*!< This instance is actiavted, and used */
- case INST_REQUEST_TO_REACTIVATE: /*!< This instance will be reactivated soon */
- case INST_REQUEST_TO_DESTROY: /*!< This instance will be destroy soon */
- if (instance_client(inst) == client) {
+ case INST_INIT:
+ /* Will be send a created event after the instance gets created event */
+ break;
+ case INST_ACTIVATED: /*!< This instance is actiavted, and used */
+ case INST_REQUEST_TO_REACTIVATE: /*!< This instance will be reactivated soon */
+ case INST_REQUEST_TO_DESTROY: /*!< This instance will be destroy soon */
+ if (instance_client(inst) == client) {
+ instance_unicast_created_event(inst, client);
+ } else if (instance_client(inst) == NULL) {
+ /*!
+ * \note
+ * Instances are lives in the system cluster/sub-cluster
+ */
+ if (client_is_subscribed(client, instance_cluster(inst), instance_category(inst))) {
instance_unicast_created_event(inst, client);
- } else if (instance_client(inst) == NULL) {
- /*!
- * \note
- * Instances are lives in the system cluster/sub-cluster
- */
- if (client_is_subscribed(client, instance_cluster(inst), instance_category(inst))) {
- instance_unicast_created_event(inst, client);
- DbgPrint("(Subscribed) Created package: %s\n", info->dbox_id);
- }
+ DbgPrint("(Subscribed) Created package: %s\n", info->dbox_id);
}
+ }
- break;
- default:
- DbgPrint("%s(%s) is not activated (%d)\n",
- package_name(info), instance_id(inst), instance_state(inst));
- break;
+ break;
+ default:
+ DbgPrint("%s(%s) is not activated (%d)\n",
+ package_name(info), instance_id(inst), instance_state(inst));
+ break;
}
}
}
}
switch (instance_state(inst)) {
- case INST_INIT:
- case INST_REQUEST_TO_ACTIVATE:
- /* Will be send a created event after the instance gets created event */
- switch (alter) {
- case ALTER_CREATE:
- if (!instance_has_client(inst, client)) {
- instance_add_client(inst, client);
- }
- break;
- case ALTER_DESTROY:
- if (instance_has_client(inst, client)) {
- instance_del_client(inst, client);
- }
- break;
- default:
- break;
+ case INST_INIT:
+ case INST_REQUEST_TO_ACTIVATE:
+ /* Will be send a created event after the instance gets created event */
+ switch (alter) {
+ case ALTER_CREATE:
+ if (!instance_has_client(inst, client)) {
+ instance_add_client(inst, client);
}
break;
- case INST_ACTIVATED: /*!< This instance is actiavted, and used */
- case INST_REQUEST_TO_REACTIVATE: /*!< This instance will be reactivated soon */
- case INST_REQUEST_TO_DESTROY: /*!< This instance will be destroy soon */
- /*!
- * \note
- * Instances are lives in the system cluster/sub-cluster
- */
- switch (alter) {
- case ALTER_CREATE:
- if (!instance_has_client(inst, client)) {
- instance_unicast_created_event(inst, client);
- instance_add_client(inst, client);
- DbgPrint("(Subscribed) Created package: %s\n", info->dbox_id);
- }
- break;
- case ALTER_DESTROY:
- if (instance_has_client(inst, client)) {
- instance_unicast_deleted_event(inst, client, DBOX_STATUS_ERROR_NONE);
- instance_del_client(inst, client);
- }
- break;
- default:
- break;
+ case ALTER_DESTROY:
+ if (instance_has_client(inst, client)) {
+ instance_del_client(inst, client);
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ case INST_ACTIVATED: /*!< This instance is actiavted, and used */
+ case INST_REQUEST_TO_REACTIVATE: /*!< This instance will be reactivated soon */
+ case INST_REQUEST_TO_DESTROY: /*!< This instance will be destroy soon */
+ /*!
+ * \note
+ * Instances are lives in the system cluster/sub-cluster
+ */
+ switch (alter) {
+ case ALTER_CREATE:
+ if (!instance_has_client(inst, client)) {
+ instance_unicast_created_event(inst, client);
+ instance_add_client(inst, client);
+ DbgPrint("(Subscribed) Created package: %s\n", info->dbox_id);
+ }
+ break;
+ case ALTER_DESTROY:
+ if (instance_has_client(inst, client)) {
+ instance_unicast_deleted_event(inst, client, DBOX_STATUS_ERROR_NONE);
+ instance_del_client(inst, client);
}
-
break;
default:
- DbgPrint("%s(%s) is not activated (%d)\n",
- package_name(info), instance_id(inst), instance_state(inst));
break;
+ }
+
+ break;
+ default:
+ DbgPrint("%s(%s) is not activated (%d)\n",
+ package_name(info), instance_id(inst), instance_state(inst));
+ break;
}
}
}
while (state != ERROR && state != END) {
switch (state) {
- case START:
- switch (buffer[i]) {
- case '1'...'9':
- state = WIDTH;
- break;
- case ' ':
- case '\t':
- case ';':
- i++;
- break;
- case '\0':
- state = END;
- break;
- default:
- state = ERROR;
- break;
- }
+ case START:
+ switch (buffer[i]) {
+ case '1'...'9':
+ state = WIDTH;
break;
- case WIDTH:
- switch (buffer[i]) {
- case '0'...'9':
- w = (w * 10) + (buffer[i] - '0');
- i++;
- break;
- case 'x':
- state = DELIM;
- i++;
- break;
- default:
- state = ERROR;
- break;
- }
-
+ case ' ':
+ case '\t':
+ case ';':
+ i++;
break;
- case DELIM:
- switch (buffer[i]) {
- case '1'...'9':
- state = HEIGHT;
- break;
- case ' ':
- case '\t':
- i++;
- break;
- default:
- state = ERROR;
- break;
- }
+ case '\0':
+ state = END;
break;
- case HEIGHT:
- switch (buffer[i]) {
- case '0'...'9':
- h = (h * 10) + (buffer[i] - '0');
- i++;
- break;
- case ';':
- case '\0':
- state = STOP;
- break;
- default:
- state = ERROR;
- break;
- }
+ default:
+ state = ERROR;
break;
- case STOP:
- if (w == 1 && h == 1) {
- *size |= DBOX_SIZE_TYPE_1x1;
- } else if (w == 2 && h == 1) {
- *size |= DBOX_SIZE_TYPE_2x1;
- } else if (w == 2 && h == 2) {
- *size |= DBOX_SIZE_TYPE_2x2;
- } else if (w == 4 && h == 1) {
- *size |= DBOX_SIZE_TYPE_4x1;
- } else if (w == 4 && h == 2) {
- *size |= DBOX_SIZE_TYPE_4x2;
- } else if (w == 4 && h == 3) {
- *size |= DBOX_SIZE_TYPE_4x3;
- } else if (w == 4 && h == 4) {
- *size |= DBOX_SIZE_TYPE_4x4;
- } else if (w == 21 && h == 21) {
- *size |= DBOX_SIZE_TYPE_EASY_1x1;
- } else if (w == 23 && h == 21) {
- *size |= DBOX_SIZE_TYPE_EASY_3x1;
- } else if (w == 23 && h == 23) {
- *size |= DBOX_SIZE_TYPE_EASY_3x3;
- } else {
- ErrPrint("Invalid size type: %dx%d\n", w, h);
- }
-
- if (buffer[i] == ';') {
- state = START;
- } else if (buffer[i] == '\0') {
- state = END;
- }
+ }
+ break;
+ case WIDTH:
+ switch (buffer[i]) {
+ case '0'...'9':
+ w = (w * 10) + (buffer[i] - '0');
+ i++;
+ break;
+ case 'x':
+ state = DELIM;
+ i++;
+ break;
+ default:
+ state = ERROR;
+ break;
+ }
- w = 0;
- h = 0;
+ break;
+ case DELIM:
+ switch (buffer[i]) {
+ case '1'...'9':
+ state = HEIGHT;
+ break;
+ case ' ':
+ case '\t':
+ i++;
+ break;
+ default:
+ state = ERROR;
+ break;
+ }
+ break;
+ case HEIGHT:
+ switch (buffer[i]) {
+ case '0'...'9':
+ h = (h * 10) + (buffer[i] - '0');
+ i++;
+ break;
+ case ';':
+ case '\0':
+ state = STOP;
break;
default:
- return -1;
+ state = ERROR;
+ break;
+ }
+ break;
+ case STOP:
+ if (w == 1 && h == 1) {
+ *size |= DBOX_SIZE_TYPE_1x1;
+ } else if (w == 2 && h == 1) {
+ *size |= DBOX_SIZE_TYPE_2x1;
+ } else if (w == 2 && h == 2) {
+ *size |= DBOX_SIZE_TYPE_2x2;
+ } else if (w == 4 && h == 1) {
+ *size |= DBOX_SIZE_TYPE_4x1;
+ } else if (w == 4 && h == 2) {
+ *size |= DBOX_SIZE_TYPE_4x2;
+ } else if (w == 4 && h == 3) {
+ *size |= DBOX_SIZE_TYPE_4x3;
+ } else if (w == 4 && h == 4) {
+ *size |= DBOX_SIZE_TYPE_4x4;
+ } else if (w == 21 && h == 21) {
+ *size |= DBOX_SIZE_TYPE_EASY_1x1;
+ } else if (w == 23 && h == 21) {
+ *size |= DBOX_SIZE_TYPE_EASY_3x1;
+ } else if (w == 23 && h == 23) {
+ *size |= DBOX_SIZE_TYPE_EASY_3x3;
+ } else {
+ ErrPrint("Invalid size type: %dx%d\n", w, h);
+ }
+
+ if (buffer[i] == ';') {
+ state = START;
+ } else if (buffer[i] == '\0') {
+ state = END;
+ }
+
+ w = 0;
+ h = 0;
+ break;
+ default:
+ return -1;
}
}
}
switch (state) {
- case COMMENT:
- if (c == CR || c == LF || c == EOF) {
+ case COMMENT:
+ if (c == CR || c == LF || c == EOF) {
+ buffer[buffer_idx] = '\0';
+
+ state = START;
+ token_idx = -1;
+ ch_idx = 0;
+ buffer_idx = 0;
+ linelen = -1; /* Will be ZERO by follwing increment code */
+ quote = 0;
+ } else {
+ buffer[buffer_idx++] = c;
+ if (buffer_idx == (sizeof(buffer) - 1)) {
buffer[buffer_idx] = '\0';
-
- state = START;
- token_idx = -1;
- ch_idx = 0;
buffer_idx = 0;
- linelen = -1; /* Will be ZERO by follwing increment code */
- quote = 0;
- } else {
+ }
+ }
+ break;
+ case START:
+ if (linelen == 0 && c == '#') {
+ state = COMMENT;
+ } else if (isspace(c)) {
+ /* Ignore empty space */
+ } else {
+ state = TOKEN;
+ ungetc(c, fp);
+ }
+ break;
+ case SPACE:
+ if (c == '=') {
+ state = VALUE;
+ } else if (!isspace(c)) {
+ state = ERROR;
+ }
+ break;
+ case VALUE:
+ if (c == '"') {
+ if (quote == 1) {
+ buffer[buffer_idx] = '\0';
+ state = END;
+ } else if (buffer_idx != 0) {
buffer[buffer_idx++] = c;
- if (buffer_idx == (sizeof(buffer) - 1)) {
- buffer[buffer_idx] = '\0';
- buffer_idx = 0;
+ if (buffer_idx >= sizeof(buffer)) {
+ state = ERROR;
}
+ } else {
+ quote = 1;
}
- break;
- case START:
- if (linelen == 0 && c == '#') {
- state = COMMENT;
- } else if (isspace(c)) {
- /* Ignore empty space */
+ } else if (isspace(c)) {
+ if (buffer_idx == 0) {
+ /* Ignore */
+ } else if (quote == 1) {
+ buffer[buffer_idx++] = c;
+ if (buffer_idx >= sizeof(buffer)) {
+ state = ERROR;
+ }
} else {
- state = TOKEN;
+ buffer[buffer_idx] = '\0';
ungetc(c, fp);
+ state = END;
}
- break;
- case SPACE:
- if (c == '=') {
- state = VALUE;
- } else if (!isspace(c)) {
+ } else {
+ buffer[buffer_idx++] = c;
+ if (buffer_idx >= sizeof(buffer)) {
state = ERROR;
}
- break;
- case VALUE:
- if (c == '"') {
- if (quote == 1) {
- buffer[buffer_idx] = '\0';
- state = END;
- } else if (buffer_idx != 0) {
- buffer[buffer_idx++] = c;
- if (buffer_idx >= sizeof(buffer)) {
- state = ERROR;
- }
- } else {
- quote = 1;
- }
- } else if (isspace(c)) {
- if (buffer_idx == 0) {
- /* Ignore */
- } else if (quote == 1) {
- buffer[buffer_idx++] = c;
- if (buffer_idx >= sizeof(buffer)) {
- state = ERROR;
- }
- } else {
- buffer[buffer_idx] = '\0';
- ungetc(c, fp);
- state = END;
- }
+ }
+ break;
+ case TOKEN:
+ if (c == '=') {
+ if (token_idx < 0) {
+ state = ERROR;
} else {
- buffer[buffer_idx++] = c;
- if (buffer_idx >= sizeof(buffer)) {
- state = ERROR;
- }
+ state = VALUE;
+ }
+ } else if (isspace(c)) {
+ if (token_idx < 0) {
+ break;
}
- break;
- case TOKEN:
- if (c == '=') {
- if (token_idx < 0) {
- state = ERROR;
- } else {
- state = VALUE;
- }
- } else if (isspace(c)) {
- if (token_idx < 0) {
- break;
- }
- if (token_handler[token_idx].name[ch_idx] != '\0') {
- state = ERROR;
- } else {
- state = SPACE;
- }
- } else {
- if (token_idx < 0) {
- /* Now start to find a token! */
- token_idx = 0;
+ if (token_handler[token_idx].name[ch_idx] != '\0') {
+ state = ERROR;
+ } else {
+ state = SPACE;
+ }
+ } else {
+ if (token_idx < 0) {
+ /* Now start to find a token! */
+ token_idx = 0;
+ }
+
+ if (token_handler[token_idx].name[ch_idx] == c) {
+ ch_idx++;
+ } else {
+ ungetc(c, fp);
+ while (ch_idx-- > 0) {
+ ungetc(token_handler[token_idx].name[ch_idx], fp);
}
- if (token_handler[token_idx].name[ch_idx] == c) {
- ch_idx++;
+ token_idx++;
+
+ if (token_handler[token_idx].name == NULL) {
+ state = ERROR;
} else {
- ungetc(c, fp);
- while (ch_idx-- > 0) {
- ungetc(token_handler[token_idx].name[ch_idx], fp);
- }
-
- token_idx++;
-
- if (token_handler[token_idx].name == NULL) {
- state = ERROR;
- } else {
- ch_idx = 0;
- }
+ ch_idx = 0;
}
}
- break;
- case ERROR:
- if (c == CR || c == LF || c == EOF) {
- state = START;
- token_idx = -1;
- buffer_idx = 0;
- ch_idx = 0;
- linelen = -1;
- quote = 0;
+ }
+ break;
+ case ERROR:
+ if (c == CR || c == LF || c == EOF) {
+ state = START;
+ token_idx = -1;
+ buffer_idx = 0;
+ ch_idx = 0;
+ linelen = -1;
+ quote = 0;
+ }
+ break;
+ case END:
+ if (c == LF || c == CR || c == EOF) {
+ state = START;
+
+ /*!
+ * \NOTE
+ * Make the string terminator
+ */
+ buffer[buffer_idx] = '\0';
+
+ if (token_idx >= 0 && token_handler[token_idx].handler) {
+ token_handler[token_idx].handler(item, buffer);
}
- break;
- case END:
- if (c == LF || c == CR || c == EOF) {
- state = START;
-
- /*!
- * \NOTE
- * Make the string terminator
- */
- buffer[buffer_idx] = '\0';
-
- if (token_idx >= 0 && token_handler[token_idx].handler) {
- token_handler[token_idx].handler(item, buffer);
- }
- token_idx = -1;
- ch_idx = 0;
- buffer_idx = 0;
- linelen = -1;
- quote = 0;
- /* Finish */
- } else if (isspace(c)) {
- /* ignore */
- } else {
- state = ERROR;
- }
- break;
- default:
- /* ?? */
- break;
+ token_idx = -1;
+ ch_idx = 0;
+ buffer_idx = 0;
+ linelen = -1;
+ quote = 0;
+ /* Finish */
+ } else if (isspace(c)) {
+ /* ignore */
+ } else {
+ state = ERROR;
+ }
+ break;
+ default:
+ /* ?? */
+ break;
}
linelen++;
static inline void invoke_callback(const char *pkgname, struct item *item, double value)
{
switch (item->type) {
- case PKGMGR_EVENT_DOWNLOAD:
- invoke_download_event_handler(pkgname, item->status, value);
- break;
- case PKGMGR_EVENT_UNINSTALL:
- invoke_uninstall_event_handler(pkgname, item->status, value);
- break;
- case PKGMGR_EVENT_INSTALL:
- invoke_install_event_handler(pkgname, item->status, value);
- break;
- case PKGMGR_EVENT_UPDATE:
- invoke_update_event_handler(pkgname, item->status, value);
- break;
- case PKGMGR_EVENT_RECOVER:
- invoke_recover_event_handler(pkgname, item->status, value);
- break;
- default:
- ErrPrint("Unknown type: %d\n", item->type);
- break;
+ case PKGMGR_EVENT_DOWNLOAD:
+ invoke_download_event_handler(pkgname, item->status, value);
+ break;
+ case PKGMGR_EVENT_UNINSTALL:
+ invoke_uninstall_event_handler(pkgname, item->status, value);
+ break;
+ case PKGMGR_EVENT_INSTALL:
+ invoke_install_event_handler(pkgname, item->status, value);
+ break;
+ case PKGMGR_EVENT_UPDATE:
+ invoke_update_event_handler(pkgname, item->status, value);
+ break;
+ case PKGMGR_EVENT_RECOVER:
+ invoke_recover_event_handler(pkgname, item->status, value);
+ break;
+ default:
+ ErrPrint("Unknown type: %d\n", item->type);
+ break;
}
}
const char *expected_status;
switch (item->type) {
- case PKGMGR_EVENT_DOWNLOAD:
- expected_status = "download";
- break;
- case PKGMGR_EVENT_UNINSTALL:
- expected_status = "uninstall";
- break;
- case PKGMGR_EVENT_INSTALL:
- expected_status = "install";
- break;
- case PKGMGR_EVENT_UPDATE:
- expected_status = "update";
- break;
- case PKGMGR_EVENT_RECOVER:
- expected_status = "recover";
- break;
- default:
- return 0;
+ case PKGMGR_EVENT_DOWNLOAD:
+ expected_status = "download";
+ break;
+ case PKGMGR_EVENT_UNINSTALL:
+ expected_status = "uninstall";
+ break;
+ case PKGMGR_EVENT_INSTALL:
+ expected_status = "install";
+ break;
+ case PKGMGR_EVENT_UPDATE:
+ expected_status = "update";
+ break;
+ case PKGMGR_EVENT_RECOVER:
+ expected_status = "recover";
+ break;
+ default:
+ return 0;
}
return !strcasecmp(status, expected_status);
}
switch (item->status) {
- case PKGMGR_STATUS_START:
- case PKGMGR_STATUS_COMMAND:
- item->status = PKGMGR_STATUS_PROCESSING;
- case PKGMGR_STATUS_PROCESSING:
- break;
- default:
- ErrPrint("Invalid state [%s, %s]\n", pkgname, val);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ case PKGMGR_STATUS_START:
+ case PKGMGR_STATUS_COMMAND:
+ item->status = PKGMGR_STATUS_PROCESSING;
+ case PKGMGR_STATUS_PROCESSING:
+ break;
+ default:
+ ErrPrint("Invalid state [%s, %s]\n", pkgname, val);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (val) {
}
switch (item->status) {
- case PKGMGR_STATUS_START:
- case PKGMGR_STATUS_COMMAND:
- item->status = PKGMGR_STATUS_PROCESSING;
- case PKGMGR_STATUS_PROCESSING:
- break;
- default:
- ErrPrint("Invalid state [%s, %s]\n", pkgname, val);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ case PKGMGR_STATUS_START:
+ case PKGMGR_STATUS_COMMAND:
+ item->status = PKGMGR_STATUS_PROCESSING;
+ case PKGMGR_STATUS_PROCESSING:
+ break;
+ default:
+ ErrPrint("Invalid state [%s, %s]\n", pkgname, val);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
if (val) {
item->data = data;
switch (type) {
- case PKGMGR_EVENT_DOWNLOAD:
- s_info.download_event = eina_list_prepend(s_info.download_event, item);
- break;
- case PKGMGR_EVENT_UNINSTALL:
- s_info.uninstall_event = eina_list_prepend(s_info.uninstall_event, item);
- break;
- case PKGMGR_EVENT_INSTALL:
- s_info.install_event = eina_list_prepend(s_info.install_event, item);
- break;
- case PKGMGR_EVENT_UPDATE:
- s_info.update_event = eina_list_prepend(s_info.update_event, item);
- break;
- case PKGMGR_EVENT_RECOVER:
- s_info.recover_event = eina_list_prepend(s_info.recover_event, item);
- break;
- default:
- DbgFree(item);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ case PKGMGR_EVENT_DOWNLOAD:
+ s_info.download_event = eina_list_prepend(s_info.download_event, item);
+ break;
+ case PKGMGR_EVENT_UNINSTALL:
+ s_info.uninstall_event = eina_list_prepend(s_info.uninstall_event, item);
+ break;
+ case PKGMGR_EVENT_INSTALL:
+ s_info.install_event = eina_list_prepend(s_info.install_event, item);
+ break;
+ case PKGMGR_EVENT_UPDATE:
+ s_info.update_event = eina_list_prepend(s_info.update_event, item);
+ break;
+ case PKGMGR_EVENT_RECOVER:
+ s_info.recover_event = eina_list_prepend(s_info.recover_event, item);
+ break;
+ default:
+ DbgFree(item);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return DBOX_STATUS_ERROR_NONE;
void *cbdata = NULL;
switch (type) {
- case PKGMGR_EVENT_DOWNLOAD:
- EINA_LIST_FOREACH(s_info.download_event, l, item) {
- if (item->cb == cb && item->data == data) {
- s_info.download_event = eina_list_remove(s_info.download_event, item);
- cbdata = item->data;
- DbgFree(item);
- break;
- }
+ case PKGMGR_EVENT_DOWNLOAD:
+ EINA_LIST_FOREACH(s_info.download_event, l, item) {
+ if (item->cb == cb && item->data == data) {
+ s_info.download_event = eina_list_remove(s_info.download_event, item);
+ cbdata = item->data;
+ DbgFree(item);
+ break;
}
- break;
- case PKGMGR_EVENT_UNINSTALL:
- EINA_LIST_FOREACH(s_info.uninstall_event, l, item) {
- if (item->cb == cb && item->data == data) {
- s_info.uninstall_event = eina_list_remove(s_info.uninstall_event, item);
- cbdata = item->data;
- DbgFree(item);
- break;
- }
+ }
+ break;
+ case PKGMGR_EVENT_UNINSTALL:
+ EINA_LIST_FOREACH(s_info.uninstall_event, l, item) {
+ if (item->cb == cb && item->data == data) {
+ s_info.uninstall_event = eina_list_remove(s_info.uninstall_event, item);
+ cbdata = item->data;
+ DbgFree(item);
+ break;
}
- break;
- case PKGMGR_EVENT_INSTALL:
- EINA_LIST_FOREACH(s_info.install_event, l, item) {
- if (item->cb == cb && item->data == data) {
- s_info.install_event = eina_list_remove(s_info.install_event, item);
- cbdata = item->data;
- DbgFree(item);
- break;
- }
+ }
+ break;
+ case PKGMGR_EVENT_INSTALL:
+ EINA_LIST_FOREACH(s_info.install_event, l, item) {
+ if (item->cb == cb && item->data == data) {
+ s_info.install_event = eina_list_remove(s_info.install_event, item);
+ cbdata = item->data;
+ DbgFree(item);
+ break;
}
- break;
- case PKGMGR_EVENT_UPDATE:
- EINA_LIST_FOREACH(s_info.update_event, l, item) {
- if (item->cb == cb && item->data == data) {
- s_info.update_event = eina_list_remove(s_info.update_event, item);
- cbdata = item->data;
- DbgFree(item);
- break;
- }
+ }
+ break;
+ case PKGMGR_EVENT_UPDATE:
+ EINA_LIST_FOREACH(s_info.update_event, l, item) {
+ if (item->cb == cb && item->data == data) {
+ s_info.update_event = eina_list_remove(s_info.update_event, item);
+ cbdata = item->data;
+ DbgFree(item);
+ break;
}
- break;
- case PKGMGR_EVENT_RECOVER:
- EINA_LIST_FOREACH(s_info.recover_event, l, item) {
- if (item->cb == cb && item->data == data) {
- s_info.recover_event = eina_list_remove(s_info.recover_event, item);
- cbdata = item->data;
- DbgFree(item);
- break;
- }
+ }
+ break;
+ case PKGMGR_EVENT_RECOVER:
+ EINA_LIST_FOREACH(s_info.recover_event, l, item) {
+ if (item->cb == cb && item->data == data) {
+ s_info.recover_event = eina_list_remove(s_info.recover_event, item);
+ cbdata = item->data;
+ DbgFree(item);
+ break;
}
- break;
- default:
- ErrPrint("Invalid type\n");
- break;
+ }
+ break;
+ default:
+ ErrPrint("Invalid type\n");
+ break;
}
return cbdata;
state = BEGIN;
while (*fileptr && state != ERROR) {
switch (state) {
- case BEGIN:
- if (*fileptr == '{') {
- block = calloc(1, sizeof(*block));
- if (!block) {
- ErrPrint("calloc: %s\n", strerror(errno));
- state = ERROR;
- continue;
- }
- state = FIELD;
- ptr = NULL;
+ case BEGIN:
+ if (*fileptr == '{') {
+ block = calloc(1, sizeof(*block));
+ if (!block) {
+ ErrPrint("calloc: %s\n", strerror(errno));
+ state = ERROR;
+ continue;
}
- break;
- case FIELD:
- if (isspace(*fileptr)) {
- if (ptr != NULL) {
- *fileptr = '\0';
- }
- } else if (*fileptr == '=') {
+ state = FIELD;
+ ptr = NULL;
+ }
+ break;
+ case FIELD:
+ if (isspace(*fileptr)) {
+ if (ptr != NULL) {
*fileptr = '\0';
- ptr = NULL;
- state = DATA;
- } else if (ptr == NULL) {
- ptr = fileptr;
- field_idx = 0;
- field_len = 0;
+ }
+ } else if (*fileptr == '=') {
+ *fileptr = '\0';
+ ptr = NULL;
+ state = DATA;
+ } else if (ptr == NULL) {
+ ptr = fileptr;
+ field_idx = 0;
+ field_len = 0;
+
+ while (field_list[field_idx]) {
+ if (field_list[field_idx][field_len] == *fileptr) {
+ break;
+ }
+ field_idx++;
+ }
+ if (!field_list[field_idx]) {
+ ErrPrint("Invalid field\n");
+ state = ERROR;
+ continue;
+ }
+
+ field_len++;
+ } else {
+ if (field_list[field_idx][field_len] != *fileptr) {
+ field_idx++;
while (field_list[field_idx]) {
- if (field_list[field_idx][field_len] == *fileptr) {
+ if (!strncmp(field_list[field_idx], fileptr - field_len, field_len)) {
break;
+ } else {
+ field_idx++;
}
- field_idx++;
}
if (!field_list[field_idx]) {
- ErrPrint("Invalid field\n");
state = ERROR;
+ ErrPrint("field is not valid\n");
continue;
}
+ }
- field_len++;
- } else {
- if (field_list[field_idx][field_len] != *fileptr) {
- field_idx++;
- while (field_list[field_idx]) {
- if (!strncmp(field_list[field_idx], fileptr - field_len, field_len)) {
- break;
- } else {
- field_idx++;
- }
- }
+ field_len++;
+ }
+ break;
+ case DATA:
+ switch (field_idx) {
+ case FIELD_TYPE:
+ if (ptr == NULL) {
+ if (isspace(*fileptr)) {
+ break;
+ }
- if (!field_list[field_idx]) {
- state = ERROR;
- ErrPrint("field is not valid\n");
- continue;
- }
+ if (*fileptr == '\0') {
+ state = ERROR;
+ ErrPrint("Type is not valid\n");
+ continue;
}
- field_len++;
+ ptr = fileptr;
+ type_idx = 0;
+ type_len = 0;
}
- break;
- case DATA:
- switch (field_idx) {
- case FIELD_TYPE:
- if (ptr == NULL) {
- if (isspace(*fileptr)) {
- break;
- }
-
- if (*fileptr == '\0') {
- state = ERROR;
- ErrPrint("Type is not valid\n");
- continue;
- }
-
- ptr = fileptr;
- type_idx = 0;
- type_len = 0;
- }
- if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
- *fileptr = '\0';
- }
+ if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
+ *fileptr = '\0';
+ }
- if (type_list[type_idx][type_len] != *fileptr) {
+ if (type_list[type_idx][type_len] != *fileptr) {
+ type_idx++;
+ while (type_list[type_idx]) {
+ if (!strncmp(type_list[type_idx], fileptr - type_len, type_len)) {
+ break;
+ } else {
type_idx++;
- while (type_list[type_idx]) {
- if (!strncmp(type_list[type_idx], fileptr - type_len, type_len)) {
- break;
- } else {
- type_idx++;
- }
- }
-
- if (!type_list[type_idx]) {
- state = ERROR;
- ErrPrint("type is not valid (%s)\n", fileptr - type_len);
- continue;
- }
}
+ }
- if (!*fileptr) {
- block->type = type_idx;
- state = DONE;
- ptr = NULL;
- }
+ if (!type_list[type_idx]) {
+ state = ERROR;
+ ErrPrint("type is not valid (%s)\n", fileptr - type_len);
+ continue;
+ }
+ }
- type_len++;
- break;
- case FIELD_PART:
- if (ptr == NULL) {
- ptr = fileptr;
- }
+ if (!*fileptr) {
+ block->type = type_idx;
+ state = DONE;
+ ptr = NULL;
+ }
- if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
- *fileptr = '\0';
- }
+ type_len++;
+ break;
+ case FIELD_PART:
+ if (ptr == NULL) {
+ ptr = fileptr;
+ }
- if (!*fileptr) {
- block->part = ptr;
- state = DONE;
- ptr = NULL;
- }
- break;
- case FIELD_DATA:
- if (ptr == NULL) {
- ptr = fileptr;
- }
+ if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
+ *fileptr = '\0';
+ }
- if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
- *fileptr = '\0';
- }
+ if (!*fileptr) {
+ block->part = ptr;
+ state = DONE;
+ ptr = NULL;
+ }
+ break;
+ case FIELD_DATA:
+ if (ptr == NULL) {
+ ptr = fileptr;
+ }
- if (!*fileptr) {
- block->data = ptr;
- state = DONE;
- ptr = NULL;
- }
- break;
- case FIELD_OPTION:
- if (ptr == NULL) {
- ptr = fileptr;
- }
+ if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
+ *fileptr = '\0';
+ }
- if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
- *fileptr = '\0';
- }
+ if (!*fileptr) {
+ block->data = ptr;
+ state = DONE;
+ ptr = NULL;
+ }
+ break;
+ case FIELD_OPTION:
+ if (ptr == NULL) {
+ ptr = fileptr;
+ }
- if (!*fileptr) {
- block->option = ptr;
- state = DONE;
- ptr = NULL;
- }
- break;
- case FIELD_ID:
- if (ptr == NULL) {
- ptr = fileptr;
- }
+ if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
+ *fileptr = '\0';
+ }
- if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
- *fileptr = '\0';
- }
+ if (!*fileptr) {
+ block->option = ptr;
+ state = DONE;
+ ptr = NULL;
+ }
+ break;
+ case FIELD_ID:
+ if (ptr == NULL) {
+ ptr = fileptr;
+ }
- if (!*fileptr) {
- block->id = ptr;
- state = DONE;
- ptr = NULL;
- }
- break;
- case FIELD_TARGET:
- if (ptr == NULL) {
- ptr = fileptr;
- }
+ if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
+ *fileptr = '\0';
+ }
- if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
- *fileptr = '\0';
- }
+ if (!*fileptr) {
+ block->id = ptr;
+ state = DONE;
+ ptr = NULL;
+ }
+ break;
+ case FIELD_TARGET:
+ if (ptr == NULL) {
+ ptr = fileptr;
+ }
- if (!*fileptr) {
- block->target = ptr;
- state = DONE;
- ptr = NULL;
- }
- break;
- case FIELD_FILE:
- if (ptr == NULL) {
- ptr = fileptr;
- }
+ if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
+ *fileptr = '\0';
+ }
- if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
- *fileptr = '\0';
- }
+ if (!*fileptr) {
+ block->target = ptr;
+ state = DONE;
+ ptr = NULL;
+ }
+ break;
+ case FIELD_FILE:
+ if (ptr == NULL) {
+ ptr = fileptr;
+ }
- if (!*fileptr) {
- block->target = ptr;
- state = DONE;
- ptr = NULL;
- }
- default:
- break;
+ if (*fileptr && (*fileptr == '\n' || *fileptr == '\r' || *fileptr == '\f')) {
+ *fileptr = '\0';
}
- break;
- case DONE:
- if (isspace(*fileptr)) {
- } else if (*fileptr == '}') {
- state = BEGIN;
- block->filename = filename;
- block_list = eina_list_append(block_list, block);
- block = NULL;
- } else {
- state = FIELD;
- continue;
+ if (!*fileptr) {
+ block->target = ptr;
+ state = DONE;
+ ptr = NULL;
}
- break;
- case END:
default:
break;
+ }
+
+ break;
+ case DONE:
+ if (isspace(*fileptr)) {
+ } else if (*fileptr == '}') {
+ state = BEGIN;
+ block->filename = filename;
+ block_list = eina_list_append(block_list, block);
+ block = NULL;
+ } else {
+ state = FIELD;
+ continue;
+ }
+ break;
+ case END:
+ default:
+ break;
}
fileptr++;
}
switch (state) {
- case EVENT_STATE_ACTIVATE:
- cmd = CMD_DBOX_KEY_DOWN;
- break;
- case EVENT_STATE_ACTIVATED:
- cmd = CMD_DBOX_KEY_DOWN;
- break;
- case EVENT_STATE_DEACTIVATE:
- cmd = CMD_DBOX_KEY_UP;
- break;
- default:
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ case EVENT_STATE_ACTIVATE:
+ cmd = CMD_DBOX_KEY_DOWN;
+ break;
+ case EVENT_STATE_ACTIVATED:
+ cmd = CMD_DBOX_KEY_DOWN;
+ break;
+ case EVENT_STATE_DEACTIVATE:
+ cmd = CMD_DBOX_KEY_UP;
+ break;
+ default:
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
packet = packet_create_noack((const char *)&cmd, "ssdi", package_name(pkg), instance_id(inst), event_info->tv, event_info->keycode);
}
switch (state) {
- case EVENT_STATE_ACTIVATE:
- cmd = CMD_DBOX_MOUSE_DOWN;
- break;
- case EVENT_STATE_ACTIVATED:
- cmd = CMD_DBOX_MOUSE_MOVE;
- break;
- case EVENT_STATE_DEACTIVATE:
- cmd = CMD_DBOX_MOUSE_UP;
- break;
- default:
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ case EVENT_STATE_ACTIVATE:
+ cmd = CMD_DBOX_MOUSE_DOWN;
+ break;
+ case EVENT_STATE_ACTIVATED:
+ cmd = CMD_DBOX_MOUSE_MOVE;
+ break;
+ case EVENT_STATE_DEACTIVATE:
+ cmd = CMD_DBOX_MOUSE_UP;
+ break;
+ default:
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
packet = packet_create_noack((const char *)&cmd, "ssdii", package_name(pkg), instance_id(inst), event_info->tv, event_info->x, event_info->y);
timestamp = event_info->tv;
switch (state) {
- case EVENT_STATE_ACTIVATE:
- script_handler_update_keycode(script, event_info->keycode);
- (void)script_handler_feed_event(script, DBOX_SCRIPT_KEY_DOWN, timestamp);
- break;
- case EVENT_STATE_ACTIVATED:
- script_handler_update_keycode(script, event_info->keycode);
- (void)script_handler_feed_event(script, DBOX_SCRIPT_KEY_DOWN, timestamp);
- break;
- case EVENT_STATE_DEACTIVATE:
- script_handler_update_keycode(script, event_info->keycode);
- (void)script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_UP, timestamp);
- break;
- default:
- ErrPrint("Unknown event\n");
- break;
+ case EVENT_STATE_ACTIVATE:
+ script_handler_update_keycode(script, event_info->keycode);
+ (void)script_handler_feed_event(script, DBOX_SCRIPT_KEY_DOWN, timestamp);
+ break;
+ case EVENT_STATE_ACTIVATED:
+ script_handler_update_keycode(script, event_info->keycode);
+ (void)script_handler_feed_event(script, DBOX_SCRIPT_KEY_DOWN, timestamp);
+ break;
+ case EVENT_STATE_DEACTIVATE:
+ script_handler_update_keycode(script, event_info->keycode);
+ (void)script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_UP, timestamp);
+ break;
+ default:
+ ErrPrint("Unknown event\n");
+ break;
}
return 0;
timestamp = event_info->tv;
switch (state) {
- case EVENT_STATE_ACTIVATE:
- script_handler_update_pointer(script, event_info->x, event_info->y, 1);
- (void)script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_DOWN, timestamp);
- break;
- case EVENT_STATE_ACTIVATED:
- script_handler_update_pointer(script, event_info->x, event_info->y, -1);
- (void)script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_MOVE, timestamp);
- break;
- case EVENT_STATE_DEACTIVATE:
- script_handler_update_pointer(script, event_info->x, event_info->y, 0);
- (void)script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_UP, timestamp);
- break;
- default:
- break;
+ case EVENT_STATE_ACTIVATE:
+ script_handler_update_pointer(script, event_info->x, event_info->y, 1);
+ (void)script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_DOWN, timestamp);
+ break;
+ case EVENT_STATE_ACTIVATED:
+ script_handler_update_pointer(script, event_info->x, event_info->y, -1);
+ (void)script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_MOVE, timestamp);
+ break;
+ case EVENT_STATE_DEACTIVATE:
+ script_handler_update_pointer(script, event_info->x, event_info->y, 0);
+ (void)script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_UP, timestamp);
+ break;
+ default:
+ break;
}
return 0;
}
switch (state) {
- case EVENT_STATE_ACTIVATE:
- cmd = CMD_GBAR_KEY_DOWN;
- break;
- case EVENT_STATE_ACTIVATED:
- cmd = CMD_GBAR_KEY_DOWN;
- break;
- case EVENT_STATE_DEACTIVATE:
- cmd = CMD_GBAR_KEY_UP;
- break;
- default:
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ case EVENT_STATE_ACTIVATE:
+ cmd = CMD_GBAR_KEY_DOWN;
+ break;
+ case EVENT_STATE_ACTIVATED:
+ cmd = CMD_GBAR_KEY_DOWN;
+ break;
+ case EVENT_STATE_DEACTIVATE:
+ cmd = CMD_GBAR_KEY_UP;
+ break;
+ default:
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
packet = packet_create_noack((const char *)&cmd, "ssdi", package_name(pkg), instance_id(inst), event_info->tv, event_info->keycode);
}
switch (state) {
- case EVENT_STATE_ACTIVATE:
- cmd = CMD_GBAR_MOUSE_DOWN;
- break;
- case EVENT_STATE_ACTIVATED:
- cmd = CMD_GBAR_MOUSE_MOVE;
- break;
- case EVENT_STATE_DEACTIVATE:
- cmd = CMD_GBAR_MOUSE_UP;
- break;
- default:
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ case EVENT_STATE_ACTIVATE:
+ cmd = CMD_GBAR_MOUSE_DOWN;
+ break;
+ case EVENT_STATE_ACTIVATED:
+ cmd = CMD_GBAR_MOUSE_MOVE;
+ break;
+ case EVENT_STATE_DEACTIVATE:
+ cmd = CMD_GBAR_MOUSE_UP;
+ break;
+ default:
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
packet = packet_create_noack((const char *)&cmd, "ssdii", package_name(pkg), instance_id(inst), event_info->tv, event_info->x, event_info->y);
timestamp = event_info->tv;
switch (state) {
- case EVENT_STATE_ACTIVATE:
- script_handler_update_keycode(script, event_info->keycode);
- (void)script_handler_feed_event(script, DBOX_SCRIPT_KEY_DOWN, timestamp);
- break;
- case EVENT_STATE_ACTIVATED:
- script_handler_update_keycode(script, event_info->keycode);
- (void)script_handler_feed_event(script, DBOX_SCRIPT_KEY_DOWN, timestamp);
- break;
- case EVENT_STATE_DEACTIVATE:
- script_handler_update_keycode(script, event_info->keycode);
- (void)script_handler_feed_event(script, DBOX_SCRIPT_KEY_UP, timestamp);
- break;
- default:
- ErrPrint("Unknown event\n");
- break;
+ case EVENT_STATE_ACTIVATE:
+ script_handler_update_keycode(script, event_info->keycode);
+ (void)script_handler_feed_event(script, DBOX_SCRIPT_KEY_DOWN, timestamp);
+ break;
+ case EVENT_STATE_ACTIVATED:
+ script_handler_update_keycode(script, event_info->keycode);
+ (void)script_handler_feed_event(script, DBOX_SCRIPT_KEY_DOWN, timestamp);
+ break;
+ case EVENT_STATE_DEACTIVATE:
+ script_handler_update_keycode(script, event_info->keycode);
+ (void)script_handler_feed_event(script, DBOX_SCRIPT_KEY_UP, timestamp);
+ break;
+ default:
+ ErrPrint("Unknown event\n");
+ break;
}
return 0;
timestamp = event_info->tv;
switch (state) {
- case EVENT_STATE_ACTIVATE:
- script_handler_update_pointer(script, event_info->x, event_info->y, 1);
- (void)script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_DOWN, timestamp);
- break;
- case EVENT_STATE_ACTIVATED:
- script_handler_update_pointer(script, event_info->x, event_info->y, -1);
- (void)script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_MOVE, timestamp);
- break;
- case EVENT_STATE_DEACTIVATE:
- script_handler_update_pointer(script, event_info->x, event_info->y, 0);
- (void)script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_UP, timestamp);
- break;
- default:
- break;
+ case EVENT_STATE_ACTIVATE:
+ script_handler_update_pointer(script, event_info->x, event_info->y, 1);
+ (void)script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_DOWN, timestamp);
+ break;
+ case EVENT_STATE_ACTIVATED:
+ script_handler_update_pointer(script, event_info->x, event_info->y, -1);
+ (void)script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_MOVE, timestamp);
+ break;
+ case EVENT_STATE_DEACTIVATE:
+ script_handler_update_pointer(script, event_info->x, event_info->y, 0);
+ (void)script_handler_feed_event(script, DBOX_SCRIPT_MOUSE_UP, timestamp);
+ break;
+ default:
+ break;
}
return 0;
}
}
} else {
switch (type) {
- case DBOX_DELETE_PERMANENTLY:
- ret = instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
- break;
- case DBOX_DELETE_TEMPORARY:
- ret = instance_destroy(inst, DBOX_DESTROY_TYPE_TEMPORARY);
- break;
- default:
- break;
+ case DBOX_DELETE_PERMANENTLY:
+ ret = instance_destroy(inst, DBOX_DESTROY_TYPE_DEFAULT);
+ break;
+ case DBOX_DELETE_TEMPORARY:
+ ret = instance_destroy(inst, DBOX_DESTROY_TYPE_TEMPORARY);
+ break;
+ default:
+ break;
}
}
}
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;
+ 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;
}
script_handler_update_pointer(script, event.x, event.y, event.type);
}
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;
+ 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;
}
script_handler_update_pointer(script, event.x, event.y, event.type);
}
switch (package_dbox_type(instance_package(inst))) {
- case DBOX_TYPE_SCRIPT:
- script_handler_resize(instance_dbox_script(inst), w, h);
- if (safe_filename) {
- (void)script_handler_parse_desc(inst, safe_filename, 0);
- } else {
- safe_filename = util_uri_to_path(id);
- (void)script_handler_parse_desc(inst, safe_filename, 0);
- }
+ case DBOX_TYPE_SCRIPT:
+ script_handler_resize(instance_dbox_script(inst), w, h);
+ if (safe_filename) {
+ (void)script_handler_parse_desc(inst, safe_filename, 0);
+ } else {
+ safe_filename = util_uri_to_path(id);
+ (void)script_handler_parse_desc(inst, safe_filename, 0);
+ }
- if (unlink(safe_filename) < 0) {
- ErrPrint("unlink: %s - %s\n", strerror(errno), safe_filename);
- }
- break;
- case DBOX_TYPE_BUFFER:
- default:
- /*!
- * \check
- * text format (inst)
- */
- instance_dbox_updated_by_instance(inst, safe_filename, x, y, w, h);
- break;
+ if (unlink(safe_filename) < 0) {
+ ErrPrint("unlink: %s - %s\n", strerror(errno), safe_filename);
+ }
+ break;
+ case DBOX_TYPE_BUFFER:
+ default:
+ /*!
+ * \check
+ * text format (inst)
+ */
+ instance_dbox_updated_by_instance(inst, safe_filename, x, y, w, h);
+ break;
}
slave_give_more_ttl(slave);
}
switch (package_gbar_type(instance_package(inst))) {
- case GBAR_TYPE_SCRIPT:
- DbgPrint("%s updated (%s)\n", instance_id(inst), descfile);
- if (script_handler_is_loaded(instance_gbar_script(inst))) {
- (void)script_handler_parse_desc(inst, descfile, 1);
- }
- break;
- case GBAR_TYPE_TEXT:
- instance_set_gbar_size(inst, 0, 0);
- case GBAR_TYPE_BUFFER:
- instance_gbar_updated(pkgname, id, descfile, x, y, w, h);
- break;
- default:
- DbgPrint("Ignore updated DESC(%s)\n", pkgname);
- break;
+ case GBAR_TYPE_SCRIPT:
+ DbgPrint("%s updated (%s)\n", instance_id(inst), descfile);
+ if (script_handler_is_loaded(instance_gbar_script(inst))) {
+ (void)script_handler_parse_desc(inst, descfile, 1);
+ }
+ break;
+ case GBAR_TYPE_TEXT:
+ instance_set_gbar_size(inst, 0, 0);
+ case GBAR_TYPE_BUFFER:
+ instance_gbar_updated(pkgname, id, descfile, x, y, w, h);
+ break;
+ default:
+ DbgPrint("Ignore updated DESC(%s)\n", pkgname);
+ break;
}
out:
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;
+ case DBOX_SHOW:
+ return "Show";
+ case DBOX_HIDE:
+ return "Hide";
+ case DBOX_HIDE_WITH_PAUSE:
+ return "Paused";
+ default:
+ break;
}
return "Unknown";
* Service!!! Receive packet & route packet
*/
switch (recv_state) {
- case RECV_INIT:
- size = packet_header_size();
- packet_offset = 0;
- recv_offset = 0;
- packet = NULL;
- ptr = malloc(size);
- if (!ptr) {
- ErrPrint("Heap: %s\n", strerror(errno));
- ret = -ENOMEM;
- break;
+ case RECV_INIT:
+ size = packet_header_size();
+ packet_offset = 0;
+ recv_offset = 0;
+ packet = NULL;
+ ptr = malloc(size);
+ if (!ptr) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ ret = -ENOMEM;
+ break;
+ }
+ recv_state = RECV_HEADER;
+ /* Go through, don't break from here */
+ case RECV_HEADER:
+ ret = secure_socket_recv(tcb->fd, ptr, size - recv_offset, &tcb->pid);
+ if (ret <= 0) {
+ if (ret == 0) {
+ ret = -ECANCELED;
}
- recv_state = RECV_HEADER;
- /* Go through, don't break from here */
- case RECV_HEADER:
- ret = secure_socket_recv(tcb->fd, ptr, size - recv_offset, &tcb->pid);
- if (ret <= 0) {
- if (ret == 0) {
- ret = -ECANCELED;
- }
- DbgFree(ptr);
- ptr = NULL;
+ DbgFree(ptr);
+ ptr = NULL;
+ break;
+ }
+
+ recv_offset += ret;
+ ret = 0;
+
+ if (recv_offset == size) {
+ packet = packet_build(packet, packet_offset, ptr, size);
+ DbgFree(ptr);
+ ptr = NULL;
+ if (!packet) {
+ ret = -EFAULT;
break;
}
- recv_offset += ret;
- ret = 0;
+ packet_offset += recv_offset;
- if (recv_offset == size) {
- packet = packet_build(packet, packet_offset, ptr, size);
- DbgFree(ptr);
- ptr = NULL;
- if (!packet) {
- ret = -EFAULT;
- break;
- }
-
- packet_offset += recv_offset;
-
- size = packet_payload_size(packet);
- if (size <= 0) {
- recv_state = RECV_DONE;
- recv_offset = 0;
- break;
- }
-
- recv_state = RECV_PAYLOAD;
+ size = packet_payload_size(packet);
+ if (size <= 0) {
+ recv_state = RECV_DONE;
recv_offset = 0;
-
- ptr = malloc(size);
- if (!ptr) {
- ErrPrint("Heap: %s\n", strerror(errno));
- ret = -ENOMEM;
- }
- }
- break;
- case RECV_PAYLOAD:
- ret = secure_socket_recv(tcb->fd, ptr, size - recv_offset, &tcb->pid);
- if (ret <= 0) {
- if (ret == 0) {
- ret = -ECANCELED;
- }
- DbgFree(ptr);
- ptr = NULL;
break;
}
- recv_offset += ret;
- ret = 0;
+ recv_state = RECV_PAYLOAD;
+ recv_offset = 0;
- if (recv_offset == size) {
- packet = packet_build(packet, packet_offset, ptr, size);
- DbgFree(ptr);
- ptr = NULL;
- if (!packet) {
- ret = -EFAULT;
- break;
- }
+ ptr = malloc(size);
+ if (!ptr) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ ret = -ENOMEM;
+ }
+ }
+ break;
+ case RECV_PAYLOAD:
+ ret = secure_socket_recv(tcb->fd, ptr, size - recv_offset, &tcb->pid);
+ if (ret <= 0) {
+ if (ret == 0) {
+ ret = -ECANCELED;
+ }
+ DbgFree(ptr);
+ ptr = NULL;
+ break;
+ }
- packet_offset += recv_offset;
+ recv_offset += ret;
+ ret = 0;
- recv_state = RECV_DONE;
- recv_offset = 0;
+ if (recv_offset == size) {
+ packet = packet_build(packet, packet_offset, ptr, size);
+ DbgFree(ptr);
+ ptr = NULL;
+ if (!packet) {
+ ret = -EFAULT;
+ break;
}
- break;
- case RECV_DONE:
- default:
- /* Dead code */
- break;
+
+ packet_offset += recv_offset;
+
+ recv_state = RECV_DONE;
+ recv_offset = 0;
+ }
+ break;
+ case RECV_DONE:
+ default:
+ /* Dead code */
+ break;
}
if (recv_state == RECV_DONE) {
cbdata->data = data;
switch (event) {
- case TCB_EVENT_CREATE:
- if (tcb) {
- DbgPrint("To catch the create event of TCB does not requires \"tcb\" handle\n");
- }
- svc_ctx->tcb_create_cb_list = eina_list_append(svc_ctx->tcb_create_cb_list, cbdata);
- break;
- case TCB_EVENT_DESTROY:
- svc_ctx->tcb_destroy_cb_list = eina_list_append(svc_ctx->tcb_destroy_cb_list, cbdata);
- break;
- default:
- DbgFree(cbdata);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ case TCB_EVENT_CREATE:
+ if (tcb) {
+ DbgPrint("To catch the create event of TCB does not requires \"tcb\" handle\n");
+ }
+ svc_ctx->tcb_create_cb_list = eina_list_append(svc_ctx->tcb_create_cb_list, cbdata);
+ break;
+ case TCB_EVENT_DESTROY:
+ svc_ctx->tcb_destroy_cb_list = eina_list_append(svc_ctx->tcb_destroy_cb_list, cbdata);
+ break;
+ default:
+ DbgFree(cbdata);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return DBOX_STATUS_ERROR_NONE;
Eina_List *l;
switch (event) {
- case TCB_EVENT_CREATE:
- EINA_LIST_FOREACH(svc_ctx->tcb_create_cb_list, l, cbdata) {
- if (cbdata->tcb == tcb && cbdata->cb == cb && cbdata->data == data) {
- svc_ctx->tcb_create_cb_list = eina_list_remove(svc_ctx->tcb_create_cb_list, cbdata);
- DbgFree(cbdata);
- return DBOX_STATUS_ERROR_NONE;
- }
+ case TCB_EVENT_CREATE:
+ EINA_LIST_FOREACH(svc_ctx->tcb_create_cb_list, l, cbdata) {
+ if (cbdata->tcb == tcb && cbdata->cb == cb && cbdata->data == data) {
+ svc_ctx->tcb_create_cb_list = eina_list_remove(svc_ctx->tcb_create_cb_list, cbdata);
+ DbgFree(cbdata);
+ return DBOX_STATUS_ERROR_NONE;
}
- break;
- case TCB_EVENT_DESTROY:
- EINA_LIST_FOREACH(svc_ctx->tcb_destroy_cb_list, l, cbdata) {
- if (cbdata->tcb == tcb && cbdata->cb == cb && cbdata->data == data) {
- svc_ctx->tcb_destroy_cb_list = eina_list_remove(svc_ctx->tcb_destroy_cb_list, cbdata);
- DbgFree(cbdata);
- return DBOX_STATUS_ERROR_NONE;
- }
+ }
+ break;
+ case TCB_EVENT_DESTROY:
+ EINA_LIST_FOREACH(svc_ctx->tcb_destroy_cb_list, l, cbdata) {
+ if (cbdata->tcb == tcb && cbdata->cb == cb && cbdata->data == data) {
+ svc_ctx->tcb_destroy_cb_list = eina_list_remove(svc_ctx->tcb_destroy_cb_list, cbdata);
+ DbgFree(cbdata);
+ return DBOX_STATUS_ERROR_NONE;
}
- break;
- default:
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+ break;
+ default:
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return DBOX_STATUS_ERROR_NOT_EXIST;
EINA_LIST_FOREACH_SAFE(svc_ctx->event_list, l, n, item) {
switch (item->type) {
- case SERVICE_EVENT_TIMER:
- if (!FD_ISSET(item->info.timer.fd, set)) {
- break;
- }
-
- if (read(item->info.timer.fd, &expired_count, sizeof(expired_count)) == sizeof(expired_count)) {
- DbgPrint("Expired %d times\n", expired_count);
- if (item->event_cb(svc_ctx, item->cbdata) >= 0) {
- break;
- }
- } else {
- ErrPrint("read: %s\n", strerror(errno));
- }
+ case SERVICE_EVENT_TIMER:
+ if (!FD_ISSET(item->info.timer.fd, set)) {
+ break;
+ }
- if (!eina_list_data_find(svc_ctx->event_list, item)) {
+ if (read(item->info.timer.fd, &expired_count, sizeof(expired_count)) == sizeof(expired_count)) {
+ DbgPrint("Expired %d times\n", expired_count);
+ if (item->event_cb(svc_ctx, item->cbdata) >= 0) {
break;
}
+ } else {
+ ErrPrint("read: %s\n", strerror(errno));
+ }
- svc_ctx->event_list = eina_list_remove(svc_ctx->event_list, item);
- if (close(item->info.timer.fd) < 0) {
- ErrPrint("close: %s\n", strerror(errno));
- }
- DbgFree(item);
- break;
- default:
- ErrPrint("Unknown event: %d\n", item->type);
+ if (!eina_list_data_find(svc_ctx->event_list, item)) {
break;
+ }
+
+ svc_ctx->event_list = eina_list_remove(svc_ctx->event_list, item);
+ if (close(item->info.timer.fd) < 0) {
+ ErrPrint("close: %s\n", strerror(errno));
+ }
+ DbgFree(item);
+ break;
+ default:
+ ErrPrint("Unknown event: %d\n", item->type);
+ break;
}
}
}
#if defined(HAVE_LIVEBOX)
#include <dynamicbox_service.h>
#include <dynamicbox_conf.h>
+#include <dynamicbox_errno.h>
#include "client_life.h"
#include "slave_life.h"
#include "xmonitor.h"
int errno;
+struct event_cbdata {
+ int (*handler)(enum oom_event_type type, void *data);
+ void *data;
+ int deleted;
+};
+
static struct {
int deactivated;
+ Eina_List *oom_event_list;
+ int oom_event_in_process;
} s_info = {
.deactivated = 0,
+ .oom_event_list = NULL,
+ .oom_event_in_process = 0,
};
static void lcd_state_cb(keynode_t *node, void *user_data)
static void low_mem_cb(keynode_t *node, void *user_data)
{
int val;
+ Eina_List *l;
+ Eina_List *n;
+ struct event_cbdata *item;
val = vconf_keynode_get_int(node);
CRITICAL_LOG("Low memory: level %d\n", val);
if (s_info.deactivated == 0) {
s_info.deactivated = 1;
+
+ s_info.oom_event_in_process = 1;
+ EINA_LIST_FOREACH_SAFE(s_info.oom_event_list, l, n, item) {
+ if (item->deleted || item->handler(OOM_TYPE_LOW, item->data) < 0 || item->deleted) {
+ s_info.oom_event_list = eina_list_remove(s_info.oom_event_list, item);
+ free(item);
+ }
+ }
+ s_info.oom_event_in_process = 0;
+
//slave_deactivate_all(0, 1, 0);
malloc_trim(0);
ErrPrint("Fall into the low mem status\n");
CRITICAL_LOG("Normal memory: level %d\n", val);
if (s_info.deactivated == 1) {
s_info.deactivated = 0;
+
+ s_info.oom_event_in_process = 1;
+ EINA_LIST_FOREACH_SAFE(s_info.oom_event_list, l, n, item) {
+ if (item->deleted || item->handler(OOM_TYPE_NORMAL, item->data) < 0 || item->deleted) {
+ s_info.oom_event_list = eina_list_remove(s_info.oom_event_list, item);
+ free(item);
+ }
+ }
+ s_info.oom_event_in_process = 0;
+
//slave_activate_all();
ErrPrint("Recover from the low mem status\n");
}
}
}
+HAPI int setting_add_oom_event_callback(int (*handler)(enum oom_event_type type, void *data), void *data)
+{
+ struct event_cbdata *item;
+
+ item = malloc(sizeof(*item));
+ if (!item) {
+ ErrPrint("malloc: %s\n", strerror(errno));
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ }
+
+ item->handler = handler;
+ item->data = data;
+ item->deleted = 0;
+
+ s_info.oom_event_list = eina_list_append(s_info.oom_event_list, item);
+ return DBOX_STATUS_ERROR_NONE;
+}
+
+HAPI int setting_del_oom_event_callback(int (*handler)(enum oom_event_type type, void *data), void *data)
+{
+ struct event_cbdata *item;
+ Eina_List *l;
+ Eina_List *n;
+
+ EINA_LIST_FOREACH_SAFE(s_info.oom_event_list, l, n, item) {
+ if (handler == item->handler && item->data == data) {
+ if (s_info.oom_event_in_process) {
+ item->deleted = 1;
+ } else {
+ s_info.oom_event_list = eina_list_remove(s_info.oom_event_list, item);
+ free(item);
+ }
+ return DBOX_STATUS_ERROR_NONE;
+ }
+ }
+
+ return DBOX_STATUS_ERROR_NOT_EXIST;
+}
+
+HAPI enum oom_event_type setting_oom_level(void)
+{
+ int ret;
+ int status;
+
+ ret = vconf_get_int(VCONFKEY_SYSMAN_LOW_MEMORY, &status);
+ if (ret == 0 && status >= VCONFKEY_SYSMAN_LOW_MEMORY_SOFT_WARNING) {
+ return OOM_TYPE_LOW;
+ }
+
+ return OOM_TYPE_NORMAL;
+}
+
HAPI int setting_init(void)
{
int ret;
}
switch (packet_type(packet)) {
- case PACKET_REQ:
-
- /* Need to send reply packet */
- DbgPrint("%p REQ: Command: [%s]\n", tcb, command);
- if (!strcmp(command, "add_livebox") || !strcmp(command, "rm_livebox")) {
- ret = security_server_check_privilege_by_sockfd(tcb_fd(tcb), "data-provider-master::shortcut.livebox", "w");
- if (ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) {
- ErrPrint("SMACK:Access denied\n");
- send_reply_packet(tcb, packet, SHORTCUT_ERROR_PERMISSION_DENIED);
- break;
- }
-
- } else if (!strcmp(command, "add_shortcut") || !strcmp(command, "rm_shortcut")) {
- ret = security_server_check_privilege_by_sockfd(tcb_fd(tcb), "data-provider-master::shortcut.shortcut", "w");
- if (ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) {
- ErrPrint("SMACK:Access denied\n");
- send_reply_packet(tcb, packet, SHORTCUT_ERROR_PERMISSION_DENIED);
- break;
- }
+ case PACKET_REQ:
+
+ /* Need to send reply packet */
+ DbgPrint("%p REQ: Command: [%s]\n", tcb, command);
+ if (!strcmp(command, "add_livebox") || !strcmp(command, "rm_livebox")) {
+ ret = security_server_check_privilege_by_sockfd(tcb_fd(tcb), "data-provider-master::shortcut.livebox", "w");
+ if (ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) {
+ ErrPrint("SMACK:Access denied\n");
+ send_reply_packet(tcb, packet, SHORTCUT_ERROR_PERMISSION_DENIED);
+ break;
}
- if (service_common_multicast_packet(tcb, packet, TCB_CLIENT_TYPE_SERVICE) < 0) {
- ErrPrint("Unable to send service request packet\n");
- } else {
- (void)put_reply_context(tcb, packet_seq(packet));
- }
- break;
- case PACKET_REQ_NOACK:
- /* Doesn't need to send reply packet */
- DbgPrint("%p REQ_NOACK: Command: [%s]\n", tcb, command);
- if (!strcmp(command, "service_register")) {
- tcb_client_type_set(tcb, TCB_CLIENT_TYPE_SERVICE);
+ } else if (!strcmp(command, "add_shortcut") || !strcmp(command, "rm_shortcut")) {
+ ret = security_server_check_privilege_by_sockfd(tcb_fd(tcb), "data-provider-master::shortcut.shortcut", "w");
+ if (ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) {
+ ErrPrint("SMACK:Access denied\n");
+ send_reply_packet(tcb, packet, SHORTCUT_ERROR_PERMISSION_DENIED);
break;
}
+ }
- if (service_common_multicast_packet(tcb, packet, TCB_CLIENT_TYPE_SERVICE) < 0) {
- ErrPrint("Unable to send service reuqest packet\n");
- }
+ if (service_common_multicast_packet(tcb, packet, TCB_CLIENT_TYPE_SERVICE) < 0) {
+ ErrPrint("Unable to send service request packet\n");
+ } else {
+ (void)put_reply_context(tcb, packet_seq(packet));
+ }
+ break;
+ case PACKET_REQ_NOACK:
+ /* Doesn't need to send reply packet */
+ DbgPrint("%p REQ_NOACK: Command: [%s]\n", tcb, command);
+ if (!strcmp(command, "service_register")) {
+ tcb_client_type_set(tcb, TCB_CLIENT_TYPE_SERVICE);
break;
- case PACKET_ACK:
- /* Okay, client(or app) send a reply packet to us. */
- DbgPrint("%p ACK: Command: [%s]\n", tcb, command);
- tcb = get_reply_context(packet_seq(packet));
- if (!tcb) {
- ErrPrint("There is no proper context\n");
- break;
- }
+ }
- if (tcb_is_valid(s_info.svc_ctx, tcb) < 0) {
- ErrPrint("TCB is not valid (already disconnected?)\n");
- break;
- }
+ if (service_common_multicast_packet(tcb, packet, TCB_CLIENT_TYPE_SERVICE) < 0) {
+ ErrPrint("Unable to send service reuqest packet\n");
+ }
+ break;
+ case PACKET_ACK:
+ /* Okay, client(or app) send a reply packet to us. */
+ DbgPrint("%p ACK: Command: [%s]\n", tcb, command);
+ tcb = get_reply_context(packet_seq(packet));
+ if (!tcb) {
+ ErrPrint("There is no proper context\n");
+ break;
+ }
- if (service_common_unicast_packet(tcb, packet) < 0) {
- ErrPrint("Unable to send reply packet\n");
- }
+ if (tcb_is_valid(s_info.svc_ctx, tcb) < 0) {
+ ErrPrint("TCB is not valid (already disconnected?)\n");
break;
- default:
- ErrPrint("Packet type is not valid[%s]\n", command);
- return -EINVAL;
+ }
+
+ if (service_common_unicast_packet(tcb, packet) < 0) {
+ ErrPrint("Unable to send reply packet\n");
+ }
+ break;
+ default:
+ ErrPrint("Packet type is not valid[%s]\n", command);
+ return -EINVAL;
}
/*!
return 0;
}
- if (!slave->secured) {
+ if (!slave->secured && !DYNAMICBOX_CONF_SLAVE_LIMIT_TO_TTL) {
return 0;
}
} else {
bundle_add(param, BUNDLE_SLAVE_SVC_OP_TYPE, APP_CONTROL_OPERATION_MAIN);
bundle_add(param, DYNAMICBOX_CONF_BUNDLE_SLAVE_NAME, slave_name(slave));
- bundle_add(param, DYNAMICBOX_CONF_BUNDLE_SLAVE_SECURED, slave->secured ? "true" : "false");
+ bundle_add(param, DYNAMICBOX_CONF_BUNDLE_SLAVE_SECURED, (DYNAMICBOX_CONF_SLAVE_LIMIT_TO_TTL || slave->secured) ? "true" : "false");
bundle_add(param, DYNAMICBOX_CONF_BUNDLE_SLAVE_ABI, slave->abi);
slave->pid = (pid_t)aul_launch_app(slave_pkgname(slave), param);
bundle_free(param);
switch (slave->pid) {
- case AUL_R_EHIDDENFORGUEST: /**< App hidden for guest mode */
- case AUL_R_ENOLAUNCHPAD: /**< no launchpad */
- case AUL_R_EILLACC: /**< Illegal Access */
- case AUL_R_EINVAL: /**< Invalid argument */
- case AUL_R_ENOINIT: /**< AUL handler NOT initialized */
- case AUL_R_ERROR: /**< General error */
- CRITICAL_LOG("Failed to launch a new slave %s (%d)\n", slave_name(slave), slave->pid);
- slave->pid = (pid_t)-1;
- ecore_timer_del(slave->activate_timer);
- slave->activate_timer = NULL;
-
- slave->relaunch_timer = NULL;
-
- invoke_slave_fault_handler(slave);
- /* Waiting app-launch result */
- break;
- case AUL_R_ETIMEOUT: /**< Timeout */
- case AUL_R_ECOMM: /**< Comunication Error */
- case AUL_R_ETERMINATING: /**< application terminating */
- case AUL_R_ECANCELED: /**< Operation canceled */
- slave->relaunch_count--;
-
- CRITICAL_LOG("Try relaunch again %s (%d), %d\n", slave_name(slave), slave->pid, slave->relaunch_count);
- slave->pid = (pid_t)-1;
- ret = ECORE_CALLBACK_RENEW;
- ecore_timer_reset(slave->activate_timer);
- /* Try again after a few secs later */
- break;
- case AUL_R_LOCAL: /**< Launch by himself */
- case AUL_R_OK: /**< General success */
- default:
- DbgPrint("Slave %s is launched with %d as %s\n", slave_pkgname(slave), slave->pid, slave_name(slave));
- slave->relaunch_timer = NULL;
- ecore_timer_reset(slave->activate_timer);
- break;
+ case AUL_R_EHIDDENFORGUEST: /**< App hidden for guest mode */
+ case AUL_R_ENOLAUNCHPAD: /**< no launchpad */
+ case AUL_R_EILLACC: /**< Illegal Access */
+ case AUL_R_EINVAL: /**< Invalid argument */
+ case AUL_R_ENOINIT: /**< AUL handler NOT initialized */
+ case AUL_R_ERROR: /**< General error */
+ CRITICAL_LOG("Failed to launch a new slave %s (%d)\n", slave_name(slave), slave->pid);
+ slave->pid = (pid_t)-1;
+ ecore_timer_del(slave->activate_timer);
+ slave->activate_timer = NULL;
+
+ slave->relaunch_timer = NULL;
+
+ invoke_slave_fault_handler(slave);
+ /* Waiting app-launch result */
+ break;
+ case AUL_R_ETIMEOUT: /**< Timeout */
+ case AUL_R_ECOMM: /**< Comunication Error */
+ case AUL_R_ETERMINATING: /**< application terminating */
+ case AUL_R_ECANCELED: /**< Operation canceled */
+ slave->relaunch_count--;
+
+ CRITICAL_LOG("Try relaunch again %s (%d), %d\n", slave_name(slave), slave->pid, slave->relaunch_count);
+ slave->pid = (pid_t)-1;
+ ret = ECORE_CALLBACK_RENEW;
+ ecore_timer_reset(slave->activate_timer);
+ /* Try again after a few secs later */
+ break;
+ case AUL_R_LOCAL: /**< Launch by himself */
+ case AUL_R_OK: /**< General success */
+ default:
+ DbgPrint("Slave %s is launched with %d as %s\n", slave_pkgname(slave), slave->pid, slave_name(slave));
+ slave->relaunch_timer = NULL;
+ ecore_timer_reset(slave->activate_timer);
+ break;
}
}
HAPI int slave_activate(struct slave_node *slave)
{
- /*!
- * \note
+ /**
+ * @todo
+ * If a slave is deactivated by OOM killer,
+ * We should not activate it again from here.
+ * Instead of this, it should be reactivated by user event or oom event(normal)
+ */
+
+ /**
+ * @note
* This check code can be replaced with the slave->state check code
* If the slave data has the PID, it means, it is activated
* Even if it is in the termiating sequence, it will have the PID
- * before terminated at last.
+ * until it is terminated at last.
* So we can use this simple code for checking the slave's last state.
- * about it is alive? or not.
+ * whether it is alive or not.
*/
if (slave_pid(slave) != (pid_t)-1) {
if (slave->terminate_timer) {
bundle_add(param, BUNDLE_SLAVE_SVC_OP_TYPE, APP_CONTROL_OPERATION_MAIN);
bundle_add(param, DYNAMICBOX_CONF_BUNDLE_SLAVE_NAME, slave_name(slave));
- bundle_add(param, DYNAMICBOX_CONF_BUNDLE_SLAVE_SECURED, slave->secured ? "true" : "false");
+ bundle_add(param, DYNAMICBOX_CONF_BUNDLE_SLAVE_SECURED, (DYNAMICBOX_CONF_SLAVE_LIMIT_TO_TTL || slave->secured) ? "true" : "false");
bundle_add(param, DYNAMICBOX_CONF_BUNDLE_SLAVE_ABI, slave->abi);
slave->pid = (pid_t)aul_launch_app(slave_pkgname(slave), param);
bundle_free(param);
switch (slave->pid) {
- case AUL_R_EHIDDENFORGUEST: /**< App hidden for guest mode */
- case AUL_R_ENOLAUNCHPAD: /**< no launchpad */
- case AUL_R_EILLACC: /**< Illegal Access */
- case AUL_R_EINVAL: /**< Invalid argument */
- case AUL_R_ENOINIT: /**< AUL handler NOT initialized */
- case AUL_R_ERROR: /**< General error */
- CRITICAL_LOG("Failed to launch a new slave %s (%d)\n", slave_name(slave), slave->pid);
+ case AUL_R_EHIDDENFORGUEST: /**< App hidden for guest mode */
+ case AUL_R_ENOLAUNCHPAD: /**< no launchpad */
+ case AUL_R_EILLACC: /**< Illegal Access */
+ case AUL_R_EINVAL: /**< Invalid argument */
+ case AUL_R_ENOINIT: /**< AUL handler NOT initialized */
+ case AUL_R_ERROR: /**< General error */
+ CRITICAL_LOG("Failed to launch a new slave %s (%d)\n", slave_name(slave), slave->pid);
+ slave->pid = (pid_t)-1;
+ /* Waiting app-launch result */
+ break;
+ case AUL_R_ECOMM: /**< Comunication Error */
+ case AUL_R_ETERMINATING: /**< application terminating */
+ case AUL_R_ECANCELED: /**< Operation canceled */
+ case AUL_R_ETIMEOUT: /**< Timeout */
+ CRITICAL_LOG("Try relaunch this soon %s (%d)\n", slave_name(slave), slave->pid);
+ slave->relaunch_timer = ecore_timer_add(DYNAMICBOX_CONF_SLAVE_RELAUNCH_TIME, relaunch_timer_cb, slave);
+ if (!slave->relaunch_timer) {
+ CRITICAL_LOG("Failed to register a relaunch timer (%s)\n", slave_name(slave));
slave->pid = (pid_t)-1;
- /* Waiting app-launch result */
- break;
- case AUL_R_ECOMM: /**< Comunication Error */
- case AUL_R_ETERMINATING: /**< application terminating */
- case AUL_R_ECANCELED: /**< Operation canceled */
- case AUL_R_ETIMEOUT: /**< Timeout */
- CRITICAL_LOG("Try relaunch this soon %s (%d)\n", slave_name(slave), slave->pid);
- slave->relaunch_timer = ecore_timer_add(DYNAMICBOX_CONF_SLAVE_RELAUNCH_TIME, relaunch_timer_cb, slave);
- if (!slave->relaunch_timer) {
- CRITICAL_LOG("Failed to register a relaunch timer (%s)\n", slave_name(slave));
- slave->pid = (pid_t)-1;
- return DBOX_STATUS_ERROR_FAULT;
- }
- /* Try again after a few secs later */
- break;
- case AUL_R_LOCAL: /**< Launch by himself */
- case AUL_R_OK: /**< General success */
- default:
- DbgPrint("Slave %s is launched with %d as %s\n", slave_pkgname(slave), slave->pid, slave_name(slave));
- break;
+ return DBOX_STATUS_ERROR_FAULT;
+ }
+ /* Try again after a few secs later */
+ break;
+ case AUL_R_LOCAL: /**< Launch by himself */
+ case AUL_R_OK: /**< General success */
+ default:
+ DbgPrint("Slave %s is launched with %d as %s\n", slave_pkgname(slave), slave->pid, slave_name(slave));
+ break;
}
slave->activate_timer = ecore_timer_add(DYNAMICBOX_CONF_SLAVE_ACTIVATE_TIME, activate_timer_cb, slave);
{
double delay;
- if (!slave->secured || !slave->ttl_timer) {
+ if (!DYNAMICBOX_CONF_SLAVE_LIMIT_TO_TTL && (!slave->secured || !slave->ttl_timer)) {
return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
HAPI int slave_freeze_ttl(struct slave_node *slave)
{
- if (!slave->secured || !slave->ttl_timer) {
+ if (!DYNAMICBOX_CONF_SLAVE_LIMIT_TO_TTL && (!slave->secured || !slave->ttl_timer)) {
return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
{
double delay;
- if (!slave->secured || !slave->ttl_timer) {
+ if (!DYNAMICBOX_CONF_SLAVE_LIMIT_TO_TTL && (!slave->secured || !slave->ttl_timer)) {
return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
slave_pause(slave);
}
- if (slave->secured == 1 && DYNAMICBOX_CONF_SLAVE_TTL > 0.0f) {
+ if ((DYNAMICBOX_CONF_SLAVE_LIMIT_TO_TTL || slave->secured == 1) && DYNAMICBOX_CONF_SLAVE_TTL > 0.0f) {
DbgPrint("Slave deactivation timer is added (%s - %lf)\n", slave_name(slave), DYNAMICBOX_CONF_SLAVE_TTL);
slave->ttl_timer = ecore_timer_add(DYNAMICBOX_CONF_SLAVE_TTL, slave_ttl_cb, slave);
if (!slave->ttl_timer) {
* The master will not reactivate it automatically.
*/
DbgPrint("Manual reactivate option is turned on\n");
- } else if (reactivate && slave_need_to_reactivate(slave)) {
+ } else if (reactivate && slave_need_to_reactivate(slave) && setting_oom_level() == OOM_TYPE_NORMAL) {
int ret;
DbgPrint("Need to reactivate a slave\n");
HAPI const int const slave_is_activated(struct slave_node *slave)
{
switch (slave->state) {
- case SLAVE_REQUEST_TO_TERMINATE:
- case SLAVE_TERMINATED:
- return 0;
- case SLAVE_REQUEST_TO_DISCONNECT:
- /* This case should be treated as an activated state.
- * To send the last request to the provider.
- */
- case SLAVE_REQUEST_TO_LAUNCH:
- /* Not yet launched. but the slave incurred an unexpected error */
- case SLAVE_REQUEST_TO_PAUSE:
- case SLAVE_REQUEST_TO_RESUME:
- case SLAVE_PAUSED:
- case SLAVE_RESUMED:
- return 1;
- default:
- return slave->pid != (pid_t)-1;
+ case SLAVE_REQUEST_TO_TERMINATE:
+ case SLAVE_TERMINATED:
+ return 0;
+ case SLAVE_REQUEST_TO_DISCONNECT:
+ /* This case should be treated as an activated state.
+ * To send the last request to the provider.
+ */
+ case SLAVE_REQUEST_TO_LAUNCH:
+ /* Not yet launched. but the slave incurred an unexpected error */
+ case SLAVE_REQUEST_TO_PAUSE:
+ case SLAVE_REQUEST_TO_RESUME:
+ case SLAVE_PAUSED:
+ case SLAVE_RESUMED:
+ return 1;
+ default:
+ return slave->pid != (pid_t)-1;
}
/* Could not be reach to here */
*/
switch (event) {
- case SLAVE_EVENT_ACTIVATE:
- slave->event_activate_list = eina_list_prepend(slave->event_activate_list, ev);
- break;
- case SLAVE_EVENT_DELETE:
- slave->event_delete_list = eina_list_prepend(slave->event_delete_list, ev);
- break;
- case SLAVE_EVENT_DEACTIVATE:
- slave->event_deactivate_list = eina_list_prepend(slave->event_deactivate_list, ev);
- break;
- case SLAVE_EVENT_PAUSE:
- slave->event_pause_list = eina_list_prepend(slave->event_pause_list, ev);
- break;
- case SLAVE_EVENT_RESUME:
- slave->event_resume_list = eina_list_prepend(slave->event_resume_list, ev);
- break;
- case SLAVE_EVENT_FAULT:
- slave->event_fault_list = eina_list_prepend(slave->event_fault_list, ev);
- break;
- default:
- DbgFree(ev);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ case SLAVE_EVENT_ACTIVATE:
+ slave->event_activate_list = eina_list_prepend(slave->event_activate_list, ev);
+ break;
+ case SLAVE_EVENT_DELETE:
+ slave->event_delete_list = eina_list_prepend(slave->event_delete_list, ev);
+ break;
+ case SLAVE_EVENT_DEACTIVATE:
+ slave->event_deactivate_list = eina_list_prepend(slave->event_deactivate_list, ev);
+ break;
+ case SLAVE_EVENT_PAUSE:
+ slave->event_pause_list = eina_list_prepend(slave->event_pause_list, ev);
+ break;
+ case SLAVE_EVENT_RESUME:
+ slave->event_resume_list = eina_list_prepend(slave->event_resume_list, ev);
+ break;
+ case SLAVE_EVENT_FAULT:
+ slave->event_fault_list = eina_list_prepend(slave->event_fault_list, ev);
+ break;
+ default:
+ DbgFree(ev);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return DBOX_STATUS_ERROR_NONE;
Eina_List *n;
switch (event) {
- case SLAVE_EVENT_DEACTIVATE:
- EINA_LIST_FOREACH_SAFE(slave->event_deactivate_list, l, n, ev) {
- if (ev->evt_cb == cb && ev->cbdata == data) {
- if (slave->in_event_process & SLAVE_EVENT_PROCESS_DEACTIVATE) {
- ev->deleted = 1;
- } else {
- slave->event_deactivate_list = eina_list_remove(slave->event_deactivate_list, ev);
- DbgFree(ev);
- }
- return DBOX_STATUS_ERROR_NONE;
+ case SLAVE_EVENT_DEACTIVATE:
+ EINA_LIST_FOREACH_SAFE(slave->event_deactivate_list, l, n, ev) {
+ if (ev->evt_cb == cb && ev->cbdata == data) {
+ if (slave->in_event_process & SLAVE_EVENT_PROCESS_DEACTIVATE) {
+ ev->deleted = 1;
+ } else {
+ slave->event_deactivate_list = eina_list_remove(slave->event_deactivate_list, ev);
+ DbgFree(ev);
}
+ return DBOX_STATUS_ERROR_NONE;
}
- break;
- case SLAVE_EVENT_DELETE:
- EINA_LIST_FOREACH_SAFE(slave->event_delete_list, l, n, ev) {
- if (ev->evt_cb == cb && ev->cbdata == data) {
- if (slave->in_event_process & SLAVE_EVENT_PROCESS_DELETE) {
- ev->deleted = 1;
- } else {
- slave->event_delete_list = eina_list_remove(slave->event_delete_list, ev);
- DbgFree(ev);
- }
- return DBOX_STATUS_ERROR_NONE;
+ }
+ break;
+ case SLAVE_EVENT_DELETE:
+ EINA_LIST_FOREACH_SAFE(slave->event_delete_list, l, n, ev) {
+ if (ev->evt_cb == cb && ev->cbdata == data) {
+ if (slave->in_event_process & SLAVE_EVENT_PROCESS_DELETE) {
+ ev->deleted = 1;
+ } else {
+ slave->event_delete_list = eina_list_remove(slave->event_delete_list, ev);
+ DbgFree(ev);
}
+ return DBOX_STATUS_ERROR_NONE;
}
- break;
- case SLAVE_EVENT_ACTIVATE:
- EINA_LIST_FOREACH_SAFE(slave->event_activate_list, l, n, ev) {
- if (ev->evt_cb == cb && ev->cbdata == data) {
- if (slave->in_event_process & SLAVE_EVENT_PROCESS_ACTIVATE) {
- ev->deleted = 1;
- } else {
- slave->event_activate_list = eina_list_remove(slave->event_activate_list, ev);
- DbgFree(ev);
- }
- return DBOX_STATUS_ERROR_NONE;
+ }
+ break;
+ case SLAVE_EVENT_ACTIVATE:
+ EINA_LIST_FOREACH_SAFE(slave->event_activate_list, l, n, ev) {
+ if (ev->evt_cb == cb && ev->cbdata == data) {
+ if (slave->in_event_process & SLAVE_EVENT_PROCESS_ACTIVATE) {
+ ev->deleted = 1;
+ } else {
+ slave->event_activate_list = eina_list_remove(slave->event_activate_list, ev);
+ DbgFree(ev);
}
+ return DBOX_STATUS_ERROR_NONE;
}
- break;
- case SLAVE_EVENT_PAUSE:
- EINA_LIST_FOREACH_SAFE(slave->event_pause_list, l, n, ev) {
- if (ev->evt_cb == cb && ev->cbdata == data) {
- if (slave->in_event_process & SLAVE_EVENT_PROCESS_PAUSE) {
- ev->deleted = 1;
- } else {
- slave->event_pause_list = eina_list_remove(slave->event_pause_list, ev);
- DbgFree(ev);
- }
- return DBOX_STATUS_ERROR_NONE;
+ }
+ break;
+ case SLAVE_EVENT_PAUSE:
+ EINA_LIST_FOREACH_SAFE(slave->event_pause_list, l, n, ev) {
+ if (ev->evt_cb == cb && ev->cbdata == data) {
+ if (slave->in_event_process & SLAVE_EVENT_PROCESS_PAUSE) {
+ ev->deleted = 1;
+ } else {
+ slave->event_pause_list = eina_list_remove(slave->event_pause_list, ev);
+ DbgFree(ev);
}
+ return DBOX_STATUS_ERROR_NONE;
}
- break;
- case SLAVE_EVENT_RESUME:
- EINA_LIST_FOREACH_SAFE(slave->event_resume_list, l, n, ev) {
- if (ev->evt_cb == cb && ev->cbdata == data) {
- if (slave->in_event_process & SLAVE_EVENT_PROCESS_RESUME) {
- ev->deleted = 1;
- } else {
- slave->event_resume_list = eina_list_remove(slave->event_resume_list, ev);
- DbgFree(ev);
- }
- return DBOX_STATUS_ERROR_NONE;
+ }
+ break;
+ case SLAVE_EVENT_RESUME:
+ EINA_LIST_FOREACH_SAFE(slave->event_resume_list, l, n, ev) {
+ if (ev->evt_cb == cb && ev->cbdata == data) {
+ if (slave->in_event_process & SLAVE_EVENT_PROCESS_RESUME) {
+ ev->deleted = 1;
+ } else {
+ slave->event_resume_list = eina_list_remove(slave->event_resume_list, ev);
+ DbgFree(ev);
}
+ return DBOX_STATUS_ERROR_NONE;
}
- break;
- case SLAVE_EVENT_FAULT:
- EINA_LIST_FOREACH_SAFE(slave->event_fault_list, l, n, ev) {
- if (ev->evt_cb == cb && ev->cbdata == data) {
- if (slave->in_event_process & SLAVE_EVENT_PROCESS_FAULT) {
- ev->deleted = 1;
- } else {
- slave->event_fault_list = eina_list_remove(slave->event_fault_list, ev);
- DbgFree(ev);
- }
- return DBOX_STATUS_ERROR_NONE;
+ }
+ break;
+ case SLAVE_EVENT_FAULT:
+ EINA_LIST_FOREACH_SAFE(slave->event_fault_list, l, n, ev) {
+ if (ev->evt_cb == cb && ev->cbdata == data) {
+ if (slave->in_event_process & SLAVE_EVENT_PROCESS_FAULT) {
+ ev->deleted = 1;
+ } else {
+ slave->event_fault_list = eina_list_remove(slave->event_fault_list, ev);
+ DbgFree(ev);
}
+ return DBOX_STATUS_ERROR_NONE;
}
- break;
- default:
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+ break;
+ default:
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return DBOX_STATUS_ERROR_NOT_EXIST;
unsigned int cmd = CMD_RESUME;
switch (slave->state) {
- case SLAVE_REQUEST_TO_DISCONNECT:
- case SLAVE_REQUEST_TO_LAUNCH:
- case SLAVE_REQUEST_TO_TERMINATE:
- case SLAVE_TERMINATED:
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- case SLAVE_RESUMED:
- case SLAVE_REQUEST_TO_RESUME:
- return DBOX_STATUS_ERROR_NONE;
- default:
- break;
+ case SLAVE_REQUEST_TO_DISCONNECT:
+ case SLAVE_REQUEST_TO_LAUNCH:
+ case SLAVE_REQUEST_TO_TERMINATE:
+ case SLAVE_TERMINATED:
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ case SLAVE_RESUMED:
+ case SLAVE_REQUEST_TO_RESUME:
+ return DBOX_STATUS_ERROR_NONE;
+ default:
+ break;
}
timestamp = util_timestamp();
unsigned int cmd = CMD_PAUSE;
switch (slave->state) {
- case SLAVE_REQUEST_TO_DISCONNECT:
- case SLAVE_REQUEST_TO_LAUNCH:
- case SLAVE_REQUEST_TO_TERMINATE:
- case SLAVE_TERMINATED:
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- case SLAVE_PAUSED:
- case SLAVE_REQUEST_TO_PAUSE:
- return DBOX_STATUS_ERROR_NONE;
- default:
- break;
+ case SLAVE_REQUEST_TO_DISCONNECT:
+ case SLAVE_REQUEST_TO_LAUNCH:
+ case SLAVE_REQUEST_TO_TERMINATE:
+ case SLAVE_TERMINATED:
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ case SLAVE_PAUSED:
+ case SLAVE_REQUEST_TO_PAUSE:
+ return DBOX_STATUS_ERROR_NONE;
+ default:
+ break;
}
timestamp = util_timestamp();
HAPI const char *slave_state_string(const struct slave_node *slave)
{
switch (slave->state) {
- case SLAVE_REQUEST_TO_DISCONNECT:
- return "RequestToDisconnect";
- case SLAVE_REQUEST_TO_LAUNCH:
- return "RequestToLaunch";
- case SLAVE_REQUEST_TO_TERMINATE:
- return "RequestToTerminate";
- case SLAVE_TERMINATED:
- return "Terminated";
- case SLAVE_REQUEST_TO_PAUSE:
- return "RequestToPause";
- case SLAVE_REQUEST_TO_RESUME:
- return "RequestToResume";
- case SLAVE_PAUSED:
- return "Paused";
- case SLAVE_RESUMED:
- return "Resumed";
- case SLAVE_ERROR:
- return "Error";
- default:
- break;
+ case SLAVE_REQUEST_TO_DISCONNECT:
+ return "RequestToDisconnect";
+ case SLAVE_REQUEST_TO_LAUNCH:
+ return "RequestToLaunch";
+ case SLAVE_REQUEST_TO_TERMINATE:
+ return "RequestToTerminate";
+ case SLAVE_TERMINATED:
+ return "Terminated";
+ case SLAVE_REQUEST_TO_PAUSE:
+ return "RequestToPause";
+ case SLAVE_REQUEST_TO_RESUME:
+ return "RequestToResume";
+ case SLAVE_PAUSED:
+ return "Paused";
+ case SLAVE_RESUMED:
+ return "Resumed";
+ case SLAVE_ERROR:
+ return "Error";
+ default:
+ break;
}
return "Unknown";
if (rpc->handle < 0) {
DbgPrint("RPC handle is not ready to use it\n");
- if (((slave_control_option(slave) & PROVIDER_CTRL_MANUAL_REACTIVATION) == PROVIDER_CTRL_MANUAL_REACTIVATION || slave_is_secured(slave))
+ if (((slave_control_option(slave) & PROVIDER_CTRL_MANUAL_REACTIVATION) == PROVIDER_CTRL_MANUAL_REACTIVATION || slave_is_secured(slave) || DYNAMICBOX_CONF_SLAVE_LIMIT_TO_TTL)
&& !slave_is_activated(slave))
{
int ret;
if (rpc->handle < 0) {
DbgPrint("RPC handle is not ready to use it\n");
- if (((slave_control_option(slave) & PROVIDER_CTRL_MANUAL_REACTIVATION) == PROVIDER_CTRL_MANUAL_REACTIVATION || slave_is_secured(slave))
+ if (((slave_control_option(slave) & PROVIDER_CTRL_MANUAL_REACTIVATION) == PROVIDER_CTRL_MANUAL_REACTIVATION || slave_is_secured(slave) || DYNAMICBOX_CONF_SLAVE_LIMIT_TO_TTL)
&& !slave_is_activated(slave))
{
int ret;
out_idx = 0;
for (state = STATE_START, ptr = src; state != STATE_END; ptr++) {
switch (state) {
- case STATE_START:
- if (*ptr == '\0') {
- state = STATE_END;
- } else if (!isblank(*ptr)) {
- state = STATE_FIND;
- ptr--;
- }
- break;
- case STATE_FIND:
- if (*ptr == '\0') {
- state = STATE_END;
- } else if (*ptr == *pattern) {
- state = STATE_CHECK;
- ptr--;
- idx = 0;
- } else {
- ret[out_idx] = *ptr;
- out_idx++;
- if (out_idx == out_sz) {
- tmp = extend_heap(ret, &out_sz, strlen(replace) + 1);
- if (!tmp) {
- DbgFree(ret);
- return NULL;
- }
- ret = tmp;
+ case STATE_START:
+ if (*ptr == '\0') {
+ state = STATE_END;
+ } else if (!isblank(*ptr)) {
+ state = STATE_FIND;
+ ptr--;
+ }
+ break;
+ case STATE_FIND:
+ if (*ptr == '\0') {
+ state = STATE_END;
+ } else if (*ptr == *pattern) {
+ state = STATE_CHECK;
+ ptr--;
+ idx = 0;
+ } else {
+ ret[out_idx] = *ptr;
+ out_idx++;
+ if (out_idx == out_sz) {
+ tmp = extend_heap(ret, &out_sz, strlen(replace) + 1);
+ if (!tmp) {
+ DbgFree(ret);
+ return NULL;
}
+ ret = tmp;
}
- break;
- case STATE_CHECK:
- if (!pattern[idx]) {
- /*!
- * If there is no space for copying the replacement,
- * Extend size of the return buffer.
- */
- if (out_sz - out_idx < strlen(replace) + 1) {
- tmp = extend_heap(ret, &out_sz, strlen(replace) + 1);
- if (!tmp) {
- DbgFree(ret);
- return NULL;
- }
- ret = tmp;
+ }
+ break;
+ case STATE_CHECK:
+ if (!pattern[idx]) {
+ /*!
+ * If there is no space for copying the replacement,
+ * Extend size of the return buffer.
+ */
+ if (out_sz - out_idx < strlen(replace) + 1) {
+ tmp = extend_heap(ret, &out_sz, strlen(replace) + 1);
+ if (!tmp) {
+ DbgFree(ret);
+ return NULL;
}
+ ret = tmp;
+ }
- strcpy(ret + out_idx, replace);
- out_idx += strlen(replace);
-
- state = STATE_FIND;
- ptr--;
- } else if (*ptr != pattern[idx]) {
- ptr -= idx;
-
- /* Copy the first matched character */
- ret[out_idx] = *ptr;
- out_idx++;
- if (out_idx == out_sz) {
- tmp = extend_heap(ret, &out_sz, strlen(replace) + 1);
- if (!tmp) {
- DbgFree(ret);
- return NULL;
- }
-
- ret = tmp;
+ strcpy(ret + out_idx, replace);
+ out_idx += strlen(replace);
+
+ state = STATE_FIND;
+ ptr--;
+ } else if (*ptr != pattern[idx]) {
+ ptr -= idx;
+
+ /* Copy the first matched character */
+ ret[out_idx] = *ptr;
+ out_idx++;
+ if (out_idx == out_sz) {
+ tmp = extend_heap(ret, &out_sz, strlen(replace) + 1);
+ if (!tmp) {
+ DbgFree(ret);
+ return NULL;
}
- state = STATE_FIND;
- } else {
- idx++;
+ ret = tmp;
}
- break;
- default:
- break;
+
+ state = STATE_FIND;
+ } else {
+ idx++;
+ }
+ break;
+ default:
+ break;
}
}
if (tag[tag_idx][idx] == '\0') {
if (*ptr == '=' || isblank(*ptr)) {
switch (tag_idx) {
- case TAG_SOURCE:
- if (source) {
- ErrPrint("source[%s] is overrided\n", source);
- }
-
- while ((*ptr != '\0' && *ptr != ';') && (*ptr == '=' || isblank(*ptr))) {
- ptr++;
- }
-
- source = ptr;
- while (*ptr != '\0' && *ptr != ';') {
- ptr++;
- }
-
- if (*source == '\0') {
- type = NULL;
- }
-
- *ptr = '\0';
- rollback_ptr = ptr + 1;
- idx = 0;
- break;
- case TAG_TYPE:
- if (type) {
- ErrPrint("type[%s] is overrided\n", type);
- }
-
- while ((*ptr != '\0' && *ptr != ';') && (*ptr == '=' || isblank(*ptr))) {
- ptr++;
- }
-
- type = ptr;
- while (*ptr != '\0' && *ptr != ';') {
- ptr++;
- }
-
- if (*type == '\0') {
- type = NULL;
- }
-
- *ptr = '\0';
- rollback_ptr = ptr + 1;
- idx = 0;
- break;
- case TAG_OPTION:
- if (option) {
- ErrPrint("option[%s] is overrided\n", option);
- }
-
- while ((*ptr != '\0' && *ptr != ';') && (*ptr == '=' || isblank(*ptr))) {
- ptr++;
- }
-
- option = ptr;
- while (*ptr != '\0' && *ptr != ';') {
- ptr++;
- }
-
- if (*option == '\0') {
- option = NULL;
- }
-
- *ptr = '\0';
- rollback_ptr = ptr + 1;
- idx = 0;
- break;
- default:
- break;
+ case TAG_SOURCE:
+ if (source) {
+ ErrPrint("source[%s] is overrided\n", source);
+ }
+
+ while ((*ptr != '\0' && *ptr != ';') && (*ptr == '=' || isblank(*ptr))) {
+ ptr++;
+ }
+
+ source = ptr;
+ while (*ptr != '\0' && *ptr != ';') {
+ ptr++;
+ }
+
+ if (*source == '\0') {
+ type = NULL;
+ }
+
+ *ptr = '\0';
+ rollback_ptr = ptr + 1;
+ idx = 0;
+ break;
+ case TAG_TYPE:
+ if (type) {
+ ErrPrint("type[%s] is overrided\n", type);
+ }
+
+ while ((*ptr != '\0' && *ptr != ';') && (*ptr == '=' || isblank(*ptr))) {
+ ptr++;
+ }
+
+ type = ptr;
+ while (*ptr != '\0' && *ptr != ';') {
+ ptr++;
+ }
+
+ if (*type == '\0') {
+ type = NULL;
+ }
+
+ *ptr = '\0';
+ rollback_ptr = ptr + 1;
+ idx = 0;
+ break;
+ case TAG_OPTION:
+ if (option) {
+ ErrPrint("option[%s] is overrided\n", option);
+ }
+
+ while ((*ptr != '\0' && *ptr != ';') && (*ptr == '=' || isblank(*ptr))) {
+ ptr++;
+ }
+
+ option = ptr;
+ while (*ptr != '\0' && *ptr != ';') {
+ ptr++;
+ }
+
+ if (*option == '\0') {
+ option = NULL;
+ }
+
+ *ptr = '\0';
+ rollback_ptr = ptr + 1;
+ idx = 0;
+ break;
+ default:
+ break;
}
} else {
ptr = rollback_ptr;
pid = aul_launch_app(SVC_PKG, NULL);
switch (pid) {
- case AUL_R_EHIDDENFORGUEST: /**< App hidden for guest mode */
- case AUL_R_ENOLAUNCHPAD: /**< no launchpad */
- case AUL_R_EILLACC: /**< Illegal Access */
- case AUL_R_EINVAL: /**< Invalid argument */
- case AUL_R_ENOINIT: /**< AUL handler NOT initialized */
- case AUL_R_ERROR: /**< General error */
- ErrPrint("Failed to launch an app: %s(%d)\n", SVC_PKG, pid);
+ case AUL_R_EHIDDENFORGUEST: /**< App hidden for guest mode */
+ case AUL_R_ENOLAUNCHPAD: /**< no launchpad */
+ case AUL_R_EILLACC: /**< Illegal Access */
+ case AUL_R_EINVAL: /**< Invalid argument */
+ case AUL_R_ENOINIT: /**< AUL handler NOT initialized */
+ case AUL_R_ERROR: /**< General error */
+ ErrPrint("Failed to launch an app: %s(%d)\n", SVC_PKG, pid);
+ ret = DBOX_STATUS_ERROR_FAULT;
+ break;
+ case AUL_R_ETIMEOUT: /**< Timeout */
+ case AUL_R_ECOMM: /**< Comunication Error */
+ case AUL_R_ETERMINATING: /**< application terminating */
+ case AUL_R_ECANCELED: /**< Operation canceled */
+ /* Need time to launch app again */
+ ErrPrint("Terminating now, try to launch this after few sec later: %s(%d)\n", SVC_PKG, pid);
+ s_info.svc_daemon_is_launched = 1;
+ s_info.delay_launcher = service_common_add_timer(svc_ctx, LAUNCH_TIMEOUT, lazy_launcher_cb, NULL);
+ if (!s_info.delay_launcher) {
+ ErrPrint("Unable to add delay launcher\n");
ret = DBOX_STATUS_ERROR_FAULT;
- break;
- case AUL_R_ETIMEOUT: /**< Timeout */
- case AUL_R_ECOMM: /**< Comunication Error */
- case AUL_R_ETERMINATING: /**< application terminating */
- case AUL_R_ECANCELED: /**< Operation canceled */
- /* Need time to launch app again */
- ErrPrint("Terminating now, try to launch this after few sec later: %s(%d)\n", SVC_PKG, pid);
- s_info.svc_daemon_is_launched = 1;
- s_info.delay_launcher = service_common_add_timer(svc_ctx, LAUNCH_TIMEOUT, lazy_launcher_cb, NULL);
- if (!s_info.delay_launcher) {
- ErrPrint("Unable to add delay launcher\n");
- ret = DBOX_STATUS_ERROR_FAULT;
- }
- break;
- case AUL_R_LOCAL: /**< Launch by himself */
- case AUL_R_OK: /**< General success */
- default:
- DbgPrint("Launched: %s(%d)\n", SVC_PKG, pid);
- s_info.svc_daemon_is_launched = 1;
- s_info.svc_daemon_pid = pid;
- s_info.launch_timer = service_common_add_timer(svc_ctx, LAUNCH_TIMEOUT, launch_timeout_cb, NULL);
- if (!s_info.launch_timer) {
- ErrPrint("Unable to create launch timer\n");
- }
+ }
+ break;
+ case AUL_R_LOCAL: /**< Launch by himself */
+ case AUL_R_OK: /**< General success */
+ default:
+ DbgPrint("Launched: %s(%d)\n", SVC_PKG, pid);
+ s_info.svc_daemon_is_launched = 1;
+ s_info.svc_daemon_pid = pid;
+ s_info.launch_timer = service_common_add_timer(svc_ctx, LAUNCH_TIMEOUT, launch_timeout_cb, NULL);
+ if (!s_info.launch_timer) {
+ ErrPrint("Unable to create launch timer\n");
+ }
}
return ret;
}
switch (packet_type(packet)) {
- case PACKET_REQ:
- if (!s_info.svc_daemon_is_launched) {
- ret = launch_svc(tcb_svc_ctx(tcb));
- if (ret != DBOX_STATUS_ERROR_NONE) {
- goto reply_out;
- }
+ case PACKET_REQ:
+ if (!s_info.svc_daemon_is_launched) {
+ ret = launch_svc(tcb_svc_ctx(tcb));
+ if (ret != DBOX_STATUS_ERROR_NONE) {
+ goto reply_out;
}
+ }
- if (!s_info.svc_daemon) {
- ret = put_pended_request(tcb, packet);
- if (ret < 0) {
- goto reply_out;
- }
- } else if (tcb_is_valid(s_info.svc_ctx, s_info.svc_daemon) >= 0) {
- ret = service_common_unicast_packet(s_info.svc_daemon, packet);
- if (ret <0) {
- goto reply_out;
- }
+ if (!s_info.svc_daemon) {
+ ret = put_pended_request(tcb, packet);
+ if (ret < 0) {
+ goto reply_out;
+ }
+ } else if (tcb_is_valid(s_info.svc_ctx, s_info.svc_daemon) >= 0) {
+ ret = service_common_unicast_packet(s_info.svc_daemon, packet);
+ if (ret <0) {
+ goto reply_out;
+ }
- put_reply_tcb(tcb, packet_seq(packet));
+ put_reply_tcb(tcb, packet_seq(packet));
- if (s_info.ttl_timer && service_common_update_timer(s_info.ttl_timer, TTL_TIMEOUT) < 0) {
- ErrPrint("Failed to update timer\n");
- }
+ if (s_info.ttl_timer && service_common_update_timer(s_info.ttl_timer, TTL_TIMEOUT) < 0) {
+ ErrPrint("Failed to update timer\n");
}
+ }
- break;
- case PACKET_REQ_NOACK:
- if (!strcmp(cmd, "service_register")) {
- if (!s_info.svc_daemon_is_launched) {
- ErrPrint("Service daemon is not launched. but something tries to register a service\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
+ break;
+ case PACKET_REQ_NOACK:
+ if (!strcmp(cmd, "service_register")) {
+ if (!s_info.svc_daemon_is_launched) {
+ ErrPrint("Service daemon is not launched. but something tries to register a service\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
- if (s_info.svc_daemon) {
- ErrPrint("Service daemon is already prepared\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
+ if (s_info.svc_daemon) {
+ ErrPrint("Service daemon is already prepared\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
- if (s_info.launch_timer) {
- service_common_del_timer(tcb_svc_ctx(tcb), s_info.launch_timer);
- s_info.launch_timer = NULL;
- }
+ if (s_info.launch_timer) {
+ service_common_del_timer(tcb_svc_ctx(tcb), s_info.launch_timer);
+ s_info.launch_timer = NULL;
+ }
- s_info.ttl_timer = service_common_add_timer(tcb_svc_ctx(tcb), TTL_TIMEOUT, ttl_timer_cb, NULL);
- if (!s_info.ttl_timer) {
- ErrPrint("Failed to add TTL timer\n");
- if (s_info.svc_daemon_pid > 0) {
- ret = aul_terminate_pid(s_info.svc_daemon_pid);
- ErrPrint("Terminate: %d\n", ret);
- s_info.svc_daemon_pid = -1;
- }
- s_info.svc_daemon_is_launched = 0;
- return DBOX_STATUS_ERROR_FAULT;
+ s_info.ttl_timer = service_common_add_timer(tcb_svc_ctx(tcb), TTL_TIMEOUT, ttl_timer_cb, NULL);
+ if (!s_info.ttl_timer) {
+ ErrPrint("Failed to add TTL timer\n");
+ if (s_info.svc_daemon_pid > 0) {
+ ret = aul_terminate_pid(s_info.svc_daemon_pid);
+ ErrPrint("Terminate: %d\n", ret);
+ s_info.svc_daemon_pid = -1;
}
- DbgPrint("TTL Timer is added: %p\n", s_info.ttl_timer);
-
- s_info.svc_daemon = tcb;
- flush_pended_request();
- }
- break;
- case PACKET_ACK:
- tcb = get_reply_tcb(packet_seq(packet));
- if (!tcb) {
- ErrPrint("Unable to find reply tcb\n");
- break;
+ s_info.svc_daemon_is_launched = 0;
+ return DBOX_STATUS_ERROR_FAULT;
}
+ DbgPrint("TTL Timer is added: %p\n", s_info.ttl_timer);
- if (tcb_is_valid(s_info.svc_ctx, tcb) < 0) {
- ErrPrint("TCB is not valid\n");
- break;
- }
+ s_info.svc_daemon = tcb;
+ flush_pended_request();
+ }
+ break;
+ case PACKET_ACK:
+ tcb = get_reply_tcb(packet_seq(packet));
+ if (!tcb) {
+ ErrPrint("Unable to find reply tcb\n");
+ break;
+ }
- ret = service_common_unicast_packet(tcb, packet);
- if (ret < 0) {
- ErrPrint("Unable to forward the reply packet\n");
- }
+ if (tcb_is_valid(s_info.svc_ctx, tcb) < 0) {
+ ErrPrint("TCB is not valid\n");
break;
- default:
- ErrPrint("Packet type is not valid[%s]\n", cmd);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = service_common_unicast_packet(tcb, packet);
+ if (ret < 0) {
+ ErrPrint("Unable to forward the reply packet\n");
+ }
+ break;
+ default:
+ ErrPrint("Packet type is not valid[%s]\n", cmd);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return DBOX_STATUS_ERROR_NONE;
item->user_data = user_data;
switch (event) {
- case XMONITOR_PAUSED:
- s_info.pause_list = eina_list_prepend(s_info.pause_list, item);
- break;
- case XMONITOR_RESUMED:
- s_info.resume_list = eina_list_prepend(s_info.resume_list, item);
- break;
- default:
- ErrPrint("Invalid event type\n");
- DbgFree(item);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ case XMONITOR_PAUSED:
+ s_info.pause_list = eina_list_prepend(s_info.pause_list, item);
+ break;
+ case XMONITOR_RESUMED:
+ s_info.resume_list = eina_list_prepend(s_info.resume_list, item);
+ break;
+ default:
+ ErrPrint("Invalid event type\n");
+ DbgFree(item);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return DBOX_STATUS_ERROR_NONE;
Eina_List *n;
switch (event) {
- case XMONITOR_PAUSED:
- EINA_LIST_FOREACH_SAFE(s_info.pause_list, l, n, item) {
- if (item->cb == cb && item->user_data == user_data) {
- s_info.pause_list = eina_list_remove(s_info.pause_list, item);
- DbgFree(item);
- return DBOX_STATUS_ERROR_NONE;
- }
+ case XMONITOR_PAUSED:
+ EINA_LIST_FOREACH_SAFE(s_info.pause_list, l, n, item) {
+ if (item->cb == cb && item->user_data == user_data) {
+ s_info.pause_list = eina_list_remove(s_info.pause_list, item);
+ DbgFree(item);
+ return DBOX_STATUS_ERROR_NONE;
}
- break;
-
- case XMONITOR_RESUMED:
- EINA_LIST_FOREACH_SAFE(s_info.resume_list, l, n, item) {
- if (item->cb == cb && item->user_data == user_data) {
- s_info.resume_list = eina_list_remove(s_info.resume_list, item);
- DbgFree(item);
- return DBOX_STATUS_ERROR_NONE;
- }
+ }
+ break;
+
+ case XMONITOR_RESUMED:
+ EINA_LIST_FOREACH_SAFE(s_info.resume_list, l, n, item) {
+ if (item->cb == cb && item->user_data == user_data) {
+ s_info.resume_list = eina_list_remove(s_info.resume_list, item);
+ DbgFree(item);
+ return DBOX_STATUS_ERROR_NONE;
}
- break;
- default:
- ErrPrint("Invalid event type\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+ break;
+ default:
+ ErrPrint("Invalid event type\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return DBOX_STATUS_ERROR_NOT_EXIST;
item->user_data = user_data;
switch (event) {
- case XMONITOR_PAUSED:
- s_info.pause_list = eina_list_prepend(s_info.pause_list, item);
- break;
- case XMONITOR_RESUMED:
- s_info.resume_list = eina_list_prepend(s_info.resume_list, item);
- break;
- default:
- ErrPrint("Invalid event type\n");
- DbgFree(item);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ case XMONITOR_PAUSED:
+ s_info.pause_list = eina_list_prepend(s_info.pause_list, item);
+ break;
+ case XMONITOR_RESUMED:
+ s_info.resume_list = eina_list_prepend(s_info.resume_list, item);
+ break;
+ default:
+ ErrPrint("Invalid event type\n");
+ DbgFree(item);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return DBOX_STATUS_ERROR_NONE;
Eina_List *n;
switch (event) {
- case XMONITOR_PAUSED:
- EINA_LIST_FOREACH_SAFE(s_info.pause_list, l, n, item) {
- if (item->cb == cb && item->user_data == user_data) {
- s_info.pause_list = eina_list_remove(s_info.pause_list, item);
- DbgFree(item);
- return DBOX_STATUS_ERROR_NONE;
- }
+ case XMONITOR_PAUSED:
+ EINA_LIST_FOREACH_SAFE(s_info.pause_list, l, n, item) {
+ if (item->cb == cb && item->user_data == user_data) {
+ s_info.pause_list = eina_list_remove(s_info.pause_list, item);
+ DbgFree(item);
+ return DBOX_STATUS_ERROR_NONE;
}
- break;
-
- case XMONITOR_RESUMED:
- EINA_LIST_FOREACH_SAFE(s_info.resume_list, l, n, item) {
- if (item->cb == cb && item->user_data == user_data) {
- s_info.resume_list = eina_list_remove(s_info.resume_list, item);
- DbgFree(item);
- return DBOX_STATUS_ERROR_NONE;
- }
+ }
+ break;
+
+ case XMONITOR_RESUMED:
+ EINA_LIST_FOREACH_SAFE(s_info.resume_list, l, n, item) {
+ if (item->cb == cb && item->user_data == user_data) {
+ s_info.resume_list = eina_list_remove(s_info.resume_list, item);
+ DbgFree(item);
+ return DBOX_STATUS_ERROR_NONE;
}
- break;
- default:
- ErrPrint("Invalid event type\n");
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+ break;
+ default:
+ ErrPrint("Invalid event type\n");
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
}
return DBOX_STATUS_ERROR_NOT_EXIST;