--- /dev/null
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+\r
+ Apache License\r
+ Version 2.0, January 2004\r
+ http://www.apache.org/licenses/\r
+\r
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r
+\r
+ 1. Definitions.\r
+\r
+ "License" shall mean the terms and conditions for use, reproduction,\r
+ and distribution as defined by Sections 1 through 9 of this document.\r
+\r
+ "Licensor" shall mean the copyright owner or entity authorized by\r
+ the copyright owner that is granting the License.\r
+\r
+ "Legal Entity" shall mean the union of the acting entity and all\r
+ other entities that control, are controlled by, or are under common\r
+ control with that entity. For the purposes of this definition,\r
+ "control" means (i) the power, direct or indirect, to cause the\r
+ direction or management of such entity, whether by contract or\r
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the\r
+ outstanding shares, or (iii) beneficial ownership of such entity.\r
+\r
+ "You" (or "Your") shall mean an individual or Legal Entity\r
+ exercising permissions granted by this License.\r
+\r
+ "Source" form shall mean the preferred form for making modifications,\r
+ including but not limited to software source code, documentation\r
+ source, and configuration files.\r
+\r
+ "Object" form shall mean any form resulting from mechanical\r
+ transformation or translation of a Source form, including but\r
+ not limited to compiled object code, generated documentation,\r
+ and conversions to other media types.\r
+\r
+ "Work" shall mean the work of authorship, whether in Source or\r
+ Object form, made available under the License, as indicated by a\r
+ copyright notice that is included in or attached to the work\r
+ (an example is provided in the Appendix below).\r
+\r
+ "Derivative Works" shall mean any work, whether in Source or Object\r
+ form, that is based on (or derived from) the Work and for which the\r
+ editorial revisions, annotations, elaborations, or other modifications\r
+ represent, as a whole, an original work of authorship. For the purposes\r
+ of this License, Derivative Works shall not include works that remain\r
+ separable from, or merely link (or bind by name) to the interfaces of,\r
+ the Work and Derivative Works thereof.\r
+\r
+ "Contribution" shall mean any work of authorship, including\r
+ the original version of the Work and any modifications or additions\r
+ to that Work or Derivative Works thereof, that is intentionally\r
+ submitted to Licensor for inclusion in the Work by the copyright owner\r
+ or by an individual or Legal Entity authorized to submit on behalf of\r
+ the copyright owner. For the purposes of this definition, "submitted"\r
+ means any form of electronic, verbal, or written communication sent\r
+ to the Licensor or its representatives, including but not limited to\r
+ communication on electronic mailing lists, source code control systems,\r
+ and issue tracking systems that are managed by, or on behalf of, the\r
+ Licensor for the purpose of discussing and improving the Work, but\r
+ excluding communication that is conspicuously marked or otherwise\r
+ designated in writing by the copyright owner as "Not a Contribution."\r
+\r
+ "Contributor" shall mean Licensor and any individual or Legal Entity\r
+ on behalf of whom a Contribution has been received by Licensor and\r
+ subsequently incorporated within the Work.\r
+\r
+ 2. Grant of Copyright License. Subject to the terms and conditions of\r
+ this License, each Contributor hereby grants to You a perpetual,\r
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+ copyright license to reproduce, prepare Derivative Works of,\r
+ publicly display, publicly perform, sublicense, and distribute the\r
+ Work and such Derivative Works in Source or Object form.\r
+\r
+ 3. Grant of Patent License. Subject to the terms and conditions of\r
+ this License, each Contributor hereby grants to You a perpetual,\r
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+ (except as stated in this section) patent license to make, have made,\r
+ use, offer to sell, sell, import, and otherwise transfer the Work,\r
+ where such license applies only to those patent claims licensable\r
+ by such Contributor that are necessarily infringed by their\r
+ Contribution(s) alone or by combination of their Contribution(s)\r
+ with the Work to which such Contribution(s) was submitted. If You\r
+ institute patent litigation against any entity (including a\r
+ cross-claim or counterclaim in a lawsuit) alleging that the Work\r
+ or a Contribution incorporated within the Work constitutes direct\r
+ or contributory patent infringement, then any patent licenses\r
+ granted to You under this License for that Work shall terminate\r
+ as of the date such litigation is filed.\r
+\r
+ 4. Redistribution. You may reproduce and distribute copies of the\r
+ Work or Derivative Works thereof in any medium, with or without\r
+ modifications, and in Source or Object form, provided that You\r
+ meet the following conditions:\r
+\r
+ (a) You must give any other recipients of the Work or\r
+ Derivative Works a copy of this License; and\r
+\r
+ (b) You must cause any modified files to carry prominent notices\r
+ stating that You changed the files; and\r
+\r
+ (c) You must retain, in the Source form of any Derivative Works\r
+ that You distribute, all copyright, patent, trademark, and\r
+ attribution notices from the Source form of the Work,\r
+ excluding those notices that do not pertain to any part of\r
+ the Derivative Works; and\r
+\r
+ (d) If the Work includes a "NOTICE" text file as part of its\r
+ distribution, then any Derivative Works that You distribute must\r
+ include a readable copy of the attribution notices contained\r
+ within such NOTICE file, excluding those notices that do not\r
+ pertain to any part of the Derivative Works, in at least one\r
+ of the following places: within a NOTICE text file distributed\r
+ as part of the Derivative Works; within the Source form or\r
+ documentation, if provided along with the Derivative Works; or,\r
+ within a display generated by the Derivative Works, if and\r
+ wherever such third-party notices normally appear. The contents\r
+ of the NOTICE file are for informational purposes only and\r
+ do not modify the License. You may add Your own attribution\r
+ notices within Derivative Works that You distribute, alongside\r
+ or as an addendum to the NOTICE text from the Work, provided\r
+ that such additional attribution notices cannot be construed\r
+ as modifying the License.\r
+\r
+ You may add Your own copyright statement to Your modifications and\r
+ may provide additional or different license terms and conditions\r
+ for use, reproduction, or distribution of Your modifications, or\r
+ for any such Derivative Works as a whole, provided Your use,\r
+ reproduction, and distribution of the Work otherwise complies with\r
+ the conditions stated in this License.\r
+\r
+ 5. Submission of Contributions. Unless You explicitly state otherwise,\r
+ any Contribution intentionally submitted for inclusion in the Work\r
+ by You to the Licensor shall be under the terms and conditions of\r
+ this License, without any additional terms or conditions.\r
+ Notwithstanding the above, nothing herein shall supersede or modify\r
+ the terms of any separate license agreement you may have executed\r
+ with Licensor regarding such Contributions.\r
+\r
+ 6. Trademarks. This License does not grant permission to use the trade\r
+ names, trademarks, service marks, or product names of the Licensor,\r
+ except as required for reasonable and customary use in describing the\r
+ origin of the Work and reproducing the content of the NOTICE file.\r
+\r
+ 7. Disclaimer of Warranty. Unless required by applicable law or\r
+ agreed to in writing, Licensor provides the Work (and each\r
+ Contributor provides its Contributions) on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r
+ implied, including, without limitation, any warranties or conditions\r
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r
+ PARTICULAR PURPOSE. You are solely responsible for determining the\r
+ appropriateness of using or redistributing the Work and assume any\r
+ risks associated with Your exercise of permissions under this License.\r
+\r
+ 8. Limitation of Liability. In no event and under no legal theory,\r
+ whether in tort (including negligence), contract, or otherwise,\r
+ unless required by applicable law (such as deliberate and grossly\r
+ negligent acts) or agreed to in writing, shall any Contributor be\r
+ liable to You for damages, including any direct, indirect, special,\r
+ incidental, or consequential damages of any character arising as a\r
+ result of this License or out of the use or inability to use the\r
+ Work (including but not limited to damages for loss of goodwill,\r
+ work stoppage, computer failure or malfunction, or any and all\r
+ other commercial damages or losses), even if such Contributor\r
+ has been advised of the possibility of such damages.\r
+\r
+ 9. Accepting Warranty or Additional Liability. While redistributing\r
+ the Work or Derivative Works thereof, You may choose to offer,\r
+ and charge a fee for, acceptance of support, warranty, indemnity,\r
+ or other liability obligations and/or rights consistent with this\r
+ License. However, in accepting such obligations, You may act only\r
+ on Your own behalf and on Your sole responsibility, not on behalf\r
+ of any other Contributor, and only if You agree to indemnify,\r
+ defend, and hold each Contributor harmless for any liability\r
+ incurred by, or claims asserted against, such Contributor by reason\r
+ of your accepting any such warranty or additional liability.\r
+\r
+ END OF TERMS AND CONDITIONS\r
+\r
+ APPENDIX: How to apply the Apache License to your work.\r
+\r
+ To apply the Apache License to your work, attach the following\r
+ boilerplate notice, with the fields enclosed by brackets "[]"\r
+ replaced with your own identifying information. (Don't include\r
+ the brackets!) The text should be enclosed in the appropriate\r
+ comment syntax for the file format. We also recommend that a\r
+ file or class name and description of purpose be included on the\r
+ same "printed page" as the copyright notice for easier\r
+ identification within third-party archives.\r
+\r
+ Copyright [yyyy] [name of copyright owner]\r
+\r
+ Licensed under the Apache License, Version 2.0 (the "License");\r
+ you may not use this file except in compliance with the License.\r
+ You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+\r
--- /dev/null
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
\ No newline at end of file
+++ /dev/null
-#!/bin/sh
-
-DESC="Push service daemon"
-NAME=pushd
-DAEMON=/usr/bin/$NAME
-SCRIPTNAME=/etc/init.d/$NAME
-
-[ -x "$DAEMON" ] || exit 0
-
-do_start() {
- PID=`pidof $NAME`
- [ -z "$PID" ] || return 1
- $DAEMON
- RETVAL=$?
- return "$RETVAL"
-}
-
-do_stop() {
- PID=`pidof $NAME`
- if [ -n "$PID" ]; then
- kill $PID
- fi
- return 0
-}
-
-prt_res() {
- RETVAL=$1
-
- case "$RETVAL" in
- 0|1)
- echo "... done."
- RETVAL=0
- ;;
- *)
- echo "... failed!"
- RETVAL=1
- ;;
- esac
-
- return $RETVAL
-}
-
-case "$1" in
- start)
- echo "Starting $DESC" "$NAME"
- do_start
- prt_res $?
- ;;
- stop)
- echo "Stopping $DESC" "$NAME"
- do_stop
- prt_res $?
- ;;
- *)
- echo "Usage: $SCRIPTNAME {start|stop}" >&2
- exit 3
- ;;
-esac
-
+++ /dev/null
-/etc/init.d/pushd
\ No newline at end of file
+++ /dev/null
-/etc/init.d/pushd
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apach e License, Version 2.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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#ifndef __PUSH_LIB_H__
-#define __PUSH_LIB_H__
-
-#include <errno.h>
-#include <app.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup CAPI_MESSAGING_PUSH_MODULE
- * @{
- */
-
-/**
- * @file push.h
- * @ingroup CAPI_MESSAGING_FRAMEWORK
- * @brief Support to receive push notifications
- */
-
-/**
- * @brief Enumerations of error codes for push API
- */
-typedef enum {
- PUSH_ERROR_NONE = 0, /**< Successful */
- PUSH_ERROR_OUT_OF_MEMORY = -ENOMEM, /**< Out of memory */
- PUSH_ERROR_INVALID_PARAMETER = -EINVAL, /**< Invalid parameter */
- PUSH_ERROR_NOT_CONNECTED = -ENOTCONN, /**< Not connected */
- PUSH_ERROR_NO_DATA = -ENODATA, /**< No data available */
- PUSH_ERROR_OPERATION_FAILED = -0x00004300, /**< Internal operation failed */
-} push_error_e;
-
-/**
- * @brief Enumerations of registration state
- */
-typedef enum {
- PUSH_STATE_REGISTERED, /**< Registred */
- PUSH_STATE_UNREGISTERED, /**< Unregistered */
- PUSH_STATE_ERROR, /**< Error */
-} push_state_e;
-
-/**
- * @brief Enumerations of result
- */
-typedef enum {
- PUSH_RESULT_SUCCESS, /**< Successful */
- PUSH_RESULT_TIMEOUT, /**< Request timed out */
- PUSH_RESULT_SERVER_ERROR, /**< Push server error */
- PUSH_RESULT_SYSTEM_ERROR, /**< System error */
-} push_result_e;
-
-/**
- * @brief Handle of a connection to the push service
- */
-typedef struct push_connection_s *push_connection_h;
-
-/**
- * @brief Handle of a notification delivered from the push server
- */
-typedef struct push_notification_s *push_notification_h;
-
-/**
- * @brief State callback
- * @remarks This callback will be invoked when the regisration state is
- * refreshed. If the registration or degistration has been succeeded,
- * then this state callback must be called. In addition, the state
- * can be changed if the push server deregisters the application.
- * @param[in] state Registration state
- * @param[in] err Error message
- * @param[in] user_data User data passed to this callback
- * @see push_connect()
- */
-typedef void (*push_state_cb)(
- push_state_e state, const char *err, void *user_data);
-
-/**
- * @brief Notifcation callback
- * @param[in] notification A handle of notification containing its payload.
- * The handle is available inside this callback only.
- * @param[in] user_data User data passed to this callback
- * @see push_connect(), push_get_notification_data()
- */
-typedef void (*push_notify_cb)(
- push_notification_h noti, void *user_data);
-
-/**
- * @brief Result callback
- * @param[in] result Registration/deregistration result
- * @param[in] msg Result message from the push server or NULL
- * @param[in] user_data User data passed to this callback
- * @see push_register(), push_deregister()
- */
-typedef void (*push_result_cb)(push_result_e result, const char *msg, void *user_data);
-
-/**
- * @brief Connects to the push service and sets callback functions
- * @remarks If there is a connection between an application and the push service,
- * the notify callback passes the notification upon its arrival.
- * Otherwise, the push service posts a UI notification to alert users.
- * Connection should be freed with @ref push_disconnect() by you.
- * @param[in] app_id The application ID
- * @param[in] state_cb State callback function
- * @param[in] notify_cb Notify callback function
- * @param[in] user_data User data to pass to <I>state_cb</I> and <I>notify_cb</I>
- * @param[out] connection The connection handle to the push service
- * @return 0 on success, otherwise a negative error value.
- * @retval PUSH_ERROR_NONE Successful
- * @retval PUSH_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval PUSH_ERROR_OUT_OF_MEMORY Out of memory
- * @retval PUSH_ERROR_OPERATION_FAILED Operation failed
- * @pre There is no connection for the <I>app_id</I> to the push service
- * @post The state callback will be called to let you know the current
- * registration state immediately.
- * @see push_disconnect()
- */
-int push_connect(const char *app_id, push_state_cb state_callback,
- push_notify_cb notify_callback, void *user_data,
- push_connection_h *connection);
-
-/**
- * @brief Closes the connection and releases all its resources
- * @remarks If you call this function in the push callback functions,
- * it may cause your application crash.
- * @param[in] connection Handle of a connection to the push service
- * @see push_connect()
- */
-void push_disconnect(push_connection_h connection);
-
-/**
- * @brief Registers an application to the push server
- * @param[in] connection The connection handle to the push service
- * @param[in] service A @ref Service handle to launch an application by
- * an posted UI notification
- * @param[in] result_cb Result callback function
- * @param[in] user_data User data to pass to <I>result_cb</I>
- * @return 0 on success, otherwise a negative error value.
- * @retval PUSH_ERROR_NONE Successful
- * @retval PUSH_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval PUSH_ERROR_OUT_OF_MEMORY Out of memory
- * @retval PUSH_ERROR_NOT_CONNECTED No connection to the push service
- * @retval PUSH_ERROR_OPERATION_FAILED Operation failed
- * @pre The application should be connected to the push service
- * @post For successful result, the state callback should be invoked
- * @see push_deregister()
- */
-int push_register(push_connection_h connection, service_h service,
- push_result_cb result_callback, void *user_data);
-
-/**
- * @brief Deregisters an application from the Push server
- * @param[in] connection The connection handle to the push service
- * @param[in] result_cb Result callback function
- * @param[in] user_data User data to pass to <I>result_cb</I>
- * @return 0 on success, otherwise a negative error value.
- * @retval PUSH_ERROR_NONE Successful
- * @retval PUSH_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval PUSH_ERROR_OUT_OF_MEMORY Out of memory
- * @retval PUSH_ERROR_NOT_CONNECTED No connection to the push service
- * @retval PUSH_ERROR_OPERATION_FAILED Operation failed
- * @pre The application should be connected to the push service
- * @post In result, the state callback will be invoked
- * @see push_register()
- */
-int push_deregister(push_connection_h connection, push_result_cb callback,
- void *user_data);
-
-/**
- * @brief Gets notification data which its server sent
- * @remark The <I>data</I> must be released with free() by you
- * @param[in] notification The notification handle
- * @param[out] data The notification data\n
- * Set NULL if error but <I>PUSH_ERROR_INVALID_PARAMETER</I>
- * @return 0 on success, otherwise a negative error value.
- * @retval PUSH_ERROR_NONE Successful
- * @retval PUSH_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval PUSH_ERROR_OUT_OF_MEMORY Out of memory
- * @retval PUSH_ERROR_NO_DATA No data available
- * @see push_notify_cb()
- * @see push_get_unread_notification()
- */
-int push_get_notification_data(push_notification_h notification, char **data);
-
-
-/**
- * @brief Gets the notification message which its server sent
- * @remark The <I>msg</I> must be released with free() by you
- * @param[in] notification The notification handle
- * @param[out] data The notification message\n
- * Set NULL if error but <I>PUSH_ERROR_INVALID_PARAMETER</I>
- * @return 0 on success, otherwise a negative error value.
- * @retval PUSH_ERROR_NONE Successful
- * @retval PUSH_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval PUSH_ERROR_OUT_OF_MEMORY Out of memory
- * @retval PUSH_ERROR_NO_DATA No data available
- * @see push_notify_cb()
- * @see push_get_unread_notification()
- */
-int push_get_notification_message(push_notification_h notification,
- char **msg);
-
-/**
- * @brief Gets the received time of the notification message
- *
- * @param[in] notification The notification handle
- * @param[out] received_time The received time of the notification message. \n
- * The @a received_time is based on UTC.
- * @return 0 on success, otherwise a negative error value.
- * @retval PUSH_ERROR_NONE Successful
- * @retval PUSH_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval PUSH_ERROR_NO_DATA No data available
- *
- * @see push_notify_cb()
- * @see push_get_unread_notification()
- */
-int push_get_notification_time(push_notification_h notification, long long int *received_time);
-
-/**
- * @brief Gets an unread notification message from the push server
- *
- * @remark This method will be deprecated.
- * @remark @a noti must be released with push_free_notification() by you
- *
- * @details If an application receives an unread message with this method, the message is removed from the system. \n
- * This method can be called repeatedly until it returns <I>PUSH_ERROR_NO_DATA</I> \n
- * But, this method does NOT guarantee order and reliability of notification messages. \n
- * Some notification messages can be dropped when the system message queue is full.
- *
- * @param[in] connection The connection handle to the push service
- * @param[out] noti The notification handle
- * @return 0 on success, otherwise a negative error value.
- * @retval PUSH_ERROR_NONE Successful
- * @retval PUSH_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval PUSH_ERROR_OUT_OF_MEMORY Out of memory
- * @retval PUSH_ERROR_NO_DATA No data available
- *
- * @see push_get_notification_message()
- * @see push_get_notification_time()
- * @see push_get_notification_data()
- */
-int push_get_unread_notification(push_connection_h connection,
- push_notification_h *noti);
-
-
-/**
- * @brief Gets the registration ID in <I>PUSH_STATE_REGISTERED</I> state
- * @remark The <I>reg_id</I> must be released with free() by you
- * @param[in] connection The connection handle to the push service
- * @param[out] reg_id The registration ID\n
- * Set NULL if error but <I>PUSH_ERROR_INVALID_PARAMETER</I>
- * @return 0 on success, otherwise a negative error value
- * @retval PUSH_ERROR_NONE Successful
- * @retval PUSH_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval PUSH_ERROR_OUT_OF_MEMORY Out of memory
- * @retval PUSH_ERROR_NO_DATA No registration ID available
- */
-int push_get_registration_id(push_connection_h connection, char **reg_id);
-
-
-/**
- * @brief Frees the notification handle
- * @param[in] noti The notification handle
- */
-void push_free_notification(push_notification_h noti);
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __PUSH_LIB_H__ */
+++ /dev/null
-[Unit]
-Description=Pushd service
-
-[Service]
-Type=forking
-ExecStart=/usr/bin/pushd
-
-[Install]
-WantedBy=tizen-middleware.target
+++ /dev/null
-../pushd.service
\ No newline at end of file
--- /dev/null
+/*\r
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved\r
+ *\r
+ * Licensed under the Apach e License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+\r
+#ifndef __PUSH_SERVICE_DOC_H__\r
+#define __PUSH_SERVICE_DOC_H__\r
+\r
+/**\r
+ * @ingroup CAPI_MESSAGING_FRAMEWORK\r
+ * @defgroup CAPI_MESSAGING_PUSH_PUBLIC_MODULE Push\r
+ * @brief The @ref CAPI_MESSAGING_PUSH_PUBLIC_MODULE API provides functions to receive push notifications.\r
+ *\r
+ * @addtogroup CAPI_MESSAGING_PUSH_PUBLIC_MODULE\r
+ *\r
+ * @section CAPI_MESSAGING_PUSH_PUBLIC_MODULE_HEADER Required Header\r
+ * \#include <push-service.h>\r
+ *\r
+ * @section CAPI_MESSAGING_PUSH_PUBLIC_MODULE_OVERVIEW Overview\r
+ *\r
+ * The Push API allows your application to receive push notifications from a push server.\r
+ * The push service is a client daemon that maintains a permanent connection between your device\r
+ * and the push server, in order to process your registration/deregistration requests and\r
+ * deliver push notifications to your application. If the application is connected,\r
+ * the push service passes the notification data over the connection. Otherwise,\r
+ * the push service posts a UI notification with the data.\r
+ * It will be delivered when a user launches the application by selecting the posting.\r
+ *\r
+ * To receive push notifications, you need to follow the steps below:\r
+ *\r
+ * - Connecting to the push service\r
+ * - Registering your application\r
+ * - Getting notification data\r
+ *\r
+ * Push notification helps your application server send data to the application on devices\r
+ * over an IP network even if the application is not running.\r
+ * Push notification may reduce battery consumption over other applications keeping its own connection\r
+ * to its remote application server.\r
+ * @image html capi_messaging_push_overview1.png\r
+ *\r
+ * @subsection CAPI_MESSAGING_PUSH_PUBLIC_LIMITATIONS Service Limitation\r
+ * - Payload of a push message is limited to 4096 bytes.\r
+ * - Administrative permission is needed for your application and server to use the push service.\r
+ * - Push service does not guarantee delivery and order of push messages.\r
+ * - A device should have a valid IMEI number.\r
+ * <BR>\r
+ */\r
+\r
+#endif /* __PUSH_SERVICE_DOC_H__ */\r
--- /dev/null
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apach e License, Version 2.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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __PUSH_DOC_H__
+#define __PUSH_DOC_H__
+
+/**
+ * @internal
+ * @defgroup CAPI_MESSAGING_PUSH_MODULE Push-Internal
+ * @brief The @ref CAPI_MESSAGING_PUSH_MODULE API provides functions to receive push notifications.
+ * @ingroup CAPI_MESSAGING_FRAMEWORK
+ *
+ * @addtogroup CAPI_MESSAGING_PUSH_MODULE
+ *
+ * @section CAPI_MESSAGING_PUSH_MODULE_HEADER Required Header
+ * \#include <push.h>
+ *
+ * @section CAPI_MESSAGING_PUSH_MODULE_OVERVIEW Overview
+ *
+ * The Push API allows your application to receive push notifications from a push server.
+ * The push service is a client daemon that maintains a permanent connection between your device
+ * and the push server, in order to process your registration/deregistration requests and
+ * deliver push notifications to your application. If the application is connected,
+ * the push service passes the notification data over the connection. Otherwise,
+ * the push service posts a UI notification with the data.
+ * It will be delivered when a user launches the application by selecting the posting.
+ *
+ * To receive push notifications, you need to follow the steps below:
+ *
+ * - Connecting to the push service
+ * - Registering your application
+ * - Getting notification data
+ *
+ * Push notification helps your application server send data to the application on devices
+ * over an IP network even if the application is not running.
+ * Push notification may reduce battery consumption over other applications keeping its own connection
+ * to its remote application server.
+ * @image html capi_messaging_push_overview1.png
+ *
+ * @subsection CAPI_MESSAGING_PUSH_MODULE_OVERVIEW Service Limitation
+ * - Payload of a push message is limited to 4096 bytes.
+ * - Administrative permission is needed for your application and server to use the push service.
+ * - Push service does not guarantee delivery and order of push messages.
+ * - A device should have a valid IMEI number.
+ *
+ * @section CAPI_MESSAGING_PUSH_MODULE_FEATURE Related Features
+ * This API is related with the following feature:
+ * - http://tizen.org/feature/network.push
+ *
+ * It is recommended to design feature related codes in your application for reliability.
+ *
+ * You can check if a devrice supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.
+ *
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
+ *
+ * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ *
+ */
+
+#endif /* __PUSH_DOC_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __PUSH_PUBLIC_LIB_H__
+#define __PUSH_PUBLIC_LIB_H__
+
+#include <tizen_error.h>
+#include <app.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file push-service.h
+ */
+
+/**
+ * @addtogroup CAPI_MESSAGING_PUSH_PUBLIC_MODULE
+ * @{
+ */
+
+/**
+ * @brief Enumerations of error codes for push API.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef enum {
+ PUSH_SERVICE_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ PUSH_SERVICE_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+ PUSH_SERVICE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+ PUSH_SERVICE_ERROR_NOT_CONNECTED = TIZEN_ERROR_CONNECTION, /**< Not connected */
+ PUSH_SERVICE_ERROR_NO_DATA = TIZEN_ERROR_NO_DATA, /**< No data available */
+ PUSH_SERVICE_ERROR_OPERATION_FAILED = TIZEN_ERROR_UNKNOWN, /**< Internal operation failed */
+ PUSH_SERVICE_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< No privilege to access the push service */
+ PUSH_SERVICE_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Push service not supported */
+} push_service_error_e;
+
+/**
+ * @brief Enumeration of registration states.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef enum {
+ PUSH_SERVICE_STATE_REGISTERED, /**< Registred */
+ PUSH_SERVICE_STATE_UNREGISTERED, /**< Unregistered */
+ PUSH_SERVICE_STATE_PROVISIONING_IPCHANGE, /**< To change the provisining server IP */
+ PUSH_SERVICE_STATE_PING_CHANGE, /**< Ping interval is changing */
+ PUSH_SERVICE_STATE_ERROR, /**< Error */
+} push_service_state_e;
+
+/**
+ * @brief Enumeration of result.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef enum {
+ PUSH_SERVICE_RESULT_SUCCESS, /**< Successful */
+ PUSH_SERVICE_RESULT_TIMEOUT, /**< Request timed out */
+ PUSH_SERVICE_RESULT_SERVER_ERROR, /**< Push server error */
+ PUSH_SERVICE_RESULT_SYSTEM_ERROR, /**< System error */
+} push_service_result_e;
+
+/**
+ * @brief Connection to the push service handle.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef struct push_connection_s *push_service_connection_h;
+
+/**
+ * @brief Notification delivered from the push server handle.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef struct push_notification_s *push_service_notification_h;
+
+/**
+ * @brief Called when the registration state is refreshed.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks This callback will be invoked when the registration state is refreshed. \n
+ * If the registration or deregistration has succeeded, then this state callback must be called. \n
+ * In addition, the state can be changed if the push server deregisters the application.
+ * @param[in] state The registration state
+ * @param[in] err The error message
+ * @param[in] user_data The user data passed to this callback
+ * @see push_service_connect()
+ */
+typedef void (*push_service_state_cb)(
+ push_service_state_e state, const char *err, void *user_data);
+
+/**
+ * @brief Called to handle a notification.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] notification A handle of the notification containing its payload\n
+ * The handle is available inside this callback only.
+ * @param[in] user_data The user data passed to this callback
+ * @see push_service_connect()
+ * @see push_service_get_notification_data()
+ */
+typedef void (*push_service_notify_cb)(
+ push_service_notification_h noti, void *user_data);
+
+/**
+ * @brief Called with the result of a registration/deregistration.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] result The registration/deregistration result
+ * @param[in] msg The result message from the push server,
+ * otherwise @c NULL
+ * @param[in] user_data The user data passed to this callback
+ * @see push_service_register()
+ * @see push_service_deregister()
+ */
+typedef void (*push_service_result_cb)(push_service_result_e result, const char *msg, void *user_data);
+
+/**
+ * @brief Connects to the push service and sets callback functions.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/push
+ * @remarks If there is a connection between an application and the push service,\n
+ * the notify callback passes the notification upon its arrival.\n
+ * Otherwise, the push service posts a UI notification to alert users.\n
+ * The connection should be freed with push_service_disconnect() by you.
+ * @param[in] push_app_id App id received from Tizen Push Server team
+ * @param[in] state_callback State callback function
+ * @param[in] notify_callback Notify callback function
+ * @param[in] user_data User data to pass to <I>state_cb</I> and <I>notify_cb</I>
+ * @param[out] connection The connection handle to the push service
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_SERVICE_ERROR_NONE Successful
+ * @retval #PUSH_SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_SERVICE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PUSH_SERVICE_ERROR_NOT_CONNECTED Connection to the daemon failed
+ * @retval #PUSH_SERVICE_ERROR_PERMISSION_DENIED No push privilege
+ * @retval #PUSH_SERVICE_ERROR_NOT_SUPPORTED Not supported feature
+ * @pre There is no connection to the push service for the <I>app_id</I>.
+ * @post The state callback will be called to let you know the current
+ * registration state immediately.
+ * @see push_service_disconnect()
+ */
+int push_service_connect(const char *push_app_id,
+ push_service_state_cb state_callback,
+ push_service_notify_cb notify_callback, void *user_data,
+ push_service_connection_h *connection);
+
+/**
+ * @brief Closes the connection and releases all its resources
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks If you call this function in the push callback functions,\n
+ * it may cause your application to crash.\n
+ * The specific error code can be obtained using the get_last_result()\n
+ * Error codes are described in the exception section.
+ * @param[in] connection The connection handle to the push service
+ * @exception #PUSH_SERVICE_ERROR_NONE Successful
+ * @exception #PUSH_SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @exception #PUSH_SERVICE_ERROR_NOT_SUPPORTED Not supported feature
+ * @see push_service_connect()
+ */
+void push_service_disconnect(push_service_connection_h connection);
+
+/**
+ * @brief Registers an application to the push server.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] connection The connection handle to the push service
+ * @param[in] result_callback Result callback function
+ * @param[in] user_data User data to pass to <I>result_cb</I>
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_SERVICE_ERROR_NONE Successful
+ * @retval #PUSH_SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_SERVICE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PUSH_SERVICE_ERROR_NOT_CONNECTED No connection to the push service
+ * @retval #PUSH_SERVICE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #PUSH_SERVICE_ERROR_NOT_SUPPORTED Not supported feature
+ * @pre The application should be connected to the push service.
+ * @post As a result, the state callback will be invoked.
+ * @see push_service_deregister()
+ */
+int push_service_register(push_service_connection_h connection,
+ push_service_result_cb result_callback, void *user_data);
+
+/**
+ * @brief Deregisters an application from the Push server.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] connection The connection handle to the push service
+ * @param[in] result_callback Result callback function
+ * @param[in] user_data User data to pass to <I>result_cb</I>
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_SERVICE_ERROR_NONE Successful
+ * @retval #PUSH_SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_SERVICE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PUSH_SERVICE_ERROR_NOT_CONNECTED No connection to the push service
+ * @retval #PUSH_SERVICE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #PUSH_SERVICE_ERROR_NOT_SUPPORTED Not supported feature
+ * @pre The application should be connected to the push service.
+ * @post As a result, the state callback will be invoked.
+ * @see push_service_register()
+ */
+int push_service_deregister(push_service_connection_h connection, push_service_result_cb result_callback,
+ void *user_data);
+
+/**
+ * @brief Retrieves the payload data of a notification that forcibly launched the app.
+ * @details When a notification arrives at the device with the "LAUNCH"\n
+ * option or a user clicks a notification in the quick panel,\n
+ * the push daemon forcibly launches the app and delivers the\n
+ * notification to the app as a bundle. This function returns\n
+ * the payload data in the notificaiton.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/push
+ * @remark This function must be called in the app control callback function.\n
+ * You must release the payload data using free().\n
+ * push_service_app_control_to_notification() is preferred to this API.\n
+ * The specific error code can be obtained using the get_last_result()\n
+ * Error codes are described in the exception section.
+ * @param[in] app_control The app control handle that is handed over in the\n
+ * app control callback function
+ * @param[in] operation The operation in the app control handle retrieved by\n
+ * app_control_get_operation()
+ * @return The payload data (appData) in the notification\n
+ * NULL if the app is not launched by a push notification.
+ * @exception #PUSH_SERVICE_ERROR_NONE Successful
+ * @exception #PUSH_SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @exception #PUSH_SERVICE_ERROR_NO_DATA Not launched by a notification
+ * @exception #PUSH_SERVICE_ERROR_OPERATION_FAILED Operation fail
+ * @exception #PUSH_SERVICE_ERROR_OUT_OF_MEMORY Out of memory
+ * @exception #PUSH_SERVICE_ERROR_NOT_CONNECTED Connection to the daemon failed
+ * @exception #PUSH_SERVICE_ERROR_PERMISSION_DENIED No push privilege
+ * @exception #PUSH_SERVICE_ERROR_NOT_SUPPORTED Not supported feature
+ * @see app_control_get_operation()
+ */
+char *push_service_app_control_to_noti_data(app_control_h app_control, char *operation);
+
+/**
+ * @brief Retrieves the notification that forcibly launched the app.
+ * @details When a notification arrives at the device with the "LAUNCH"\n
+ * option or a user clicks a notification in the quick panel,\n
+ * the push daemon forcibly launches the app and delivers the\n
+ * notification to the app as a bundle. This function returns\n
+ * the notificaiton from the bundle.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/push
+ * @remark This function must be called in the app control callback function.\n
+ * You must release the notification using push_service_free_notification().
+ * @param[in] app_control The app control handle that is handed over in the\n
+ * app control callback function
+ * @param[in] operation The operation in the app control handle retrieved by\n
+ * app_control_get_operation()
+ * @param[out] noti The handle of the notification that forcibly launched the app
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_SERVICE_ERROR_NONE Successful
+ * @retval #PUSH_SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_SERVICE_ERROR_NO_DATA Not launched by a notification
+ * @retval #PUSH_SERVICE_ERROR_OPERATION_FAILED Operation fail
+ * @retval #PUSH_SERVICE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PUSH_SERVICE_ERROR_NOT_CONNECTED Connection to the daemon failed
+ * @retval #PUSH_SERVICE_ERROR_PERMISSION_DENIED No push privilege
+ * @retval #PUSH_SERVICE_ERROR_NOT_SUPPORTED Not supported feature
+ * @see push_service_free_notificaiton()
+ * @see app_control_get_operation()
+ */
+int push_service_app_control_to_notification(app_control_h app_control, char *operation, push_service_notification_h *noti);
+
+/**
+ * @brief Gets notification data sent by the server.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks You must release @a data using free().
+ * @param[in] notification The notification handle
+ * @param[out] data The notification data\n
+ * Set NULL if error but <I>PUSH_SERVICE_ERROR_INVALID_PARAMETER</I>
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_SERVICE_ERROR_NONE Successful
+ * @retval #PUSH_SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_SERVICE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PUSH_SERVICE_ERROR_NO_DATA No data available
+ * @retval #PUSH_SERVICE_ERROR_NOT_SUPPORTED Not supported feature
+ * @see push_service_notify_cb()
+ * @see push_service_request_unread_notification()
+ */
+int push_service_get_notification_data(push_service_notification_h notification, char **data);
+
+/**
+ * @brief Gets the notification message sent by the server.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remark The <I>msg</I> must be released with free().\n
+ * push_service_request_unread_notification() is\n
+ * preferred to this API.
+ * @param[in] notification The notification handle
+ * @param[out] msg The notification message\n
+ * Set NULL if error but <I>PUSH_SERVICE_ERROR_INVALID_PARAMETER</I>
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_SERVICE_ERROR_NONE Successful
+ * @retval #PUSH_SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_SERVICE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PUSH_SERVICE_ERROR_NO_DATA No data available
+ * @retval #PUSH_SERVICE_ERROR_NOT_SUPPORTED Not supported feature
+ * @see push_service_notify_cb()
+ * @see push_service_get_unread_notification()
+ */
+int push_service_get_notification_message(push_service_notification_h notification,
+ char **msg);
+
+/**
+ * @brief Gets the received time of the notification message.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] notification The notification handle
+ * @param[out] received_time The received time of the notification message \n
+ * The @a received_time is based on UTC.
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_SERVICE_ERROR_NONE Successful
+ * @retval #PUSH_SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_SERVICE_ERROR_NO_DATA No data available
+ * @retval #PUSH_SERVICE_ERROR_NOT_SUPPORTED Not supported feature
+ * @see push_service_notify_cb()
+ * @see push_service_request_unread_notification()
+ */
+int push_service_get_notification_time(push_service_notification_h notification, long long int *received_time);
+
+/**
+ * @brief Gets the sender of the notification.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks You must release @a sender using free().
+ * @param[in] notification The notification handle
+ * @param[out] sender The sender\n
+ * Set @c NULL if error but #PUSH_SERVICE_ERROR_INVALID_PARAMETER
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_SERVICE_ERROR_NONE Successful
+ * @retval #PUSH_SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_SERVICE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PUSH_SERVICE_ERROR_NO_DATA No data available
+ * @retval #PUSH_SERVICE_ERROR_NOT_SUPPORTED Not supported feature
+ * @see push_service_notify_cb()
+ * @see push_serivce_get_unread_notification()
+ */
+int push_service_get_notification_sender(push_service_notification_h notification,
+ char **sender);
+
+/**
+ * @brief Gets the session ID of the notification.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks You must release @a session_info using free().
+ * @param[in] notification The notification handle
+ * @param[out] session_info The session ID\n
+ * Set @c NULL if error but #PUSH_SERVICE_ERROR_INVALID_PARAMETER
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_SERVICE_ERROR_NONE Successful
+ * @retval #PUSH_SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_SERVICE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PUSH_SERVICE_ERROR_NO_DATA No data available
+ * @retval #PUSH_SERVICE_ERROR_NOT_SUPPORTED Not supported feature
+ * @see push_service_notify_cb()
+ * @see push_service_request_unread_notification()
+ */
+int push_service_get_notification_session_info(push_service_notification_h notification,
+ char **session_info);
+
+
+/**
+ * @brief Gets the request ID assigned by the sender.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks You must release @a request_id using free().
+ * @param[in] notification The notification handle
+ * @param[out] request_id The request ID\n
+ * Set @c NULL if error but #PUSH_SERVICE_ERROR_INVALID_PARAMETER
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_SERVICE_ERROR_NONE Successful
+ * @retval #PUSH_SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_SERVICE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PUSH_SERVICE_ERROR_NO_DATA No data available
+ * @retval #PUSH_SERVICE_ERROR_NOT_SUPPORTED Not supported feature
+ * @see push_service_notify_cb()
+ * @see push_service_request_unread_notification()
+ */
+int push_service_get_notification_request_id(push_service_notification_h notification,
+ char **request_id);
+
+/**
+ * @brief Gets the value in the type field of the notification
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] notification The notification handle
+ * @param[out] type The type value assigned by the sender
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_SERVICE_ERROR_NONE Successful
+ * @retval #PUSH_SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_SERVICE_ERROR_NO_DATA No data available
+ * @retval #PUSH_SERVICE_ERROR_NOT_SUPPORTED Not supported feature
+ * @see push_service_notify_cb()
+ * @see push_service_request_unread_notification()
+ */
+int push_service_get_notification_type(push_service_notification_h notification, int *type);
+
+/**
+ * @brief Gets an unread notification message from the push server.
+ * @details If an application receives an unread message with this method, the message is removed from the system. \n
+ * This method can be called repeatedly until it returns <I>PUSH_SERVICE_ERROR_NO_DATA</I> \n
+ * But, this method does NOT guarantee order and reliability of notification messages. \n
+ * Some notification messages can be dropped when the system message queue is full.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks It is recommended to use push_service_request_unread_notification().
+ * @remarks You must release @a noti using push_service_free_notification().
+ * @param[in] connection The connection handle to the push service
+ * @param[out] noti The notification handle
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_SERVICE_ERROR_NONE Successful
+ * @retval #PUSH_SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_SERVICE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PUSH_SERVICE_ERROR_NO_DATA No data available
+ * @retval #PUSH_SERVICE_ERROR_NOT_SUPPORTED Not supported feature
+ *
+ * @see push_service_get_notification_message()
+ * @see push_service_get_notification_time()
+ * @see push_service_get_notification_data()
+ */
+int push_service_get_unread_notification(push_service_connection_h connection,
+ push_service_notification_h *noti);
+
+/**
+ * @brief Requests unread notification messages to the push server.
+ * @details When the app wants to receive messages that arrived before it launched, this \n
+ * method should be called. Upon receiving ths request, the daemon sends messages\n
+ * stored in its DB to the app. The notify_callback() method assigned in push_service_connect()\n
+ * will be called when these messages arrive. No need to call this method multiple\n
+ * times to receive multiple messages. This method does NOT guarantee order and\n
+ * reliability of notification messages.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks This method is preferred to push_service_get_unread_notification().
+ * @param[in] connection The connection handle to the push service
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_SERVICE_ERROR_NONE Successful
+ * @retval #PUSH_SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_SERVICE_ERROR_NOT_CONNECTED Not connected to the daemon
+ * @retval #PUSH_SERVICE_ERROR_OPERATION_FAILED Error when sending the request
+ * @retval #PUSH_SERVICE_ERROR_NOT_SUPPORTED Not supported feature
+ *
+ * @see push_service_get_unread_notification()
+ * @see push_service_connect()
+ */
+int push_service_request_unread_notification(push_service_connection_h connection);
+
+/**
+ * @brief Gets the registration ID in the <I>PUSH_SERVICE_STATE_REGISTERED</I> state.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks You must release @a reg_id using free().
+ * @param[in] connection The connection handle to the push service
+ * @param[out] reg_id The registration ID\n
+ * Set NULL if error but <I>PUSH_SERVICE_ERROR_INVALID_PARAMETER</I>
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_SERVICE_ERROR_NONE Successful
+ * @retval #PUSH_SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_SERVICE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PUSH_SERVICE_ERROR_NO_DATA No registration ID available
+ * @retval #PUSH_SERVICE_ERROR_NOT_SUPPORTED Not supported feature
+ */
+int push_service_get_registration_id(push_service_connection_h connection, char **reg_id);
+
+/**
+ * @brief Frees the notification handle.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remark The specific error code can be obtained using the get_last_result()\n
+ * Error codes are described in the exception section.
+ * @param[in] noti The notification handle
+ * @exception #PUSH_SERVICE_ERROR_NONE Successful
+ * @exception #PUSH_SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @exception #PUSH_SERVICE_ERROR_NOT_SUPPORTED Not supported feature
+ */
+void push_service_free_notification(push_service_notification_h noti);
+
+/**
+ * @}
+ */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __PUSH_PUBLIC_LIB_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __PUSH_LIB_H__
+#define __PUSH_LIB_H__
+
+#include <app.h>
+#include <tizen_error.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file push.h
+ */
+
+/**
+ * @internal
+ * @addtogroup CAPI_MESSAGING_PUSH_MODULE
+ * @{
+ */
+
+/**
+ * @brief Enumeration of error codes for push API.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef enum {
+ PUSH_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ PUSH_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+ PUSH_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+ PUSH_ERROR_NOT_CONNECTED = TIZEN_ERROR_CONNECTION, /**< Not connected */
+ PUSH_ERROR_NO_DATA = TIZEN_ERROR_NO_DATA, /**< No data available */
+ PUSH_ERROR_OPERATION_FAILED = TIZEN_ERROR_UNKNOWN, /**< Internal operation failed */
+ PUSH_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< No privilege to access the push service */
+} push_error_e;
+
+/**
+ * @brief Enumeration of registration states.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef enum {
+ PUSH_STATE_REGISTERED, /**< Registered */
+ PUSH_STATE_UNREGISTERED, /**< Unregistered */
+ PUSH_STATE_PROVISIONING_IPCHANGE, /**< To change the provisioning server IP */
+ PUSH_STATE_PING_CHANGE, /**< Ping interval is changing */
+ PUSH_STATE_ERROR, /**< Error */
+} push_state_e;
+
+/**
+ * @brief Enumeration of result.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef enum {
+ PUSH_RESULT_SUCCESS, /**< Successful */
+ PUSH_RESULT_TIMEOUT, /**< Request timed out */
+ PUSH_RESULT_SERVER_ERROR, /**< Push server error */
+ PUSH_RESULT_SYSTEM_ERROR, /**< System error */
+} push_result_e;
+
+/**
+ * @brief Connection to the push service handle.
+ */
+typedef struct push_connection_s *push_connection_h;
+
+/**
+ * @brief Notification delivered from the push server handle.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef struct push_notification_s *push_notification_h;
+
+/**
+ * @brief Called when the registration state is refreshed.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks This callback will be invoked when the registration state is refreshed. \n
+ * If the registration or deregistration has succeeded, then this state callback must be called. \n
+ * In addition, the state can be changed if the push server deregisters the application.
+ * @param[in] state The registration state
+ * @param[in] err The error message
+ * @param[in] user_data The user data passed to this callback
+ * @see push_connect()
+ */
+typedef void (*push_state_cb)(
+ push_state_e state, const char *err, void *user_data);
+
+/**
+ * @brief Called to handle a notification.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] notification A handle of the notification containing its payload \n
+ * The handle is available inside this callback only.
+ * @param[in] user_data The user data passed to this callback
+ * @see push_connect()
+ * @see push_get_notification_data()
+ */
+typedef void (*push_notify_cb)(
+ push_notification_h noti, void *user_data);
+
+/**
+ * @brief Called with the result of a registration/deregistration.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] result The registration/deregistration result
+ * @param[in] msg The result message from the push server,
+ * otherwise @c NULL
+ * @param[in] user_data The user data passed to this callback
+ * @see push_register()
+ * @see push_deregister()
+ */
+typedef void (*push_result_cb)(push_result_e result, const char *msg, void *user_data);
+
+/**
+ * @brief Connects to the push service and sets callback functions.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/push
+ * @remarks If there is a connection between an application and the push service,
+ * the notify callback passes the notification upon its arrival.\n
+ * Otherwise, the push service posts a UI notification to alert users.\n
+ * The connection should be freed using push_disconnect().
+ * @param[in] app_id The application ID
+ * @param[in] state_cb The state callback function
+ * @param[in] notify_cb The notify callback function
+ * @param[in] user_data The user data to pass to @a state_cb and @a notify_cb
+ * @param[out] connection The connection handle to the push service
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_ERROR_NONE Successful
+ * @retval #PUSH_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PUSH_ERROR_NOT_CONNECTED Connection to the daemon failed
+ * @retval #PUSH_ERROR_PERMISSION_DENIED No push privilege
+ * @pre There is no connection for the @a app_id to the push service.
+ * @post The state callback will be called to let you know the current
+ * registration state immediately.
+ * @see push_disconnect()
+ */
+int push_connect(const char *push_app_id, push_state_cb state_callback,
+ push_notify_cb notify_callback, void *user_data,
+ push_connection_h *connection);
+
+/**
+ * @brief Closes the connection and releases all its resources.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @remarks If you call this function in the push callback functions,
+ * it may cause your application to crash.
+ * @param[in] connection A connection to the push service handle
+ * @see push_connect()
+ */
+void push_disconnect(push_connection_h connection);
+
+/**
+ * @brief Registers an application to the push server.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @param[in] connection The connection handle to the push service
+ * @param[in] app_control An @ref CAPI_APP_CONTROL_MODULE handle to launch an application by\n
+ * an posted UI notification
+ * @param[in] result_callback Result callback function
+ * @param[in] user_data The user data to pass to @a result_cb
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_ERROR_NONE Successful
+ * @retval #PUSH_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PUSH_ERROR_NOT_CONNECTED No connection to the push service
+ * @retval #PUSH_ERROR_OPERATION_FAILED Operation failed
+ * @pre The application should be connected to the push service.
+ * @post For successful result, the state callback should be invoked.
+ * @see push_deregister()
+ */
+int push_register(push_connection_h connection, app_control_h app_control,
+ push_result_cb result_callback, void *user_data);
+
+/**
+ * @brief Deregisters an application from the Push server.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @param[in] connection The connection handle to the push service
+ * @param[in] result_callback Result callback function
+ * @param[in] user_data The user data to pass to @a result_cb
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_ERROR_NONE Successful
+ * @retval #PUSH_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PUSH_ERROR_NOT_CONNECTED No connection to the push service
+ * @retval #PUSH_ERROR_OPERATION_FAILED Operation failed
+ * @pre The application should be connected to the push service.
+ * @post As a result, the state callback will be invoked.
+ * @see push_register()
+ */
+int push_deregister(push_connection_h connection, push_result_cb result_callback,
+ void *user_data);
+
+/**
+ * @brief Gets the payload data in the notification.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @remarks You must release @a data using free().
+ * @param[in] notification The notification handle
+ * @param[out] data The notification data\n
+ * Set @c NULL if error but #PUSH_ERROR_INVALID_PARAMETER
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_ERROR_NONE Successful
+ * @retval #PUSH_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PUSH_ERROR_NO_DATA No data available
+ * @see push_notify_cb()
+ * @see push_request_unread_notification()
+ */
+int push_get_notification_data(push_notification_h notification, char **data);
+
+/**
+ * @brief Gets the message in the notification.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @remarks You must release @a msg using free().
+ * @param[in] notification The notification handle
+ * @param[out] msg The notification message\n
+ * Set @c NULL if error but #PUSH_ERROR_INVALID_PARAMETER
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_ERROR_NONE Successful
+ * @retval #PUSH_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PUSH_ERROR_NO_DATA No data available
+ * @see push_notify_cb()
+ * @see push_request_unread_notification()
+ */
+int push_get_notification_message(push_notification_h notification,
+ char **msg);
+
+/**
+ * @brief Gets the received time of the notification.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @param[in] notification The notification handle
+ * @param[out] received_time The received time of the notification message\n
+ * The @a received_time is based on UTC.
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_ERROR_NONE Successful
+ * @retval #PUSH_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_ERROR_NO_DATA No data available
+ *
+ * @see push_notify_cb()
+ * @see push_request_unread_notification()
+ */
+int push_get_notification_time(push_notification_h notification, long long int *received_time);
+
+/**
+ * @brief Gets the sender of the notification.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @remarks You must release @a sender using free().
+ * @param[in] notification The notification handle
+ * @param[out] sender The sender\n
+ * Set @c NULL if error but #PUSH_ERROR_INVALID_PARAMETER
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_ERROR_NONE Successful
+ * @retval #PUSH_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PUSH_ERROR_NO_DATA No data available
+ * @see push_notify_cb()
+ * @see push_request_unread_notification()
+ */
+int push_get_notification_sender(push_notification_h notification,
+ char **sender);
+
+/**
+ * @brief Gets the session ID of the notification.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @remarks You must release @a session_info using free().
+ * @param[in] notification The notification handle
+ * @param[out] session_info The session ID\n
+ * Set @c NULL if error but #PUSH_ERROR_INVALID_PARAMETER
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_ERROR_NONE Successful
+ * @retval #PUSH_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PUSH_ERROR_NO_DATA No data available
+ * @see push_notify_cb()
+ * @see push_request_unread_notification()
+ */
+int push_get_notification_session_info(push_notification_h notification,
+ char **session_info);
+
+
+/**
+ * @brief Gets the request ID assigned by the sender.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @remarks You must release @a request_id using free().
+ * @param[in] notification The notification handle
+ * @param[out] request_id The request ID\n
+ * Set @c NULL if error but #PUSH_ERROR_INVALID_PARAMETER
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_ERROR_NONE Successful
+ * @retval #PUSH_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PUSH_ERROR_NO_DATA No data available
+ * @see push_notify_cb()
+ * @see push_request_unread_notification()
+ */
+int push_get_notification_request_id(push_notification_h notification,
+ char **request_id);
+
+/**
+ * @brief Gets the value in the type field of the notification
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @param[in] notification The notification handle
+ * @param[out] type The type value assigned by the sender
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_ERROR_NONE Successful
+ * @retval #PUSH_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_ERROR_NO_DATA No data available
+ * @see push_notify_cb()
+ * @see push_request_unread_notification()
+ */
+int push_get_notification_type(push_notification_h notification, int *type);
+
+/**
+ * @brief Gets an unread notification message from the push server.
+ *
+ * @details If an application receives an unread message with this method, the message is removed from the system.\n
+ * This method can be called repeatedly until it returns #PUSH_ERROR_NO_DATA.\n
+ * However, this method does NOT guarantee order and reliability of notification messages.\n
+ * Some notification messages can be dropped when the system message queue is full.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @remarks This method will be deprecated.
+ * @remarks You must release @a noti using push_free_notification().
+ * push_request_unread_notification() is preferred to this API.
+ * @param[in] connection The connection handle to the push service
+ * @param[out] noti The notification handle
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_ERROR_NONE Successful
+ * @retval #PUSH_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PUSH_ERROR_NO_DATA No data available
+ *
+ * @see push_get_notification_message()
+ * @see push_get_notification_time()
+ * @see push_get_notification_data()
+ */
+int push_get_unread_notification(push_connection_h connection,
+ push_notification_h *noti);
+
+/**
+ * @brief Requests unread notification messages to the push server.
+ * @details When the app wants to receive messages that arrived before it launced, this \n
+ * method should be called. Upon receiving ths request, the daemon sends messages\n
+ * stored in its DB to the app. The notify_callback() method assigned in push_connect()\n
+ * will be called when these messages arrive. No need to call this method multiple\n
+ * times to receive multiple messages. This method does NOT guarantee order and\n
+ * reliability of notification messages.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @remark This method is preferred to push_get_unread_notification().
+ * @param[in] connection The connection handle to the push service
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_ERROR_NONE Successful
+ * @retval #PUSH_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_ERROR_NOT_CONNECTED Not connected to the daemon
+ * @retval #PUSH_ERROR_OPERATION_FAILED Error when sending the request
+ *
+ * @see push_get_unread_notification()
+ * @see push_connect()
+ */
+int push_request_unread_notification(push_connection_h connection);
+
+/**
+ * @brief Retrieves the notification with the notification token
+ * @details When the push service forcibly launches the application to\n
+ deliver a notification, a unique token for the notification\n
+ is generated and delivered to the application as a bundle.\n
+ Using this API with this token, the application can get\n
+ the notification.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/push
+ * @remark This function must be called in the app control callback function.\n
+ * You must release the notification using push_free_notification().
+ * @param[in] noti_token The notification token received from the bundle
+ * @param[out] noti The handle for the notification that launched this app
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_SERVICE_ERROR_NONE Successful
+ * @retval #PUSH_SERVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_SERVICE_ERROR_NO_DATA No notification for this token
+ * @retval #PUSH_SERVICE_ERROR_OPERATION_FAILED Operation fail
+ * @retval #PUSH_SERVICE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PUSH_SERVICE_ERROR_NOT_CONNECTED Connection to the daemon failed
+ * @retval #PUSH_SERVICE_ERROR_PERMISSION_DENIED No push privilege
+ * @see push_free_notificaiton()
+ * @see app_control_get_operation()
+ */
+int push_get_notification_using_token(const char *noti_token, push_notification_h *noti);
+
+
+/**
+ * @brief Gets the registration ID in the @a #PUSH_STATE_REGISTERED state.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @remarks You must release @a reg_id using free().
+ * @param[in] connection The connection handle to the push service
+ * @param[out] reg_id The registration ID
+ * Set @c NULL if error but #PUSH_ERROR_INVALID_PARAMETER
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PUSH_ERROR_NONE Successful
+ * @retval #PUSH_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PUSH_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PUSH_ERROR_NO_DATA No registration ID available
+ */
+int push_get_registration_id(push_connection_h connection, char **reg_id);
+
+
+/**
+ * @brief Frees the notification handle.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/push
+ * @param[in] noti The notification handle
+ */
+void push_free_notification(push_notification_h noti);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __PUSH_LIB_H__ */
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+ <assign>
+ <filesystem path="/usr/lib/libpush.so.0.2.12" label="_"/>
+ <filesystem path="/usr/lib/libpush.so.0" label="_"/>
+ </assign>
+</manifest>
+%global _support_weblog 0
+
Name: push
-Summary: Push services and client library.
-Version: 0.2.23
+Summary: Push services and client library..
+Version: 0.4.06
Release: 1
-Group: TO_BE_FILLED
-License: TO_BE_FILLED
+Group: Application Framwork/Service
+License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
-
+Source1: pushd.service
+Requires(post): /sbin/ldconfig
+Requires(post): /usr/bin/sqlite3
+Requires(post): /usr/bin/vconftool
+Requires(postun): /sbin/ldconfig
+
+%if %{_support_weblog}
+BuildRequires: pkgconfig(zlib)
+BuildRequires: pkgconfig(json-glib-1.0)
+%endif
%description
Push services and client library.
%package -n libpush
Summary: Push service client library
-Group: TO_BE_FILLED
+Group: Application Framwork/Libraries
+Requires: %{name}-bin = %{version}-%{release}
Provides: libpush.so.0
%description -n libpush
Push service client library
-
%package -n libpush-devel
Summary: Push service client library (DEV)
Group: devel
%description -n libpush-devel
Push service client library (DEV)
-
%package bin
Summary: Push service daemon
-Group: TO_BE_FILLED
+Group: Application Framwork/Service
+Requires(post): telephony-daemon
%description bin
Push service daemon
-
%package tool
Summary: Push service tool
Group: devel
%description tool
Push service tool
-
-
%prep
%setup -q
%install
rm -rf %{buildroot}
+mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants
+install -m 0644 %{SOURCE1} %{buildroot}%{_libdir}/systemd/system/pushd.service
+ln -s ../pushd.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/pushd.service
+mkdir -p %{buildroot}/usr/lib/systemd/user/tizen-middleware.target.wants
+cp %{SOURCE1} %{buildroot}/usr/lib/systemd/user/pushd.service
+ln -s ../pushd.service %{buildroot}/usr/lib/systemd/user/tizen-middleware.target.wants/
+
+mkdir -p %{buildroot}/usr/share/license
+cp -f LICENSE %{buildroot}/usr/share/license/%{name}
+
+%if %{_support_weblog}
+cp -a share/push/push_sslkey.pem %{buildroot}/usr/share/push/
+cp -a share/push/prd-dl-key.pem %{buildroot}/usr/share/push/
+%endif
-mkdir -p %{buildroot}%{_bindir}
-mkdir -p %{buildroot}%{_libdir}/pkgconfig
mkdir -p %{buildroot}%{_includedir}
-mkdir -p %{buildroot}/usr/share/push
-mkdir -p %{buildroot}%{_sysconfdir}/init.d
-mkdir -p %{buildroot}%{_sysconfdir}/rc.d/{rc3.d,rc5.d}
-mkdir -p %{buildroot}%{_libdir}/systemd/user/tizen-middleware.target.wants
+cp -a include/push-service.h %{buildroot}%{_includedir}
+cp -a include/push.h %{buildroot}%{_includedir}
+%if %{_support_weblog}
+ include/pushlog.h %{buildroot}%{_includedir}
+%endif
+
+mkdir -p %{buildroot}%{_libdir}/pkgconfig
+cp -a push.pc %{buildroot}%{_libdir}/pkgconfig/
+mkdir -p %{buildroot}/usr/share/push/
+mkdir -p %{buildroot}%{_bindir}
%ifarch %{arm}
#libpush
cp -a arm/lib/libpush.so.* %{buildroot}%{_libdir}
-#libpush-devel
-cp -a arm/include/push.h %{buildroot}%{_includedir}
-cp -a arm/lib/pkgconfig/push.pc %{buildroot}%{_libdir}/pkgconfig/push.pc
+#libpus-devel
cp -a arm/lib/libpush.so %{buildroot}%{_libdir}
#push-bin
cp -a arm/bin/pushd %{buildroot}%{_bindir}
-cp -a arm/share/push/PushServerTrust.cer %{buildroot}/usr/share/push/PushServerTrust.cer
-cp -a arm/etc/init.d/pushd %{buildroot}%{_sysconfdir}/init.d/pushd
-cp -a arm/etc/rc.d/rc3.d/S90pushd %{buildroot}%{_sysconfdir}/rc.d/rc3.d/S90pushd
-cp -a arm/etc/rc.d/rc5.d/S90pushd %{buildroot}%{_sysconfdir}/rc.d/rc5.d/S90pushd
-cp -a arm/lib/systemd/user/pushd.service %{buildroot}%{_libdir}/systemd/user/pushd.service
-cp -a arm/lib/systemd/user/tizen-middleware.target.wants/pushd.service %{buildroot}%{_libdir}/systemd/user/tizen-middleware.target.wants/pushd.service
-#push-tool
cp -a arm/bin/push_tool %{buildroot}%{_bindir}
+cp -a arm/share/push/*.cer %{buildroot}/usr/share/push/
+%if %{_support_weblog}
+ arm/bin/pushlog_tool
+%endif
%else
#libpush
cp -a x86/lib/libpush.so.* %{buildroot}%{_libdir}
-#libpush-devel
-cp -a x86/include/push.h %{buildroot}%{_includedir}
-cp -a x86/lib/pkgconfig/push.pc %{buildroot}%{_libdir}/pkgconfig/push.pc
+#libpus-devel
cp -a x86/lib/libpush.so %{buildroot}%{_libdir}
#push-bin
cp -a x86/bin/pushd %{buildroot}%{_bindir}
-cp -a x86/share/push/PushServerTrust.cer %{buildroot}/usr/share/push/PushServerTrust.cer
-cp -a x86/etc/init.d/pushd %{buildroot}%{_sysconfdir}/init.d/pushd
-cp -a x86/etc/rc.d/rc3.d/S90pushd %{buildroot}%{_sysconfdir}/rc.d/rc3.d/S90pushd
-cp -a x86/etc/rc.d/rc5.d/S90pushd %{buildroot}%{_sysconfdir}/rc.d/rc5.d/S90pushd
-cp -a x86/lib/systemd/user/pushd.service %{buildroot}%{_libdir}/systemd/user/pushd.service
-cp -a x86/lib/systemd/user/tizen-middleware.target.wants/pushd.service %{buildroot}%{_libdir}/systemd/user/tizen-middleware.target.wants/pushd.service
-#push-tool
cp -a x86/bin/push_tool %{buildroot}%{_bindir}
+cp -a x86/share/push/*.cer %{buildroot}/usr/share/push/
+%if %{_support_weblog}
+ x86/bin/pushlog_tool
+%endif
%endif
+
%post bin
-mkdir -p /opt/dbspace
-sqlite3 /opt/dbspace/.push.db "PRAGMA journal_mode = PERSIST; create table a(a); drop table a;" > /dev/null
-chown root:5000 /opt/dbspace/.push.db
-chown root:5000 /opt/dbspace/.push.db-journal
-chmod 660 /opt/dbspace/.push.db
-chmod 660 /opt/dbspace/.push.db-journal
-
-
-_VER="1"
-_DEV_TYPE="00000000"
-_DEV_INFO="device.model=ssltest"
-_IP_PV="gld.push.samsungosp.com"
-_PORT_PV=5223
-#ping interval {120,240,480,960,1920}
-_PING_INT=480
-_GRP="-g 5000"
-
-vconftool set -t string file/private/push-bin/version ${_VER} ${_GRP} -f
-vconftool set -t string file/private/push-bin/dev_type ${_DEV_TYPE} ${_GRP} -f
-vconftool set -t string file/private/push-bin/dev_info ${_DEV_INFO} ${_GRP} -f
-vconftool set -t string file/private/push-bin/ip_pv ${_IP_PV} ${_GRP} -f
-vconftool set -t int file/private/push-bin/port_pv ${_PORT_PV} ${_GRP} -f
-vconftool set -t int file/private/push-bin/ping_int ${_PING_INT} ${_GRP} -f
-
-vconftool unset file/private/push-bin/devtk
+mkdir -p /opt/usr/dbspace
+sqlite3 /opt/usr/dbspace/.push.db "PRAGMA journal_mode = PERSIST; create table a(a); drop table a;" > /dev/null
+chown root:5000 /opt/usr/dbspace/.push.db
+chown root:5000 /opt/usr/dbspace/.push.db-journal
+chmod 660 /opt/usr/dbspace/.push.db
+chmod 660 /opt/usr/dbspace/.push.db-journal
+
+chsmack -a 'push-service::db' /opt/usr/dbspace/.push.db
+chsmack -a 'push-service::db' /opt/usr/dbspace/.push.db-journal
%post -n libpush
/sbin/ldconfig
%postun -p /sbin/ldconfig
-
%files -n libpush
+%manifest libpush.manifest
%attr(644,-,-) %{_libdir}/libpush.so.*
%files -n libpush-devel
%{_libdir}/libpush.so
%files bin
+%manifest push-bin.manifest
%{_bindir}/pushd
/usr/share/push/*.cer
-/etc/init.d/pushd
-/etc/rc.d/rc3.d/S90pushd
-/etc/rc.d/rc5.d/S90pushd
+/usr/share/license/%{name}
+
+# This is a certificate file to access to logging server by HTTPS.
+%if %{_support_weblog}
+/usr/share/push/push_sslkey.pem
+/usr/share/push/prd-dl-key.pem
+%endif
+
/usr/lib/systemd/user/pushd.service
/usr/lib/systemd/user/tizen-middleware.target.wants/pushd.service
+%{_libdir}/systemd/system/multi-user.target.wants/pushd.service
+%{_libdir}/systemd/system/pushd.service
%files tool
+%manifest push-tool.manifest
%{_bindir}/push_tool
+%if %{_support_weblog}
+ %{_bindir}/pushlog_tool
+%endif
+
%changelog
+* Sat Nov 3 2012 Jooseok Park <jooseok.park@samsung.com> - 0.2.26
+- Prevent bug fixed(out-of bounds read, dead code,..)
+* Mon Oct 22 2012 Jooseok Park <jooseok.park@samsung.com> - 0.2.25
+- bundle null check added & protobuf null check added
+* Wed Sep 19 2012 Jooseok Park <jooseok.park@samsung.com> - 0.2.24
+- when pkg is uninstlled, db process is added
* Fri Sep 7 2012 Jooseok Park <jooseok.park@samsung.com> - 0.2.23
- emul check logic is changed(using capi-system-info)
* Tue Sep 4 2012 Jooseok Park <jooseok.park@samsung.com> - 0.2.22
[Unit]
-Description=Pushd service
+Description=Push daemon
+After=tizen-runtime.target
[Service]
Type=forking
ExecStart=/usr/bin/pushd
+Restart=always
+MemoryLimit=10M
[Install]
-WantedBy=tizen-middleware.target
+WantedBy=multi-user.target
--- /dev/null
+<manifest>
+ <define>
+ <domain name="push-service" policy="restricted" plist="push-bin"/>
+ <request>
+ <smack request="system::use_internet" type="rw"/>
+ <smack request="sys-assert::core" type="rwxat"/>
+ <smack request="telephony_framework::api_modem" type="r"/>
+ <smack request="telephony_framework::api_sim" type="r"/>
+ <smack request="telephony_framework::api_network" type="r"/>
+ <smack request="pkgmgr::info" type = "r"/>
+ <smack request="pkgmgr::db" type = "rlx"/>
+ <smack request="ail::db" type = "rlx"/>
+ <smack request="data-provider-master::notification" type="rw"/>
+ <smack request="data-provider-master::notification.client" type="w"/>
+ <smack request="data-provider-master::badge" type="rw"/>
+ <smack request="data-provider-master::badge.client" type="w"/>
+ <smack request="connman" type="rw" />
+ <smack request="net-config" type="rw" />
+ <smack request="connman::get" type="rw" />
+ <smack request="telephony_framework::api_ps_public" type="rw" />
+ <smack request="deviced::display" type="rw" />
+ <smack request="secure-storage" type="rw" />
+ <smack request="security-server::api-privilege-by-pid" type="w"/>
+ <smack request="alarm-server::alarm" type = "w"/>
+ </request>
+ <permit>
+ <smack permit="system::use_internet" type="w"/>
+ <smack permit="dbus" type="rx"/>
+ </permit>
+ <provide>
+ <label name="push-service::db"/>
+ <label name="push-service::push"/>
+ </provide>
+ </define>
+ <request>
+ <domain name="push-service"/>
+ </request>
+ <assign>
+ <filesystem path="/etc/init.d/pushd" label="_" exec_label="none"/>
+ <filesystem path="/etc/rc.d/rc3.d/S90pushd" label="_" exec_label="none"/>
+ <filesystem path="/etc/rc.d/rc5.d/S90pushd" label="_" exec_label="none"/>
+ </assign>
+</manifest>
--- /dev/null
+<manifest>
+ <define>
+ <domain name="push-tool" policy="restricted" plist="push-tool"/>
+ <request>
+ <smack request="push-service::db" type="rw"/>
+ <smack request="push-service::push" type="w"/>
+ </request>
+ </define>
+</manifest>
Requires: capi-appfw-application
Libs: -L${libdir} -lpush
Cflags: -I${includedir}
-
--- /dev/null
+-----BEGIN CERTIFICATE-----\r
+MIIDTDCCArWgAwIBAgIJAIPbVe1K1TpOMA0GCSqGSIb3DQEBBQUAMIG9MQswCQYD\r
+VQQGEwJLUjEUMBIGA1UECAwLR3llb25nZ2ktZG8xDjAMBgNVBAcMBVN1d29uMSUw\r
+IwYDVQQKDBxTQU1TVU5HIEVMRUNUUk9OSUNTIENPLiwgTFREMRswGQYDVQQLDBJQ\r
+bGF0Zm9ybSBkZXYgdGVhbS4xIjAgBgNVBAMMGSouYmlnZGF0YS5zc3Auc2Ftc3Vu\r
+Zy5jb20xIDAeBgkqhkiG9w0BCQEWEWFkbWluQHNhbXN1bmcuY29tMCAXDTEzMDUy\r
+OTA3MjcyOVoYDzIwNjMwNTE3MDcyNzI5WjCBvTELMAkGA1UEBhMCS1IxFDASBgNV\r
+BAgMC0d5ZW9uZ2dpLWRvMQ4wDAYDVQQHDAVTdXdvbjElMCMGA1UECgwcU0FNU1VO\r
+RyBFTEVDVFJPTklDUyBDTy4sIExURDEbMBkGA1UECwwSUGxhdGZvcm0gZGV2IHRl\r
+YW0uMSIwIAYDVQQDDBkqLmJpZ2RhdGEuc3NwLnNhbXN1bmcuY29tMSAwHgYJKoZI\r
+hvcNAQkBFhFhZG1pbkBzYW1zdW5nLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAw\r
+gYkCgYEAlGwP7mw/gHSM1/xaO2xVIv9QSQpAeP6bzc4JhLChTcbpyeXHfZf24em/\r
+pu8ocIDrO6AtEWuLmiHhdo1dWwEOjn3uZkdzmZv3DCanLgM+QRcU7EyhwAVXns6P\r
+YDeUyU896QJZh1jnaiD2Wi9tNJBCoTOqb0u6sQZRuhtOg9Sti4ECAwEAAaNQME4w\r
+HQYDVR0OBBYEFFuRWZUawqsPc2NKTbkxgp1LqtvFMB8GA1UdIwQYMBaAFFuRWZUa\r
+wqsPc2NKTbkxgp1LqtvFMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEA\r
+LAxLc9bZ8Hz7al2INLbqjSZ80rs1rYS0vCSUpNu2wU+AacgK5Fj6/5LlFoalT96Y\r
+xpqtt9ojYsTFrQPHv+JeHpvd+NlHHZASseXq/2IevcczNozP9i5ipXTJPX8eEMwo\r
+IvaV7mE5TU47OXVbpnk9t7oUPAoptByDMUKfbLTUol0=\r
+-----END CERTIFICATE-----\r
--- /dev/null
+-----BEGIN RSA PRIVATE KEY-----\r
+MIICWwIBAAKBgQCUbA/ubD+AdIzX/Fo7bFUi/1BJCkB4/pvNzgmEsKFNxunJ5cd9\r
+l/bh6b+m7yhwgOs7oC0Ra4uaIeF2jV1bAQ6Ofe5mR3OZm/cMJqcuAz5BFxTsTKHA\r
+BVeezo9gN5TJTz3pAlmHWOdqIPZaL200kEKhM6pvS7qxBlG6G06D1K2LgQIDAQAB\r
+AoGAbl0cS5G6dm4z/Lbs8ZrQg8GNlYJGBrJscFBwy3X7u7XZSgPOnxlMvxftJthX\r
+HbD/OcsVOArcN7RRzrG3ZWAXzcL5ooSQzRuyQz/YyRiVT3fowSBMlj5xnSHayUN+\r
+3BMU2ngbL+AnOFq7YkMKaXXbj07uLKZJpvDotRC6raQUBAECQQDD4r44NUx111N8\r
+h0vF6bauo7UEFPfIoV4UxtoVISsD3CoyywSHYzTKdYNQeC9SqAw6xL+4qRjgjCXF\r
+ExlhiuVxAkEAwfh2wHLYhlhgrCmg92L/S9ewu3s+e1TBWS/+/RxwKTXB2kO56uz/\r
+OC7c444uRwMiy9EYbSY+WJUyiQrn1xW/EQJAfRiHvCOlkbgSk/tfU6Qey0a26kVt\r
+vE35ZDFdwpKtAskOleN7H+8mHomPc8tdBV9WeA2AFrC+t2ApGsNIuTdXsQJAaJum\r
+74MAYvOmrzKELOam6DAakAGXYMwEuiS4T6jWlGL5eMytp5TIz3P2jIJRUtrOGT1a\r
+/wJw/TT5XA8VmVmRAQJAauTkUlAHf3uCUI8/0DpIBcTFuk30hjUqIn3h/xj20wtr\r
+YfAuZ8RtP4LQAJmcMOREiZ/+DQJkUDH3O9bA0VhnHg==\r
+-----END RSA PRIVATE KEY-----\r
+++ /dev/null
-#!/bin/sh
-
-DESC="Push service daemon"
-NAME=pushd
-DAEMON=/usr/bin/$NAME
-SCRIPTNAME=/etc/init.d/$NAME
-
-[ -x "$DAEMON" ] || exit 0
-
-do_start() {
- PID=`pidof $NAME`
- [ -z "$PID" ] || return 1
- $DAEMON
- RETVAL=$?
- return "$RETVAL"
-}
-
-do_stop() {
- PID=`pidof $NAME`
- if [ -n "$PID" ]; then
- kill $PID
- fi
- return 0
-}
-
-prt_res() {
- RETVAL=$1
-
- case "$RETVAL" in
- 0|1)
- echo "... done."
- RETVAL=0
- ;;
- *)
- echo "... failed!"
- RETVAL=1
- ;;
- esac
-
- return $RETVAL
-}
-
-case "$1" in
- start)
- echo "Starting $DESC" "$NAME"
- do_start
- prt_res $?
- ;;
- stop)
- echo "Stopping $DESC" "$NAME"
- do_stop
- prt_res $?
- ;;
- *)
- echo "Usage: $SCRIPTNAME {start|stop}" >&2
- exit 3
- ;;
-esac
-
+++ /dev/null
-/etc/init.d/pushd
\ No newline at end of file
+++ /dev/null
-/etc/init.d/pushd
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apach e License, Version 2.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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#ifndef __PUSH_LIB_H__
-#define __PUSH_LIB_H__
-
-#include <errno.h>
-#include <app.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup CAPI_MESSAGING_PUSH_MODULE
- * @{
- */
-
-/**
- * @file push.h
- * @ingroup CAPI_MESSAGING_FRAMEWORK
- * @brief Support to receive push notifications
- */
-
-/**
- * @brief Enumerations of error codes for push API
- */
-typedef enum {
- PUSH_ERROR_NONE = 0, /**< Successful */
- PUSH_ERROR_OUT_OF_MEMORY = -ENOMEM, /**< Out of memory */
- PUSH_ERROR_INVALID_PARAMETER = -EINVAL, /**< Invalid parameter */
- PUSH_ERROR_NOT_CONNECTED = -ENOTCONN, /**< Not connected */
- PUSH_ERROR_NO_DATA = -ENODATA, /**< No data available */
- PUSH_ERROR_OPERATION_FAILED = -0x00004300, /**< Internal operation failed */
-} push_error_e;
-
-/**
- * @brief Enumerations of registration state
- */
-typedef enum {
- PUSH_STATE_REGISTERED, /**< Registred */
- PUSH_STATE_UNREGISTERED, /**< Unregistered */
- PUSH_STATE_ERROR, /**< Error */
-} push_state_e;
-
-/**
- * @brief Enumerations of result
- */
-typedef enum {
- PUSH_RESULT_SUCCESS, /**< Successful */
- PUSH_RESULT_TIMEOUT, /**< Request timed out */
- PUSH_RESULT_SERVER_ERROR, /**< Push server error */
- PUSH_RESULT_SYSTEM_ERROR, /**< System error */
-} push_result_e;
-
-/**
- * @brief Handle of a connection to the push service
- */
-typedef struct push_connection_s *push_connection_h;
-
-/**
- * @brief Handle of a notification delivered from the push server
- */
-typedef struct push_notification_s *push_notification_h;
-
-/**
- * @brief State callback
- * @remarks This callback will be invoked when the regisration state is
- * refreshed. If the registration or degistration has been succeeded,
- * then this state callback must be called. In addition, the state
- * can be changed if the push server deregisters the application.
- * @param[in] state Registration state
- * @param[in] err Error message
- * @param[in] user_data User data passed to this callback
- * @see push_connect()
- */
-typedef void (*push_state_cb)(
- push_state_e state, const char *err, void *user_data);
-
-/**
- * @brief Notifcation callback
- * @param[in] notification A handle of notification containing its payload.
- * The handle is available inside this callback only.
- * @param[in] user_data User data passed to this callback
- * @see push_connect(), push_get_notification_data()
- */
-typedef void (*push_notify_cb)(
- push_notification_h noti, void *user_data);
-
-/**
- * @brief Result callback
- * @param[in] result Registration/deregistration result
- * @param[in] msg Result message from the push server or NULL
- * @param[in] user_data User data passed to this callback
- * @see push_register(), push_deregister()
- */
-typedef void (*push_result_cb)(push_result_e result, const char *msg, void *user_data);
-
-/**
- * @brief Connects to the push service and sets callback functions
- * @remarks If there is a connection between an application and the push service,
- * the notify callback passes the notification upon its arrival.
- * Otherwise, the push service posts a UI notification to alert users.
- * Connection should be freed with @ref push_disconnect() by you.
- * @param[in] app_id The application ID
- * @param[in] state_cb State callback function
- * @param[in] notify_cb Notify callback function
- * @param[in] user_data User data to pass to <I>state_cb</I> and <I>notify_cb</I>
- * @param[out] connection The connection handle to the push service
- * @return 0 on success, otherwise a negative error value.
- * @retval PUSH_ERROR_NONE Successful
- * @retval PUSH_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval PUSH_ERROR_OUT_OF_MEMORY Out of memory
- * @retval PUSH_ERROR_OPERATION_FAILED Operation failed
- * @pre There is no connection for the <I>app_id</I> to the push service
- * @post The state callback will be called to let you know the current
- * registration state immediately.
- * @see push_disconnect()
- */
-int push_connect(const char *app_id, push_state_cb state_callback,
- push_notify_cb notify_callback, void *user_data,
- push_connection_h *connection);
-
-/**
- * @brief Closes the connection and releases all its resources
- * @remarks If you call this function in the push callback functions,
- * it may cause your application crash.
- * @param[in] connection Handle of a connection to the push service
- * @see push_connect()
- */
-void push_disconnect(push_connection_h connection);
-
-/**
- * @brief Registers an application to the push server
- * @param[in] connection The connection handle to the push service
- * @param[in] service A @ref Service handle to launch an application by
- * an posted UI notification
- * @param[in] result_cb Result callback function
- * @param[in] user_data User data to pass to <I>result_cb</I>
- * @return 0 on success, otherwise a negative error value.
- * @retval PUSH_ERROR_NONE Successful
- * @retval PUSH_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval PUSH_ERROR_OUT_OF_MEMORY Out of memory
- * @retval PUSH_ERROR_NOT_CONNECTED No connection to the push service
- * @retval PUSH_ERROR_OPERATION_FAILED Operation failed
- * @pre The application should be connected to the push service
- * @post For successful result, the state callback should be invoked
- * @see push_deregister()
- */
-int push_register(push_connection_h connection, service_h service,
- push_result_cb result_callback, void *user_data);
-
-/**
- * @brief Deregisters an application from the Push server
- * @param[in] connection The connection handle to the push service
- * @param[in] result_cb Result callback function
- * @param[in] user_data User data to pass to <I>result_cb</I>
- * @return 0 on success, otherwise a negative error value.
- * @retval PUSH_ERROR_NONE Successful
- * @retval PUSH_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval PUSH_ERROR_OUT_OF_MEMORY Out of memory
- * @retval PUSH_ERROR_NOT_CONNECTED No connection to the push service
- * @retval PUSH_ERROR_OPERATION_FAILED Operation failed
- * @pre The application should be connected to the push service
- * @post In result, the state callback will be invoked
- * @see push_register()
- */
-int push_deregister(push_connection_h connection, push_result_cb callback,
- void *user_data);
-
-/**
- * @brief Gets notification data which its server sent
- * @remark The <I>data</I> must be released with free() by you
- * @param[in] notification The notification handle
- * @param[out] data The notification data\n
- * Set NULL if error but <I>PUSH_ERROR_INVALID_PARAMETER</I>
- * @return 0 on success, otherwise a negative error value.
- * @retval PUSH_ERROR_NONE Successful
- * @retval PUSH_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval PUSH_ERROR_OUT_OF_MEMORY Out of memory
- * @retval PUSH_ERROR_NO_DATA No data available
- * @see push_notify_cb()
- * @see push_get_unread_notification()
- */
-int push_get_notification_data(push_notification_h notification, char **data);
-
-
-/**
- * @brief Gets the notification message which its server sent
- * @remark The <I>msg</I> must be released with free() by you
- * @param[in] notification The notification handle
- * @param[out] data The notification message\n
- * Set NULL if error but <I>PUSH_ERROR_INVALID_PARAMETER</I>
- * @return 0 on success, otherwise a negative error value.
- * @retval PUSH_ERROR_NONE Successful
- * @retval PUSH_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval PUSH_ERROR_OUT_OF_MEMORY Out of memory
- * @retval PUSH_ERROR_NO_DATA No data available
- * @see push_notify_cb()
- * @see push_get_unread_notification()
- */
-int push_get_notification_message(push_notification_h notification,
- char **msg);
-
-/**
- * @brief Gets the received time of the notification message
- *
- * @param[in] notification The notification handle
- * @param[out] received_time The received time of the notification message. \n
- * The @a received_time is based on UTC.
- * @return 0 on success, otherwise a negative error value.
- * @retval PUSH_ERROR_NONE Successful
- * @retval PUSH_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval PUSH_ERROR_NO_DATA No data available
- *
- * @see push_notify_cb()
- * @see push_get_unread_notification()
- */
-int push_get_notification_time(push_notification_h notification, long long int *received_time);
-
-/**
- * @brief Gets an unread notification message from the push server
- *
- * @remark This method will be deprecated.
- * @remark @a noti must be released with push_free_notification() by you
- *
- * @details If an application receives an unread message with this method, the message is removed from the system. \n
- * This method can be called repeatedly until it returns <I>PUSH_ERROR_NO_DATA</I> \n
- * But, this method does NOT guarantee order and reliability of notification messages. \n
- * Some notification messages can be dropped when the system message queue is full.
- *
- * @param[in] connection The connection handle to the push service
- * @param[out] noti The notification handle
- * @return 0 on success, otherwise a negative error value.
- * @retval PUSH_ERROR_NONE Successful
- * @retval PUSH_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval PUSH_ERROR_OUT_OF_MEMORY Out of memory
- * @retval PUSH_ERROR_NO_DATA No data available
- *
- * @see push_get_notification_message()
- * @see push_get_notification_time()
- * @see push_get_notification_data()
- */
-int push_get_unread_notification(push_connection_h connection,
- push_notification_h *noti);
-
-
-/**
- * @brief Gets the registration ID in <I>PUSH_STATE_REGISTERED</I> state
- * @remark The <I>reg_id</I> must be released with free() by you
- * @param[in] connection The connection handle to the push service
- * @param[out] reg_id The registration ID\n
- * Set NULL if error but <I>PUSH_ERROR_INVALID_PARAMETER</I>
- * @return 0 on success, otherwise a negative error value
- * @retval PUSH_ERROR_NONE Successful
- * @retval PUSH_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval PUSH_ERROR_OUT_OF_MEMORY Out of memory
- * @retval PUSH_ERROR_NO_DATA No registration ID available
- */
-int push_get_registration_id(push_connection_h connection, char **reg_id);
-
-
-/**
- * @brief Frees the notification handle
- * @param[in] noti The notification handle
- */
-void push_free_notification(push_notification_h noti);
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __PUSH_LIB_H__ */
+++ /dev/null
-# Package Information for pkg-config
-
-prefix=/usr
-exec_prefix=${prefix}
-libdir=${prefix}/lib
-includedir=${prefix}/include
-
-Name: push
-Description: Push service client library
-Version: 0.2.12
-Requires: capi-appfw-application
-Libs: -L${libdir} -lpush
-Cflags: -I${includedir}
-
+++ /dev/null
-[Unit]
-Description=Pushd service
-
-[Service]
-Type=forking
-ExecStart=/usr/bin/pushd
-
-[Install]
-WantedBy=tizen-middleware.target
+++ /dev/null
-../pushd.service
\ No newline at end of file