From: Sung-jae Park Date: Thu, 20 Dec 2012 08:09:13 +0000 (+0900) Subject: Initialize the project. X-Git-Tag: 2.1b_release~13^2~43 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a587e5d0902e6484303d3545753a1597b613dc6e;p=apps%2Flivebox%2Fdata-provider-master.git Initialize the project. Change-Id: Ica8e21c0ddc22eaede97983aeab3af516efa8572 --- diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..1830cd7 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,99 @@ +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-x + ecore + evas + ecore-evas + com-core + heynoti + x11 + libdri2 + libdrm + libdrm_slp + xfixes + dri2proto + xext + xdamage + capi-context + pkgmgr + livebox-service +) + +SET(PACKAGE "${PROJECT_NAME}") +#SET(LOCALEDIR "/opt/apps/org.tizen.${PROJECT_NAME}/res/locale") +SET(CMAKE_C_FLAGS "-Wall -fpie -Winline -Werror -fno-builtin-malloc -fno-omit-frame-pointer -g") +SET(CMAKE_EXE_LINKER_FLAGS "-pie") + +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("-DNDEBUG") +#ADD_DEFINITIONS("-DFLOG") +ADD_DEFINITIONS(${pkg_CFLAGS}) +ADD_DEFINITIONS(${pkg_LDFLAGS}) + + +ADD_EXECUTABLE(${PROJECT_NAME} + src/main.c + src/util.c + src/fault_manager.c + src/parser.c + src/conf.c + src/dead_monitor.c + src/ctx_client.c + src/group.c + src/fb.c + src/script_handler.c + src/buffer_handler.c + src/io.c + src/xmonitor.c + src/slave_life.c + src/slave_rpc.c + src/client_life.c + src/client_rpc.c + src/setting.c + src/package.c + src/instance.c + src/server.c + src/abi.c + src/critical_log.c + src/liveinfo.c + src/ctx_wrapper.c + src/pkgmgr.c +) + +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkg_LDFLAGS} "-ldl") +#INSTALL(FILES ${CMAKE_SOURCE_DIR}/org.tizen.data-provider-master.desktop DESTINATION /opt/share/applications) +#INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /opt/apps/org.tizen.${PROJECT_NAME}/bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) +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/conf.ini DESTINATION /usr/share/data-provider-master PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/resolution.ini DESTINATION /usr/share/data-provider-master PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME "org.tizen.${PROJECT_NAME}") +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) + +# INCLUDE FOR BUILD & INSTALL .PO FILES +ADD_SUBDIRECTORY(res) +ADD_SUBDIRECTORY(data) +ADD_SUBDIRECTORY(pkgmgr_livebox) +ADD_SUBDIRECTORY(util_liveinfo) diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..27daa90 --- /dev/null +++ b/LICENSE @@ -0,0 +1,83 @@ +Flora License + +Version 1.0, May, 2012 + +http://www.tizenopensource.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 Compatibility Definition Document and passes the Compatibility Test Suite 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: + +You must give any other recipients of the Work or Derivative Works a copy of this License; and +You must cause any modified files to carry prominent notices stating that You changed the files; and +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 +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. +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.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. diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt new file mode 100644 index 0000000..772eac6 --- /dev/null +++ b/data/CMakeLists.txt @@ -0,0 +1,2 @@ +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) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/data-provider-master.service DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) diff --git a/data/abi.ini b/data/abi.ini new file mode 100644 index 0000000..a466d88 --- /dev/null +++ b/data/abi.ini @@ -0,0 +1,14 @@ +[c] +package=org.tizen.data-provider-slave + +[cpp] +package=org.tizen.data-provider-slave + +[html] +package=com.samsung.data-provider-webapp-slave + +[osp] +package=gi2qxenosh.osp-livebox-service + +[app] +package=/APPID/ diff --git a/data/conf.ini b/data/conf.ini new file mode 100644 index 0000000..8df0172 --- /dev/null +++ b/data/conf.ini @@ -0,0 +1,28 @@ +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=5242880 +replace_tag=/APPID/ +slave_ttl=30.0 +max_log_line=1000 +max_log_file=3 +sqilte_flush_max=1048576 +db_path=/opt/dbspace/.livebox.db +log_path=/opt/usr/share/live_magazine/log +share_path=/opt/usr/share/live_magazine/ +script_port_path=/opt/usr/live/script_port/ +ping_interval=240.0 +slave_max_load=30 +vconf_sys_cluster=file/private/org.tizen.data-provider-master/cluster +max_pended_ctx_event=256 +use_sw_backend=false +provider_method=pixmap +debug_mode=false +overwrite_content=false +com_core_thread=true diff --git a/data/data-provider-master b/data/data-provider-master new file mode 100755 index 0000000..2e6ce3c --- /dev/null +++ b/data/data-provider-master @@ -0,0 +1,94 @@ +#!/bin/sh +# +# 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. +# + +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 + 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 () +{ + rm /opt/usr/share/live_magazine/* + rm /opt/usr/share/live_magazine/reader/* + rm /opt/usr/share/live_magazine/log/* + 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..0c154a6 --- /dev/null +++ b/data/data-provider-master.service @@ -0,0 +1,48 @@ +# +# 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. +# + + +# Developer's NOTE: (Not related with the license) +# This description is not revised by the system team. +# So I cannot guarantees these are OK or not. + +[Unit] +Description=Data Provider daemon +After=xorg.target + +[Kill] +KillSignal=SIGTERM + +[Exec] +Environment=BUFMGR_LOCK_TYPE="once" +Environment=BUFMGR_MAP_CACHE="true" +Environment=PROVIDER_DEBUG_PROVIDER="false" +Environment=PROVIDER_METHOD="pixmap" +Environment=PROVIDER_COM_CORE_THREAD="true" +StandardInput=/dev/null +StandardOutput=/dev/null +StandardError=/dev/null + +[Service] +Type=forking +ExecStartPre= +ExecStart=/usr/bin/data-provider-master +ExecStop=kill -TERM `cat /tmp/.master.pid` +PIDFile=/tmp/.master.pid +RestartSec=1 + +[Install] +WantedBy=tizen-middleware.target diff --git a/data/resolution.ini b/data/resolution.ini new file mode 100644 index 0000000..2bccdb6 --- /dev/null +++ b/data/resolution.ini @@ -0,0 +1,7 @@ +1x1=175x175 +2x1=354x175 +2x2=354x354 +4x1=712x175 +4x2=712x354 +4x3=712x533 +4x4=712x712 diff --git a/include/abi.h b/include/abi.h new file mode 100644 index 0000000..ea70f7f --- /dev/null +++ b/include/abi.h @@ -0,0 +1,24 @@ +/* + * 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. + */ + +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 int abi_del_all(void); +extern const char *abi_find_by_pkgname(const char *pkgname); + +/* End of a file */ diff --git a/include/buffer_handler.h b/include/buffer_handler.h new file mode 100644 index 0000000..84be680 --- /dev/null +++ b/include/buffer_handler.h @@ -0,0 +1,162 @@ +/* + * 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. + */ + +struct buffer_info; +struct inst_info; + +enum buffer_type { /*!< Must have to be sync with libprovider, liblivebox-viewer */ + 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 + * \return int + */ +extern int buffer_handler_fini(void); + +extern void *buffer_handler_pixmap_ref(struct buffer_info *info); + +extern int buffer_handler_pixmap_unref(void *buffer_ptr); + +extern void *buffer_handler_pixmap_find(int pixmap); + +extern void *buffer_handler_pixmap_buffer(struct buffer_info *info); + +extern struct inst_info *buffer_handler_instance(struct buffer_info *info); + +/* End of a file */ diff --git a/include/client_life.h b/include/client_life.h new file mode 100644 index 0000000..b577fd3 --- /dev/null +++ b/include/client_life.h @@ -0,0 +1,107 @@ +/* + * 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. + */ + +enum client_event { + CLIENT_EVENT_DEACTIVATE, + CLIENT_EVENT_DESTROY, +}; + +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); +extern int client_destroy(struct client_node *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 int 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); + +extern const int const client_is_activated(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 int 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..afc8e4d --- /dev/null +++ b/include/client_rpc.h @@ -0,0 +1,27 @@ +/* + * 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. + */ + +/*! + */ +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..bc8c45e --- /dev/null +++ b/include/conf.h @@ -0,0 +1,148 @@ +/* + * 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. + */ + +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; + } 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; + + 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 *db; + } 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; +}; + +extern struct conf g_conf; + +extern int conf_loader(void); + +#define BASE_W g_conf.base_width +#define BASE_H g_conf.base_height + +#define CR 13 +#define LF 10 + +#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 NO_CHANGE g_conf.default_conf.period +#define DEFAULT_PERIOD g_conf.default_conf.period + +#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 REPLACE_TAG_APPID g_conf.replace_tag +#define SLAVE_TTL g_conf.slave_ttl + +#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 SLAVE_MAX_LOAD g_conf.slave_max_load +#define DEFAULT_PING_TIME g_conf.ping_time +#define PAUSED_FILE "/tmp/.live.paused" + +#define MAX_ABI 256 +#define MAX_PKGNAME 512 +#define DELAY_TIME 0.0000001f +#define DEFAULT_CLUSTER "user,created" +#define MINIMUM_REACTIVATION_TIME 10 + +#define SYS_CLUSTER_KEY g_conf.vconf_sys_cluster + +#define MAX_PENDED_CTX_EVENTS g_conf.max_pended_ctx_events +#define HAPI __attribute__((visibility("hidden"))) + +/* End of a file */ diff --git a/include/critical_log.h b/include/critical_log.h new file mode 100644 index 0000000..070ac47 --- /dev/null +++ b/include/critical_log.h @@ -0,0 +1,23 @@ +/* + * 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. + */ + +extern int critical_log(const char *func, int line, const char *fmt, ...); +extern int critical_log_init(const char *tag); +extern int critical_log_fini(void); + +#define CRITICAL_LOG(args...) critical_log(__func__, __LINE__, args) + +/* End of a file */ diff --git a/include/ctx_client.h b/include/ctx_client.h new file mode 100644 index 0000000..6933716 --- /dev/null +++ b/include/ctx_client.h @@ -0,0 +1,25 @@ +/* + * 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. + */ + +struct context_info; + +extern int ctx_client_init(void); +extern int ctx_client_fini(void); +extern void ctx_update(void); +extern int ctx_enable_event_handler(struct context_info *info); +extern int ctx_disable_event_handler(struct context_info *info); + +/* End of a file */ diff --git a/include/ctx_wrapper.h b/include/ctx_wrapper.h new file mode 100644 index 0000000..425e444 --- /dev/null +++ b/include/ctx_wrapper.h @@ -0,0 +1,22 @@ +/* + * 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. + */ + +extern void ctx_wrapper_enable(void); +extern void ctx_wrapper_disable(void); +extern void *ctx_wrapper_register_callback(struct context_item *item, int (*cb)(struct context_item *item, void *user_data), void *user_data); +extern void *ctx_wrapper_unregister_callback(void *_cbfunc); + +/* End of a file */ diff --git a/include/dead_monitor.h b/include/dead_monitor.h new file mode 100644 index 0000000..779250b --- /dev/null +++ b/include/dead_monitor.h @@ -0,0 +1,20 @@ +/* + * 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. + */ + +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..97f2fa4 --- /dev/null +++ b/include/debug.h @@ -0,0 +1,44 @@ +/* + * 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. + */ + +#if !defined(FLOG) +#define DbgPrint(format, arg...) LOGD("[%s/%s:%d] " format, util_basename(__FILE__), __func__, __LINE__, ##arg) +#define ErrPrint(format, arg...) LOGE("[%s/%s:%d] " format, util_basename(__FILE__), __func__, __LINE__, ##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) +#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" + +/* End of a file */ diff --git a/include/fault_manager.h b/include/fault_manager.h new file mode 100644 index 0000000..53de351 --- /dev/null +++ b/include/fault_manager.h @@ -0,0 +1,25 @@ +/* + * 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. + */ + +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/fb.h b/include/fb.h new file mode 100644 index 0000000..3a61505 --- /dev/null +++ b/include/fb.h @@ -0,0 +1,38 @@ +/* + * 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. + */ + +struct fb_info; +struct inst_info; + +extern int fb_init(void); +extern int fb_fini(void); +extern struct fb_info *fb_create(struct inst_info *inst, int w, int h, enum buffer_type type); +extern int fb_destroy(struct fb_info *info); +extern Ecore_Evas * const fb_canvas(struct fb_info *info); +extern const char *fb_id(struct fb_info *info); +extern int fb_get_size(struct fb_info *info, int *w, int *h); +extern void fb_sync(struct fb_info *info); +extern int fb_create_buffer(struct fb_info *info); +extern int fb_destroy_buffer(struct fb_info *info); +extern int fb_resize(struct fb_info *info, int w, int h); + +/*! + * \note Only for the pixmap + */ +extern void *fb_pixmap_render_pre(struct fb_info *info); +extern int fb_pixmap_render_post(struct fb_info *info); + +/* End of a file */ diff --git a/include/group.h b/include/group.h new file mode 100644 index 0000000..a61a58b --- /dev/null +++ b/include/group.h @@ -0,0 +1,65 @@ +/* + * 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. + */ + +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..d9d7af0 --- /dev/null +++ b/include/instance.h @@ -0,0 +1,211 @@ +/* + * 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. + */ + +/*! + * \note + * An instance has three states. + * ACTIVATED, DEACTIVATED, DESTROYED + * + * When the master is launched and someone requiers 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_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 */ +}; + +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); + +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); + +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, int w, int h, double priority, const char *content, const char *title); +extern void instance_set_pd_info(struct inst_info *inst, int w, int h); + +extern void instance_pd_updated(const char *pkgname, const char *id, const char *descfile); +extern void instance_lb_updated(const char *pkgname, const char *id); +extern void instance_lb_updated_by_instance(struct inst_info *inst); +extern void instance_pd_updated_by_instance(struct inst_info *inst, const char *descfile); + +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_set_pinup(struct inst_info *inst, int pinup); +extern int instance_resize(struct inst_info *inst, int w, int h); +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); + +/*! + * \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 int 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_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); + +extern int instance_create_lb_buffer(struct inst_info *inst); +extern int instance_create_pd_buffer(struct inst_info *inst); + +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); + +extern int instance_freeze_updator(struct inst_info *inst); +extern int instance_thaw_updator(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 void instance_init(void); +extern void instance_fini(void); + +/* End of a file */ diff --git a/include/io.h b/include/io.h new file mode 100644 index 0000000..3bae7b7 --- /dev/null +++ b/include/io.h @@ -0,0 +1,25 @@ +/* + * 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. + */ + +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 *lb_pkgname, int prime, void *data), void *data); +extern int io_crawling_liveboxes(int (*cb)(const char *pkgname, int prime, void *data), void *data); +extern int io_is_exists(const char *pkgname); /* Manifest Package Name */ + +/* End of a file */ diff --git a/include/liveinfo.h b/include/liveinfo.h new file mode 100644 index 0000000..592a8ee --- /dev/null +++ b/include/liveinfo.h @@ -0,0 +1,33 @@ +/* + * 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. + */ + +struct liveinfo; + +extern int liveinfo_init(void); +extern int liveinfo_fini(void); +extern struct liveinfo *liveinfo_create(pid_t pid, int handle); +extern int 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 int liveinfo_close_fifo(struct liveinfo *info); + +/* End of a file */ diff --git a/include/main.h b/include/main.h new file mode 100644 index 0000000..62077ae --- /dev/null +++ b/include/main.h @@ -0,0 +1,16 @@ +/* + * 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. + */ + diff --git a/include/package.h b/include/package.h new file mode 100644 index 0000000..65cafbd --- /dev/null +++ b/include/package.h @@ -0,0 +1,127 @@ +/* + * 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. + */ + +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 *pkgname); +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 int 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, int 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); + +/*! + * \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); + +/* End of a file */ diff --git a/include/parser.h b/include/parser.h new file mode 100644 index 0000000..2be8995 --- /dev/null +++ b/include/parser.h @@ -0,0 +1,45 @@ +/* + * 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. + */ + +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 int 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..c5c0d82 --- /dev/null +++ b/include/pkgmgr.h @@ -0,0 +1,40 @@ +/* + * 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. + */ + +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..17ed04d --- /dev/null +++ b/include/rpc_to_slave.h @@ -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. + */ + +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..7ca8a4d --- /dev/null +++ b/include/script_handler.h @@ -0,0 +1,36 @@ +/* + * 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. + */ + +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 struct fb_info *script_handler_fb(struct script_info *info); +extern void *script_handler_evas(struct script_info *info); +extern int script_handler_parse_desc(const char *pkgname, const char *filename, 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_init(void); +extern int script_fini(void); + +extern int script_signal_emit(Evas *e, const char *part, const char *signal, double sx, double sy, double ex, double ey); +extern int script_handler_update_pointer(struct script_info *inst, double x, double y, int down); +extern int script_handler_resize(struct script_info *info, int w, int h); + +/* End of a file */ diff --git a/include/server.h b/include/server.h new file mode 100644 index 0000000..c6ad93c --- /dev/null +++ b/include/server.h @@ -0,0 +1,20 @@ +/* + * 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. + */ + +extern int server_init(void); +extern int server_fini(void); + +/* End of a file */ diff --git a/include/setting.h b/include/setting.h new file mode 100644 index 0000000..fbc9b95 --- /dev/null +++ b/include/setting.h @@ -0,0 +1,21 @@ +/* + * 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. + */ + +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/slave_life.h b/include/slave_life.h new file mode 100644 index 0000000..f5ac637 --- /dev/null +++ b/include/slave_life.h @@ -0,0 +1,193 @@ +/* + * 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. + */ + +/*! + * 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 + * SLAVE_ACTIVATED = { SLAVE_PAUSED, SLAVE_RESUMED } + */ + SLAVE_PAUSED, + SLAVE_RESUMED, + + SLAVE_ERROR = 0xFF, /* Explicitly define the size of this enum type */ +}; + +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); + +/*! + * \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) __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); + +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); + +/* End of a file */ diff --git a/include/slave_rpc.h b/include/slave_rpc.h new file mode 100644 index 0000000..e1fbd3b --- /dev/null +++ b/include/slave_rpc.h @@ -0,0 +1,30 @@ +/* + * 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. + */ + +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); +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_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..162bc01 --- /dev/null +++ b/include/util.h @@ -0,0 +1,34 @@ +/* + * 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. + */ + +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 char *util_slavename(void); +extern const char *util_basename(const char *name); +extern unsigned 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); + +#define SCHEMA_FILE "file://" +#define SCHEMA_PIXMAP "pixmap://" +#define SCHEMA_SHM "shm://" + +/* End of a file */ diff --git a/include/xmonitor.h b/include/xmonitor.h new file mode 100644 index 0000000..3ddc7cd --- /dev/null +++ b/include/xmonitor.h @@ -0,0 +1,32 @@ +/* + * 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. + */ + +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); + +/* End of a file */ diff --git a/org.tizen.data-provider-master.desktop b/org.tizen.data-provider-master.desktop new file mode 100644 index 0000000..253c8b9 --- /dev/null +++ b/org.tizen.data-provider-master.desktop @@ -0,0 +1,9 @@ +Name=Live Data Provider - Master +Type=Application +Exec=/usr/bin/data-provider-master +Icon=org.tizen.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/org.tizen.data-provider-master.manifest b/org.tizen.data-provider-master.manifest new file mode 100644 index 0000000..3dbbaa8 --- /dev/null +++ b/org.tizen.data-provider-master.manifest @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packaging/org.tizen.data-provider-master.spec b/packaging/org.tizen.data-provider-master.spec new file mode 100644 index 0000000..724cba8 --- /dev/null +++ b/packaging/org.tizen.data-provider-master.spec @@ -0,0 +1,128 @@ +Name: org.tizen.data-provider-master +Summary: Master data provider +Version: 0.13.21 +Release: 1 +Group: main/app +License: Flora License +Source0: %{name}-%{version}.tar.gz +BuildRequires: cmake, gettext-tools +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(bundle) +BuildRequires: pkgconfig(ecore-x) +BuildRequires: pkgconfig(ecore) +BuildRequires: pkgconfig(evas) +BuildRequires: pkgconfig(ecore-evas) +BuildRequires: pkgconfig(capi-context) +BuildRequires: pkgconfig(com-core) +BuildRequires: pkgconfig(heynoti) +BuildRequires: pkgconfig(libxml-2.0) +BuildRequires: pkgconfig(x11) +BuildRequires: pkgconfig(libdri2) +BuildRequires: pkgconfig(libdrm) +BuildRequires: pkgconfig(libdrm_slp) +BuildRequires: pkgconfig(xfixes) +BuildRequires: pkgconfig(dri2proto) +BuildRequires: pkgconfig(xext) +BuildRequires: pkgconfig(xdamage) +BuildRequires: pkgconfig(pkgmgr) +BuildRequires: pkgconfig(livebox-service) + +%description +Manage the slave data provider and communicate with client applications. + +%prep +%setup -q + +%build +cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} +CFLAGS="${CFLAGS} -Wall -Winline -Werror" LDFLAGS="${LDFLAGS}" make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +%make_install +mkdir -p %{buildroot}/usr/share/license + +%pre + +# Executing the stop script for stopping the service of installed provider (old version) +if [ -x /etc/rc.d/init.d/data-provider-master ]; then + /etc/rc.d/init.d/data-provider-master stop +fi + +%post + +mkdir -p /opt/usr/share/live_magazine +chown 5000:5000 /opt/usr/share/live_magazine +if [ -f /usr/lib/rpm-plugins/msm.so ]; then + echo "Update smack for CONTENT SHARING FOLDER" + chsmack -a "_" /opt/usr/share/live_magazine + chsmack -t /opt/usr/share/live_magazine +fi + +# According to this transmute attribute, below log, reader folder will be set as same label + +mkdir -p /opt/usr/share/live_magazine/log +chown 5000:5000 /opt/usr/share/live_magazine/log + +mkdir -p /opt/usr/share/live_magazine/reader +chown 5000:5000 /opt/usr/share/live_magazine/reader + +# End of a list of affected folder by the transmute attribute + +if [ ! -f "/opt/dbspace/livebox.db" ]; then + echo "Create a new livebox DB" + touch /opt/dbspace/.livebox.db + chown 0:5000 /opt/dbspace/.livebox.db + chmod 640 /opt/dbspace/.livebox.db + if [ -f /usr/lib/rpm-plugins/msm.so ]; then + echo "Update smack for DB" + chsmack -a "data-provider-master::db" /opt/dbspace/.livebox.db + fi +fi + +if [ ! -f "/opt/dbspace/livebox.db-journal" ]; then + echo "Create a new livebox DB - journal file" + touch /opt/dbspace/.livebox.db-journal + chown 0:5000 /opt/dbspace/.livebox.db-journal + chmod 640 /opt/dbspace/.livebox.db-journal + if [ -f /usr/lib/rpm-plugins/msm.so ]; then + echo "Update smack for DB(journal)" + chsmack -a "data-provider-master::db" /opt/dbspace/.livebox.db-journal + fi +fi + +mkdir -p /etc/rc.d/rc3.d +ln -sf /etc/rc.d/init.d/data-provider-master /etc/rc.d/rc3.d/S99data-provider-master +if [ -f /usr/lib/rpm-plugins/msm.so ]; then + echo "Update smack for INITD - booting script" + chsmack -a "_" /etc/rc.d/rc3.d/S99data-provider-master + chsmack -e "_" /etc/rc.d/rc3.d/S99data-provider-master +fi + +mkdir -p /usr/lib/systemd/user/tizen-middleware.target.wants +ln -sf /usr/lib/systemd/user/data-provider-master.service /usr/lib/systemd/user/tizen-middleware.target.wants/data-provider-master.service +if [ -f /usr/lib/rpm-plugins/msm.so ]; then + echo "Update smack for SYSTEMD - service file" + chsmack -a "_" /usr/lib/systemd/user/tizen-middleware.target.wants/data-provider-master.service +fi + +echo "Successfully installed. Please start a daemon again manually" +echo "/etc/init.d/data-provider-master start" + +%files -n org.tizen.data-provider-master +%manifest org.tizen.data-provider-master.manifest +%defattr(-,root,root,-) +/etc/rc.d/init.d/data-provider-master +/usr/bin/data-provider-master +/usr/bin/liveinfo +/usr/etc/package-manager/parserlib/* +/usr/share/data-provider-master/* +/usr/lib/systemd/user/data-provider-master.service +/usr/share/license/* diff --git a/pkgmgr_livebox/CMakeLists.txt b/pkgmgr_livebox/CMakeLists.txt new file mode 100644 index 0000000..529a16c --- /dev/null +++ b/pkgmgr_livebox/CMakeLists.txt @@ -0,0 +1,30 @@ +PROJECT(livebox C) + +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/pkgmgr_livebox/include) + +INCLUDE(FindPkgConfig) +pkg_check_modules(bin_pkgs REQUIRED + dlog + sqlite3 + libxml-2.0 + db-util +) + +FOREACH(flag ${bin_pkgs_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -g -Wall -Werror") + +ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") + +ADD_LIBRARY(${PROJECT_NAME} SHARED + src/service_register.c + src/dlist.c +) + +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${bin_pkgs_LDFLAGS}) + +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION "etc/package-manager/parserlib") + +# End of a file diff --git a/pkgmgr_livebox/include/dlist.h b/pkgmgr_livebox/include/dlist.h new file mode 100644 index 0000000..b4a5719 --- /dev/null +++ b/pkgmgr_livebox/include/dlist.h @@ -0,0 +1,43 @@ +/* + * 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. + */ + +#define dlist_remove_data(list, data) do { \ + struct dlist *l; \ + l = dlist_find_data(list, data); \ + list = dlist_remove(list, l); \ +} while (0) + +#define dlist_foreach(list, l, data) \ + for ((l) = (list); (l) && ((data) = dlist_data(l)); (l) = dlist_next(l)) + +#define dlist_foreach_safe(list, l, n, data) \ + for ((l) = (list), (n) = dlist_next(l); \ + (l) && ((data) = dlist_data(l)); \ + (l) = (n), (n) = dlist_next(l)) + +struct dlist; + +extern struct dlist *dlist_append(struct dlist *list, void *data); +extern struct dlist *dlist_prepend(struct dlist *list, void *data); +extern struct dlist *dlist_remove(struct dlist *list, struct dlist *l); +extern struct dlist *dlist_find_data(struct dlist *list, void *data); +extern void *dlist_data(struct dlist *l); +extern struct dlist *dlist_next(struct dlist *l); +extern struct dlist *dlist_prev(struct dlist *l); +extern int dlist_count(struct dlist *l); +extern struct dlist *dlist_nth(struct dlist *l, int nth); + +/* End of a file */ diff --git a/pkgmgr_livebox/livebox.xml b/pkgmgr_livebox/livebox.xml new file mode 100644 index 0000000..b4b862c --- /dev/null +++ b/pkgmgr_livebox/livebox.xml @@ -0,0 +1,69 @@ + + + + + + /usr/share/icons/small/org.tizen.live-nicesj.png + + + Content information + + org.tizen.nicesj + + + 1x1 + 2x1 + 2x2 + 4x1 + 4x2 + 4x3 + 4x4 + +