rsa binary pkg for push service
authorjooseok.park <jooseok.park@samsung.com>
Tue, 28 Aug 2012 04:01:15 +0000 (13:01 +0900)
committerjooseok.park <jooseok.park@samsung.com>
Tue, 28 Aug 2012 04:01:15 +0000 (13:01 +0900)
18 files changed:
arm/bin/push_tool [new file with mode: 0755]
arm/bin/pushd [new file with mode: 0755]
arm/include/push.h [new file with mode: 0644]
arm/lib/libpush.so [new symlink]
arm/lib/libpush.so.0 [new symlink]
arm/lib/libpush.so.0.2.12 [new file with mode: 0644]
arm/lib/pkgconfig/push.pc [new file with mode: 0644]
arm/share/PushServerTrust.cer [new file with mode: 0644]
packaging/push.init [new file with mode: 0644]
packaging/push.spec [new file with mode: 0755]
x86/bin/push_tool [new file with mode: 0755]
x86/bin/pushd [new file with mode: 0755]
x86/include/push.h [new file with mode: 0644]
x86/lib/libpush.so [new symlink]
x86/lib/libpush.so.0 [new symlink]
x86/lib/libpush.so.0.2.12 [new file with mode: 0644]
x86/lib/pkgconfig/push.pc [new file with mode: 0644]
x86/share/PushServerTrust.cer [new file with mode: 0644]

