From 61a319403b0dd277ab47a2e08a1ce6a6e1cd9e0a Mon Sep 17 00:00:00 2001 From: Sehong Na Date: Sat, 31 May 2014 12:35:08 +0900 Subject: [PATCH 1/1] Initialize Tizen 2.3 --- CMakeLists.txt | 207 + LICENSE | 206 + data-provider-master.desktop | 9 + data-provider-master.rule | 5 + data/CMakeLists.txt | 7 + data/abi.ini | 17 + data/data-provider-master | 98 + data/data-provider-master.service | 39 + data/dump_livebox.sh | 7 + data/mobile.data-provider-master.service | 29 + data/wayland.mobile.conf.ini | 37 + data/wayland.mobile.resolution.ini | 13 + data/wayland.wearable.conf.ini | 37 + data/wayland.wearable.resolution.ini | 14 + data/x11.mobile.conf.ini | 37 + data/x11.mobile.resolution.ini | 13 + data/x11.wearable.conf.ini | 37 + data/x11.wearable.resolution.ini | 14 + include/abi.h | 24 + include/badge_service.h | 20 + include/buffer_handler.h | 332 ++ include/client_life.h | 105 + include/client_rpc.h | 27 + include/conf.h | 201 + include/critical_log.h | 23 + include/dead_monitor.h | 20 + include/debug.h | 70 + include/event.h | 53 + include/fault_manager.h | 25 + include/file_service.h | 20 + include/group.h | 65 + include/instance.h | 264 + include/io.h | 25 + include/lite-errno.h | 69 + include/liveinfo.h | 35 + include/main.h | 16 + include/notification_service.h | 20 + include/package.h | 131 + include/parser.h | 45 + include/pkgmgr.h | 40 + include/rpc_to_slave.h | 29 + include/script_handler.h | 39 + include/server.h | 20 + include/service_common.h | 63 + include/setting.h | 21 + include/shortcut_service.h | 20 + include/slave_life.h | 215 + include/slave_rpc.h | 32 + include/util.h | 89 + include/utility_service.h | 21 + include/xmonitor.h | 34 + packaging/data-provider-master.changes | 8 + packaging/data-provider-master.manifest | 70 + packaging/data-provider-master.spec | 205 + pkgmgr_livebox/CMakeLists.txt | 31 + pkgmgr_livebox/include/dlist.h | 43 + pkgmgr_livebox/livebox.xml | 78 + pkgmgr_livebox/src/dlist.c | 189 + pkgmgr_livebox/src/service_register.c | 3194 +++++++++++ res/CMakeLists.txt | 1 + res/edje/CMakeLists.txt | 9 + res/edje/master.edc | 112 + src/abi.c | 154 + src/badge_service.c | 593 +++ src/buffer_handler.c | 1765 ++++++ src/buffer_handler_wayland.c | 921 ++++ src/client_life.c | 870 +++ src/client_rpc.c | 283 + src/conf.c | 953 ++++ src/critical_log.c | 179 + src/dead_monitor.c | 98 + src/event.c | 676 +++ src/fault_manager.c | 369 ++ src/file_service.c | 719 +++ src/group.c | 889 ++++ src/instance.c | 3294 ++++++++++++ src/io.c | 895 ++++ src/liveinfo.c | 223 + src/main.c | 461 ++ src/notification_service.c | 709 +++ src/package.c | 1609 ++++++ src/parser.c | 891 ++++ src/pkgmgr.c | 626 +++ src/script_handler.c | 1511 ++++++ src/server.c | 8541 ++++++++++++++++++++++++++++++ src/service_common.c | 1193 +++++ src/setting.c | 240 + src/shortcut_service.c | 256 + src/slave_life.c | 1717 ++++++ src/slave_rpc.c | 702 +++ src/util.c | 732 +++ src/util_wayland.c | 26 + src/util_x11.c | 27 + src/utility_service.c | 452 ++ src/xmonitor.c | 490 ++ src/xmonitor_wayland.c | 251 + util_liveinfo/CMakeLists.txt | 38 + util_liveinfo/include/liveinfo.h | 16 + util_liveinfo/include/node.h | 41 + util_liveinfo/src/liveinfo.c | 2010 +++++++ util_liveinfo/src/node.c | 389 ++ 101 files changed, 42788 insertions(+) create mode 100755 CMakeLists.txt create mode 100644 LICENSE create mode 100644 data-provider-master.desktop create mode 100644 data-provider-master.rule create mode 100644 data/CMakeLists.txt create mode 100644 data/abi.ini create mode 100755 data/data-provider-master create mode 100644 data/data-provider-master.service create mode 100644 data/dump_livebox.sh create mode 100644 data/mobile.data-provider-master.service create mode 100644 data/wayland.mobile.conf.ini create mode 100644 data/wayland.mobile.resolution.ini create mode 100644 data/wayland.wearable.conf.ini create mode 100644 data/wayland.wearable.resolution.ini create mode 100644 data/x11.mobile.conf.ini create mode 100644 data/x11.mobile.resolution.ini create mode 100644 data/x11.wearable.conf.ini create mode 100644 data/x11.wearable.resolution.ini create mode 100644 include/abi.h create mode 100644 include/badge_service.h create mode 100644 include/buffer_handler.h create mode 100644 include/client_life.h create mode 100644 include/client_rpc.h create mode 100644 include/conf.h create mode 100644 include/critical_log.h create mode 100644 include/dead_monitor.h create mode 100644 include/debug.h create mode 100644 include/event.h create mode 100644 include/fault_manager.h create mode 100644 include/file_service.h create mode 100644 include/group.h create mode 100644 include/instance.h create mode 100644 include/io.h create mode 100644 include/lite-errno.h create mode 100644 include/liveinfo.h create mode 100644 include/main.h create mode 100644 include/notification_service.h create mode 100644 include/package.h create mode 100644 include/parser.h create mode 100644 include/pkgmgr.h create mode 100644 include/rpc_to_slave.h create mode 100644 include/script_handler.h create mode 100644 include/server.h create mode 100644 include/service_common.h create mode 100644 include/setting.h create mode 100644 include/shortcut_service.h create mode 100644 include/slave_life.h create mode 100644 include/slave_rpc.h create mode 100644 include/util.h create mode 100644 include/utility_service.h create mode 100644 include/xmonitor.h create mode 100644 packaging/data-provider-master.changes create mode 100644 packaging/data-provider-master.manifest create mode 100755 packaging/data-provider-master.spec create mode 100644 pkgmgr_livebox/CMakeLists.txt create mode 100644 pkgmgr_livebox/include/dlist.h create mode 100644 pkgmgr_livebox/livebox.xml create mode 100644 pkgmgr_livebox/src/dlist.c create mode 100644 pkgmgr_livebox/src/service_register.c create mode 100644 res/CMakeLists.txt create mode 100644 res/edje/CMakeLists.txt create mode 100644 res/edje/master.edc create mode 100644 src/abi.c create mode 100644 src/badge_service.c create mode 100644 src/buffer_handler.c create mode 100644 src/buffer_handler_wayland.c create mode 100644 src/client_life.c create mode 100644 src/client_rpc.c create mode 100644 src/conf.c create mode 100644 src/critical_log.c create mode 100644 src/dead_monitor.c create mode 100644 src/event.c create mode 100644 src/fault_manager.c create mode 100644 src/file_service.c create mode 100644 src/group.c create mode 100644 src/instance.c create mode 100644 src/io.c create mode 100644 src/liveinfo.c create mode 100644 src/main.c create mode 100644 src/notification_service.c create mode 100644 src/package.c create mode 100644 src/parser.c create mode 100644 src/pkgmgr.c create mode 100644 src/script_handler.c create mode 100644 src/server.c create mode 100644 src/service_common.c create mode 100644 src/setting.c create mode 100644 src/shortcut_service.c create mode 100644 src/slave_life.c create mode 100644 src/slave_rpc.c create mode 100644 src/util.c create mode 100644 src/util_wayland.c create mode 100644 src/util_x11.c create mode 100644 src/utility_service.c create mode 100644 src/xmonitor.c create mode 100644 src/xmonitor_wayland.c create mode 100644 util_liveinfo/CMakeLists.txt create mode 100644 util_liveinfo/include/liveinfo.h create mode 100644 util_liveinfo/include/node.h create mode 100644 util_liveinfo/src/liveinfo.c create mode 100644 util_liveinfo/src/node.c diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100755 index 0000000..f11d495 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,207 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(data-provider-master C) + +INCLUDE(FindPkgConfig) +pkg_check_modules(pkg REQUIRED + ail + dlog + aul + vconf + sqlite3 + db-util + glib-2.0 + gio-2.0 + bundle + ecore + eina + com-core + pkgmgr + notification + notification-service + badge + badge-service + libsmack + shortcut + libsystemd-daemon +) + +IF (LIVEBOX) +pkg_check_modules(pkg_livebox REQUIRED + livebox-service +) +ENDIF (LIVEBOX) + +IF (X11_SUPPORT) +pkg_check_modules(pkg_extra REQUIRED + ecore-x + x11 + libdri2 + libdrm + libtbm + xfixes + dri2proto + xext + xdamage +) +ENDIF (X11_SUPPORT) + +IF (WAYLAND_SUPPORT) +pkg_check_modules(pkg_extra REQUIRED + ecore-wayland +) +ENDIF (WAYLAND_SUPPORT) + +SET(PACKAGE "${PROJECT_NAME}") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Winline -Werror -fno-builtin-malloc -fno-omit-frame-pointer -g") + +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) + +#ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") +ADD_DEFINITIONS("-DPATH_MAX=256") +ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"") +ADD_DEFINITIONS("-DLOCALEDIR=\"${LOCALEDIR}\"") + +ADD_DEFINITIONS("-DINFO_SOCKET=\"/opt/usr/share/live_magazine/.live.socket\"") +ADD_DEFINITIONS("-DCLIENT_SOCKET=\"/opt/usr/share/live_magazine/.client.socket\"") +ADD_DEFINITIONS("-DSLAVE_SOCKET=\"/opt/usr/share/live_magazine/.slave.socket\"") +ADD_DEFINITIONS("-DSERVICE_SOCKET=\"/opt/usr/share/live_magazine/.service.socket\"") + +ADD_DEFINITIONS("-DCLIENT_PORT=\"8208\"") + +ADD_DEFINITIONS("-DBADGE_SOCKET=\"/tmp/.badge.service\"") +ADD_DEFINITIONS("-DSHORTCUT_SOCKET=\"/tmp/.shortcut.service\"") +ADD_DEFINITIONS("-DNOTIFICATION_SOCKET=\"/tmp/.notification.service\"") +ADD_DEFINITIONS("-DUTILITY_SOCKET=\"/tmp/.utility.service\"") + +ADD_DEFINITIONS("-DUTILITY_SMACK_LABEL=\"data-provider-master::utility\"") +ADD_DEFINITIONS("-DSHORTCUT_SMACK_LABEL=\"data-provider-master::shortcut\"") +ADD_DEFINITIONS("-DNOTIFICATION_SMACK_LABEL=\"data-provider-master::notification\"") +ADD_DEFINITIONS("-DBADGE_SMACK_LABEL=\"data-provider-master::badge\"") +ADD_DEFINITIONS("-DDATA_SHARE_LABEL=\"data-provider-master::share\"") + +ADD_DEFINITIONS("-DDEFAULT_MASTER_CONF=\"/usr/share/data-provider-master/conf.ini\"") + +ADD_DEFINITIONS("-DNDEBUG") + +ADD_DEFINITIONS("-D_USE_ECORE_TIME_GET") + +IF (MOBILE) + ADD_DEFINITIONS("-DMOBILE") +ELSEIF (WEARABLE) + ADD_DEFINITIONS("-DWEARABLE") +ENDIF (MOBILE) + +SET(BUILD_SOURCE + src/main.c + src/util.c + src/setting.c + src/critical_log.c + src/shortcut_service.c + src/badge_service.c + src/notification_service.c + src/service_common.c + src/conf.c +) + +IF (LIVEBOX) + ADD_DEFINITIONS("-DHAVE_LIVEBOX") + SET(BUILD_SOURCE + ${BUILD_SOURCE} + src/utility_service.c + src/dead_monitor.c + src/package.c + src/instance.c + src/server.c + src/abi.c + src/fault_manager.c + src/parser.c + src/io.c + src/slave_life.c + src/slave_rpc.c + src/client_life.c + src/client_rpc.c + src/group.c + src/script_handler.c + src/liveinfo.c + src/pkgmgr.c + src/event.c + src/file_service.c + ) + + IF (WAYLAND_SUPPORT) + ADD_DEFINITIONS("-DHAVE_WAYLAND") + SET(BUILD_SOURCE + ${BUILD_SOURCE} + src/xmonitor_wayland.c + src/buffer_handler_wayland.c + src/util_wayland.c + ) + ENDIF (WAYLAND_SUPPORT) + + IF (X11_SUPPORT) + ADD_DEFINITIONS("-DHAVE_X11") + SET(BUILD_SOURCE + ${BUILD_SOURCE} + src/xmonitor.c + src/buffer_handler.c + src/util_x11.c + ) + ENDIF (X11_SUPPORT) +ENDIF (LIVEBOX) + +IF (WAYLAND_SUPPORT) + ADD_DEFINITIONS("-DHAVE_WAYLAND") + SET(BUILD_SOURCE + ${BUILD_SOURCE} + src/util_wayland.c + ) +ENDIF (WAYLAND_SUPPORT) + +IF (X11_SUPPORT) + ADD_DEFINITIONS("-DHAVE_X11") + SET(BUILD_SOURCE + ${BUILD_SOURCE} + src/util_x11.c + ) +ENDIF (X11_SUPPORT) + +#ADD_DEFINITIONS("-D_APPLY_SCRIPT_ASYNC_UPDATE") +#ADD_DEFINITIONS("-DFLOG") +ADD_DEFINITIONS(${pkg_CFLAGS}) +ADD_DEFINITIONS(${pkg_LDFLAGS}) +ADD_DEFINITIONS(${pkg_extra_CFLAGS}) +ADD_DEFINITIONS(${pkg_extra_LDFLAGS}) +ADD_DEFINITIONS(${pkg_livebox_CFLAGS}) +ADD_DEFINITIONS(${pkg_livebox_LDFLAGS}) + +ADD_EXECUTABLE(${PROJECT_NAME} ${BUILD_SOURCE}) + +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkg_LDFLAGS} ${pkg_extra_LDFLAGS} ${pkg_livebox_LDFLAGS} "-ldl -lrt") + +IF (LIVEBOX) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/abi.ini DESTINATION /usr/share/data-provider-master PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PRODUCT}.conf.ini DESTINATION /usr/share/data-provider-master RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PRODUCT}.resolution.ini DESTINATION /usr/share/data-provider-master RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +ENDIF (LIVEBOX) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME "${PROJECT_NAME}") +IF (MOBILE) +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE SETUID) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.rule DESTINATION /opt/etc/smack/accesses.d) +ELSE (MOBILE) +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) +ENDIF (MOBILE) + +# INCLUDE FOR BUILD & INSTALL .PO FILES +ADD_SUBDIRECTORY(res) +ADD_SUBDIRECTORY(data) +IF (LIVEBOX) +ADD_SUBDIRECTORY(pkgmgr_livebox) + +IF (X11_SUPPORT) + IF ("${ENGINEER_BINARY}" STREQUAL "true") + ADD_SUBDIRECTORY(util_liveinfo) + ENDIF ("${ENGINEER_BINARY}" STREQUAL "true") +ENDIF (X11_SUPPORT) +ENDIF (LIVEBOX) + +# End of a file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..571fe79 --- /dev/null +++ b/LICENSE @@ -0,0 +1,206 @@ +Flora License + +Version 1.1, April, 2013 + +http://floralicense.org/license/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, +and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by +the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and +all other entities that control, are controlled by, or are +under common control with that entity. For the purposes of +this definition, "control" means (i) the power, direct or indirect, +to cause the direction or management of such entity, +whether by contract or otherwise, or (ii) ownership of fifty percent (50%) +or more of the outstanding shares, or (iii) beneficial ownership of +such entity. + +"You" (or "Your") shall mean an individual or Legal Entity +exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, +including but not limited to software source code, documentation source, +and configuration files. + +"Object" form shall mean any form resulting from mechanical +transformation or translation of a Source form, including but +not limited to compiled object code, generated documentation, +and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, +made available under the License, as indicated by a copyright notice +that is included in or attached to the work (an example is provided +in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, +that is based on (or derived from) the Work and for which the editorial +revisions, annotations, elaborations, or other modifications represent, +as a whole, an original work of authorship. For the purposes of this License, +Derivative Works shall not include works that remain separable from, +or merely link (or bind by name) to the interfaces of, the Work and +Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original +version of the Work and any modifications or additions to that Work or +Derivative Works thereof, that is intentionally submitted to Licensor +for inclusion in the Work by the copyright owner or by an individual or +Legal Entity authorized to submit on behalf of the copyright owner. +For the purposes of this definition, "submitted" means any form of +electronic, verbal, or written communication sent to the Licensor or +its representatives, including but not limited to communication on +electronic mailing lists, source code control systems, and issue +tracking systems that are managed by, or on behalf of, the Licensor +for the purpose of discussing and improving the Work, but excluding +communication that is conspicuously marked or otherwise designated +in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity +on behalf of whom a Contribution has been received by Licensor and +subsequently incorporated within the Work. + +"Tizen Certified Platform" shall mean a software platform that complies +with the standards set forth in the Tizen Compliance Specification +and passes the Tizen Compliance Tests as defined from time to time +by the Tizen Technical Steering Group and certified by the Tizen +Association or its designated agent. + +2. Grant of Copyright License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the +Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +(except as stated in this section) patent license to make, have made, +use, offer to sell, sell, import, and otherwise transfer the Work +solely as incorporated into a Tizen Certified Platform, where such +license applies only to those patent claims licensable by such +Contributor that are necessarily infringed by their Contribution(s) +alone or by combination of their Contribution(s) with the Work solely +as incorporated into a Tizen Certified Platform to which such +Contribution(s) was submitted. If You institute patent litigation +against any entity (including a cross-claim or counterclaim +in a lawsuit) alleging that the Work or a Contribution incorporated +within the Work constitutes direct or contributory patent infringement, +then any patent licenses granted to You under this License for that +Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the +Work or Derivative Works thereof pursuant to the copyright license +above, in any medium, with or without modifications, and in Source or +Object form, provided that You meet the following conditions: + + 1. You must give any other recipients of the Work or Derivative Works + a copy of this License; and + 2. You must cause any modified files to carry prominent notices stating + that You changed the files; and + 3. You must retain, in the Source form of any Derivative Works that + You distribute, all copyright, patent, trademark, and attribution + notices from the Source form of the Work, excluding those notices + that do not pertain to any part of the Derivative Works; and + 4. If the Work includes a "NOTICE" text file as part of its distribution, + then any Derivative Works that You distribute must include a readable + copy of the attribution notices contained within such NOTICE file, + excluding those notices that do not pertain to any part of + the Derivative Works, in at least one of the following places: + within a NOTICE text file distributed as part of the Derivative Works; + within the Source form or documentation, if provided along with the + Derivative Works; or, within a display generated by the Derivative Works, + if and wherever such third-party notices normally appear. + The contents of the NOTICE file are for informational purposes only + and do not modify the License. You may add Your own attribution notices + within Derivative Works that You distribute, alongside or as an addendum + to the NOTICE text from the Work, provided that such additional attribution + notices cannot be construed as modifying the License. You may add Your own + copyright statement to Your modifications and may provide additional or + different license terms and conditions for use, reproduction, or + distribution of Your modifications, or for any such Derivative Works + as a whole, provided Your use, reproduction, and distribution of + the Work otherwise complies with the conditions stated in this License + and your own copyright statement or terms and conditions do not conflict + the conditions stated in the License including section 3. + +5. Submission of Contributions. Unless You explicitly state otherwise, +any Contribution intentionally submitted for inclusion in the Work +by You to the Licensor shall be under the terms and conditions of +this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify +the terms of any separate license agreement you may have executed +with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade +names, trademarks, service marks, or product names of the Licensor, +except as required for reasonable and customary use in describing the +origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or +agreed to in writing, Licensor provides the Work (and each +Contributor provides its Contributions) on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied, including, without limitation, any warranties or conditions +of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A +PARTICULAR PURPOSE. You are solely responsible for determining the +appropriateness of using or redistributing the Work and assume any +risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, +whether in tort (including negligence), contract, or otherwise, +unless required by applicable law (such as deliberate and grossly +negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, +incidental, or consequential damages of any character arising as a +result of this License or out of the use or inability to use the +Work (including but not limited to damages for loss of goodwill, +work stoppage, computer failure or malfunction, or any and all +other commercial damages or losses), even if such Contributor +has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing +the Work or Derivative Works thereof, You may choose to offer, +and charge a fee for, acceptance of support, warranty, indemnity, +or other liability obligations and/or rights consistent with this +License. However, in accepting such obligations, You may act only +on Your own behalf and on Your sole responsibility, not on behalf +of any other Contributor, and only if You agree to indemnify, +defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason +of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Flora License to your work + +To apply the Flora License to your work, attach the following +boilerplate notice, with the fields enclosed by brackets "[]" +replaced with your own identifying information. (Don't include +the brackets!) The text should be enclosed in the appropriate +comment syntax for the file format. We also recommend that a +file or class name and description of purpose be included on the +same "printed page" as the copyright notice for easier +identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Flora License, Version 1.1 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://floralicense.org/license/ + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/data-provider-master.desktop b/data-provider-master.desktop new file mode 100644 index 0000000..77d74ae --- /dev/null +++ b/data-provider-master.desktop @@ -0,0 +1,9 @@ +Name=Live Data Provider - Master +Type=Application +Exec=/usr/bin/data-provider-master +Icon=data-provider-master.png +NoDisplay=True +Network=True +Comment=Homescreen-Live Box content data provider (master) +X-TIZEN-TaskManage=False +X-TIZEN-Multiple=False diff --git a/data-provider-master.rule b/data-provider-master.rule new file mode 100644 index 0000000..c8dc2de --- /dev/null +++ b/data-provider-master.rule @@ -0,0 +1,5 @@ +data-provider-master notification::db rw +data-provider-master ail::db rw +data-provider-master svi-data x +data-provider-master data-provider-master::db rw +data-provider-master system::vconf_system rwxat diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt new file mode 100644 index 0000000..af462e3 --- /dev/null +++ b/data/CMakeLists.txt @@ -0,0 +1,7 @@ +#INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/data-provider-master DESTINATION /etc/rc.d/init.d/ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) +IF (MOBILE) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/mobile.data-provider-master.service DESTINATION /usr/lib/systemd/user/ RENAME data-provider-master.service PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +ELSE (MOBILE) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/data-provider-master.service DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/dump_livebox.sh DESTINATION /opt/etc/dump.d/module.d/ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) +ENDIF (MOBILE) diff --git a/data/abi.ini b/data/abi.ini new file mode 100644 index 0000000..ad8eec3 --- /dev/null +++ b/data/abi.ini @@ -0,0 +1,17 @@ +[c] +package=org.tizen.data-provider-slave + +[cpp] +package=org.tizen.data-provider-slave + +[html] +package=dbox.web-provider + +[osp] +package=gi2qxenosh.osp-appwidget-service + +[app] +package=/APPID/ + +[dali] +package=provider.multi-livebox diff --git a/data/data-provider-master b/data/data-provider-master new file mode 100755 index 0000000..6dd2a92 --- /dev/null +++ b/data/data-provider-master @@ -0,0 +1,98 @@ +#!/bin/sh +# +# Copyright 2013 Samsung Electronics Co., Ltd +# +# Licensed under the Flora License, Version 1.1 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://floralicense.org/license/ +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +launch_provider() +{ + RETRY_COUNT=0 + while [ ! -f "/tmp/.stop.provider" ]; do + # PROVIDER_HEAP_MONITOR_START=false + # PROVIDER_DISABLE_CALL_OPTION=false + # PROVIDER_METHOD="shm", "pixmap", "file" (default = "file") + BUFMGR_LOCK_TYPE="once" BUFMGR_MAP_CACHE="true" /usr/bin/data-provider-master + vconftool set -t bool memory/data-provider-master/started 0 -f + let RETRY_COUNT=$RETRY_COUNT+1 + if [ $RETRY_COUNT -gt 5 ]; then + echo "EXCEED THE MAXIMUM RETRY COUNT: $RETRY_COUNT (max 5)" + break; + fi + done + rm /tmp/.stop.provider +} + +start () +{ + OLDPID=`ps ax | grep /usr/bin/data-provider-master | grep -v grep | awk '{print $1}'` + if [ x"$OLDPID" != x"" ]; then + echo $OLDPID is already running. + exit 0 + fi + + rm /tmp/.stop.provider + launch_provider & +} + +stop () +{ + TMP=`which ps` + if [ $? -ne 0 ]; then + echo "'ps' is not exists" + exit 0 + fi + + TMP=`which grep` + if [ $? -ne 0 ]; then + echo "'grep' is not exists" + exit 0 + fi + + TMP=`which awk` + if [ $? -ne 0 ]; then + echo "'awk' is not exists" + exit 0 + fi + + if [ ! -f "/usr/bin/data-provider-master" ]; then + echo "Data provider master is not installed correctly"; + exit 0; + fi + + touch /tmp/.stop.provider + BIN_INODE=`stat -Lc "%i" /usr/bin/data-provider-master` + + PID=`ps ax | grep 'data-provider-master' | awk '{print $1}'` + for I in $PID; + do + if [ ! -f "/proc/$I/exe" ]; then + continue; + fi + + INODE=`stat -Lc "%i" /proc/$I/exe 2>/dev/null` + if [ x"$BIN_INODE" == x"$INODE" ]; then + echo "Send TERM to $I" + kill $I # Try to terminate a master which is launched already + break + fi + done +} + +case "$1" in + start|"") start;; + stop) stop;; + restart) stop; start;; +esac + +# End of a file diff --git a/data/data-provider-master.service b/data/data-provider-master.service new file mode 100644 index 0000000..e359660 --- /dev/null +++ b/data/data-provider-master.service @@ -0,0 +1,39 @@ +# +# Copyright 2013 Samsung Electronics Co., Ltd +# +# Licensed under the Flora License, Version 1.1 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://floralicense.org/license/ +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +[Unit] +Description=Data Provider daemon +DefaultDependencies=no +After=check-mount.service + +[Service] +Environment=MULTISENSE_SND_PLAYER=tizen_snd_player +Environment=ELM_MODULES=ctxpopup_copypasteUI>entry/api:datetime_input_popup>datetime/api:object_dump>win/api:access_output_tts>access/api +Environment=EINA_LOG_LEVEL=1 +Environment=ECORE_INPUT_TIMEOUT_FIX=0 +Environment=EINA_LOG_LEVELS=ecore_x:4,evas_main:1 +Environment=BUFMGR_LOCK_TYPE="once" +Environment=BUFMGR_MAP_CACHE="true" +Environment=ELM_PROFILE=mobile +EnvironmentFile=-/run/tizen-mobile-env +Type=simple +ExecStart=/usr/bin/data-provider-master +RestartSec=1 +Restart=always +MemoryLimit=50M + +[Install] +WantedBy=multi-user.target diff --git a/data/dump_livebox.sh b/data/dump_livebox.sh new file mode 100644 index 0000000..2fb6c32 --- /dev/null +++ b/data/dump_livebox.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +LIVEBOX_DEBUG=$1/livebox +mkdir -p ${LIVEBOX_DEBUG} +/bin/cp -r /opt/usr/share/live_magazine ${LIVEBOX_DEBUG} +/bin/cp -r /tmp/.dbox.service ${LIVEBOX_DEBUG}/log +ls -la /tmp/ | /bin/grep srw > ${LIVEBOX_DEBUG}/log/tmp.hidden_files diff --git a/data/mobile.data-provider-master.service b/data/mobile.data-provider-master.service new file mode 100644 index 0000000..ee61361 --- /dev/null +++ b/data/mobile.data-provider-master.service @@ -0,0 +1,29 @@ +# +# Copyright 2012 Samsung Electronics Co., Ltd +# +# Licensed under the Flora License, Version 1.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.tizenopensource.org/license +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +[Unit] +Description=Data Provider daemon +After=xorg.target + +[Service] +Type=notify +Environment=BUFMGR_LOCK_TYPE="once" +Environment=BUFMGR_MAP_CACHE="true" +ExecStart=/usr/bin/data-provider-master +RestartSec=1 + +[Install] +WantedBy=tizen-middleware.target diff --git a/data/wayland.mobile.conf.ini b/data/wayland.mobile.conf.ini new file mode 100644 index 0000000..c9b95c7 --- /dev/null +++ b/data/wayland.mobile.conf.ini @@ -0,0 +1,37 @@ +base_width=720 +base_height=1280 +minimum_period=1.0 +#script=edje +#default_abi=c +#default_group=disclosure +default_period=-1.0 +default_packet_time=0.0001 +#default_content=default +minimum_space=104857600 +#replace_tag=/APPID/ +slave_ttl=30.0 +slave_activate_time=30.0 +slave_relaunch_time=3.0 +slave_relaunch_count=3 +max_log_line=1000 +max_log_file=3 +sqilte_flush_max=1048576 +#db_path=/opt/dbspace/.livebox.db +#share_path=/opt/usr/share/live_magazine/ +log_path=/tmp/.dbox.service +#always_path=/opt/usr/share/live_magazine/always +#reader_path=/opt/usr/share/live_magazine/reader +#script_port_path=/usr/share/data-provider-master/plugin-script/ +ping_interval=240.0 +slave_max_load=30 +use_sw_backend=false +provider_method=shm +debug_mode=false +overwrite_content=false +com_core_thread=true +use_xmonitor=false +#input=/dev/input/event2 +pd_request_timeout=5.0 +premultiplied=1 +#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M +#services=[livebox],[shortcut],[notification],[utility],[badge],[file] diff --git a/data/wayland.mobile.resolution.ini b/data/wayland.mobile.resolution.ini new file mode 100644 index 0000000..e2b5a17 --- /dev/null +++ b/data/wayland.mobile.resolution.ini @@ -0,0 +1,13 @@ +1x1=175x175 +2x1=354x175 +2x2=354x354 +4x1=712x175 +4x2=712x354 +4x3=712x533 +4x4=712x712 +4x5=712x891 +4x6=712x1070 +21x21=224x215 +23x21=680x215 +23x23=680x653 +0x0=720x1280 diff --git a/data/wayland.wearable.conf.ini b/data/wayland.wearable.conf.ini new file mode 100644 index 0000000..2866b74 --- /dev/null +++ b/data/wayland.wearable.conf.ini @@ -0,0 +1,37 @@ +base_width=320 +base_height=320 +minimum_period=1.0 +#script=edje +#default_abi=c +#default_group=disclosure +default_period=-1.0 +default_packet_time=0.0001 +#default_content=default +minimum_space=104857600 +#replace_tag=/APPID/ +slave_ttl=0.0 +slave_activate_time=30.0 +slave_relaunch_time=3.0 +slave_relaunch_count=3 +max_log_line=1000 +max_log_file=3 +sqilte_flush_max=1048576 +#db_path=/opt/dbspace/.livebox.db +#share_path=/opt/usr/share/live_magazine/ +log_path=/tmp/.dbox.service +#always_path=/opt/usr/share/live_magazine/always +#reader_path=/opt/usr/share/live_magazine/reader +#script_port_path=/usr/share/data-provider-master/plugin-script/ +ping_interval=240.0 +slave_max_load=30 +use_sw_backend=false +provider_method=shm +debug_mode=false +overwrite_content=false +com_core_thread=true +use_xmonitor=false +#input=/dev/input/event2 +pd_request_timeout=5.0 +premultiplied=0 +#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M +services=[livebox],[shortcut],[badge] diff --git a/data/wayland.wearable.resolution.ini b/data/wayland.wearable.resolution.ini new file mode 100644 index 0000000..b9e7561 --- /dev/null +++ b/data/wayland.wearable.resolution.ini @@ -0,0 +1,14 @@ +1x1=320x320 +2x1=0x0 +2x2=320x320 +4x1=0x0 +4x2=0x0 +4x3=0x0 +4x4=0x0 +4x5=0x0 +4x6=0x0 +21x21=0x0 +23x21=0x0 +23x23=0x0 +0x0=320x320 +base=320x320 diff --git a/data/x11.mobile.conf.ini b/data/x11.mobile.conf.ini new file mode 100644 index 0000000..d0bdfb5 --- /dev/null +++ b/data/x11.mobile.conf.ini @@ -0,0 +1,37 @@ +base_width=720 +base_height=1280 +minimum_period=1.0 +#script=edje +#default_abi=c +#default_group=disclosure +default_period=-1.0 +default_packet_time=0.0001 +#default_content=default +minimum_space=104857600 +#replace_tag=/APPID/ +slave_ttl=30.0 +slave_activate_time=30.0 +slave_relaunch_time=3.0 +slave_relaunch_count=3 +max_log_line=1000 +max_log_file=3 +sqilte_flush_max=1048576 +#db_path=/opt/dbspace/.livebox.db +#share_path=/opt/usr/share/live_magazine/ +log_path=/tmp/.dbox.service +#always_path=/opt/usr/share/live_magazine/always +#reader_path=/opt/usr/share/live_magazine/reader +#script_port_path=/usr/share/data-provider-master/plugin-script/ +ping_interval=240.0 +slave_max_load=30 +use_sw_backend=false +provider_method=pixmap +debug_mode=false +overwrite_content=false +com_core_thread=true +use_xmonitor=false +#input=/dev/input/event2 +pd_request_timeout=5.0 +premultiplied=0 +#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M +#services=[livebox],[shortcut],[notification],[utility],[badge],[file] diff --git a/data/x11.mobile.resolution.ini b/data/x11.mobile.resolution.ini new file mode 100644 index 0000000..e2b5a17 --- /dev/null +++ b/data/x11.mobile.resolution.ini @@ -0,0 +1,13 @@ +1x1=175x175 +2x1=354x175 +2x2=354x354 +4x1=712x175 +4x2=712x354 +4x3=712x533 +4x4=712x712 +4x5=712x891 +4x6=712x1070 +21x21=224x215 +23x21=680x215 +23x23=680x653 +0x0=720x1280 diff --git a/data/x11.wearable.conf.ini b/data/x11.wearable.conf.ini new file mode 100644 index 0000000..260dadb --- /dev/null +++ b/data/x11.wearable.conf.ini @@ -0,0 +1,37 @@ +base_width=320 +base_height=320 +minimum_period=1.0 +#script=edje +#default_abi=c +#default_group=disclosure +default_period=-1.0 +default_packet_time=0.0001 +#default_content=default +minimum_space=104857600 +#replace_tag=/APPID/ +slave_ttl=0.0 +slave_activate_time=30.0 +slave_relaunch_time=3.0 +slave_relaunch_count=3 +max_log_line=1000 +max_log_file=3 +sqilte_flush_max=1048576 +#db_path=/opt/dbspace/.livebox.db +#share_path=/opt/usr/share/live_magazine/ +log_path=/tmp/.dbox.service +#always_path=/opt/usr/share/live_magazine/always +#reader_path=/opt/usr/share/live_magazine/reader +#script_port_path=/usr/share/data-provider-master/plugin-script/ +ping_interval=240.0 +slave_max_load=30 +use_sw_backend=false +provider_method=pixmap +debug_mode=false +overwrite_content=false +com_core_thread=true +use_xmonitor=false +#input=/dev/input/event2 +pd_request_timeout=5.0 +premultiplied=0 +#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M +services=[livebox],[shortcut],[badge] diff --git a/data/x11.wearable.resolution.ini b/data/x11.wearable.resolution.ini new file mode 100644 index 0000000..b9e7561 --- /dev/null +++ b/data/x11.wearable.resolution.ini @@ -0,0 +1,14 @@ +1x1=320x320 +2x1=0x0 +2x2=320x320 +4x1=0x0 +4x2=0x0 +4x3=0x0 +4x4=0x0 +4x5=0x0 +4x6=0x0 +21x21=0x0 +23x21=0x0 +23x23=0x0 +0x0=320x320 +base=320x320 diff --git a/include/abi.h b/include/abi.h new file mode 100644 index 0000000..2b4ebd8 --- /dev/null +++ b/include/abi.h @@ -0,0 +1,24 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +extern int abi_add_entry(const char *abi, const char *pkgname); +extern int abi_update_entry(const char *abi, const char *pkgname); +extern int abi_del_entry(const char *abi); +extern const char *abi_find_slave(const char *abi); +extern void abi_del_all(void); +extern const char *abi_find_by_pkgname(const char *pkgname); + +/* End of a file */ diff --git a/include/badge_service.h b/include/badge_service.h new file mode 100644 index 0000000..ed49c9f --- /dev/null +++ b/include/badge_service.h @@ -0,0 +1,20 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +extern int badge_service_init(void); +extern int badge_service_fini(void); + +/* End of a file */ diff --git a/include/buffer_handler.h b/include/buffer_handler.h new file mode 100644 index 0000000..e3aa982 --- /dev/null +++ b/include/buffer_handler.h @@ -0,0 +1,332 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +struct buffer_info; +struct inst_info; +struct buffer; + +enum buffer_type { /*!< Must have to be sync with libprovider, liblivebox-viewer, liblivebox-edje */ + BUFFER_TYPE_FILE, + BUFFER_TYPE_SHM, + BUFFER_TYPE_PIXMAP, + BUFFER_TYPE_ERROR +}; + +/*! + * \brief + * \param[in] type + * \param[in] w + * \param[in] h + * \param[in] pixel_size + * \return buffer_info + */ +extern struct buffer_info *buffer_handler_create(struct inst_info *inst, enum buffer_type type, int w, int h, int pixel_size); + +/*! + * \brief + * \param[in] info + * \return int + */ +extern int buffer_handler_destroy(struct buffer_info *info); + +/*! + * \brief + * \param[in] info + * \return int + */ +extern int buffer_handler_load(struct buffer_info *info); + +/*! + * \brief + * \param[in] info + * \return int + */ +extern int buffer_handler_unload(struct buffer_info *info); + +/*! + * \brief + * \param[in] info + * \return int + */ +extern int buffer_handler_is_loaded(const struct buffer_info *info); + +/*! + * \brief Reallocate buffer + * \param[in] info + * \param[in] w + * \param[in] h + * \return int + */ +extern int buffer_handler_resize(struct buffer_info *info, int w, int h); + +/*! + * \brief Only update the size information + * \param[in] info + * \param[in] w + * \param[in] h + * \return void + */ +extern void buffer_handler_update_size(struct buffer_info *info, int w, int h); + +/*! + * \brief + * \param[in] info + * \return const char * + */ +extern const char *buffer_handler_id(const struct buffer_info *info); + +/*! + * \param[in] info + * \return buffer_type + */ +extern enum buffer_type buffer_handler_type(const struct buffer_info *info); + +/*! + * \brief This API is not supported for Pixmap. + * \param[in] info + * \return void* + */ +extern void *buffer_handler_fb(struct buffer_info *info); + +/*! + * \brief + * \param[in] info + * \param[out] w + * \param[out] h + * \return int + */ +extern int buffer_handler_get_size(struct buffer_info *info, int *w, int *h); + +/*! + * \brief This API only can be used for file type buffer + * \param[in] info + * \return void + */ +extern void buffer_handler_flush(struct buffer_info *info); + +/*! + * \brief + * \param[in] info + * \return 0 if fails. Return value should be casted to Pixmap type + */ +extern int buffer_handler_pixmap(const struct buffer_info *info); + +/*! + * \brief + * \param[in] info + * \return buffer + */ +extern void *buffer_handler_pixmap_acquire_buffer(struct buffer_info *info); + +/*! + * \brief + * \param[in] info + * \return int + */ +extern int buffer_handler_pixmap_release_buffer(void *canvas); + +/*! + * \brief + * \return int + */ +extern int buffer_handler_init(void); + +/*! + * \brief + * \details + * \remarks + * \return int + * \retval + * \pre + * \post + * \sa + */ +extern int buffer_handler_fini(void); + +/*! + * \brief + * \details + * \remarks + * \param[in] info + * \return void * + * \retval NULL + * \retval address + * \pre + * \post + * \sa + */ +extern void *buffer_handler_pixmap_ref(struct buffer_info *info); + +/*! + * \brief + * \details + * \remarks + * \param[in] buffer_ptr + * \return int + * \retval + * \pre + * \post + * \sa + */ +extern int buffer_handler_pixmap_unref(void *buffer_ptr); + +/*! + * \brief + * \details + * \remarks + * \param[in] pixmap + * \return void * + * \retval + * \pre + * \post + * \sa + */ +extern void *buffer_handler_pixmap_find(int pixmap); + +/*! + * \brief + * \details + * \remarks + * \param[in] info + * \return void * + * \retval + * \pre + * \post + * \sa + */ +extern void *buffer_handler_pixmap_buffer(struct buffer_info *info); + +/*! + * \brief + * \details + * \remarks + * \param[in] info + * \return struct inst_info * + * \retval + * \pre + * \post + * \sa + */ +extern struct inst_info *buffer_handler_instance(struct buffer_info *info); + +/*! + * \brief + * \details + * \remarks + * \param[in] type + * \param[in] resource + * \return struct buffer * + * \retval NULL + * \retval address + * \pre + * \post + * \sa + */ +extern struct buffer *buffer_handler_raw_open(enum buffer_type type, void *resource); + +/*! + * \brief + * \details + * \remarks + * \param[in] buffer + * \return int + * \retval + * \pre + * \post + * \sa + */ +extern int buffer_handler_raw_close(struct buffer *buffer); + +/*! + * \brief + * \details + * \remarks + * \param[in] buffer + * \return void * + * \retval NULL + * \pre + * \post + * \sa + */ +extern void *buffer_handler_raw_data(struct buffer *buffer); + +/*! + * \brief + * \details + * \remarks + * \param[in] buffer + * \return int + * \retval + * \pre + * \post + * \sa + */ +extern int buffer_handler_raw_size(struct buffer *buffer); + +/*! + * \brief + * \details + * \remarks + * \param[in] buffer + * \return int + * \retval + * \pre + * \post + * \sa + */ +extern int buffer_handler_lock(struct buffer_info *buffer); + +/*! + * \brief + * \details + * \remarks + * \param[in] buffer + * \return int + * \retval + * \pre + * \post + * \sa + */ +extern int buffer_handler_unlock(struct buffer_info *buffer); + +/*! + * \brief + * \details + * \remarks + * \param[in] buffer + * \param[in] data + * \return int + * \retval + * \pre + * \post + * \sa + */ +extern int buffer_handler_set_data(struct buffer_info *buffer, void *data); + +/*! + * \brief + * \details + * \remarks + * \param[in] buffer + * \return void * + * \retval NULL + * \retval address + * \pre + * \post + * \sa + */ +extern void *buffer_handler_data(struct buffer_info *buffer); +/* End of a file */ diff --git a/include/client_life.h b/include/client_life.h new file mode 100644 index 0000000..fa88612 --- /dev/null +++ b/include/client_life.h @@ -0,0 +1,105 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +enum client_event { + CLIENT_EVENT_ACTIVATE, + CLIENT_EVENT_DEACTIVATE +}; + +enum client_global_event { + CLIENT_GLOBAL_EVENT_CREATE, + CLIENT_GLOBAL_EVENT_DESTROY +}; + +struct inst_info; +struct packet; + +/*! + * \note + * Create & Destroy + */ +extern struct client_node *client_create(pid_t pid, int handle); +#define client_destroy(client) client_unref(client) + +/*! + * \note + * Reference count + */ +extern struct client_node *client_ref(struct client_node *client); +extern struct client_node *client_unref(struct client_node *client); +extern const int const client_refcnt(const struct client_node *client); + +/*! + * \note + * Information of client PID + */ +extern const pid_t const client_pid(const struct client_node *client); +extern struct client_node *client_find_by_pid(pid_t pid); +extern struct client_node *client_find_by_rpc_handle(int handle); + +/*! + * \note + * Statistics for state of client + */ +extern const int const client_count_paused(void); +extern int client_is_all_paused(void); +extern int client_count(void); + +/*! + * \note + * For dead signal handler + */ +extern struct client_node *client_deactivated_by_fault(struct client_node *client); +extern void client_reset_fault(struct client_node *client); +extern const int const client_is_faulted(const struct client_node *client); + +/*! + * \note + * For other components which wants to know the state of a client + */ +extern int client_event_callback_add(struct client_node *client, enum client_event event, int (*cb)(struct client_node *, void *), void *data); +extern int client_event_callback_del(struct client_node *client, enum client_event event, int (*cb)(struct client_node *, void *), void *data); + +extern int client_global_event_handler_del(enum client_global_event event_type, int (*cb)(struct client_node *, void *), void *data); +extern int client_global_event_handler_add(enum client_global_event event_type, int (*cb)(struct client_node *client, void *data), void *data); + +/*! + * \note + * Private data set & get + */ +extern int client_set_data(struct client_node *client, const char *tag, void *data); +extern void *client_data(struct client_node *client, const char *tag); +extern void *client_del_data(struct client_node *client, const char *tag); + +/*! + * Handling the client statues + * Paused or Resumed + */ +extern void client_paused(struct client_node *client); +extern void client_resumed(struct client_node *client); + +extern int client_subscribe(struct client_node *client, const char *cluster, const char *category); +extern int client_unsubscribe(struct client_node *client, const char *cluster, const char *category); +extern int client_is_subscribed(struct client_node *client, const char *cluster, const char *category); + +extern int client_init(void); +extern void client_fini(void); + +extern int client_browse_list(const char *cluster, const char *category, int (*cb)(struct client_node *client, void *data), void *data); +extern int client_nr_of_subscriber(const char *cluster, const char *category); + +extern int client_broadcast(struct inst_info *inst, struct packet *packet); +/* End of a file */ diff --git a/include/client_rpc.h b/include/client_rpc.h new file mode 100644 index 0000000..20a8a38 --- /dev/null +++ b/include/client_rpc.h @@ -0,0 +1,27 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*! + */ +extern int client_rpc_async_request(struct client_node *client, struct packet *packet); +extern int client_rpc_handle(struct client_node *client); + +/*! + */ +extern int client_rpc_init(struct client_node *client, int handle); +extern int client_rpc_fini(struct client_node *client); + +/* End of a file */ diff --git a/include/conf.h b/include/conf.h new file mode 100644 index 0000000..aab11d1 --- /dev/null +++ b/include/conf.h @@ -0,0 +1,201 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +struct conf { + int width; + int height; + + int base_width; + int base_height; + double minimum_period; + + struct { + char *script; + char *abi; + char *pd_group; + double period; + int pixels; + } default_conf; + + struct { + char *name; + char *secured; + char *abi; + } launch_key; + + double default_packet_time; + + char *empty_content; + char *empty_title; + + char *default_content; + char *default_title; + + unsigned long minimum_space; + + char *replace_tag; + + double slave_ttl; + double slave_activate_time; + double slave_relaunch_time; + int slave_relaunch_count; + + int max_log_line; + int max_log_file; + + unsigned long sqlite_flush_max; + + struct { + char *conf; + char *image; + char *script; + char *root; + char *script_port; + char *slave_log; + char *reader; + char *always; + char *db; + char *input; + } path; + + int max_size_type; + + int slave_max_load; + + double ping_time; + + char *vconf_sys_cluster; + int max_pended_ctx_events; + + int use_sw_backend; + char *provider_method; + int debug_mode; + int overwrite_content; + int com_core_thread; + int use_xmonitor; + int premultiplied; + + double scale_width_factor; + double scale_height_factor; + + double pd_request_timeout; + + char *emergency_disk; + char *services; +}; + +extern struct conf g_conf; + +extern int conf_loader(void); +extern void conf_update_size(void); +extern void conf_reset(void); +extern void conf_init(void); + +#define BASE_W g_conf.base_width +#define BASE_H g_conf.base_height + +#define CR 13 +#define LF 10 + +#define EMERGENCY_DISK g_conf.emergency_disk +#define SCALE_WIDTH_FACTOR g_conf.scale_width_factor +#define SCALE_HEIGHT_FACTOR g_conf.scale_height_factor + +#define USE_SW_BACKEND g_conf.use_sw_backend +#define PROVIDER_METHOD g_conf.provider_method +#define DEBUG_MODE g_conf.debug_mode +#define OVERWRITE_CONTENT g_conf.overwrite_content +#define COM_CORE_THREAD g_conf.com_core_thread + +#define MINIMUM_PERIOD g_conf.minimum_period + +#define DEFAULT_SCRIPT g_conf.default_conf.script +#define DEFAULT_ABI g_conf.default_conf.abi +#define DEFAULT_GROUP g_conf.default_conf.pd_group +#define DEFAULT_PERIOD g_conf.default_conf.period +#define DEFAULT_PIXELS g_conf.default_conf.pixels +#define PRIORITY_NO_CHANGE -1.0f + +#define BUNDLE_SLAVE_NAME g_conf.launch_key.name +#define BUNDLE_SLAVE_SECURED g_conf.launch_key.secured +#define BUNDLE_SLAVE_ABI g_conf.launch_key.abi +#define PACKET_TIME g_conf.default_packet_time +#define CONTENT_NO_CHANGE g_conf.empty_content +#define TITLE_NO_CHANGE g_conf.empty_title +#define DEFAULT_TITLE g_conf.default_title +#define DEFAULT_CONTENT g_conf.default_content +#define MINIMUM_SPACE g_conf.minimum_space + +#define IMAGE_PATH g_conf.path.image +#define SCRIPT_PATH g_conf.path.script +#define SCRIPT_PORT_PATH g_conf.path.script_port +#define CONF_PATH g_conf.path.conf +#define ROOT_PATH g_conf.path.root +#define SLAVE_LOG_PATH g_conf.path.slave_log +#define READER_PATH g_conf.path.reader +#define ALWAYS_PATH g_conf.path.always +#define INPUT_PATH g_conf.path.input + +#define REPLACE_TAG_APPID g_conf.replace_tag +#define SLAVE_TTL g_conf.slave_ttl +#define SLAVE_ACTIVATE_TIME g_conf.slave_activate_time +#define SLAVE_RELAUNCH_TIME g_conf.slave_relaunch_time +#define SLAVE_RELAUNCH_COUNT g_conf.slave_relaunch_count + +#define MAX_LOG_LINE g_conf.max_log_line +#define MAX_LOG_FILE g_conf.max_log_file + +#define SQLITE_FLUSH_MAX g_conf.sqlite_flush_max +#define DBFILE g_conf.path.db + +#define PD_REQUEST_TIMEOUT g_conf.pd_request_timeout + +#define SLAVE_MAX_LOAD g_conf.slave_max_load +#define DEFAULT_PING_TIME g_conf.ping_time +#define PREMULTIPLIED_COLOR g_conf.premultiplied +#define SERVICES g_conf.services + +#define SERVICE_LIVEBOX "[livebox]" +#define SERVICE_NOTIFICATION "[notification]" +#define SERVICE_BADGE "[badge]" +#define SERVICE_SHORTCUT "[shortcut]" +#define SERVICE_UTILITY "[utility]" +#define SERVICE_FILE "[file]" + +#define PAUSED_FILE "/tmp/.live.paused" + +#define MAX_ABI 256 +#define MAX_PKGNAME 512 +#define DELAY_TIME 0.0000001f +#define DEFAULT_CLUSTER "user,created" +#define MINIMUM_REACTIVATION_TIME 10 + +#if !defined(VCONFKEY_MASTER_STARTED) +#define VCONFKEY_MASTER_STARTED "memory/data-provider-master/started" +#endif + +#if !defined(VCONFKEY_MASTER_RESTART_COUNT) +#define VCONFKEY_MASTER_RESTART_COUNT "memory/private/data-provider-master/restart_count" +#endif + +#define USE_XMONITOR g_conf.use_xmonitor + +#define HAPI __attribute__((visibility("hidden"))) +/*! + * EAPI is defined from eina.h + */ + +/* End of a file */ diff --git a/include/critical_log.h b/include/critical_log.h new file mode 100644 index 0000000..f060ce1 --- /dev/null +++ b/include/critical_log.h @@ -0,0 +1,23 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +extern int critical_log(const char *func, int line, const char *fmt, ...); +extern int critical_log_init(const char *tag); +extern void critical_log_fini(void); + +#define CRITICAL_LOG(args...) critical_log(__func__, __LINE__, args) + +/* End of a file */ diff --git a/include/dead_monitor.h b/include/dead_monitor.h new file mode 100644 index 0000000..96efa3b --- /dev/null +++ b/include/dead_monitor.h @@ -0,0 +1,20 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +extern int dead_init(void); +extern int dead_fini(void); + +/* End of a file */ diff --git a/include/debug.h b/include/debug.h new file mode 100644 index 0000000..cc4911f --- /dev/null +++ b/include/debug.h @@ -0,0 +1,70 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if !defined(FLOG) +#define DbgPrint(format, arg...) SECURE_LOGD(format, ##arg) +#define ErrPrint(format, arg...) SECURE_LOGE(format, ##arg) +#define WarnPrint(format, arg...) SECURE_LOGW(format, ##arg) +#else +extern FILE *__file_log_fp; +#define DbgPrint(format, arg...) do { fprintf(__file_log_fp, "[LOG] [%s/%s:%d] " format, util_basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0) +#define ErrPrint(format, arg...) do { fprintf(__file_log_fp, "[ERR] [%s/%s:%d] " format, util_basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0) +#define WarnPrint(format, arg...) do { fprintf(__file_log_fp, "[WRN] [%s/%s:%d] " format, util_basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0) +#endif + +// DbgPrint("FREE\n"); +#define DbgFree(a) do { \ + free(a); \ +} while (0) + +#define DbgXFree(a) do { \ + DbgPrint("XFree\n"); \ + XFree(a); \ +} while (0) + + +#if defined(LOG_TAG) +#undef LOG_TAG +#endif + +#define LOG_TAG "DATA_PROVIDER_MASTER" + +#if defined(_ENABLE_PERF) +#define PERF_INIT() \ + struct timeval __stv; \ + struct timeval __etv; \ + struct timeval __rtv + +#define PERF_BEGIN() do { \ + if (gettimeofday(&__stv, NULL) < 0) { \ + ErrPrint("gettimeofday: %s\n", strerror(errno)); \ + } \ +} while (0) + +#define PERF_MARK(tag) do { \ + if (gettimeofday(&__etv, NULL) < 0) { \ + ErrPrint("gettimeofday: %s\n", strerror(errno)); \ + } \ + timersub(&__etv, &__stv, &__rtv); \ + DbgPrint("[%s] %u.%06u\n", tag, __rtv.tv_sec, __rtv.tv_usec); \ +} while (0) +#else +#define PERF_INIT() +#define PERF_BEGIN() +#define PERF_MARK(tag) +#endif + +/* End of a file */ diff --git a/include/event.h b/include/event.h new file mode 100644 index 0000000..800b071 --- /dev/null +++ b/include/event.h @@ -0,0 +1,53 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +struct event_data { + int x; + int y; + unsigned int keycode; + int device; + int slot; + struct { + int major; + int minor; + } touch; + struct { + int major; + int minor; + } width; + int distance; /* Hovering */ +#if defined(_USE_ECORE_TIME_GET) + double tv; +#else + struct timeval tv; +#endif +}; + +enum event_state { + EVENT_STATE_DEACTIVATED, + EVENT_STATE_ACTIVATE, + EVENT_STATE_ACTIVATED, + EVENT_STATE_DEACTIVATE, + EVENT_STATE_ERROR +}; + +extern int event_init(void); +extern int event_fini(void); +extern int event_activate(int x, int y, int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data); +extern int event_deactivate(int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data); +extern int event_is_activated(void); + +/* End of a file */ diff --git a/include/fault_manager.h b/include/fault_manager.h new file mode 100644 index 0000000..cfc1bec --- /dev/null +++ b/include/fault_manager.h @@ -0,0 +1,25 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +extern int fault_check_pkgs(struct slave_node *node); +extern int fault_func_call(struct slave_node *node, const char *pkgname, const char *filename, const char *func); +extern int fault_func_ret(struct slave_node *node, const char *pkgname, const char *filename, const char *func); +extern int const fault_is_occured(void); +extern void fault_unicast_info(struct client_node *client, const char *pkgname, const char *filename, const char *func); +extern void fault_broadcast_info(const char *pkgname, const char *filename, const char *func); +extern int fault_info_set(struct slave_node *slave, const char *pkgname, const char *id, const char *func); + +/* End of a file */ diff --git a/include/file_service.h b/include/file_service.h new file mode 100644 index 0000000..208f739 --- /dev/null +++ b/include/file_service.h @@ -0,0 +1,20 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +extern int file_service_init(void); +extern int file_service_fini(void); + +/* End of a file */ diff --git a/include/group.h b/include/group.h new file mode 100644 index 0000000..04dfddd --- /dev/null +++ b/include/group.h @@ -0,0 +1,65 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +struct cluster; +struct category; +struct pkg_info; +struct context_info; +struct context_item; +struct context_option; + +extern struct cluster *group_create_cluster(const char *name); +extern struct cluster *group_find_cluster(const char *name); +extern int group_destroy_cluster(struct cluster *cluster); + +extern struct category *group_create_category(struct cluster *cluster, const char *name); +extern struct category *group_find_category(struct cluster *cluster, const char *name); +extern int group_destroy_category(struct category *category); + +extern const char * const group_category_name(struct category *category); +extern const char * const group_cluster_name(struct cluster *cluster); +extern const char *group_cluster_name_by_category(struct category *category); + +extern int group_add_package(struct category *category, const char *pkgname); +extern int group_del_package(struct category *category, const char *pkgname); + +extern int group_add_livebox(const char *group, const char *pkgname); +extern int group_del_livebox(const char *pkgname); + +extern int group_init(void); +extern int group_fini(void); + +extern struct context_info *group_create_context_info(struct category *category, const char *pkgname); +extern struct context_item *group_add_context_item(struct context_info *info, const char *ctx_item); +extern int group_add_option(struct context_item *item, const char *key, const char *value); +extern int group_destroy_context_info(struct context_info *info); + +extern Eina_List * const group_context_info_list(struct category *category); +extern Eina_List * const group_context_item_list(struct context_info *info); +extern Eina_List * const group_context_option_list(struct context_item *item); +extern Eina_List * const group_cluster_list(void); +extern Eina_List * const group_category_list(struct cluster *cluster); +extern struct context_info * const group_context_info_from_item(struct context_item *item); +extern struct category * const group_category_from_context_info(struct context_info *info); +extern const char * const group_option_item_key(struct context_option *option); +extern const char * const group_option_item_value(struct context_option *option); +extern const char * const group_context_item(struct context_item *item); +extern const char * const group_pkgname_from_context_info(struct context_info *info); + +extern void *group_context_item_del_data(struct context_item *item, const char *tag); +extern void *group_context_item_data(struct context_item *item, const char *tag); +extern int group_context_item_add_data(struct context_item *item, const char *tag, void *data); +/* End of a file */ diff --git a/include/instance.h b/include/instance.h new file mode 100644 index 0000000..a61c32c --- /dev/null +++ b/include/instance.h @@ -0,0 +1,264 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*! + * \note + * An instance has three states. + * ACTIVATED, DEACTIVATED, DESTROYED + * + * When the master is launched and someone requires to create this instance, + * The master just allocate a heap for new instance. + * We defined this as "DEACTIVATED" state. + * + * After master successfully allocate heap for an instance, + * It will send a load request to a specified slave + * (The slave will be specified when a package informaion is + * prepared via configuration file of each livebox packages.) + * We defined this as "REQUEST_TO_ACTIVATE" state. + * + * After the slave create a new instance, it will sends back + * "created" event to the master. + * Then the master will change the state of the instance to + * "ACTIVATED". + * + * Sometimes, slaves can meet some unexpected problems then + * it will tries to clear all problems and tries to keep them in safe env. + * To do this, master or slave can be terminated. + * In this case, the master has to find the fault module(crashed livebox) + * and prevent it from loading at the slave. + * And it will send requests for re-creating all other normal liveboxes. + * We defined this as "REQUEST_TO_REACTIVATE". + * + * After slave is launched again(recovered from fault situation), it will + * receives "re-create" event from the master, then it will create all + * instances of requested liveboxes. + * + * When the master receives "created" event from the slaves, + * It will change the instance's state to "ACTIVATED" + * But now, the master will not send "created" event to the clients. + * + * Because the clients don't want to know the re-created liveboxes. + * They just want to know about fault liveboxes to display deactivated + * message. + * + * Sometimes the master can send requests to the slave to unload instances. + * We defined this as "REQUEST_TO_DEACTIVATE". + * + * After the slave successfully destroy instances, + * The master will change the instance's state to "DEACTIVATED" + * It is same state with the first time when it is created in the master. + * + * Sometimes, the instances can be deleted permanently from the master and slave. + * We called this "destorying an instance". + * So we defined its states as "DESTROYED". + * It can make confusing us, the "DESTROYED" means like the instance is already deleted from the + * heap,. + * Yes, it is right. But the instance cannot be deleted directly. + * Because some callbacks still reference it to complete its job. + * So the instance needs to keep this DESTROYED state for a while + * until all callbacks are done for their remained jobs. + * + * To unload the instance from the slave, + * The master should send a request to the slave, + * And the master should keep the instance until it receives "deleted" event from the slave. + * We defined this state as "REQUEST_TO_DESTROY". + * + * After master receives "deleted" event from the slave, + * It will change the state of an master to "DESTROYED" + * + * There is one more event to change the state of an instance to "DESTROYED". + * In case of system created livebox, it could be destroyed itself. + * So the slave will send "deleted" event to the master directly. + * Even if the master doesn't requests to delete it. + * + * In this case, the master will change the state of an instance to + * "DESTROYED" state. but it will wait to delete it from the heap until + * reference count of an instance reaches to ZERO. + */ + +enum instance_event { + INSTANCE_EVENT_DESTROY, + INSTNACE_EVENT_UNKNOWN +}; + +enum instance_destroy_type { + INSTANCE_DESTROY_DEFAULT = 0x00, + INSTANCE_DESTROY_UPGRADE = 0x01, + INSTANCE_DESTROY_UNINSTALL = 0x02, + INSTANCE_DESTROY_TERMINATE = 0x03, + INSTANCE_DESTROY_FAULT = 0x04, + INSTANCE_DESTROY_TEMPORARY = 0x05, + INSTANCE_DESTROY_UNKNOWN = 0x06 +}; + +enum instance_state { + INST_INIT = 0x0, /*!< Only keeps in the master */ + + /*! + */ + INST_ACTIVATED, /*!< This instance is loaded to the slave */ + INST_REQUEST_TO_ACTIVATE, /*!< Sent a request to a slave to load this */ + INST_REQUEST_TO_REACTIVATE, /*!< Sent a request to a slave to load this without "created" event for clients(viewer) */ + + /*! + */ + INST_DESTROYED, /*!< Instance is unloaded and also it requires to be deleted from the master */ + INST_REQUEST_TO_DESTROY /*!< Sent a request to a slave, when the master receives deleted event, the master will delete this */ +}; + +enum livebox_visible_state { /*!< Must be sync'd with livebox-viewer */ + LB_SHOW = 0x00, /*!< Livebox is showed. Default state */ + LB_HIDE = 0x01, /*!< Livebox is hide, with no update event, but keep update timer */ + + LB_HIDE_WITH_PAUSE = 0x02, /*!< Livebix is hide, it needs to be paused (with freezed update timer) */ + + LB_VISIBLE_ERROR = 0xFFFFFFFF /* To enlarge the size of this enumeration type */ +}; + +#define IS_PD 1 +#define IS_LB 0 + +struct inst_info; +struct pkg_info; +struct script_handle; +struct client_node; + +extern struct inst_info *instance_create(struct client_node *client, double timestamp, const char *pkgname, const char *content, const char *cluster, const char *category, double period, int width, int height); +extern int instance_destroy(struct inst_info *inst, enum instance_destroy_type type); +extern int instance_reload(struct inst_info *inst, enum instance_destroy_type type); + +extern struct inst_info * instance_ref(struct inst_info *inst); +extern struct inst_info * instance_unref(struct inst_info *inst); + +extern int instance_state_reset(struct inst_info *inst); +extern int instance_destroyed(struct inst_info *inst, int reason); + +extern int instance_reactivate(struct inst_info *inst); +extern int instance_activate(struct inst_info *inst); + +extern int instance_recover_state(struct inst_info *inst); +extern int instance_need_slave(struct inst_info *inst); + +extern void instance_set_lb_info(struct inst_info *inst, double priority, const char *content, const char *title); +extern void instance_set_lb_size(struct inst_info *inst, int w, int h); +extern void instance_set_pd_size(struct inst_info *inst, int w, int h); +extern void instance_set_alt_info(struct inst_info *inst, const char *icon, const char *name); + +extern int instance_set_pinup(struct inst_info *inst, int pinup); +extern int instance_resize(struct inst_info *inst, int w, int h); +extern int instance_hold_scroll(struct inst_info *inst, int seize); +extern int instance_set_period(struct inst_info *inst, double period); +extern int instance_clicked(struct inst_info *inst, const char *event, double timestamp, double x, double y); +extern int instance_text_signal_emit(struct inst_info *inst, const char *emission, const char *source, double sx, double sy, double ex, double ey); +extern int instance_signal_emit(struct inst_info *inst, const char *emission, const char *source, double sx, double sy, double ex, double ey, double x, double y, int down); +extern int instance_change_group(struct inst_info *inst, const char *cluster, const char *category); +extern int instance_set_visible_state(struct inst_info *inst, enum livebox_visible_state state); +extern enum livebox_visible_state instance_visible_state(struct inst_info *inst); +extern int instance_set_update_mode(struct inst_info *inst, int active_update); +extern int instance_active_update(struct inst_info *inst); + +/*! + * \note + * getter + */ +extern const double const instance_timestamp(const struct inst_info *inst); +extern struct pkg_info * const instance_package(const struct inst_info *inst); +extern struct script_info * const instance_lb_script(const struct inst_info *inst); +extern struct script_info * const instance_pd_script(const struct inst_info *inst); +extern struct buffer_info * const instance_pd_buffer(const struct inst_info *inst); +extern struct buffer_info * const instance_lb_buffer(const struct inst_info *inst); +extern const char * const instance_id(const struct inst_info *inst); +extern const char * const instance_content(const struct inst_info *inst); +extern const char * const instance_category(const struct inst_info *inst); +extern const char * const instance_cluster(const struct inst_info *inst); +extern const char * const instance_title(const struct inst_info *inst); +extern const char * const instance_auto_launch(const struct inst_info *inst); +extern const int const instance_priority(const struct inst_info *inst); +extern const struct client_node * const instance_client(const struct inst_info *inst); +extern const double const instance_period(const struct inst_info *inst); +extern const int const instance_timeout(const struct inst_info *inst); +extern const int const instance_lb_width(const struct inst_info *inst); +extern const int const instance_lb_height(const struct inst_info *inst); +extern const int const instance_pd_width(const struct inst_info *inst); +extern const int const instance_pd_height(const struct inst_info *inst); +extern const enum instance_state const instance_state(const struct inst_info *inst); + +/*! + * event + */ +extern int instance_unicast_created_event(struct inst_info *inst, struct client_node *client); +extern int instance_unicast_deleted_event(struct inst_info *inst, struct client_node *client, int reason); + +extern int instance_create_lb_buffer(struct inst_info *inst, int pixels); +extern int instance_create_pd_buffer(struct inst_info *inst, int pixels); + +extern void instance_slave_set_pd_pos(struct inst_info *inst, double x, double y); +extern void instance_slave_get_pd_pos(struct inst_info *inst, double *x, double *y); + +extern int instance_slave_open_pd(struct inst_info *inst, struct client_node *client); +extern int instance_slave_close_pd(struct inst_info *inst, struct client_node *client, int reason); + +extern int instance_freeze_updator(struct inst_info *inst); +extern int instance_thaw_updator(struct inst_info *inst); + +extern int instance_send_access_event(struct inst_info *inst, int status); + +extern int instance_lb_update_begin(struct inst_info *inst, double priority, const char *content, const char *title); +extern int instance_lb_update_end(struct inst_info *inst); + +extern int instance_pd_update_begin(struct inst_info *inst); +extern int instance_pd_update_end(struct inst_info *inst); + +extern void instance_pd_updated(const char *pkgname, const char *id, const char *descfile); +extern void instance_lb_updated_by_instance(struct inst_info *inst, const char *safe_file); +extern void instance_pd_updated_by_instance(struct inst_info *inst, const char *descfile); + +/*! + * \note + * if the status is LB_STATUS_ERROR_FAULT (slave is faulted) + * even though the PD is not created, this will forcely send the PD_DESTROYED event to the client. + */ +extern int instance_client_pd_destroyed(struct inst_info *inst, int status); +extern int instance_client_pd_created(struct inst_info *inst, int status); + +extern int instance_send_access_status(struct inst_info *inst, int status); +extern int instance_send_key_status(struct inst_info *inst, int status); +extern int instance_forward_packet(struct inst_info *inst, struct packet *packet); + +extern struct client_node *instance_pd_owner(struct inst_info *inst); + +/*! + * Multiple viewer + */ +extern int instance_add_client(struct inst_info *inst, struct client_node *client); +extern int instance_del_client(struct inst_info *inst, struct client_node *client); +extern int instance_has_client(struct inst_info *inst, struct client_node *client); +extern void *instance_client_list(struct inst_info *inst); + +extern int instance_init(void); +extern int instance_fini(void); + +extern int instance_event_callback_add(struct inst_info *inst, enum instance_event type, int (*event_cb)(struct inst_info *inst, void *data), void *data); +extern int instance_event_callback_del(struct inst_info *inst, enum instance_event type, int (*event_cb)(struct inst_info *inst, void *data), void *data); + +/*! + */ +extern int instance_set_data(struct inst_info *inst, const char *tag, void *data); +extern void *instance_del_data(struct inst_info *inst, const char *tag); +extern void *instance_get_data(struct inst_info *inst, const char *tag); + +extern void instance_reload_period(struct inst_info *inst, double period); +/* End of a file */ diff --git a/include/io.h b/include/io.h new file mode 100644 index 0000000..c3d83b4 --- /dev/null +++ b/include/io.h @@ -0,0 +1,25 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +extern int io_init(void); +extern int io_fini(void); +extern int io_load_package_db(struct pkg_info *info); +extern char *io_livebox_pkgname(const char *pkgname); +extern int io_update_livebox_package(const char *pkgname, int (*cb)(const char *pkgid, const char *lbid, int prime, void *data), void *data); +extern int io_crawling_liveboxes(int (*cb)(const char *pkgid, const char *lbid, int prime, void *data), void *data); +extern int io_is_exists(const char *lbid); + +/* End of a file */ diff --git a/include/lite-errno.h b/include/lite-errno.h new file mode 100644 index 0000000..a46b9f5 --- /dev/null +++ b/include/lite-errno.h @@ -0,0 +1,69 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __LIVEBOX_ERRNO_H +#define __LIVEBOX_ERRNO_H + +#ifdef __cplusplus +extern "C" { +#endif + +/*! + * \addtogroup CAPI_LIVEBOX_SERVICE_MODULE + * \{ + */ + +/*! + * \brief + * Definitions for the result status of livebox operation. + */ +enum livebox_status { + LB_STATUS_SUCCESS = 0x00000000, /*!< Operation is successfully completed */ + LB_STATUS_ERROR = 0x80000000, /*!< This will be OR'd with other specific error value */ + LB_STATUS_ERROR_INVALID = LB_STATUS_ERROR | 0x0001, /*!< Invalid request */ + LB_STATUS_ERROR_FAULT = LB_STATUS_ERROR | 0x0002, /*!< Fault - Unable to recover from the error */ + LB_STATUS_ERROR_MEMORY = LB_STATUS_ERROR | 0x0004, /*!< Memory is not enough to do this operation */ + LB_STATUS_ERROR_EXIST = LB_STATUS_ERROR | 0x0008, /*!< Already exists */ + LB_STATUS_ERROR_BUSY = LB_STATUS_ERROR | 0x0010, /*!< Busy so the operation is not started(accepted), try again */ + LB_STATUS_ERROR_PERMISSION = LB_STATUS_ERROR | 0x0020, /*!< Permission error */ + LB_STATUS_ERROR_ALREADY = LB_STATUS_ERROR | 0x0040, /*!< Operation is already started */ + LB_STATUS_ERROR_CANCEL = LB_STATUS_ERROR | 0x0080, /*!< Operation is canceled */ + LB_STATUS_ERROR_IO = LB_STATUS_ERROR | 0x0100, /*!< I/O Error */ + LB_STATUS_ERROR_NOT_EXIST = LB_STATUS_ERROR | 0x0200, /*!< Not exists */ + LB_STATUS_ERROR_TIMEOUT = LB_STATUS_ERROR | 0x0400, /*!< Timeout */ + LB_STATUS_ERROR_NOT_IMPLEMENTED = LB_STATUS_ERROR | 0x0800, /*!< Operation is not implemented */ + LB_STATUS_ERROR_NO_SPACE = LB_STATUS_ERROR | 0x1000, /*!< No space to operate */ + LB_STATUS_ERROR_DISABLED = LB_STATUS_ERROR | 0x2000 /*!< Disabled */ +}; + +/*! + * \brief Check whether given code value indicates error or not. + * \param[in] s + * \return 1 or 0 + */ +#define LB_STATUS_IS_ERROR(s) (!!((s) & LB_STATUS_ERROR)) + +/*! + * \} + */ + +#ifdef __cplusplus +} +#endif + +#endif +/* End of a file */ + diff --git a/include/liveinfo.h b/include/liveinfo.h new file mode 100644 index 0000000..f951e26 --- /dev/null +++ b/include/liveinfo.h @@ -0,0 +1,35 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +struct liveinfo; + +extern int liveinfo_init(void); +extern void liveinfo_fini(void); +extern struct liveinfo *liveinfo_create(pid_t pid, int handle); +extern void liveinfo_destroy(struct liveinfo *info); + +extern struct liveinfo *liveinfo_find_by_pid(pid_t pid); +extern struct liveinfo *liveinfo_find_by_handle(int handle); + +extern const char *liveinfo_filename(struct liveinfo *info); +extern pid_t liveinfo_pid(struct liveinfo *info); +extern FILE *liveinfo_fifo(struct liveinfo *info); +extern int liveinfo_open_fifo(struct liveinfo *info); +extern void liveinfo_close_fifo(struct liveinfo *info); +extern void liveinfo_set_data(struct liveinfo *info, void *data); +extern void *liveinfo_data(struct liveinfo *info); + +/* End of a file */ diff --git a/include/main.h b/include/main.h new file mode 100644 index 0000000..67a71d8 --- /dev/null +++ b/include/main.h @@ -0,0 +1,16 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + diff --git a/include/notification_service.h b/include/notification_service.h new file mode 100644 index 0000000..e02dfa3 --- /dev/null +++ b/include/notification_service.h @@ -0,0 +1,20 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +extern int notification_service_init(void); +extern int notification_service_fini(void); + +/* End of a file */ diff --git a/include/package.h b/include/package.h new file mode 100644 index 0000000..dd5d3f6 --- /dev/null +++ b/include/package.h @@ -0,0 +1,131 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +enum lb_type { + LB_TYPE_NONE = 0x0, + LB_TYPE_SCRIPT, + LB_TYPE_FILE, + LB_TYPE_TEXT, + LB_TYPE_BUFFER +}; + +enum pd_type { + PD_TYPE_NONE = 0x0, + PD_TYPE_SCRIPT, + PD_TYPE_TEXT, + PD_TYPE_BUFFER +}; + +enum alter_type { + ALTER_CREATE, + ALTER_DESTROY +}; + +struct pkg_info; +struct inst_info; +struct context_info; +struct slave_node; + +/*! + * \brief + * Construction & Destruction + */ +extern struct pkg_info *package_create(const char *pkgid, const char *lbid); +extern int package_destroy(struct pkg_info *info); +extern char *package_lb_pkgname(const char *pkgname); +extern int package_is_lb_pkgname(const char *pkgname); +extern struct pkg_info *package_find(const char *pkgname); +extern const char *package_find_by_secured_slave(struct slave_node *slave); +extern struct inst_info *package_find_instance_by_id(const char *pkgname, const char *id); +extern struct inst_info *package_find_instance_by_timestamp(const char *pkgname, double timestamp); +extern int package_dump_fault_info(struct pkg_info *info); +extern int package_set_fault_info(struct pkg_info *info, double timestamp, const char *filename, const char *function); +extern int package_get_fault_info(struct pkg_info *info, double *timestmap, const char **filename, const char **function); + +/*! + * \brief + * Readonly functions + */ +extern const int const package_is_fault(const struct pkg_info *info); +extern struct slave_node * const package_slave(const struct pkg_info *info); +extern const int const package_timeout(const struct pkg_info *info); +extern const double const package_period(const struct pkg_info *info); +extern const int const package_secured(const struct pkg_info *info); +extern const char * const package_script(const struct pkg_info *info); +extern const char * const package_abi(const struct pkg_info *info); +extern const char * const package_lb_path(const struct pkg_info *info); +extern const char * const package_lb_group(const struct pkg_info *info); +extern const char * const package_pd_path(const struct pkg_info *info); +extern const char * const package_pd_group(const struct pkg_info *info); +extern const int const package_pinup(const struct pkg_info *info); +extern const char * const package_auto_launch(const struct pkg_info *info); +extern const unsigned int const package_size_list(const struct pkg_info *info); +extern const int const package_pd_width(const struct pkg_info *info); +extern const int const package_pd_height(const struct pkg_info *info); +extern const char * const package_name(const struct pkg_info *info); +extern const char * const package_libexec(struct pkg_info *info); +extern int package_network(struct pkg_info *info); +extern Eina_List *package_ctx_info(struct pkg_info *pkginfo); + +extern int package_set_libexec(struct pkg_info *info, const char *libexec); +extern void package_set_pinup(struct pkg_info *info, int pinup); +extern void package_set_auto_launch(struct pkg_info *info, const char *auto_launch); +extern void package_set_size_list(struct pkg_info *info, unsigned int size_list); +extern void package_set_lb_type(struct pkg_info *info, enum lb_type type); +extern void package_set_pd_type(struct pkg_info *info, enum pd_type type); +extern int package_set_lb_group(struct pkg_info *info, const char *group); +extern int package_set_lb_path(struct pkg_info *info, const char *path); +extern int package_set_pd_group(struct pkg_info *info, const char *group); +extern int package_set_pd_path(struct pkg_info *info, const char *path); +extern int package_set_script(struct pkg_info *info, const char *script); +extern void package_set_secured(struct pkg_info *info, int secured); +extern void package_set_period(struct pkg_info *info, double period); +extern void package_set_timeout(struct pkg_info *info, int timeout); +extern void package_set_network(struct pkg_info *info, int network); +extern void package_set_pd_height(struct pkg_info *info, int height); +extern void package_set_pd_width(struct pkg_info *info, int width); +extern int package_set_abi(struct pkg_info *info, const char *abi); +extern void package_add_ctx_info(struct pkg_info *pkginfo, struct context_info *info); +extern void package_del_ctx_info(struct pkg_info *pkginfo, struct context_info *info); + +/*! + * \brief + * Reference counter + */ +extern struct pkg_info * const package_ref(struct pkg_info *info); +extern struct pkg_info * const package_unref(struct pkg_info *info); +extern const int const package_refcnt(const struct pkg_info *info); + +extern const enum pd_type const package_pd_type(const struct pkg_info *info); +extern const enum lb_type const package_lb_type(const struct pkg_info *info); + +extern int package_add_instance(struct pkg_info *info, struct inst_info *inst); +extern int package_del_instance(struct pkg_info *info, struct inst_info *inst); +extern Eina_List *package_instance_list(struct pkg_info *info); + +extern int package_clear_fault(struct pkg_info *info); +extern int package_alter_instances_to_client(struct client_node *client, enum alter_type alter); + +extern const Eina_List *package_list(void); +extern int const package_fault_count(struct pkg_info *info); + +extern int package_init(void); +extern int package_fini(void); + +extern int package_is_enabled(const char *appid); +extern int package_faulted(struct pkg_info *info, int broadcast); + +/* End of a file */ diff --git a/include/parser.h b/include/parser.h new file mode 100644 index 0000000..16e297a --- /dev/null +++ b/include/parser.h @@ -0,0 +1,45 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +struct parser; + +extern struct parser *parser_load(const char *filename); +extern int parser_unload(struct parser *handle); +extern double parser_period(struct parser *handle); +extern int parser_network(struct parser *handle); +extern int parser_timeout(struct parser *handle); +extern const char *parser_auto_launch(struct parser *handle); +extern unsigned int parser_size(struct parser *handle); +extern void parser_get_pdsize(struct parser *handle, unsigned int *width, unsigned int *height); +extern const char *parser_group_str(struct parser *handle); +extern int parser_secured(struct parser *handle); +extern int parser_pinup(struct parser *handler); + +extern const char *parser_lb_path(struct parser *handle); +extern const char *parser_lb_group(struct parser *handle); +extern const char *parser_pd_path(struct parser *handle); +extern const char *parser_pd_group(struct parser *handle); + +extern const char *parser_abi(struct parser *handle); + +extern int parser_text_pd(struct parser *handle); +extern int parser_text_lb(struct parser *handle); +extern int parser_buffer_lb(struct parser *handle); +extern int parser_buffer_pd(struct parser *handle); + +extern const char *parser_script(struct parser *handle); + +/* End of a file */ diff --git a/include/pkgmgr.h b/include/pkgmgr.h new file mode 100644 index 0000000..e4fe4c2 --- /dev/null +++ b/include/pkgmgr.h @@ -0,0 +1,40 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +enum pkgmgr_event_type { + PKGMGR_EVENT_DOWNLOAD, + PKGMGR_EVENT_INSTALL, + PKGMGR_EVENT_UPDATE, + PKGMGR_EVENT_UNINSTALL, + PKGMGR_EVENT_RECOVER +}; + +enum pkgmgr_status { + PKGMGR_STATUS_START, + PKGMGR_STATUS_PROCESSING, + PKGMGR_STATUS_COMMAND, + PKGMGR_STATUS_END, + PKGMGR_STATUS_ERROR +}; + +extern int pkgmgr_init(void); +extern int pkgmgr_fini(void); + +extern int pkgmgr_add_event_callback(enum pkgmgr_event_type type, int (*cb)(const char *pkgname, enum pkgmgr_status status, double value, void *data), void *data); + +extern void *pkgmgr_del_event_callback(enum pkgmgr_event_type type, int (*cb)(const char *pkgname, enum pkgmgr_status status, double value, void *data), void *data); + +/* End of a file */ diff --git a/include/rpc_to_slave.h b/include/rpc_to_slave.h new file mode 100644 index 0000000..d80c021 --- /dev/null +++ b/include/rpc_to_slave.h @@ -0,0 +1,29 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +extern int rpc_send_new(struct inst_info *inst, void (*ret_cb)(const char *funcname, GVariant *result, void *data), void *data, int skip_need_to_create); +extern int rpc_send_renew(struct inst_info *inst, void (*ret_cb)(const char *funcname, GVariant *result, void *data), void *data); + +extern void rpc_send_update_request(const char *pkgname, const char *cluster, const char *category); +/*! + * \brief + * \param[in] period if it is negative value, the data provider will use the default period + */ +extern struct inst_info *rpc_send_create_request(struct client_node *client, const char *pkgname, const char *content, const char *cluster, const char *category, double timestamp, double period); +extern void rpc_send_resume_request(void); +extern void rpc_send_pause_request(void); + +/* End of a file */ diff --git a/include/script_handler.h b/include/script_handler.h new file mode 100644 index 0000000..5e84f2b --- /dev/null +++ b/include/script_handler.h @@ -0,0 +1,39 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +struct script_info; +struct fb_info; + +extern struct script_info *script_handler_create(struct inst_info *inst, const char *file, const char *group, int w, int h); +extern int script_handler_destroy(struct script_info *info); +extern int script_handler_parse_desc(struct inst_info *inst, const char *descfile, int is_pd); +extern int script_handler_unload(struct script_info *info, int is_pd); +extern int script_handler_load(struct script_info *info, int is_pd); +extern int script_handler_is_loaded(struct script_info *info); +extern int script_handler_feed_event(struct script_info *info, int event, double timestamp); + +extern int script_init(void); +extern int script_fini(void); + +extern int script_signal_emit(void *buffer_handle, const char *part, const char *signal, double sx, double sy, double ex, double ey); + +extern int script_handler_update_pointer(struct script_info *inst, int x, int y, int down); +extern int script_handler_update_keycode(struct script_info *info, unsigned int keycode); +extern int script_handler_resize(struct script_info *info, int w, int h); +extern const char *script_handler_buffer_id(struct script_info *info); +extern struct buffer_info *script_handler_buffer_info(struct script_info *info); + +/* End of a file */ diff --git a/include/server.h b/include/server.h new file mode 100644 index 0000000..457ab15 --- /dev/null +++ b/include/server.h @@ -0,0 +1,20 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +extern int server_init(void); +extern int server_fini(void); + +/* End of a file */ diff --git a/include/service_common.h b/include/service_common.h new file mode 100644 index 0000000..f0dbf96 --- /dev/null +++ b/include/service_common.h @@ -0,0 +1,63 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +enum tcb_type { + TCB_CLIENT_TYPE_APP = 0x00, + TCB_CLIENT_TYPE_SERVICE = 0x01, + TCB_CLIENT_TYPE_UNKNOWN = 0xff +}; + +enum tcb_event_type { + TCB_EVENT_CREATE = 0x01, + TCB_EVENT_DESTROY = 0x02 +}; + +struct tcb; +struct service_context; +struct service_event_item; + +extern int tcb_fd(struct tcb *tcb); + +/*! + * \remarks This function will return valid pid only after it gets the packet from a client. + * or it will returns -1. + * \param[in] Thread Control Block + * \return pid Process Id + * \retval -1 TCB is not valid or the client is remote host. so we cannot get the PID of it. + * \retval >0 Process Id (PID) + */ +extern int tcb_pid(struct tcb *tcb); + +extern struct service_context *tcb_svc_ctx(struct tcb *tcb); +extern int tcb_client_type(struct tcb *tcb); +extern int tcb_client_type_set(struct tcb *tcb, enum tcb_type type); +extern int tcb_is_valid(struct service_context *svc_ctx, struct tcb *tcb); + +extern struct service_context *service_common_create(const char *addr, int (*service_thread_main)(struct tcb *tcb, struct packet *packet, void *data), void *data); +extern int service_common_destroy(struct service_context *svc_ctx); + +extern int service_common_multicast_packet(struct tcb *tcb, struct packet *packet, int type); +extern int service_common_unicast_packet(struct tcb *tcb, struct packet *packet); + +extern struct service_event_item *service_common_add_timer(struct service_context *svc_ctx, double timer, int (*timer_cb)(struct service_context *svc_cx, void *data), void *data); +extern int service_common_update_timer(struct service_event_item *item, double timer); +extern int service_common_del_timer(struct service_context *svc_ctx, struct service_event_item *item); + +extern int service_common_fd(struct service_context *ctx); + +extern int service_register_tcb_callback(struct service_context *svc_ctx, struct tcb *tcb, enum tcb_event_type event, void (*cb)(struct service_context *svc_ctx, struct tcb *tcb, void *data), void *data); +extern int service_unregister_tcb_callback(struct service_context *svc_ctx, struct tcb *tcb, enum tcb_event_type event, void (*cb)(struct service_context *svc_ctx, struct tcb *tcb, void *data), void *data); + +/* End of a file */ diff --git a/include/setting.h b/include/setting.h new file mode 100644 index 0000000..6d0700f --- /dev/null +++ b/include/setting.h @@ -0,0 +1,21 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +extern int setting_is_lcd_off(void); +extern int setting_init(void); +extern int setting_fini(void); + +/* End of a file */ diff --git a/include/shortcut_service.h b/include/shortcut_service.h new file mode 100644 index 0000000..2810039 --- /dev/null +++ b/include/shortcut_service.h @@ -0,0 +1,20 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +extern int shortcut_service_init(void); +extern int shortcut_service_fini(void); + +/* End of a file */ diff --git a/include/slave_life.h b/include/slave_life.h new file mode 100644 index 0000000..7f477f3 --- /dev/null +++ b/include/slave_life.h @@ -0,0 +1,215 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*! + * Managing the reference counter of a slave + */ + +struct slave_node; + +enum slave_event { + SLAVE_EVENT_ACTIVATE, + SLAVE_EVENT_DEACTIVATE, /* deactivate callback, can return REACTIVATE, DEFAULT */ + SLAVE_EVENT_DELETE, + SLAVE_EVENT_FAULT, /* Critical fault */ + + SLAVE_EVENT_PAUSE, + SLAVE_EVENT_RESUME, + + SLAVE_NEED_TO_REACTIVATE +}; + +enum slave_state { + /*! + * Launch the slave but not yet receives "hello" packet + */ + SLAVE_REQUEST_TO_LAUNCH, + + /*! + * \note + * Terminate the slave but not yet receives dead signal + */ + SLAVE_REQUEST_TO_TERMINATE, + + /*! + * \note + * No slave process exists, just slave object created + */ + SLAVE_TERMINATED, + + /*! + * \note + * State change request is sent, + */ + SLAVE_REQUEST_TO_PAUSE, + SLAVE_REQUEST_TO_RESUME, + + /*! + * \note + * Request an action for disconnecting to master from the provider side. + * This flag should be treated as an activated state. + */ + SLAVE_REQUEST_TO_DISCONNECT, + + /*! + * \note + * SLAVE_ACTIVATED = { SLAVE_PAUSED, SLAVE_RESUMED } + */ + SLAVE_PAUSED, + SLAVE_RESUMED, + + SLAVE_ERROR = 0xFF /* Explicitly define the size of this enum type */ +}; + +enum PROVIDER_CTRL { + PROVIDER_CTRL_DEFAULT = 0x00, /*!< Set default control operation */ + PROVIDER_CTRL_MANUAL_TERMINATION = 0x01, /*!< Terminate process manually */ + PROVIDER_CTRL_MANUAL_REACTIVATION = 0x02, /*!< Reactivate process manually */ +}; + +extern struct slave_node *slave_ref(struct slave_node *slave); +extern struct slave_node *slave_unref(struct slave_node *slave); +extern const int const slave_refcnt(struct slave_node *slave); + +/*! + * \brief + * Create a new slave object or destroy it + * + * \param[in] name + * \param[in] is_secured + * \param[in] abi + * \param[in] pkgname + * \param[in] period + * \return slave_node + */ +extern struct slave_node *slave_create(const char *name, int is_secured, const char *abi, const char *pkgname, int network); + +/*! + * \brief + * \param[in] slave + * \return void + */ +extern void slave_destroy(struct slave_node *slave); + +/*! + * \brief + * Launch or terminate a slave + * \param[in] slave + * \return int + */ +extern int slave_activate(struct slave_node *slave); + +/*! + * \brief After this function call, the slave object can be deleted + * \param[in] slave + */ +extern struct slave_node *slave_deactivate(struct slave_node *slave, int direct) __attribute__((warn_unused_result)); + +/*! + * To check the slave's activation state + */ +extern const int const slave_is_activated(struct slave_node *slave); +extern int slave_activated(struct slave_node *slave); + +extern int slave_give_more_ttl(struct slave_node *slave); +extern int slave_freeze_ttl(struct slave_node *slave); +extern int slave_thaw_ttl(struct slave_node *slave); +extern int slave_expired_ttl(struct slave_node *slave); + +/*! + * \NOTE + * To mangage the unexpected termination of a slave + * After this function call, the slave object can be deleted + */ +extern struct slave_node *slave_deactivated_by_fault(struct slave_node *slave) __attribute__((warn_unused_result)); + +/*! + * \NOTE + * After this function, the slave object can be deleted + */ +extern struct slave_node *slave_deactivated(struct slave_node *slave) __attribute__((warn_unused_result)); + +extern int slave_event_callback_add(struct slave_node *slave, enum slave_event event, int (*cb)(struct slave_node *, void *), void *data); +extern int slave_event_callback_del(struct slave_node *slave, enum slave_event event, int (*cb)(struct slave_node *, void *), void *data); + +extern int slave_set_data(struct slave_node *slave, const char *tag, void *data); +extern void *slave_del_data(struct slave_node *slave, const char *tag); +extern void *slave_data(struct slave_node *slave, const char *tag); + +extern struct slave_node *slave_find_by_pid(pid_t pid); +extern struct slave_node *slave_find_by_name(const char *name); +extern struct slave_node *slave_find_by_pkgname(const char *pkgname); +extern struct slave_node *slave_find_by_rpc_handle(int handle); + +extern void slave_dead_handler(struct slave_node *slave); +extern const int const slave_is_secured(const struct slave_node *slave); +extern const char * const slave_name(const struct slave_node *slave); +extern const pid_t const slave_pid(const struct slave_node *slave); +extern const char * const slave_abi(const struct slave_node *slave); +extern int slave_set_pid(struct slave_node *slave, pid_t pid); + +/*! + * \note + * Used for making decision of destroying a slave or not + * Used for balancing load of the slave. + */ +extern void slave_load_package(struct slave_node *slave); +extern void slave_unload_package(struct slave_node *slave); +extern int const slave_loaded_package(struct slave_node *slave); +extern struct slave_node *slave_find_available(const char *abi, int secured, int network); + +extern double const slave_ttl(const struct slave_node *slave); + +/*! + * \note + * Used for making decision of activating a slave or not + */ +extern void slave_load_instance(struct slave_node *slave); + +/*! + * \NOTE + * After this function call, the slave object can be deleted. + */ +extern struct slave_node *slave_unload_instance(struct slave_node *slave) __attribute__((warn_unused_result)); + +extern int const slave_loaded_instance(struct slave_node *slave); + +extern int slave_resume(struct slave_node *slave); +extern int slave_pause(struct slave_node *slave); + +extern const char *slave_pkgname(const struct slave_node *slave); +extern enum slave_state slave_state(const struct slave_node *slave); +extern const char *slave_state_string(const struct slave_node *slave); + +extern const void *slave_list(void); +extern int const slave_fault_count(const struct slave_node *slave); + +extern int slave_need_to_reactivate_instances(struct slave_node *slave); +extern void slave_set_reactivate_instances(struct slave_node *slave, int reactivate); + +extern void slave_set_reactivation(struct slave_node *slave, int flag); +extern int slave_need_to_reactivate(struct slave_node *slave); + +extern int slave_network(const struct slave_node *slave); +extern void slave_set_network(struct slave_node *slave, int network); + +extern int slave_deactivate_all(int reactivate, int reactivate_instances, int no_timer); +extern int slave_activate_all(void); + +extern void slave_set_control_option(struct slave_node *slave, int ctrl); +extern int slave_control_option(struct slave_node *slave); + +/* End of a file */ diff --git a/include/slave_rpc.h b/include/slave_rpc.h new file mode 100644 index 0000000..f5dc7fa --- /dev/null +++ b/include/slave_rpc.h @@ -0,0 +1,32 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +extern int slave_rpc_async_request(struct slave_node *slave, const char *pkgname, struct packet *packet, void (*ret_cb)(struct slave_node *slave, const struct packet *packet, void *data), void *data, int urgent); +extern int slave_rpc_request_only(struct slave_node *slave, const char *pkgname, struct packet *packet, int urgent); + +extern int slave_rpc_update_handle(struct slave_node *slave, int handle); +extern int slave_rpc_ping(struct slave_node *slave); +extern void slave_rpc_request_update(const char *pkgname, const char *id, const char *cluster, const char *category, const char *content, int force); +extern int slave_rpc_handle(struct slave_node *slave); +extern int slave_rpc_ping_freeze(struct slave_node *slave); +extern int slave_rpc_ping_thaw(struct slave_node *slave); + +extern int slave_rpc_disconnect(struct slave_node *slave); + +extern int slave_rpc_init(struct slave_node *slave); +extern int slave_rpc_fini(struct slave_node *slave); + +/* End of a file */ diff --git a/include/util.h b/include/util.h new file mode 100644 index 0000000..4f32a76 --- /dev/null +++ b/include/util.h @@ -0,0 +1,89 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +extern unsigned long util_string_hash(const char *str); +extern double util_timestamp(void); +extern int util_check_ext(const char *filename, const char *check_ptr); +extern int util_validate_livebox_package(const char *pkgname); +extern int util_unlink(const char *filename); +extern int util_unlink_files(const char *folder); +extern char *util_slavename(void); +extern const char *util_basename(const char *name); +extern unsigned long long util_free_space(const char *path); +extern char *util_replace_string(const char *src, const char *pattern, const char *replace); +extern const char *util_uri_to_path(const char *uri); +extern void *util_timer_add(double interval, Eina_Bool (*cb)(void *data), void *data); +extern void util_timer_interval_set(void *timer, double interval); +extern double util_time_delay_for_compensation(double period); +extern void util_setup_log_disk(void); +extern void util_remove_emergency_disk(void); +extern void util_prepare_emergency_disk(void); +extern int util_emergency_disk_is_mounted(void); +extern int util_service_is_enabled(const char *tag); + +extern int util_screen_size_get(int *width, int *height); +extern int util_screen_init(void); +extern int util_screen_fini(void); + +#define SCHEMA_FILE "file://" +#define SCHEMA_PIXMAP "pixmap://" +#define SCHEMA_SHM "shm://" + +#define CRITICAL_SECTION_BEGIN(handle) \ +do { \ + int ret; \ + ret = pthread_mutex_lock(handle); \ + if (ret != 0) \ + ErrPrint("Failed to lock: %s\n", strerror(ret)); \ +} while (0) + +#define CRITICAL_SECTION_END(handle) \ +do { \ + int ret; \ + ret = pthread_mutex_unlock(handle); \ + if (ret != 0) \ + ErrPrint("Failed to unlock: %s\n", strerror(ret)); \ +} while (0) + +#define CANCEL_SECTION_BEGIN() do { \ + int ret; \ + ret = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); \ + if (ret != 0) \ + ErrPrint("Unable to set cancelate state: %s\n", strerror(ret)); \ +} while (0) + +#define CANCEL_SECTION_END() do { \ + int ret; \ + ret = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); \ + if (ret != 0) \ + ErrPrint("Unable to set cancelate state: %s\n", strerror(ret)); \ +} while (0) + +#define CLOSE_PIPE(p) do { \ + int status; \ + status = close(p[PIPE_READ]); \ + if (status < 0) \ + ErrPrint("close: %s\n", strerror(errno)); \ + status = close(p[PIPE_WRITE]); \ + if (status < 0) \ + ErrPrint("close: %s\n", strerror(errno)); \ +} while (0) + +#define PIPE_READ 0 +#define PIPE_WRITE 1 +#define PIPE_MAX 2 + +/* End of a file */ diff --git a/include/utility_service.h b/include/utility_service.h new file mode 100644 index 0000000..db80cd0 --- /dev/null +++ b/include/utility_service.h @@ -0,0 +1,21 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +extern int utility_service_init(void); +extern int utility_service_fini(void); + +/* End of a file */ + diff --git a/include/xmonitor.h b/include/xmonitor.h new file mode 100644 index 0000000..3e01722 --- /dev/null +++ b/include/xmonitor.h @@ -0,0 +1,34 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +enum xmonitor_event { + XMONITOR_PAUSED, + XMONITOR_RESUMED, + + XMONITOR_ERROR = 0xFFFFFFFF /* To specify the size of this enum */ +}; + +extern int xmonitor_init(void); +extern void xmonitor_fini(void); +extern int xmonitor_update_state(int pid); +extern int xmonitor_add_event_callback(enum xmonitor_event event, int (*cb)(void *user_data), void *user_data); +extern int xmonitor_del_event_callback(enum xmonitor_event event, int (*cb)(void *user_data), void *user_data); +extern int xmonitor_is_paused(void); +extern void xmonitor_handle_state_changes(void); +extern int xmonitor_resume(struct client_node *client); +extern int xmonitor_pause(struct client_node *client); + +/* End of a file */ diff --git a/packaging/data-provider-master.changes b/packaging/data-provider-master.changes new file mode 100644 index 0000000..5e22b27 --- /dev/null +++ b/packaging/data-provider-master.changes @@ -0,0 +1,8 @@ +* Wed Sep 11 2013 Rusty Lynch accepted/tizen/20130620.160431@d15ede1 +- Add support for systemd socket activation for notification service + +* Thu Jun 20 2013 Victor Hakoun accepted/tizen/20130620.115235@e8bd452 +- Replace manifest with default floor + +* Fri Jun 07 2013 Victor Hakoun accepted/tizen/20130530.164904@68752b5 +- Fix build x86_64 diff --git a/packaging/data-provider-master.manifest b/packaging/data-provider-master.manifest new file mode 100644 index 0000000..5efa5e7 --- /dev/null +++ b/packaging/data-provider-master.manifest @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec new file mode 100755 index 0000000..ad79dc6 --- /dev/null +++ b/packaging/data-provider-master.spec @@ -0,0 +1,205 @@ +%bcond_with wayland + +Name: data-provider-master +Summary: Master service provider for liveboxes +Version: 0.43.2 +Release: 1 +Group: HomeTF/Livebox +License: Flora +Source0: %{name}-%{version}.tar.gz +Source1001: %{name}.manifest +BuildRequires: cmake, gettext-tools, smack, coreutils +BuildRequires: pkgconfig(ail) +BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(aul) +BuildRequires: pkgconfig(vconf) +BuildRequires: pkgconfig(sqlite3) +BuildRequires: pkgconfig(db-util) +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(gio-2.0) +BuildRequires: pkgconfig(libsmack) +BuildRequires: pkgconfig(bundle) + +%if %{with wayland} +BuildRequires: pkgconfig(ecore-wayland) +%else +BuildRequires: pkgconfig(ecore-x) +BuildRequires: pkgconfig(x11) +BuildRequires: pkgconfig(libdri2) +BuildRequires: pkgconfig(libdrm) +BuildRequires: pkgconfig(libtbm) +BuildRequires: pkgconfig(xfixes) +BuildRequires: pkgconfig(dri2proto) +BuildRequires: pkgconfig(xext) +BuildRequires: pkgconfig(xdamage) +%endif + +BuildRequires: pkgconfig(ecore) +BuildRequires: pkgconfig(eina) +BuildRequires: pkgconfig(com-core) +BuildRequires: pkgconfig(libxml-2.0) +BuildRequires: pkgconfig(pkgmgr) + +%if "%{sec_product_feature_livebox}" != "0" +BuildRequires: pkgconfig(livebox-service) +%endif + +BuildRequires: pkgconfig(notification) +BuildRequires: pkgconfig(notification-service) +BuildRequires: pkgconfig(badge) +BuildRequires: pkgconfig(badge-service) +BuildRequires: pkgconfig(shortcut) +BuildRequires: pkgconfig(security-server) +BuildRequires: pkgconfig(libsystemd-daemon) +Requires(post): sys-assert +Requires(post): dbus + +%description +Manage the 2nd stage livebox service provider and communicate with the viewer application. +Keep trace on the life-cycle of the livebox and status of the service providers, viewer applications. + +%prep +%setup -q +cp %{SOURCE1001} . + +%build +%if 0%{?sec_build_binary_debug_enable} +export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE" +export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE" +export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE" +%endif + +export ENGINEER=false +%if 0%{?tizen_build_binary_release_type_eng} +export CFLAGS="${CFLAGS} -DTIZEN_ENGINEER_MODE" +export CXXFLAGS="${CXXFLAGS} -DTIZEN_ENGINEER_MODE" +export FFLAGS="${FFLAGS} -DTIZEN_ENGINEER_MODE" +export ENGINEER=true +%endif + +%if %{with wayland} +export WAYLAND_SUPPORT=On +export X11_SUPPORT=Off +export LIVEBOX_SHM=wayland +%else +export WAYLAND_SUPPORT=Off +export X11_SUPPORT=On +export LIVEBOX_SHM=x11 +%endif + +%if "%{_repository}" == "wearable" +export LIVEBOX_SHM="${LIVEBOX_SHM}.wearable" +export MOBILE=Off +export WEARABLE=On +%else +export LIVEBOX_SHM="${LIVEBOX_SHM}.mobile" +export MOBILE=On +export WEARABLE=Off +%endif + +%if "%{sec_product_feature_livebox}" == "0" +export LIVEBOX=Off +%else +export LIVEBOX=On +%endif + +%cmake . -DPRODUCT=${LIVEBOX_SHM} -DENGINEER_BINARY=${ENGINEER} -DWAYLAND_SUPPORT=${WAYLAND_SUPPORT} -DX11_SUPPORT=${X11_SUPPORT} -DMOBILE=${MOBILE} -DWEARABLE=${WEARABLE} -DLIVEBOX=${LIVEBOX} + +CFLAGS="${CFLAGS} -Wall -Winline -Werror" LDFLAGS="${LDFLAGS}" make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +%make_install +mkdir -p %{buildroot}/%{_datarootdir}/license +%if "%{_repository}" == "wearable" +mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants +ln -sf ../data-provider-master.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/data-provider-master.service +%else +mkdir -p %{buildroot}/%{_libdir}/systemd/user/tizen-middleware.target.wants +ln -sf %{_libdir}/systemd/user/data-provider-master.service %{buildroot}/%{_libdir}/systemd/user/tizen-middleware.target.wants/data-provider-master.service +%endif + +%if "%{sec_product_feature_livebox}" == "0" +# Nothing provides +%else +mkdir -p %{buildroot}/opt/usr/share/live_magazine +mkdir -p %{buildroot}/opt/usr/share/live_magazine/log +mkdir -p %{buildroot}/opt/usr/share/live_magazine/reader +mkdir -p %{buildroot}/opt/usr/share/live_magazine/always +mkdir -p %{buildroot}/opt/usr/devel/usr/bin +mkdir -p %{buildroot}/opt/dbspace +touch %{buildroot}/opt/dbspace/.livebox.db +touch %{buildroot}/opt/dbspace/.livebox.db-journal +if [ ! -s %{buildroot}/opt/dbspace/.livebox.db ]; then +echo "LiveBox DB file is not exists, initiate it" +sqlite3 %{buildroot}/opt/dbspace/.livebox.db < + + + + + /usr/share/icons/small/org.tizen.live-nicesj.png + + + Content information + + org.tizen.nicesj + + org.tizen.nicesj + + + 1x1 + 2x1 + 2x2 + 4x1 + 4x2 + 4x3 + 4x4 + + + 21x21 + 23x21 + 23x23 + + + 0x0 +