diff --git a/arm/bin/push_tool b/arm/bin/push_tool
new file mode 100755 (executable)
index 0000000..189ced0
Binary files /dev/null and b/arm/bin/push_tool differ
diff --git a/arm/bin/pushd b/arm/bin/pushd
new file mode 100755 (executable)
index 0000000..486c4a2
Binary files /dev/null and b/arm/bin/pushd differ
diff --git a/arm/include/push.h b/arm/include/push.h
new file mode 100644 (file)
index 0000000..a8f697d
--- /dev/null
@@ -0,0 +1,290 @@
+/*
+ * 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__ */
diff --git a/arm/lib/libpush.so b/arm/lib/libpush.so
new file mode 120000 (symlink)
index 0000000..42d3ebb
--- /dev/null
@@ -0,0 +1 @@
+libpush.so.0
\ No newline at end of file
diff --git a/arm/lib/libpush.so.0 b/arm/lib/libpush.so.0
new file mode 120000 (symlink)
index 0000000..e8cbc23
--- /dev/null
@@ -0,0 +1 @@
+libpush.so.0.2.12
\ No newline at end of file
diff --git a/arm/lib/libpush.so.0.2.12 b/arm/lib/libpush.so.0.2.12
new file mode 100644 (file)
index 0000000..43d9ec6
Binary files /dev/null and b/arm/lib/libpush.so.0.2.12 differ
diff --git a/arm/lib/pkgconfig/push.pc b/arm/lib/pkgconfig/push.pc
new file mode 100644 (file)
index 0000000..b7919a2
--- /dev/null
@@ -0,0 +1,14 @@
+# 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}
+
diff --git a/arm/share/PushServerTrust.cer b/arm/share/PushServerTrust.cer
new file mode 100644 (file)
index 0000000..7fb8bb2
--- /dev/null
@@ -0,0 +1,19 @@
+-----BEGIN CERTIFICATE-----
+MIIDGDCCAoGgAwIBAgIJAPMld7YDENSnMA0GCSqGSIb3DQEBBQUAMIGkMQswCQYD
+VQQGEwJLUjEUMBIGA1UECAwLR3llb25nZ2kgZG8xDjAMBgNVBAcMBVN1d29uMSUw
+IwYDVQQKDBxTQU1TVU5HIEVMRUNUUk9OSUNTIENPLiwgTFREMR4wHAYDVQQDDBUq
+LnB1c2guc2Ftc3VuZ29zcC5jb20xKDAmBgkqhkiG9w0BCQEWGWFkbWluQHB1c2gu
+c2Ftc3VuZ29zcC5jb20wHhcNOTkxMjMxMTUwMjEwWhcNNDkxMjE4MTUwMjEwWjCB
+pDELMAkGA1UEBhMCS1IxFDASBgNVBAgMC0d5ZW9uZ2dpIGRvMQ4wDAYDVQQHDAVT
+dXdvbjElMCMGA1UECgwcU0FNU1VORyBFTEVDVFJPTklDUyBDTy4sIExURDEeMBwG
+A1UEAwwVKi5wdXNoLnNhbXN1bmdvc3AuY29tMSgwJgYJKoZIhvcNAQkBFhlhZG1p
+bkBwdXNoLnNhbXN1bmdvc3AuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB
+gQDS/wx087bX6AA7bz/rPd/AOtm8g1ebRfENevGCnMrnU43PlryjjQjgKxwMO1R5
+Mdvv9IsSdoGIKj5h5VZlWbuiCx5pPqf62Owu3DjVLLuHWmlFkb7y6mKfshAcGCVq
+azjayWF9NpmOPnJDlFOZHTu+5X0+KEyx/W7kS6gcB5WIRwIDAQABo1AwTjAdBgNV
+HQ4EFgQUWMjZPBPgzaBussvwASa64F2DMFEwHwYDVR0jBBgwFoAUWMjZPBPgzaBu
+ssvwASa64F2DMFEwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQBpsXfr
+Fyd3rdKRzyBh/aJgY+XLZf5/TZYhtv2OLv5kMK0EkS0CEduPK5LeZwOhWgLIGpsl
+m8F2WNFttqP6fsAHExLTUlyqt4HT0CdzUtypjgsUPK5GBqEvz6+iQP+hZ4NKuxNB
+kci9Q85y89ANKtHvKxN1vu7gqArGFyIOJDVC8w==
+-----END CERTIFICATE-----
diff --git a/packaging/push.init b/packaging/push.init
new file mode 100644 (file)
index 0000000..09f9681
--- /dev/null
@@ -0,0 +1,59 @@
+#!/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
+
diff --git a/packaging/push.spec b/packaging/push.spec
new file mode 100755 (executable)
index 0000000..30d7afc
--- /dev/null
@@ -0,0 +1,140 @@
+Name:       push
+Summary:    Push services and client library.
+Version:    0.2.20
+Release:    1
+Group:      TO_BE_FILLED
+License:    TO_BE_FILLED
+Source0:    %{name}-%{version}.tar.gz
+Source1:    push.init
+
+%description
+Push services and client library.
+
+%package -n libpush
+Summary:    Push service client library
+Group:      TO_BE_FILLED
+Provides:   libpush.so.0
+
+%description -n libpush
+Push service client library
+
+
+%package -n libpush-devel
+Summary:    Push service client library (DEV)
+Group:      devel
+Requires:   libpush = %{version}-%{release}
+Requires:   capi-appfw-application-devel
+
+%description -n libpush-devel
+Push service client library (DEV)
+
+
+%package bin
+Summary:    Push service daemon
+Group:      TO_BE_FILLED
+
+%description bin
+Push service daemon
+
+
+%package tool
+Summary:    Push service tool
+Group:      devel
+Requires:   libpush = %{version}-%{release}
+Requires:   %{name}-bin = %{version}-%{release}
+
+%description tool
+Push service tool
+
+%prep
+%setup -q
+
+%build
+
+%install
+rm -rf %{buildroot}
+
+mkdir -p %{buildroot}/etc/init.d
+install -m 0755 %{SOURCE1} %{buildroot}/etc/init.d/pushd
+mkdir -p %{buildroot}%{_bindir}
+mkdir -p %{buildroot}%{_libdir}/pkgconfig
+mkdir -p %{buildroot}%{_includedir}
+mkdir -p %{buildroot}/usr/share/push
+
+%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
+cp -a arm/lib/libpush.so %{buildroot}%{_libdir}
+#push-bin
+cp -a arm/bin/pushd %{buildroot}%{_bindir}
+cp -a arm/share/PushServerTrust.cer %{buildroot}/usr/share/push/PushServerTrust.cer
+#push-tool
+cp -a arm/bin/push_tool %{buildroot}%{_bindir}
+%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
+cp -a x86/lib/libpush.so %{buildroot}%{_libdir}
+#push-bin
+cp -a x86/bin/pushd %{buildroot}%{_bindir}
+cp -a x86/share/PushServerTrust.cer %{buildroot}/usr/share/push/PushServerTrust.cer
+#push-tool
+cp -a x86/bin/push_tool %{buildroot}%{_bindir}
+%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
+ln -s /etc/init.d/pushd /etc/rc.d/rc3.d/S90pushd
+ln -s /etc/init.d/pushd /etc/rc.d/rc5.d/S90pushd
+
+
+_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
+
+%post -n libpush
+/sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+
+%files -n libpush
+%attr(644,-,-) %{_libdir}/libpush.so.*
+
+%files -n libpush-devel
+%{_includedir}/*.h
+%{_libdir}/pkgconfig/*.pc
+%{_libdir}/libpush.so
+
+%files bin
+%{_bindir}/pushd
+/etc/init.d/pushd
+/usr/share/push/*.cer
+
+%files tool
+%{_bindir}/push_tool
diff --git a/x86/bin/push_tool b/x86/bin/push_tool
new file mode 100755 (executable)
index 0000000..0dbb4b4
Binary files /dev/null and b/x86/bin/push_tool differ
diff --git a/x86/bin/pushd b/x86/bin/pushd
new file mode 100755 (executable)
index 0000000..c2023b0
Binary files /dev/null and b/x86/bin/pushd differ
diff --git a/x86/include/push.h b/x86/include/push.h
new file mode 100644 (file)
index 0000000..a8f697d
--- /dev/null
@@ -0,0 +1,290 @@
+/*
+ * 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__ */
diff --git a/x86/lib/libpush.so b/x86/lib/libpush.so
new file mode 120000 (symlink)
index 0000000..42d3ebb
--- /dev/null
@@ -0,0 +1 @@
+libpush.so.0
\ No newline at end of file
diff --git a/x86/lib/libpush.so.0 b/x86/lib/libpush.so.0
new file mode 120000 (symlink)
index 0000000..e8cbc23
--- /dev/null
@@ -0,0 +1 @@
+libpush.so.0.2.12
\ No newline at end of file
diff --git a/x86/lib/libpush.so.0.2.12 b/x86/lib/libpush.so.0.2.12
new file mode 100644 (file)
index 0000000..301bf66
Binary files /dev/null and b/x86/lib/libpush.so.0.2.12 differ
diff --git a/x86/lib/pkgconfig/push.pc b/x86/lib/pkgconfig/push.pc
new file mode 100644 (file)
index 0000000..b7919a2
--- /dev/null
@@ -0,0 +1,14 @@
+# 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}
+
diff --git a/x86/share/PushServerTrust.cer b/x86/share/PushServerTrust.cer
new file mode 100644 (file)
index 0000000..7fb8bb2
--- /dev/null
@@ -0,0 +1,19 @@
+-----BEGIN CERTIFICATE-----
+MIIDGDCCAoGgAwIBAgIJAPMld7YDENSnMA0GCSqGSIb3DQEBBQUAMIGkMQswCQYD
+VQQGEwJLUjEUMBIGA1UECAwLR3llb25nZ2kgZG8xDjAMBgNVBAcMBVN1d29uMSUw
+IwYDVQQKDBxTQU1TVU5HIEVMRUNUUk9OSUNTIENPLiwgTFREMR4wHAYDVQQDDBUq
+LnB1c2guc2Ftc3VuZ29zcC5jb20xKDAmBgkqhkiG9w0BCQEWGWFkbWluQHB1c2gu
+c2Ftc3VuZ29zcC5jb20wHhcNOTkxMjMxMTUwMjEwWhcNNDkxMjE4MTUwMjEwWjCB
+pDELMAkGA1UEBhMCS1IxFDASBgNVBAgMC0d5ZW9uZ2dpIGRvMQ4wDAYDVQQHDAVT
+dXdvbjElMCMGA1UECgwcU0FNU1VORyBFTEVDVFJPTklDUyBDTy4sIExURDEeMBwG
+A1UEAwwVKi5wdXNoLnNhbXN1bmdvc3AuY29tMSgwJgYJKoZIhvcNAQkBFhlhZG1p
+bkBwdXNoLnNhbXN1bmdvc3AuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB
+gQDS/wx087bX6AA7bz/rPd/AOtm8g1ebRfENevGCnMrnU43PlryjjQjgKxwMO1R5
+Mdvv9IsSdoGIKj5h5VZlWbuiCx5pPqf62Owu3DjVLLuHWmlFkb7y6mKfshAcGCVq
+azjayWF9NpmOPnJDlFOZHTu+5X0+KEyx/W7kS6gcB5WIRwIDAQABo1AwTjAdBgNV
+HQ4EFgQUWMjZPBPgzaBussvwASa64F2DMFEwHwYDVR0jBBgwFoAUWMjZPBPgzaBu
+ssvwASa64F2DMFEwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQBpsXfr
+Fyd3rdKRzyBh/aJgY+XLZf5/TZYhtv2OLv5kMK0EkS0CEduPK5LeZwOhWgLIGpsl
+m8F2WNFttqP6fsAHExLTUlyqt4HT0CdzUtypjgsUPK5GBqEvz6+iQP+hZ4NKuxNB
+kci9Q85y89ANKtHvKxN1vu7gqArGFyIOJDVC8w==
+-----END CERTIFICATE-----