Source cleanup 71/65671/4
authorSangyoon Jang <s89.jang@samsung.com>
Tue, 12 Apr 2016 05:44:16 +0000 (14:44 +0900)
committerSangyoon Jang <s89.jang@samsung.com>
Tue, 12 Apr 2016 06:46:11 +0000 (15:46 +0900)
- comm_xxx(pkgmgr_installer_client.so) => merged at pkgmgr_client
- remove unused files
- don't install unnecessary files

Change-Id: Ia369bb621606437645673e2fea136ec9f59d18fb
Signed-off-by: Sangyoon Jang <s89.jang@samsung.com>
26 files changed:
CMakeLists.txt
client/CMakeLists.txt
client/include/comm_client.h [new file with mode: 0644]
client/include/comm_config.h [new file with mode: 0644]
client/include/pkgmgr-api.h [deleted file]
client/include/pkgmgr-debug.h
client/src/comm_client_gdbus.c [new file with mode: 0644]
client/src/pkgmgr.c
comm/CMakeLists.txt [deleted file]
comm/comm_client.h [deleted file]
comm/comm_client_gdbus.c [deleted file]
comm/comm_config.h [deleted file]
comm/comm_debug.h [deleted file]
comm/pkgmgr-installer-client.pc.in [deleted file]
comm/pkgmgr-installer.pc.in [deleted file]
comm/pkgmgr_installer.c [deleted file]
comm/pkgmgr_installer.h [deleted file]
comm/pkgmgr_installer_config.h [deleted file]
include/package-manager-debug.h [deleted file]
installer/CMakeLists.txt [new file with mode: 0644]
installer/pkgmgr-installer.pc.in [new file with mode: 0644]
installer/pkgmgr_installer.c [new file with mode: 0644]
installer/pkgmgr_installer.h [new file with mode: 0644]
installer/pkgmgr_installer_config.h [new file with mode: 0644]
installer/pkgmgr_installer_debug.h [new file with mode: 0644]
packaging/pkgmgr.spec

index d49500f6e942e5a7f9c9a9517f400fe51eb8806b..7c5c2d1a6ba0cee94b913e0f0a69406ea6c02c7b 100644 (file)
@@ -21,9 +21,6 @@ INCLUDE_DIRECTORIES(comm)
 
 INCLUDE(FindPkgConfig)
 
-ADD_SUBDIRECTORY(comm)
+ADD_SUBDIRECTORY(installer)
 ADD_SUBDIRECTORY(client)
 ADD_SUBDIRECTORY(types)
-
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/package-manager-debug.h DESTINATION include)
-
index 0b73ac2d97da414a55912e095d5b40ca5c8126f9..99e9d9155692844265f866662ba82865456f1860 100644 (file)
@@ -1,9 +1,10 @@
 # package manager client library
 
-SET(SRCS src/pkgmgr-internal.c src/pkgmgr.c)
+SET(SRCS src/pkgmgr-internal.c src/pkgmgr.c src/comm_client_gdbus.c)
 
 pkg_check_modules(CLIENT_DEPS REQUIRED
                glib-2.0
+               gio-2.0
                dlog
                pkgmgr-parser
                pkgmgr-info
@@ -22,7 +23,6 @@ ADD_LIBRARY(${PKGMGR_CLIENT} SHARED ${SRCS})
 SET_TARGET_PROPERTIES(${PKGMGR_CLIENT} PROPERTIES SOVERSION ${VERSION_MAJOR})
 SET_TARGET_PROPERTIES(${PKGMGR_CLIENT} PROPERTIES VERSION ${VERSION})
 TARGET_LINK_LIBRARIES(${PKGMGR_CLIENT}
-               pkgmgr_installer_client
                pkgmgr-info
                ${CLIENT_DEPS_LDFLAGS})
 
diff --git a/client/include/comm_client.h b/client/include/comm_client.h
new file mode 100644 (file)
index 0000000..1fff2b3
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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 __COMM_CLIENT_H__
+#define __COMM_CLIENT_H__
+
+#include <glib.h>
+
+typedef struct comm_client comm_client;
+typedef void (*status_cb) (void *cb_data, uid_t target_uid, const char *req_id,
+                          const char *pkg_type, const char *pkgid,
+                          const char *appid,    const char *key,
+                          const char *val);
+
+comm_client *comm_client_new(void);
+int comm_client_free(comm_client *cc);
+
+GVariant *comm_client_request(comm_client *cc, const char *method, GVariant *params);
+
+int comm_client_set_status_callback(int comm_status_type, comm_client *cc, status_cb cb, void *cb_data);
+
+#endif                         /* __COMM_CLIENT_H__ */
diff --git a/client/include/comm_config.h b/client/include/comm_config.h
new file mode 100644 (file)
index 0000000..3cc607e
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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 __COMM_CONFIG_H__
+#define __COMM_CONFIG_H__
+
+#include <stdlib.h>            /* for NULL */
+#include <libgen.h>
+
+/* from comm_pkg_mgr.xml
+ */
+#define COMM_PKGMGR_DBUS_SERVICE "org.tizen.pkgmgr"
+#define COMM_PKGMGR_DBUS_OBJECT_PATH "/org/tizen/pkgmgr"
+#define COMM_PKGMGR_DBUS_INTERFACE "org.tizen.pkgmgr"
+
+/* from comm_status_broadcast
+ */
+#define COMM_STATUS_BROADCAST_INTERFACE "org.tizen.pkgmgr.signal"
+#define COMM_STATUS_BROADCAST_OBJECT_PATH "/org/tizen/pkgmgr/signal"
+#define COMM_STATUS_BROADCAST_SIGNAL_STATUS "status"
+#define COMM_STATUS_BROADCAST_EVENT_INSTALL "install"
+#define COMM_STATUS_BROADCAST_EVENT_UNINSTALL "uninstall"
+#define COMM_STATUS_BROADCAST_EVENT_MOVE "move"
+#define COMM_STATUS_BROADCAST_EVENT_INSTALL_PROGRESS "install_progress"
+#define COMM_STATUS_BROADCAST_EVENT_UPGRADE "upgrade"
+#define COMM_STATUS_BROADCAST_EVENT_GET_SIZE "get_size"
+#define COMM_STATUS_BROADCAST_EVENT_ENABLE_APP "enable_app"
+#define COMM_STATUS_BROADCAST_EVENT_DISABLE_APP "disable_app"
+
+
+/********
+ * enums
+ ********/
+
+/* req_type */
+enum {
+       /* to installer */
+       COMM_REQ_TO_INSTALLER = 1,
+
+       /* to activator */
+       COMM_REQ_TO_ACTIVATOR,
+
+       /* to clearer */
+       COMM_REQ_TO_CLEARER,
+
+       /* to mover*/
+       COMM_REQ_TO_MOVER,
+
+       /* cancel job */
+       COMM_REQ_CANCEL,
+
+       /*get package size */
+       COMM_REQ_GET_SIZE,
+
+       /*kill app */
+       COMM_REQ_KILL_APP,
+
+       /*check app */
+       COMM_REQ_CHECK_APP,
+
+       /* to cache clear */
+       COMM_REQ_CLEAR_CACHE_DIR,
+
+       COMM_REQ_MAX_SENTINEL
+};
+
+/* return value */
+enum {
+       COMM_RET_NOMEM = -2,
+       COMM_RET_ERROR = -1,
+       COMM_RET_OK = 0,
+       COMM_RET_QUEUED,
+
+       COMM_RET_MAX_SENTINEL
+};
+
+/* broadcast type */
+enum {
+       COMM_STATUS_BROADCAST_ALL = 0xFF,
+       COMM_STATUS_BROADCAST_INSTALL = 0x01,
+       COMM_STATUS_BROADCAST_UNINSTALL = 0x02,
+       COMM_STATUS_BROADCAST_MOVE = 0x04,
+       COMM_STATUS_BROADCAST_INSTALL_PROGRESS = 0x08,
+       COMM_STATUS_BROADCAST_UPGRADE = 0x10,
+       COMM_STATUS_BROADCAST_GET_SIZE = 0x20,
+       COMM_STATUS_BROADCAST_ENABLE_APP = 0x40,
+       COMM_STATUS_BROADCAST_DISABLE_APP = 0x80,
+};
+
+#endif                         /* __COMM_CONFIG_H__ */
diff --git a/client/include/pkgmgr-api.h b/client/include/pkgmgr-api.h
deleted file mode 100644 (file)
index adacf2a..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * slp-pkgmgr
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
- *
- * 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 API
-#define API __attribute__ ((visibility("default")))
-#endif
index 8b6e7580399e05815d99d8c6f58d030fc185436a..5badc7c9941569df6496080fc200f46f26c3dbe8 100644 (file)
 #ifndef __PKGMGR_DEBUG_H__
 #define __PKGMGR_DEBUG_H__
 
+#include <dlog.h>
+
 #ifdef LOG_TAG
 #undef LOG_TAG
 #endif /* LOG_TAG */
 #define LOG_TAG "PKGMGR"
 
-#include "package-manager-debug.h"
+#ifndef ERR
+#define ERR(fmt, args...) LOGE("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#ifndef DBG
+#define DBG(fmt, args...) LOGD("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#ifndef INFO
+#define INFO(fmt, args...) LOGI("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
 
 #define ret_if(expr) \
        do { \
diff --git a/client/src/comm_client_gdbus.c b/client/src/comm_client_gdbus.c
new file mode 100644 (file)
index 0000000..c5703ab
--- /dev/null
@@ -0,0 +1,301 @@
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+
+#include <glib.h>
+#include <gio/gio.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <glib.h>
+#include <gio/gio.h>
+
+#include "comm_config.h"
+#include "comm_client.h"
+#include "pkgmgr-debug.h"
+
+#define COMM_CLIENT_RETRY_MAX 5
+#define COMM_CLIENT_WAIT_USEC (1000000 / 2) /* 0.5 sec */
+
+/*******************
+ * ADT description
+ */
+
+/* Storing status_cb */
+struct signal_callback_data {
+       int type;
+       status_cb cb;
+       void *cb_data;
+};
+
+/* comm_client ADT */
+struct comm_client {
+       guint subscription_id;
+       GDBusConnection *conn;
+       struct signal_callback_data *sig_cb_data;
+};
+
+static int __get_signal_type(const char *name)
+{
+       if (name == NULL)
+               return -1;
+
+       if (strcmp(name, COMM_STATUS_BROADCAST_SIGNAL_STATUS) == 0)
+               return COMM_STATUS_BROADCAST_ALL;
+       else if (strcmp(name, COMM_STATUS_BROADCAST_EVENT_INSTALL) == 0)
+               return COMM_STATUS_BROADCAST_INSTALL;
+       else if (strcmp(name, COMM_STATUS_BROADCAST_EVENT_UNINSTALL) == 0)
+               return COMM_STATUS_BROADCAST_UNINSTALL;
+       else if (strcmp(name, COMM_STATUS_BROADCAST_EVENT_MOVE) == 0)
+               return COMM_STATUS_BROADCAST_MOVE;
+       else if (strcmp(name, COMM_STATUS_BROADCAST_EVENT_INSTALL_PROGRESS) == 0)
+               return COMM_STATUS_BROADCAST_INSTALL_PROGRESS;
+       else if (strcmp(name, COMM_STATUS_BROADCAST_EVENT_UPGRADE) == 0)
+               return COMM_STATUS_BROADCAST_UPGRADE;
+       else if (strcmp(name, COMM_STATUS_BROADCAST_EVENT_GET_SIZE) == 0)
+               return COMM_STATUS_BROADCAST_GET_SIZE;
+       else if (strcmp(name, COMM_STATUS_BROADCAST_EVENT_ENABLE_APP) == 0)
+               return COMM_STATUS_BROADCAST_ENABLE_APP;
+       else if (strcmp(name, COMM_STATUS_BROADCAST_EVENT_DISABLE_APP) == 0)
+               return COMM_STATUS_BROADCAST_DISABLE_APP;
+       else
+               return -1;
+}
+
+/**
+ * signal handler filter
+ * Filter signal, and run user callback
+ */
+void _on_signal_handle_filter(GDBusConnection *conn,
+               const gchar *sender_name,
+               const gchar *object_path,
+               const gchar *interface_name,
+               const gchar *signal_name,
+               GVariant *parameters,
+               gpointer user_data)
+{
+       if (interface_name && strcmp(interface_name, "org.tizen.pkgmgr.signal")) {
+               DBG("Interface name did not match. Drop the message");
+               return;
+       }
+
+       int status_type;
+       /* Values to be received by signal */
+       uid_t target_uid;
+       char *req_id;
+       char *pkg_type = NULL;
+       char *pkgid = NULL;
+       char *key = NULL;
+       char *val = NULL;
+       char *appid = NULL;
+
+       /* User's signal handler */
+       struct signal_callback_data *sig_cb_data;
+       if (user_data)
+               sig_cb_data = (struct signal_callback_data *)user_data;
+       else
+               return;
+
+       status_type = __get_signal_type(signal_name);
+       if (status_type < 0 || !(status_type & sig_cb_data->type))
+               return;
+
+       g_variant_get(parameters, "(u&s&s&s&s&s&s)",
+                               &target_uid, &req_id, &pkg_type, &pkgid, &appid, &key, &val);
+
+       /* Run signal callback if exist */
+       if (sig_cb_data && sig_cb_data->cb)
+               sig_cb_data->cb(sig_cb_data->cb_data, target_uid, req_id,
+                               pkg_type, pkgid, appid, key, val);
+
+       return;
+}
+
+/**
+ * signal_callback_data free function
+ * Just free it!
+ */
+void _free_sig_cb_data(void *data)
+{
+       struct signal_callback_data *sig_cb_data = NULL;
+       sig_cb_data = (struct signal_callback_data *)data;
+       free(sig_cb_data);
+}
+
+/*******************
+ * API description
+ */
+
+/**
+ * Create a new comm_client object
+ */
+comm_client *comm_client_new(void)
+{
+       GError *error = NULL;
+       comm_client *cc = NULL;
+
+       /* Allocate memory for ADT:comm_client */
+#if !GLIB_CHECK_VERSION(2,35,0)
+       g_type_init();
+#endif
+       cc = calloc(1, sizeof(comm_client));
+       if (NULL == cc) {
+               ERR("No memory");
+               return NULL;
+       }
+
+       /* Connect to gdbus. Gets shared BUS */
+       cc->conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+       if (error) {
+               ERR("gdbus connection error (%s)", error->message);
+               g_error_free(error);
+               goto ERROR_CLEANUP;
+       }
+       if (NULL == cc->conn) {
+               ERR("gdbus connection is not set, even gdbus error isn't raised");
+               goto ERROR_CLEANUP;
+       }
+       return cc;
+
+ ERROR_CLEANUP:
+       if (cc)
+               free(cc);
+       return NULL;
+}
+
+/**
+ * Free comm_client object
+ */
+int comm_client_free(comm_client *cc)
+{
+       if (!cc)
+               return -1;
+       if (!(cc->conn) || g_dbus_connection_is_closed(cc->conn)) {
+               ERR("Invalid gdbus connection");
+               return -2;
+       }
+
+       if (cc->sig_cb_data) {
+               g_dbus_connection_signal_unsubscribe(cc->conn, cc->subscription_id);
+               /* TODO: Is it needed to free cc->sig_cb_data here? */
+               /* _free_sig_cb_data(cc->sig_cb_data); */
+       }
+
+       /* Cleanup ADT */
+       /* flush remaining buffer: blocking mode */
+       g_dbus_connection_flush_sync(cc->conn, NULL, NULL);
+
+       /* Free signal filter if signal callback is exist */
+
+       /* just unref because it is shared BUS.
+       If ref count is 0 it will get free'd automatically
+       */
+       g_object_unref(cc->conn);
+       free(cc);
+
+       return 0;
+}
+
+/**
+ * Request a message
+ */
+GVariant *comm_client_request(comm_client *cc, const char *method, GVariant *params)
+{
+       GError *error = NULL;
+       GDBusProxy *proxy;
+       GVariant *result = NULL;
+       int retry_cnt = 0;
+
+       /* convert floating ref into normal ref */
+       g_variant_ref_sink(params);
+
+       do {
+               proxy = g_dbus_proxy_new_sync(cc->conn, G_DBUS_PROXY_FLAGS_NONE, NULL,
+                               COMM_PKGMGR_DBUS_SERVICE, COMM_PKGMGR_DBUS_OBJECT_PATH,
+                               COMM_PKGMGR_DBUS_INTERFACE, NULL, &error);
+               if (proxy == NULL) {
+                       ERR("failed to get proxy object, sleep and retry[%s]", error->message);
+                       g_error_free(error);
+                       error = NULL;
+                       usleep(COMM_CLIENT_WAIT_USEC);
+                       retry_cnt++;
+                       continue;
+               }
+
+               result = g_dbus_proxy_call_sync(proxy, method, params,
+                               G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
+               g_object_unref(proxy);
+               if (result)
+                       break;
+
+               ERR("failed to send request, sleep and retry[%s]", error->message);
+               g_error_free(error);
+               error = NULL;
+               usleep(COMM_CLIENT_WAIT_USEC);
+               retry_cnt++;
+       } while (retry_cnt <= COMM_CLIENT_RETRY_MAX);
+
+       /* decrease ref count to 0 to free resource */
+       g_variant_unref(params);
+
+       return result;
+}
+
+/**
+ * Set a callback for status signal
+ */
+int
+comm_client_set_status_callback(int comm_status_type, comm_client *cc, status_cb cb, void *cb_data)
+{
+       int r = COMM_RET_ERROR;
+
+       if (NULL == cc)
+               return COMM_RET_ERROR;
+
+       /* Create new sig_cb_data */
+       cc->sig_cb_data = calloc(1, sizeof(struct signal_callback_data));
+       if ( cc->sig_cb_data ) {
+               (cc->sig_cb_data)->type = comm_status_type;
+               (cc->sig_cb_data)->cb = cb;
+               (cc->sig_cb_data)->cb_data = cb_data;
+       } else {
+               r = COMM_RET_ERROR;
+               goto ERROR_CLEANUP;
+       }
+       /* Add a filter for signal */
+       cc->subscription_id = g_dbus_connection_signal_subscribe(cc->conn, NULL, "org.tizen.pkgmgr.signal",
+               NULL, NULL, NULL, G_DBUS_SIGNAL_FLAGS_NONE,
+               _on_signal_handle_filter, (gpointer)cc->sig_cb_data, _free_sig_cb_data);
+       if (!cc->subscription_id) {
+               ERR("Failed to add filter\n");
+               r = COMM_RET_ERROR;
+               goto ERROR_CLEANUP;
+       }
+
+       return COMM_RET_OK;
+
+ ERROR_CLEANUP:
+       ERR("General error");
+       return r;
+}
+
index c7bc61cb2438516aa7937a66fc0bb28d4e88287e..30c8704ab07f235e051f551456678c902f88cb01 100644 (file)
 #include "package-manager.h"
 #include "pkgmgr-internal.h"
 #include "pkgmgr-debug.h"
-#include "pkgmgr-api.h"
 #include "comm_client.h"
+#include "comm_config.h"
+
+/* API export macro */
+#ifndef API
+#define API __attribute__ ((visibility("default")))
+#endif
 
 #define PKG_TMP_PATH tzplatform_mkpath(TZ_USER_APP, "tmp")
 
diff --git a/comm/CMakeLists.txt b/comm/CMakeLists.txt
deleted file mode 100644 (file)
index 602f1b4..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-### Description
-# Communication modules for pkg-mgr client lib and server process
-# By Youmin Ha <youmin.ha@samsung.com>
-
-cmake_minimum_required(VERSION 2.6)
-#set(CMAKE_SKIP_BUILD_RPATH true)
-set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
-
-
-### Versioning
-if(DEFINED ${VERSION})
-       message("VERSION: ${VERSION}")
-else()
-       message("VERSION is not defined. set it as 0.1.0")
-       set(VERSION 0.1.0)
-endif()
-if(DEFINED ${VERSION_MAJOR})
-       message("VERSION_MAJOR: ${VERSION_MAJOR}")
-else()
-       message( "VERSION_MAJOR is not defined. set it as 0")
-       set(VERSION_MAJOR 0)
-endif()
-message(STATUS "version/major : ${VERSION} / ${VERSION_MAJOR}")
-
-### Get required CFLAGS, LDFLAGS from pkg-config
-
-include(FindPkgConfig)
-pkg_check_modules(installer_client_pkgs REQUIRED glib-2.0 gio-2.0 dlog)
-foreach(flag ${installer_client_pkgs_CFLAGS})
-       set(installer_client_pkgs_CFLAGS_str "${installer_client_pkgs_CFLAGS_str} ${flag}")
-endforeach()
-
-pkg_check_modules(installer_pkgs REQUIRED glib-2.0 gio-2.0 dlog pkgmgr-info)
-foreach(flag ${installer_pkgs_CFLAGS})
-       set(installer_pkgs_CFLAGS_str "${installer_pkgs_CFLAGS_str} ${flag}")
-endforeach()
-
-### Build modules
-
-## client for apps
-# Send request, get status signal
-add_library(pkgmgr_installer_client SHARED
-               comm_client_gdbus.c
-               )
-set_target_properties(pkgmgr_installer_client PROPERTIES SOVERSION ${VERSION_MAJOR})
-set_target_properties(pkgmgr_installer_client PROPERTIES VERSION ${VERSION})
-set_target_properties(pkgmgr_installer_client PROPERTIES COMPILE_FLAGS "${installer_client_pkgs_CFLAGS_str}")
-target_link_libraries(pkgmgr_installer_client ${installer_client_pkgs_LDFLAGS})
-
-## pkgmgr_installer object (by youmin.ha)
-# This library is for installer backend
-add_library(pkgmgr_installer SHARED pkgmgr_installer.c)
-set_target_properties(pkgmgr_installer PROPERTIES SOVERSION ${VERSION_MAJOR})
-set_target_properties(pkgmgr_installer PROPERTIES VERSION ${VERSION})
-set_target_properties(pkgmgr_installer PROPERTIES COMPILE_FLAGS "${installer_pkgs_CFLAGS_str}")
-target_link_libraries(pkgmgr_installer ${installer_pkgs_LDFLAGS})
-
-
-### Create pc file
-configure_file(pkgmgr-installer-client.pc.in ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr-installer-client.pc @ONLY)
-configure_file(pkgmgr-installer.pc.in ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr-installer.pc @ONLY)
-
-
-## Install
-INSTALL(TARGETS
-                       pkgmgr_installer_client
-                       pkgmgr_installer
-            DESTINATION ${LIB_INSTALL_DIR}
-               COMPONENT RuntimeLibraries)
-INSTALL(FILES
-                       comm_config.h
-                       pkgmgr_installer.h
-               DESTINATION include/pkgmgr)
-
-
-INSTALL(FILES
-               ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr-installer-client.pc
-               ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr-installer.pc
-        DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
diff --git a/comm/comm_client.h b/comm/comm_client.h
deleted file mode 100644 (file)
index 7e3d039..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * slp-pkgmgr
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
- *
- * 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 __COMM_CLIENT_H__
-#define __COMM_CLIENT_H__
-
-#include <glib.h>
-#include "comm_config.h"
-
-enum {
-       COMM_CLIENT_STATUS_CALLBACK_FLAG_NONE = 0,
-};
-
-typedef struct comm_client comm_client;
-typedef void (*status_cb) (void *cb_data, uid_t target_uid, const char *req_id,
-                          const char *pkg_type, const char *pkgid,
-                          const char *appid,    const char *key,
-                          const char *val);
-
-API comm_client *comm_client_new(void);
-API int comm_client_free(comm_client *cc);
-
-API GVariant *comm_client_request(comm_client *cc, const char *method, GVariant *params);
-
-API int comm_client_set_status_callback(int comm_status_type, comm_client *cc, status_cb cb, void *cb_data);
-#endif                         /* __COMM_CLIENT_H__ */
diff --git a/comm/comm_client_gdbus.c b/comm/comm_client_gdbus.c
deleted file mode 100644 (file)
index dd4bbfe..0000000
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- * slp-pkgmgr
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
- *
- * 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.
- *
- */
-
-
-/*
- * comm_client_gdbus.c
- * comm_client library using gdbus
- */
-
-#include <glib.h>
-#include <gio/gio.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <glib.h>
-#include <gio/gio.h>
-
-#include "comm_config.h"
-#include "comm_client.h"
-#include "comm_debug.h"
-
-#define COMM_CLIENT_RETRY_MAX 5
-#define COMM_CLIENT_WAIT_USEC (1000000 / 2) /* 0.5 sec */
-
-/*******************
- * ADT description
- */
-
-/* Storing status_cb */
-struct signal_callback_data {
-       int type;
-       status_cb cb;
-       void *cb_data;
-};
-
-/* comm_client ADT */
-struct comm_client {
-       guint subscription_id;
-       GDBusConnection *conn;
-       struct signal_callback_data *sig_cb_data;
-};
-
-static int __get_signal_type(const char *name)
-{
-       if (name == NULL)
-               return -1;
-
-       if (strcmp(name, COMM_STATUS_BROADCAST_SIGNAL_STATUS) == 0)
-               return COMM_STATUS_BROADCAST_ALL;
-       else if (strcmp(name, COMM_STATUS_BROADCAST_EVENT_INSTALL) == 0)
-               return COMM_STATUS_BROADCAST_INSTALL;
-       else if (strcmp(name, COMM_STATUS_BROADCAST_EVENT_UNINSTALL) == 0)
-               return COMM_STATUS_BROADCAST_UNINSTALL;
-       else if (strcmp(name, COMM_STATUS_BROADCAST_EVENT_MOVE) == 0)
-               return COMM_STATUS_BROADCAST_MOVE;
-       else if (strcmp(name, COMM_STATUS_BROADCAST_EVENT_INSTALL_PROGRESS) == 0)
-               return COMM_STATUS_BROADCAST_INSTALL_PROGRESS;
-       else if (strcmp(name, COMM_STATUS_BROADCAST_EVENT_UPGRADE) == 0)
-               return COMM_STATUS_BROADCAST_UPGRADE;
-       else if (strcmp(name, COMM_STATUS_BROADCAST_EVENT_GET_SIZE) == 0)
-               return COMM_STATUS_BROADCAST_GET_SIZE;
-       else if (strcmp(name, COMM_STATUS_BROADCAST_EVENT_ENABLE_APP) == 0)
-               return COMM_STATUS_BROADCAST_ENABLE_APP;
-       else if (strcmp(name, COMM_STATUS_BROADCAST_EVENT_DISABLE_APP) == 0)
-               return COMM_STATUS_BROADCAST_DISABLE_APP;
-       else
-               return -1;
-}
-
-/**
- * signal handler filter
- * Filter signal, and run user callback
- */
-void _on_signal_handle_filter(GDBusConnection *conn,
-               const gchar *sender_name,
-               const gchar *object_path,
-               const gchar *interface_name,
-               const gchar *signal_name,
-               GVariant *parameters,
-               gpointer user_data)
-{
-       if (interface_name && strcmp(interface_name, "org.tizen.pkgmgr.signal")) {
-               DBG("Interface name did not match. Drop the message");
-               return;
-       }
-
-       int status_type;
-       /* Values to be received by signal */
-       uid_t target_uid;
-       char *req_id;
-       char *pkg_type = NULL;
-       char *pkgid = NULL;
-       char *key = NULL;
-       char *val = NULL;
-       char *appid = NULL;
-
-       /* User's signal handler */
-       struct signal_callback_data *sig_cb_data;
-       if (user_data)
-               sig_cb_data = (struct signal_callback_data *)user_data;
-       else
-               return;
-
-       status_type = __get_signal_type(signal_name);
-       if (status_type < 0 || !(status_type & sig_cb_data->type))
-               return;
-
-       g_variant_get(parameters, "(u&s&s&s&s&s&s)",
-                               &target_uid, &req_id, &pkg_type, &pkgid, &appid, &key, &val);
-
-       /* Run signal callback if exist */
-       if (sig_cb_data && sig_cb_data->cb)
-               sig_cb_data->cb(sig_cb_data->cb_data, target_uid, req_id,
-                               pkg_type, pkgid, appid, key, val);
-
-       return;
-}
-
-/**
- * signal_callback_data free function
- * Just free it!
- */
-void _free_sig_cb_data(void *data)
-{
-       struct signal_callback_data *sig_cb_data = NULL;
-       sig_cb_data = (struct signal_callback_data *)data;
-       free(sig_cb_data);
-}
-
-/*******************
- * API description
- */
-
-/**
- * Create a new comm_client object
- */
-comm_client *comm_client_new(void)
-{
-       GError *error = NULL;
-       comm_client *cc = NULL;
-
-       /* Allocate memory for ADT:comm_client */
-#if !GLIB_CHECK_VERSION(2,35,0)
-       g_type_init();
-#endif
-       cc = calloc(1, sizeof(comm_client));
-       if (NULL == cc) {
-               ERR("No memory");
-               return NULL;
-       }
-
-       /* Connect to gdbus. Gets shared BUS */
-       cc->conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
-       if (error) {
-               ERR("gdbus connection error (%s)", error->message);
-               g_error_free(error);
-               goto ERROR_CLEANUP;
-       }
-       if (NULL == cc->conn) {
-               ERR("gdbus connection is not set, even gdbus error isn't raised");
-               goto ERROR_CLEANUP;
-       }
-       return cc;
-
- ERROR_CLEANUP:
-       if (cc)
-               free(cc);
-       return NULL;
-}
-
-/**
- * Free comm_client object
- */
-int comm_client_free(comm_client *cc)
-{
-       if (!cc)
-               return -1;
-       if (!(cc->conn) || g_dbus_connection_is_closed(cc->conn)) {
-               ERR("Invalid gdbus connection");
-               return -2;
-       }
-
-       if (cc->sig_cb_data) {
-               g_dbus_connection_signal_unsubscribe(cc->conn, cc->subscription_id);
-               /* TODO: Is it needed to free cc->sig_cb_data here? */
-               /* _free_sig_cb_data(cc->sig_cb_data); */
-       }
-
-       /* Cleanup ADT */
-       /* flush remaining buffer: blocking mode */
-       g_dbus_connection_flush_sync(cc->conn, NULL, NULL);
-
-       /* Free signal filter if signal callback is exist */
-
-       /* just unref because it is shared BUS.
-       If ref count is 0 it will get free'd automatically
-       */
-       g_object_unref(cc->conn);
-       free(cc);
-
-       return 0;
-}
-
-/**
- * Request a message
- */
-GVariant *comm_client_request(comm_client *cc, const char *method, GVariant *params)
-{
-       GError *error = NULL;
-       GDBusProxy *proxy;
-       GVariant *result = NULL;
-       int retry_cnt = 0;
-
-       /* convert floating ref into normal ref */
-       g_variant_ref_sink(params);
-
-       do {
-               proxy = g_dbus_proxy_new_sync(cc->conn, G_DBUS_PROXY_FLAGS_NONE, NULL,
-                               COMM_PKGMGR_DBUS_SERVICE, COMM_PKGMGR_DBUS_OBJECT_PATH,
-                               COMM_PKGMGR_DBUS_INTERFACE, NULL, &error);
-               if (proxy == NULL) {
-                       ERR("failed to get proxy object, sleep and retry[%s]", error->message);
-                       g_error_free(error);
-                       error = NULL;
-                       usleep(COMM_CLIENT_WAIT_USEC);
-                       retry_cnt++;
-                       continue;
-               }
-
-               result = g_dbus_proxy_call_sync(proxy, method, params,
-                               G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
-               g_object_unref(proxy);
-               if (result)
-                       break;
-
-               ERR("failed to send request, sleep and retry[%s]", error->message);
-               g_error_free(error);
-               error = NULL;
-               usleep(COMM_CLIENT_WAIT_USEC);
-               retry_cnt++;
-       } while (retry_cnt <= COMM_CLIENT_RETRY_MAX);
-
-       /* decrease ref count to 0 to free resource */
-       g_variant_unref(params);
-
-       return result;
-}
-
-/**
- * Set a callback for status signal
- */
-int
-comm_client_set_status_callback(int comm_status_type, comm_client *cc, status_cb cb, void *cb_data)
-{
-       int r = COMM_RET_ERROR;
-
-       if (NULL == cc)
-               return COMM_RET_ERROR;
-
-       /* Create new sig_cb_data */
-       cc->sig_cb_data = calloc(1, sizeof(struct signal_callback_data));
-       if ( cc->sig_cb_data ) {
-               (cc->sig_cb_data)->type = comm_status_type;
-               (cc->sig_cb_data)->cb = cb;
-               (cc->sig_cb_data)->cb_data = cb_data;
-       } else {
-               r = COMM_RET_ERROR;
-               goto ERROR_CLEANUP;
-       }
-       /* Add a filter for signal */
-       cc->subscription_id = g_dbus_connection_signal_subscribe(cc->conn, NULL, "org.tizen.pkgmgr.signal",
-               NULL, NULL, NULL, G_DBUS_SIGNAL_FLAGS_NONE,
-               _on_signal_handle_filter, (gpointer)cc->sig_cb_data, _free_sig_cb_data);
-       if (!cc->subscription_id) {
-               ERR("Failed to add filter\n");
-               r = COMM_RET_ERROR;
-               goto ERROR_CLEANUP;
-       }
-
-       return COMM_RET_OK;
-
- ERROR_CLEANUP:
-       ERR("General error");
-       return r;
-}
-
diff --git a/comm/comm_config.h b/comm/comm_config.h
deleted file mode 100644 (file)
index 1d9454d..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * slp-pkgmgr
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
- *
- * 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 __COMM_CONFIG_H__
-#define __COMM_CONFIG_H__
-
-#include <stdlib.h>            /* for NULL */
-#include <libgen.h>
-
-/* API export macro */
-#ifndef API
-#define API __attribute__ ((visibility("default")))
-#endif
-
-/* from comm_pkg_mgr.xml
- */
-#define COMM_PKGMGR_DBUS_SERVICE "org.tizen.pkgmgr"
-#define COMM_PKGMGR_DBUS_OBJECT_PATH "/org/tizen/pkgmgr"
-#define COMM_PKGMGR_DBUS_INTERFACE "org.tizen.pkgmgr"
-
-/* from comm_status_broadcast
- */
-#define COMM_STATUS_BROADCAST_INTERFACE "org.tizen.pkgmgr.signal"
-#define COMM_STATUS_BROADCAST_OBJECT_PATH "/org/tizen/pkgmgr/signal"
-#define COMM_STATUS_BROADCAST_SIGNAL_STATUS "status"
-#define COMM_STATUS_BROADCAST_EVENT_INSTALL "install"
-#define COMM_STATUS_BROADCAST_EVENT_UNINSTALL "uninstall"
-#define COMM_STATUS_BROADCAST_EVENT_MOVE "move"
-#define COMM_STATUS_BROADCAST_EVENT_INSTALL_PROGRESS "install_progress"
-#define COMM_STATUS_BROADCAST_EVENT_UPGRADE "upgrade"
-#define COMM_STATUS_BROADCAST_EVENT_GET_SIZE "get_size"
-#define COMM_STATUS_BROADCAST_EVENT_ENABLE_APP "enable_app"
-#define COMM_STATUS_BROADCAST_EVENT_DISABLE_APP "disable_app"
-
-
-/********
- * enums
- ********/
-
-/* req_type */
-enum {
-       /* to installer */
-       COMM_REQ_TO_INSTALLER = 1,
-
-       /* to activator */
-       COMM_REQ_TO_ACTIVATOR,
-
-       /* to clearer */
-       COMM_REQ_TO_CLEARER,
-
-       /* to mover*/
-       COMM_REQ_TO_MOVER,
-
-       /* cancel job */
-       COMM_REQ_CANCEL,
-
-       /*get package size */
-       COMM_REQ_GET_SIZE,
-
-       /*kill app */
-       COMM_REQ_KILL_APP,
-
-       /*check app */
-       COMM_REQ_CHECK_APP,
-
-       /* to cache clear */
-       COMM_REQ_CLEAR_CACHE_DIR,
-
-       COMM_REQ_MAX_SENTINEL
-};
-
-/* return value */
-enum {
-       COMM_RET_NOMEM = -2,
-       COMM_RET_ERROR = -1,
-       COMM_RET_OK = 0,
-       COMM_RET_QUEUED,
-
-       COMM_RET_MAX_SENTINEL
-};
-
-/* broadcast type */
-enum {
-       COMM_STATUS_BROADCAST_ALL = 0xFF,
-       COMM_STATUS_BROADCAST_INSTALL = 0x01,
-       COMM_STATUS_BROADCAST_UNINSTALL = 0x02,
-       COMM_STATUS_BROADCAST_MOVE = 0x04,
-       COMM_STATUS_BROADCAST_INSTALL_PROGRESS = 0x08,
-       COMM_STATUS_BROADCAST_UPGRADE = 0x10,
-       COMM_STATUS_BROADCAST_GET_SIZE = 0x20,
-       COMM_STATUS_BROADCAST_ENABLE_APP = 0x40,
-       COMM_STATUS_BROADCAST_DISABLE_APP = 0x80,
-};
-
-#endif                         /* __COMM_CONFIG_H__ */
diff --git a/comm/comm_debug.h b/comm/comm_debug.h
deleted file mode 100644 (file)
index f669daf..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * slp-pkgmgr
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
- *
- * 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 __COMM_DEBUG_H__
-#define __COMM_DEBUG_H__
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif /* LOG_TAG */
-#define LOG_TAG "PKGMGR"
-
-#include "package-manager-debug.h"
-
-#endif /* __COMM_DEBUG_H__ */
diff --git a/comm/pkgmgr-installer-client.pc.in b/comm/pkgmgr-installer-client.pc.in
deleted file mode 100644 (file)
index e1958d2..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# Copyright (c) 2008 ~ 2010 Samsung Electronics Co., Ltd.
-# All rights reserved.
-#
-
-prefix=@PREFIX@
-exec_prefix=@EXEC_PREFIX@
-libdir=@LIBDIR@
-includedir=@INCLUDEDIR@
-
-Name: package manager installer
-Description: SLP package manager's installer library
-Version: @VERSION@
-Requires: glib-2.0
-Libs: -L${libdir} -lpkgmgr_installer_client
-Cflags: -I${includedir}/pkgmgr
diff --git a/comm/pkgmgr-installer.pc.in b/comm/pkgmgr-installer.pc.in
deleted file mode 100644 (file)
index 06c0002..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# Copyright (c) 2008 ~ 2010 Samsung Electronics Co., Ltd.
-# All rights reserved.
-#
-
-prefix=@PREFIX@
-exec_prefix=@EXEC_PREFIX@
-libdir=@LIBDIR@
-includedir=@INCLUDEDIR@
-
-Name: package manager installer library
-Description: SLP package manager's installer lib for each backends
-Version: @VERSION@
-Requires:
-Libs: -L${libdir} -lpkgmgr_installer
-Cflags: -I${includedir}/pkgmgr
diff --git a/comm/pkgmgr_installer.c b/comm/pkgmgr_installer.c
deleted file mode 100644 (file)
index e759b7a..0000000
+++ /dev/null
@@ -1,596 +0,0 @@
-/*
- * slp-pkgmgr
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
- *
- * 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.
- *
- */
-
-
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <getopt.h>
-
-#include <gio/gio.h>
-
-#include "pkgmgr_installer.h"
-#include "pkgmgr_installer_config.h"
-
-#include "comm_config.h"
-#include "comm_debug.h"
-
-#include <pkgmgr-info.h>
-
-#undef LOG_TAG
-#ifndef LOG_TAG
-#define LOG_TAG "PKGMGR_INSTALLER"
-#endif /* LOG_TAG */
-
-#define MAX_STRLEN 1024
-#define MAX_QUERY_LEN  4096
-
-#define CHK_PI_RET(r) \
-       do { if (NULL == pi) return (r); } while (0)
-
-struct pkgmgr_installer {
-       int request_type;
-       int move_type;
-       char *pkgmgr_info;
-       char *session_id;
-       char *license_path;
-       char *optional_data;
-       char *caller_pkgid;
-       uid_t target_uid;
-       char *tep_path;
-       int tep_move;
-       int is_tep_included;
-       int is_preload;
-       int force_removal;
-       GDBusConnection *conn;
-};
-
-static const char *__get_signal_name(pkgmgr_installer *pi, const char *key)
-{
-       if (strcmp(key, PKGMGR_INSTALLER_INSTALL_PERCENT_KEY_STR) == 0)
-               return COMM_STATUS_BROADCAST_EVENT_INSTALL_PROGRESS;
-       else if (strcmp(key, PKGMGR_INSTALLER_GET_SIZE_KEY_STR) == 0)
-               return COMM_STATUS_BROADCAST_EVENT_GET_SIZE;
-       else if (strcmp(key, PKGMGR_INSTALLER_APPID_KEY_STR) == 0)
-               return COMM_STATUS_BROADCAST_EVENT_UNINSTALL;
-
-       switch (pi->request_type) {
-       case PKGMGR_REQ_INSTALL:
-               return COMM_STATUS_BROADCAST_EVENT_INSTALL;
-       case PKGMGR_REQ_UNINSTALL:
-               return COMM_STATUS_BROADCAST_EVENT_UNINSTALL;
-       case PKGMGR_REQ_UPGRADE:
-               return COMM_STATUS_BROADCAST_EVENT_UPGRADE;
-       case PKGMGR_REQ_MOVE:
-               return COMM_STATUS_BROADCAST_EVENT_MOVE;
-       case PKGMGR_REQ_ENABLE_APP:
-               return COMM_STATUS_BROADCAST_EVENT_ENABLE_APP;
-       case PKGMGR_REQ_DISABLE_APP:
-               return COMM_STATUS_BROADCAST_EVENT_DISABLE_APP;
-       }
-
-       ERR("cannot find type, send signal with type SIGNAL_STATUS");
-
-       return COMM_STATUS_BROADCAST_SIGNAL_STATUS;
-}
-
-static int __send_signal_for_app_event(pkgmgr_installer *pi, const char *pkg_type,
-               const char *pkgid, const char *appid, const char *key, const char *val)
-{
-       char *sid;
-       const char *name;
-       GError *err = NULL;
-
-       if (!pi || pi->conn == NULL || appid == NULL)
-               return -1;
-
-       sid = pi->session_id;
-       if (!sid)
-               sid = "";
-
-       name = __get_signal_name(pi, key);
-       if (name == NULL) {
-               ERR("unknown signal type");
-               return -1;
-       }
-
-       if (g_dbus_connection_emit_signal(pi->conn, NULL,
-                               COMM_STATUS_BROADCAST_OBJECT_PATH,
-                               COMM_STATUS_BROADCAST_INTERFACE, name,
-                               g_variant_new("(ussssss)", pi->target_uid, sid,
-                                       pkg_type, pkgid, appid, key, val), &err)
-                       != TRUE) {
-               ERR("failed to send dbus signal: %s", err->message);
-               g_error_free(err);
-               return -1;
-       }
-
-       return 0;
-}
-
-static int __send_signal_for_event(pkgmgr_installer *pi, const char *pkg_type,
-               const char *pkgid, const char *key, const char *val)
-{
-       char *sid;
-       const char *name;
-       GError *err = NULL;
-
-       if (!pi || pi->conn == NULL)
-               return -1;
-
-       sid = pi->session_id;
-       if (!sid)
-               sid = "";
-
-       name = __get_signal_name(pi, key);
-       if (name == NULL) {
-               ERR("unknown signal type");
-               return -1;
-       }
-
-       if (g_dbus_connection_emit_signal(pi->conn, NULL,
-                               COMM_STATUS_BROADCAST_OBJECT_PATH,
-                               COMM_STATUS_BROADCAST_INTERFACE, name,
-                               g_variant_new("(ussssss)", pi->target_uid, sid,
-                                       pkg_type, pkgid, "", key, val), &err)
-                       != TRUE) {
-               ERR("failed to send dbus signal: %s", err->message);
-               g_error_free(err);
-               return -1;
-       }
-
-       return 0;
-}
-
-API pkgmgr_installer *pkgmgr_installer_new(void)
-{
-       pkgmgr_installer *pi;
-       GError *err = NULL;
-
-       pi = calloc(1, sizeof(struct pkgmgr_installer));
-       if (pi == NULL)
-               return NULL;
-
-       pi->conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
-       if (pi->conn == NULL) {
-               ERR("failed to get bus: %s", err->message);
-               g_error_free(err);
-               free(pi);
-               return NULL;
-       }
-
-       pi->tep_path = NULL;
-       pi->tep_move = 0;
-       pi->request_type = PKGMGR_REQ_INVALID;
-
-       return pi;
-}
-
-API pkgmgr_installer *pkgmgr_installer_offline_new(void)
-{
-       pkgmgr_installer *pi;
-
-       pi = calloc(1, sizeof(struct pkgmgr_installer));
-       if (pi == NULL)
-               return NULL;
-
-       pi->tep_path = NULL;
-       pi->tep_move = 0;
-       pi->request_type = PKGMGR_REQ_INVALID;
-
-       return pi;
-}
-
-API int pkgmgr_installer_free(pkgmgr_installer *pi)
-{
-       CHK_PI_RET(-EINVAL);
-
-       /* free members */
-       if (pi->pkgmgr_info)
-               free(pi->pkgmgr_info);
-       if (pi->session_id)
-               free(pi->session_id);
-       if (pi->optional_data)
-               free(pi->optional_data);
-       if (pi->caller_pkgid)
-               free(pi->caller_pkgid);
-       if (pi->tep_path)
-               free(pi->tep_path);
-
-       if (pi->conn) {
-               g_dbus_connection_flush_sync(pi->conn, NULL, NULL);
-               g_object_unref(pi->conn);
-       }
-
-       free(pi);
-
-       return 0;
-}
-
-API int
-pkgmgr_installer_receive_request(pkgmgr_installer *pi,
-                                const int argc, char **argv)
-{
-       CHK_PI_RET(-EINVAL);
-
-       int r = 0;
-
-       /* Parse argv */
-       optind = 1;             /* Initialize optind to clear prev. index */
-       int opt_idx = 0;
-       int c;
-       int mode = 0;
-
-       pi->target_uid = getuid();
-       while (1) {
-               c = getopt_long(argc, argv, short_opts, long_opts, &opt_idx);
-               /* printf("c=%d %c\n", c, c); //debug */
-               if (-1 == c)
-                       break;  /* Parse is end */
-               switch (c) {
-               case OPTVAL_PRELOAD:    /* request for preload app */
-                       pi->is_preload = 1;
-                       DBG("preload request [%d]", pi->is_preload );
-                       break;
-               case OPTVAL_FORCE_REMOVAL:      /* request for force-remove */
-                       pi->force_removal = 1;
-                       DBG("force-remove request [%d]", pi->force_removal );
-                       break;
-               case 'k':       /* session id */
-                       if (pi->session_id)
-                               free(pi->session_id);
-                       pi->session_id = strndup(optarg, MAX_STRLEN);
-                       break;
-
-               case 'l':       /* license path */
-                       if (pi->license_path)
-                               free(pi->license_path);
-                       pi->license_path = strndup(optarg, MAX_STRLEN);
-                       break;
-
-               case 'i':       /* install */
-                       if (mode) {
-                               r = -EINVAL;
-                               goto RET;
-                       }
-                       mode = 'i';
-                       pi->request_type = PKGMGR_REQ_INSTALL;
-                       if (pi->pkgmgr_info)
-                               free(pi->pkgmgr_info);
-                       pi->pkgmgr_info = strndup(optarg, MAX_STRLEN);
-                       DBG("option is [i] pkgid[%s]", pi->pkgmgr_info );
-                       if (pi->pkgmgr_info && strlen(pi->pkgmgr_info)==0){
-                               free(pi->pkgmgr_info);
-                       }else{
-                               mode = 'i';
-                       }
-                       break;
-
-               case 'e':       /* install */
-                       if (pi->tep_path)
-                               free(pi->tep_path);
-                       pi->tep_path = strndup(optarg, MAX_STRLEN);
-                       pi->is_tep_included = 1;
-                       DBG("option is [e] tep_path[%s]", pi->tep_path);
-                       break;
-
-               case 'M':       /* install */
-                       if (strcmp(optarg, "tep_move") == 0)
-                               pi->tep_move = 1;
-                       else
-                               pi->tep_move = 0;
-                       DBG("option is [M] tep_move[%d]", pi->tep_move);
-                       break;
-
-               case 'd':       /* uninstall */
-                       if (mode) {
-                               r = -EINVAL;
-                               goto RET;
-                       }
-                       mode = 'd';
-                       pi->request_type = PKGMGR_REQ_UNINSTALL;
-                       if (pi->pkgmgr_info)
-                               free(pi->pkgmgr_info);
-                       pi->pkgmgr_info = strndup(optarg, MAX_STRLEN);
-                       break;
-
-
-               case 'c':       /* clear */
-                       if (mode) {
-                               r = -EINVAL;
-                               goto RET;
-                       }
-                       mode = 'c';
-                       pi->request_type = PKGMGR_REQ_CLEAR;
-                       if (pi->pkgmgr_info)
-                               free(pi->pkgmgr_info);
-                       pi->pkgmgr_info = strndup(optarg, MAX_STRLEN);
-                       break;
-
-               case 'm':       /* move */
-                       if (mode) {
-                               r = -EINVAL;
-                               goto RET;
-                       }
-                       mode = 'm';
-                       pi->request_type = PKGMGR_REQ_MOVE;
-                       if (pi->pkgmgr_info)
-                               free(pi->pkgmgr_info);
-                       pi->pkgmgr_info = strndup(optarg, MAX_STRLEN);
-                       break;
-
-               case 'r':       /* reinstall */
-                       if (mode) {
-                               r = -EINVAL;
-                               goto RET;
-                       }
-                       mode = 'r';
-                       pi->request_type = PKGMGR_REQ_REINSTALL;
-                       if (pi->pkgmgr_info)
-                               free(pi->pkgmgr_info);
-                       pi->pkgmgr_info = strndup(optarg, MAX_STRLEN);
-                       break;
-
-               case 't': /* move type*/
-                       pi->move_type = atoi(optarg);
-                       break;
-
-               case 'p': /* caller pkgid*/
-                       if (pi->caller_pkgid)
-                               free(pi->caller_pkgid);
-                       pi->caller_pkgid = strndup(optarg, MAX_STRLEN);
-
-                       break;
-
-               case 's':       /* smack */
-                       if (mode) {
-                               r = -EINVAL;
-                               goto RET;
-                       }
-                       mode = 's';
-                       pi->request_type = PKGMGR_REQ_SMACK;
-                       if (pi->pkgmgr_info)
-                               free(pi->pkgmgr_info);
-                       pi->pkgmgr_info = strndup(optarg, MAX_STRLEN);
-                       break;
-
-               case 'o': /* optional data*/
-                       pi->optional_data = strndup(optarg, MAX_STRLEN);
-                       break;
-
-               case 'y': /* pkgid for direct manifest installation */
-                       mode = 'y';
-                       pi->request_type = PKGMGR_REQ_MANIFEST_DIRECT_INSTALL;
-                       pi->pkgmgr_info = strndup(optarg, MAX_STRLEN);
-                       break;
-
-               case 'b': /* recovery */
-                       if (mode) {
-                               r = -EINVAL;
-                               goto RET;
-                       }
-                       mode = 'b';
-                       pi->request_type = PKGMGR_REQ_RECOVER;
-                       if (pi->pkgmgr_info)
-                               free(pi->pkgmgr_info);
-                       pi->pkgmgr_info = strndup(optarg, MAX_STRLEN);
-                       break;
-
-                       /* Otherwise */
-               case '?':       /* Not an option */
-                       break;
-
-               case ':':       /* */
-                       break;
-
-               }
-       }
-
- RET:
-       return r;
-}
-
-API int pkgmgr_installer_get_request_type(pkgmgr_installer *pi)
-{
-       CHK_PI_RET(PKGMGR_REQ_INVALID);
-       return pi->request_type;
-}
-
-API const char *pkgmgr_installer_get_request_info(pkgmgr_installer *pi)
-{
-       CHK_PI_RET(PKGMGR_REQ_INVALID);
-       return pi->pkgmgr_info;
-}
-
-API const char *pkgmgr_installer_get_tep_path(pkgmgr_installer *pi)
-{
-       CHK_PI_RET(PKGMGR_REQ_INVALID);
-       return pi->tep_path;
-}
-
-API int pkgmgr_installer_get_tep_move_type(pkgmgr_installer *pi)
-{
-       CHK_PI_RET(PKGMGR_REQ_INVALID);
-       return pi->tep_move;
-}
-
-API const char *pkgmgr_installer_get_session_id(pkgmgr_installer *pi)
-{
-       CHK_PI_RET(PKGMGR_REQ_INVALID);
-       return pi->session_id;
-}
-
-API const char *pkgmgr_installer_get_license_path(pkgmgr_installer *pi)
-{
-       CHK_PI_RET(PKGMGR_REQ_INVALID);
-       return pi->license_path;
-}
-
-API const char *pkgmgr_installer_get_optional_data(pkgmgr_installer *pi)
-{
-       CHK_PI_RET(PKGMGR_REQ_INVALID);
-       return pi->optional_data;
-}
-
-API int pkgmgr_installer_is_quiet(pkgmgr_installer *pi)
-{
-       return 1;
-}
-
-API int pkgmgr_installer_get_move_type(pkgmgr_installer *pi)
-{
-       CHK_PI_RET(PKGMGR_REQ_INVALID);
-       return pi->move_type;
-}
-
-API const char *pkgmgr_installer_get_caller_pkgid(pkgmgr_installer *pi)
-{
-       CHK_PI_RET(PKGMGR_REQ_INVALID);
-       return pi->caller_pkgid;
-}
-
-API int pkgmgr_installer_get_is_preload(pkgmgr_installer *pi)
-{
-       CHK_PI_RET(PKGMGR_REQ_INVALID);
-       return pi->is_preload;
-}
-
-API int pkgmgr_installer_get_force_removal(pkgmgr_installer *pi)
-{
-       CHK_PI_RET(PKGMGR_REQ_INVALID);
-       return pi->force_removal;
-}
-
-API int pkgmgr_installer_send_app_uninstall_signal(pkgmgr_installer *pi,
-                            const char *pkg_type,
-                            const char *pkgid,
-                            const char *val)
-{
-       int ret = 0;
-       ret = __send_signal_for_event(pi, pkg_type, pkgid,
-                       PKGMGR_INSTALLER_APPID_KEY_STR, val);
-       return ret;
-}
-
-API int pkgmgr_installer_set_uid(pkgmgr_installer *pi, uid_t uid)
-{
-       if (pi == NULL)
-               return -1;
-
-       pi->target_uid = uid;
-
-       return 0;
-}
-
-API int
-pkgmgr_installer_send_app_signal(pkgmgr_installer *pi,
-                            const char *pkg_type,
-                            const char *pkgid,
-                            const char *appid,
-                            const char *key, const char *val)
-{
-       int r = 0;
-
-       if (!pi->conn) {
-               ERR("connection is NULL");
-               return -1;
-       }
-
-       r = __send_signal_for_app_event(pi, pkg_type, pkgid, appid, key, val);
-
-       return r;
-}
-
-API int
-pkgmgr_installer_send_signal(pkgmgr_installer *pi,
-                            const char *pkg_type,
-                            const char *pkgid,
-                            const char *key, const char *val)
-{
-       int r = 0;
-
-       if (!pi->conn) {
-               ERR("connection is NULL");
-               return -1;
-       }
-
-       if (strcmp(key, PKGMGR_INSTALLER_UPGRADE_EVENT_STR) == 0)
-               pi->request_type = PKGMGR_REQ_UPGRADE;
-
-       r = __send_signal_for_event(pi, pkg_type, pkgid, key, val);
-
-       return r;
-}
-
-API int pkgmgr_installer_set_request_type(pkgmgr_installer *pi, int request_type)
-{
-       if (pi == NULL)
-               return -1;
-
-       pi->request_type = request_type;
-       return 0;
-}
-
-API int pkgmgr_installer_set_session_id(pkgmgr_installer *pi, const char *session_id)
-{
-       if (pi == NULL || session_id == NULL)
-               return -1;
-
-       pi->session_id = strndup(session_id, MAX_STRLEN);
-       return 0;
-}
-
-API int pkgmgr_installer_create_certinfo_set_handle(pkgmgr_instcertinfo_h *handle)
-{
-       int ret = 0;
-       ret = pkgmgrinfo_create_certinfo_set_handle(handle);
-       return ret;
-}
-
-API int pkgmgr_installer_set_cert_value(pkgmgr_instcertinfo_h handle, pkgmgr_instcert_type cert_type, char *cert_value)
-{
-       int ret = 0;
-       ret = pkgmgrinfo_set_cert_value(handle, cert_type, cert_value);
-       return ret;
-}
-
-API int pkgmgr_installer_save_certinfo(const char *pkgid, pkgmgr_instcertinfo_h handle, uid_t uid)
-{
-       int ret = 0;
-       ret = pkgmgrinfo_save_certinfo(pkgid, handle, uid);
-       return ret;
-}
-
-API int pkgmgr_installer_destroy_certinfo_set_handle(pkgmgr_instcertinfo_h handle)
-{
-       int ret = 0;
-       ret = pkgmgrinfo_destroy_certinfo_set_handle(handle);
-       return ret;
-}
-
-API int pkgmgr_installer_delete_certinfo(const char *pkgid)
-{
-       int ret = 0;
-       ret = pkgmgrinfo_delete_certinfo(pkgid);
-       return ret;
-}
diff --git a/comm/pkgmgr_installer.h b/comm/pkgmgr_installer.h
deleted file mode 100644 (file)
index fa323f1..0000000
+++ /dev/null
@@ -1,842 +0,0 @@
-/*
- * slp-pkgmgr
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
- *
- * 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.
- *
- */
-
-
-#include <sys/types.h>
-
-#ifndef __PKGMGR_INSTALLER_H__
-#define __PKGMGR_INSTALLER_H__
-
-/**
- * @file pkgmgr_installer.h
- * @author Youmin Ha <youmin.ha@samsung.com>
- * @version 0.1
- * @brief    This file declares API of pkgmgr_installer
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/**
- * pkgmgr_installer is an opaque type for an object
- */
-typedef struct pkgmgr_installer pkgmgr_installer;
-typedef void* pkgmgr_instcertinfo_h;
-
-/**
- * @brief listening event type in pkgmgr.
- */
-#define PKGMGR_INSTALLER_START_KEY_STR           "start"
-#define PKGMGR_INSTALLER_END_KEY_STR             "end"
-#define PKGMGR_INSTALLER_ERROR_KEY_STR           "error"
-#define PKGMGR_INSTALLER_APPID_KEY_STR           "appid"
-#define PKGMGR_INSTALLER_INSTALL_PERCENT_KEY_STR "install_percent"
-#define PKGMGR_INSTALLER_GET_SIZE_KEY_STR        "get_size"
-
-#define PKGMGR_INSTALLER_INSTALL_EVENT_STR       "install"
-#define PKGMGR_INSTALLER_UNINSTALL_EVENT_STR     "uninstall"
-#define PKGMGR_INSTALLER_CLEAR_EVENT_STR         "clear"
-#define PKGMGR_INSTALLER_MOVE_EVENT_STR          "move"
-#define PKGMGR_INSTALLER_UPGRADE_EVENT_STR       "update"
-#define PKGMGR_INSTALLER_OK_EVENT_STR            "ok"
-#define PKGMGR_INSTALLER_FAIL_EVENT_STR          "fail"
-
-#define PKGMGR_INSTALLER_APP_DISABLE_EVENT_STR         "disable_app"
-#define PKGMGR_INSTALLER_APP_ENABLE_EVENT_STR          "enable_app"
-#define PKGMGR_INSTALLER_GLOBAL_APP_DISABLE_FOR_UID    "disable_global_app_for_uid"
-#define PKGMGR_INSTALLER_GLOBAL_APP_ENABLE_FOR_UID     "enable_global_app_for_uid"
-
-
-/**
- * Request type.
- */
-enum {
-       PKGMGR_REQ_PERM = -1,
-       PKGMGR_REQ_INVALID = 0,
-       PKGMGR_REQ_INSTALL = 1,
-       PKGMGR_REQ_UNINSTALL = 2,
-       PKGMGR_REQ_CLEAR = 3,
-       PKGMGR_REQ_MOVE = 4,
-       PKGMGR_REQ_RECOVER = 5,
-       PKGMGR_REQ_REINSTALL = 6,
-       PKGMGR_REQ_GETSIZE = 7,
-       PKGMGR_REQ_UPGRADE = 8,
-       PKGMGR_REQ_SMACK = 9,
-       PKGMGR_REQ_MANIFEST_DIRECT_INSTALL = 10,
-       PKGMGR_REQ_ENABLE_APP = 11,
-       PKGMGR_REQ_DISABLE_APP = 12
-};
-
-enum {
-       PKGMGR_INSTALLER_EINVAL = -2,           /**< Invalid argument */
-       PKGMGR_INSTALLER_ERROR = -1,            /**< General error */
-       PKGMGR_INSTALLER_EOK = 0                        /**< General success */
-};
-
-
-typedef enum {
-       PM_SET_AUTHOR_ROOT_CERT = 0,
-       PM_SET_AUTHOR_INTERMEDIATE_CERT = 1,
-       PM_SET_AUTHOR_SIGNER_CERT = 2,
-       PM_SET_DISTRIBUTOR_ROOT_CERT = 3,
-       PM_SET_DISTRIBUTOR_INTERMEDIATE_CERT = 4,
-       PM_SET_DISTRIBUTOR_SIGNER_CERT = 5,
-       PM_SET_DISTRIBUTOR2_ROOT_CERT = 6,
-       PM_SET_DISTRIBUTOR2_INTERMEDIATE_CERT = 7,
-       PM_SET_DISTRIBUTOR2_SIGNER_CERT = 8,
-}pkgmgr_instcert_type;
-
-
-/**
- * @brief      Create a pkgmgr_installer object.
- * @pre                None
- * @post       pkgmgr_installer object must be freed.
- * @see                pkgmgr_installer_free
- * @return     pkgmgr_installer object
- * @retval     NULL    on failure creating an object
- * @remark     None
-@code
-#include <pkgmgr_installer.h>
-pkgmgr_installer *pi = pkgmgr_installer_new();
-pkgmgr_installer_free(pi);
-@endcode
- */
-pkgmgr_installer *pkgmgr_installer_new(void);
-
-/**
- * @brief      Create a pkgmgr_installer object in offline mode
- * @pre                None
- * @post       pkgmgr_installer object must be freed.
- * @see                pkgmgr_installer_free
- * @return     pkgmgr_installer object
- * @retval     NULL    on failure creating an object
- * @remark     None
-@code
-#include <pkgmgr_installer.h>
-pkgmgr_installer *pi = pkgmgr_installer_offline_new();
-pkgmgr_installer_free(pi);
-@endcode
- */
-pkgmgr_installer *pkgmgr_installer_offline_new(void);
-
-/**
-       @brief          Free a pkgmgr_installer object
-       @pre            pi must be a valid object.
-       @post           None
-       @see            pkgmgr_installer_new
-       @param[in]      pi      A pkgmgr_installer object
-       @return         Operation result
-       @retval         0       on success
-       @retval         -errno  on error
-       @remark         None
-       @code
-#include <pkgmgr_installer.h>
-pkgmgr_installer *pi = pkgmgr_installer_new();
-pkgmgr_installer_free(pi);
-       @endcode
- */
-int pkgmgr_installer_free(pkgmgr_installer *pi);
-
-/**
-       @brief          Receive a request from argv
-       @pre            None
-       @post           pkgmgr_installer_get_*(), pkgmgr_installer_is_quiet() can be called.
-       @see            pkgmgr_installer_get_request_type, pkgmgr_installer_get_request_info, pkgmgr_installer_get_session_id, pkgmgr_installer_is_quiet
-       @param[in]      pi      a pkgmgr_installer object
-       @param[in]      argc    argc from system
-       @param[in]      argv    argv from system
-       @return         Operation result
-       @retval         0 on success
-       @retval         -errno on failure
-       @remark         None
-       @code
-#include <pkgmgr_installer.h>
-int main(int argc, char **argv)
-{
-       pkgmgr_installer *pi;
-       int r;
-
-       pi = pkgmgr_installer_new();
-       int r = pkgmgr_installer_receive_request(pi, argc, argv);
-       pkgmgr_installer_free(pi);
-
-       return 0;
-}
-       @endcode
- */
-int pkgmgr_installer_receive_request(pkgmgr_installer *pi,
-                                    const int argc, char **argv);
-
-/**
-       @brief          Get request type
-       @pre            pkgmgr_installer_receive_request() must be called.
-       @post           None
-       @see            pkgmgr_installer_receive_request
-       @param[in]      pi      pkgmgr_installer object
-       @return         Request type (One of PKGMGR_REQ_* enum values)
-       @remark         None
-       @code
-int main(int argc, char **argv)
-{
-       pkgmgr_installer *pi;
-       int r = 0;
-
-       pi = pkgmgr_installer_new();
-       if(!pi) return -1;
-       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
-               r = -1;
-               goto CLEANUP_RET;
-       }
-
-       switch(pkgmgr_installer_get_request_type(pi)) {
-               case PKGMGR_REQ_PERM:
-                       // Do error processing
-                       break;
-               case PKGMGR_REQ_INVALID:
-                       // Do error processing
-                       r = -1;
-                       break;
-               case PKGMGR_REQ_INSTALL:
-                       // Do install processing
-                       break;
-               case PKGMGR_REQ_UNINSTALL:
-                       // Do uninstall processing
-                       break;
-               case PKGMGR_REQ_RECOVER:
-                       // Do recovere processing
-                       break;
-               case PKGMGR_REQ_REINSTALL:
-                       // Do reinstall processing
-                       break;
-               default:
-                       goto CLEANUP_END;
-       }
-CLEANUP_END:
-       pkgmgr_installer_free(pi);
-
-       return r;
-}
-       @endcode
- */
-int pkgmgr_installer_get_request_type(pkgmgr_installer *pi);
-
-/**
-       @brief          Get request info
-       @pre            pkgmgr_installer_receive_request() must be called.
-       @post           None
-       @see            pkgmgr_installer_receive_request
-       @param[in]      pi      pkgmgr_installer object
-       @return         Request info. When PKGMGR_REQ_INSTALL, this is a package file path to be installed. When PKGMGR_REQ_UNINSTALL, this is a package name to be uninstalled.
-       @retval         NULL    on function failure
-       @remark         Returned string must not be modified.
-       @code
-#include <pkgmgr_installer.h>
-int main(int argc, char **argv)
-{
-       pkgmgr_installer *pi;
-       int r = 0;
-       char *req_info = NULL;
-
-       pi = pkgmgr_installer_new();
-       if(!pi) return -1;
-       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
-               r = -1;
-               goto CLEANUP_RET;
-       }
-       req_info = (char *) pkgmgr_installer_get_request_info(pi);
-
-       // Do something...
-
-       pkgmgr_installer_free(pi);
-       return r;
-}
-       @endcode
- */
-const char *pkgmgr_installer_get_request_info(pkgmgr_installer *pi);
-
-/**
-       @brief          Get TEP path
-       @pre            pkgmgr_installer_receive_request() must be called.
-       @post           None
-       @see            pkgmgr_installer_receive_request
-       @param[in]      pi      pkgmgr_installer object
-       @return         TEP path if exists
-       @retval         NULL    on function failure
-       @remark         Returned string must not be modified.
-       @code
-#include <pkgmgr_installer.h>
-int main(int argc, char **argv)
-{
-       pkgmgr_installer *pi;
-       int r = 0;
-       char *tep_path = NULL;
-
-       pi = pkgmgr_installer_new();
-       if(!pi) return -1;
-       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
-               r = -1;
-               goto CLEANUP_RET;
-       }
-       tep_path = (char *) pkgmgr_installer_get_tep_path(pi);
-
-       // Do something...
-
-       pkgmgr_installer_free(pi);
-       return r;
-}
-@endcode
- */
-const char *pkgmgr_installer_get_tep_path(pkgmgr_installer *pi);
-
-/**
-       @brief          Get TEP move type
-       @pre            pkgmgr_installer_receive_request() must be called.
-       @post           None
-       @see            pkgmgr_installer_receive_request
-       @param[in]      pi      pkgmgr_installer object
-       @return         integer value indicates tep move type(0: copy TEP file / 1: move TEP file)
-       @retval         0       on function failure
-       @remark         Returned string must not be modified.
-       @code
-#include <pkgmgr_installer.h>
-int main(int argc, char **argv)
-{
-       pkgmgr_installer *pi;
-       int r = 0;
-       int tep_move_type = -1;
-
-       pi = pkgmgr_installer_new();
-       if(!pi) return -1;
-       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
-               r = -1;
-               goto CLEANUP_RET;
-       }
-       tep_move_type = pkgmgr_installer_get_tep_move_type(pi);
-
-       // Do something...
-
-       pkgmgr_installer_free(pi);
-       return r;
-}
-@endcode
- */
-int pkgmgr_installer_get_tep_move_type(pkgmgr_installer *pi);
-
-/**
-       @brief          Get session ID for a certain session
-       @pre            pkgmgr_installer_receive_request() must be called.
-       @post           None
-       @see            pkgmgr_installer_receive_request
-       @param[in]      pi      pkgmgr_installer object
-       @return         A session ID
-       @retval         NULL    on function failure
-       @remark         Returned string must not be modified.
-       @code
-#include <pkgmgr_installer.h>
-int main(int argc, char **argv)
-{
-       pkgmgr_installer *pi;
-       int r = 0;
-       char *session_id = NULL;
-
-       pi = pkgmgr_installer_new();
-       if(!pi) return -1;
-       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
-               r = -1;
-               goto CLEANUP_RET;
-       }
-       session_id = (char *) pkgmgr_installer_get_session_id(pi);
-
-       // Do something...
-
-       pkgmgr_installer_free(pi);
-       return r;
-}
-@endcode
- */
-const char *pkgmgr_installer_get_session_id(pkgmgr_installer *pi);
-
-/**
-       @brief          Get a license path
-       @pre            pkgmgr_installer_receive_request() must be called.
-       @post           None
-       @see            pkgmgr_installer_receive_request
-       @param[in]      pi      pkgmgr_installer object
-       @return         license path
-       @retval         NULL    on function failure
-       @remark         Returned string must not be modified.
-       @code
-#include <pkgmgr_installer.h>
-int main(int argc, char **argv)
-{
-       pkgmgr_installer *pi;
-       int r = 0;
-       char *license_path = NULL;
-
-       pi = pkgmgr_installer_new();
-       if(!pi) return -1;
-       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
-               r = -1;
-               goto CLEANUP_RET;
-       }
-       session_id = (char *) pkgmgr_installer_get_license_path(pi);
-
-       // Do something...
-
-       pkgmgr_installer_free(pi);
-       return r;
-}
-@endcode
- */
-const char *pkgmgr_installer_get_license_path(pkgmgr_installer *pi);
-
-/**
-       @brief          Get a optional data
-       @pre            pkgmgr_installer_receive_request() must be called.
-       @post           None
-       @see            pkgmgr_installer_receive_request
-       @param[in]      pi      pkgmgr_installer object
-       @return         optional data
-       @retval         NULL    on function failure
-       @remark         Returned string must not be modified.
-       @code
-#include <pkgmgr_installer.h>
-int main(int argc, char **argv)
-{
-       pkgmgr_installer *pi;
-       int r = 0;
-       char *optional_data = NULL;
-
-       pi = pkgmgr_installer_new();
-       if(!pi) return -1;
-       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
-               r = -1;
-               goto CLEANUP_RET;
-       }
-       optional_data = (char *) pkgmgr_installer_get_optional_data(pi);
-
-       // Do something...
-
-       pkgmgr_installer_free(pi);
-       return r;
-}
-@endcode
- */
-const char *pkgmgr_installer_get_optional_data(pkgmgr_installer *pi);
-
-/**
-       @brief          Get if a request is with quite mode or not
-       @pre            pkgmgr_installer_receive_request() must be called.
-       @post           None
-       @see            pkgmgr_installer_receive_request
-       @param[in]      pi      pkgmgr_installer object
-       @return         Operation result
-       @retval         0 if a request is not quiet mode
-       @retval         1 if a request is quiet mode
-       @remark         None
-       @code
-#include <pkgmgr_installer.h>
-int main(int argc, char **argv)
-{
-       pkgmgr_installer *pi;
-       int r = 0;
-
-       pi = pkgmgr_installer_new();
-       if(!pi) return -1;
-       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
-               r = -1;
-               goto CLEANUP_RET;
-       }
-       if(pkgmgr_installer_is_quiet(pi)) {
-               // Do quiet mode work...
-       } else {
-               // Do normal mode work...
-       }
-
-       pkgmgr_installer_free(pi);
-       return r;
-}
-       @endcode
- */
-int pkgmgr_installer_is_quiet(pkgmgr_installer *pi);
-
-/**
-       @brief          Get move type
-       @pre            pkgmgr_installer_receive_request() must be called.
-       @post           None
-       @see            pkgmgr_installer_receive_request
-       @param[in]      pi      pkgmgr_installer object
-       @return         Operation result
-       @retval         enum value of move type
-       @remark         None
-       @code
-#include <pkgmgr_installer.h>
-int main(int argc, char **argv)
-{
-       pkgmgr_installer *pi;
-       int r = 0;
-
-       pi = pkgmgr_installer_new();
-       if(!pi) return -1;
-       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
-               r = -1;
-               goto CLEANUP_RET;
-       }
-       move_type = pkgmgr_installer_get_move_type(pi);
-
-       //Do Something
-
-       pkgmgr_installer_free(pi);
-       return r;
-}
-       @endcode
- */
-int pkgmgr_installer_get_move_type(pkgmgr_installer *pi);
-
-/**
-       @brief          Get caller package id
-       @pre            pkgmgr_installer_receive_request() must be called.
-       @post           None
-       @see            pkgmgr_installer_receive_request
-       @param[in]      pi      pkgmgr_installer object
-       @return         Operation result
-       @retval         enum value of move type
-       @remark         None
-       @code
-#include <pkgmgr_installer.h>
-int main(int argc, char **argv)
-{
-       pkgmgr_installer *pi;
-       int r = 0;
-       char *pkgid = NULL;
-
-       pi = pkgmgr_installer_new();
-       if(!pi) return -1;
-       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
-               r = -1;
-               goto CLEANUP_RET;
-       }
-       pkgid = (char *) pkgmgr_installer_get_caller_pkgid(pi);
-
-       // Do something...
-
-       pkgmgr_installer_free(pi);
-       return r;
-}
-       @endcode
- */
-const char *pkgmgr_installer_get_caller_pkgid(pkgmgr_installer *pi);
-
-/**
-       @brief          Get if the request is for preload app or not
-       @pre            pkgmgr_installer_receive_request() must be called.
-       @post           None
-       @see            pkgmgr_installer_receive_request
-       @param[in]      pi      pkgmgr_installer object
-       @return         Operation result
-       @retval         0 if a request is not for preload
-       @retval         1 if a request is for preload
-       @remark         None
-       @code
-#include <pkgmgr_installer.h>
-int main(int argc, char **argv)
-{
-       pkgmgr_installer *pi;
-       int r = 0;
-       int is_preload = 0;
-
-       pi = pkgmgr_installer_new();
-       if(!pi) return -1;
-       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
-               r = -1;
-               goto CLEANUP_RET;
-       }
-       is_preload = pkgmgr_installer_get_is_preload(pi);
-
-       // Do something...
-
-       pkgmgr_installer_free(pi);
-       return r;
-}
-       @endcode
- */
-int pkgmgr_installer_get_is_preload(pkgmgr_installer *pi);
-
-/**
-       @brief          Get if the request is for force-removal
-       @pre            pkgmgr_installer_receive_request() must be called.
-       @post           None
-       @see            pkgmgr_installer_receive_request
-       @param[in]      pi      pkgmgr_installer object
-       @return         Operation result
-       @retval         0 if a request is not for force-removal
-       @retval         1 if a request is for force-removal
-       @remark         None
-       @code
-#include <pkgmgr_installer.h>
-int main(int argc, char **argv)
-{
-       pkgmgr_installer *pi;
-       int r = 0;
-       int force_remove = 0;
-
-       pi = pkgmgr_installer_new();
-       if(!pi) return -1;
-       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
-               r = -1;
-               goto CLEANUP_RET;
-       }
-       force_remove = pkgmgr_installer_get_force_removal(pi);
-
-       // Do something...
-
-       pkgmgr_installer_free(pi);
-       return r;
-}
-       @endcode
- */
-int pkgmgr_installer_get_force_removal(pkgmgr_installer *pi);
-
-/**
-       @brief          Send a app status signal
-       @pre            None
-       @post           None
-       @see            None
-       @param[in]      pi      pkgmgr_installer object
-       @param[in]      pkg_type        package type: "deb", "jar", "wgt", ...
-       @param[in]      pkgid   package id
-       @param[in]      appid   application id
-       @param[in]      key                     Signal key
-       @param[in]      val                     Signal value
-       @return         Operation result
-       @retval         0 on success
-       @retval         -errno on failure
-       @code
-#include <pkgmgr_installer.h>
-void send_app_singal(uid_t uid, int request_type, int req_id,
-               const char *pkg_type, const char *pkgid, const char *appid,
-               const char *key, const char *val)
-{
-       pkgmgr_installer *pi;
-       int r = 0;
-
-       pi = pkgmgr_installer_new();
-       if(!pi) return -1;
-
-       if (pkgmgr_installer_set_uid(pi, uid))
-               goto CLEANUP_RET;
-       if (pkgmgr_installer_set_request_type(pi, request_type))
-               goto CLEANUP_RET;
-       if ((pkgmgr_installer_set_session_id(pi, req_id))
-               goto CLEANUP_RET;
-       pkgmgr_installer_send_app_signal(pi, pkg_type, pkgid, appid, key, val);
-
-}
-       @endcode
- */
-int pkgmgr_installer_send_app_signal(pkgmgr_installer *pi,
-                            const char *pkg_type,
-                            const char *pkgid,
-                            const char *appid,
-                            const char *key, const char *val);
-
-/**
-       @brief          Send a process status signal
-       @pre            None
-       @post           None
-       @see            None
-       @param[in]      pi      pkgmgr_installer object
-       @param[in]      pkg_type        package type: "deb", "jar", "wgt", ...
-       @param[in]      pkgid   package id
-       @param[in]      key                     Signal key
-       @param[in]      val                     Signal value
-       @return         Operation result
-       @retval         0 on success
-       @retval         -errno on failure
-       @remark         If pkgmgr_installer_receive_request() is not called, the session ID will be null string (=="/0").
-       @code
-#include <pkgmgr_installer.h>
-int main(int argc, char **argv)
-{
-       pkgmgr_installer *pi;
-       int r = 0;
-       char *session_id = NULL;
-
-       pi = pkgmgr_installer_new();
-       if(!pi) return -1;
-       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
-               r = -1;
-               goto CLEANUP_RET;
-       }
-
-       // Do something...
-       pkgmgr_installer_send_signal(pi,
-        "deb", "org.tizen.foo", "install_percent", "100");
-       // A sample signal
-
-       pkgmgr_installer_free(pi);
-       return r;
-}
-       @endcode
- */
-int pkgmgr_installer_send_signal(pkgmgr_installer *pi,
-                                const char *pkg_type,
-                                const char *pkgid, const char *key,
-                                const char *val);
-
-/**
-       @brief          Send a signal which indicates application is being uninstalled
-       @pre            None
-       @post           None
-       @see            None
-       @param[in]      pi      pkgmgr_installer object
-       @param[in]      pkg_type        package type: "deb", "jar", "wgt", ...
-       @param[in]      pkgid   package id
-       @param[in]      key                     Signal key
-       @param[in]      val                     Signal value
-       @return         Operation result
-       @retval         0 on success
-       @retval         -errno on failure
-       @code
-#include <pkgmgr_installer.h>
-int main(int argc, char **argv)
-{
-       pkgmgr_installer *pi;
-       int r = 0;
-       char *session_id = NULL;
-
-       pi = pkgmgr_installer_new();
-       if(!pi) return -1;
-       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
-               r = -1;
-               goto CLEANUP_RET;
-       }
-
-       // Do something...
-       pkgmgr_installer_send_app_uninstall_signal(pi,
-        "tpk", "org.tizen.foo");
-       // A sample signal
-
-       pkgmgr_installer_free(pi);
-       return r;
-}
-       @endcode
- */
-int pkgmgr_installer_send_app_uninstall_signal(pkgmgr_installer *pi,
-                            const char *pkg_type,
-                            const char *pkgid,
-                            const char *val);
-
-/**
- * @brief      This API sets the uid of given pkgmgr_installer.
- *
- *              This API is for package-manager client application.\n
- *
- * @param[in]pi                                pointer to pkgmgr_installer
- * @param[in]uid                               uid
- * @return     0 if success, error code(<0) if fail\n
-*/
-int pkgmgr_installer_set_uid(pkgmgr_installer *pi, uid_t uid);
-
-/**
- * @brief      This API sets the requst info of given pkgmgr_installer.
- *
- *              This API is for package-manager client application.\n
- *
- * @param[in]pi                                pointer to pkgmgr_installer
- * @param[in]  request_type                            request type
- * @return     0 if success, error code(<0) if fail\n
-*/
-int pkgmgr_installer_set_request_type(pkgmgr_installer *pi, int request_type);
-
-/**
- * @brief      This API sets the session ID.
- *
- *              This API is for package-manager client application.\n
- *
- * @param[in]  pi                              pointer to pkgmgr_installer
- * @param[in]  session_id                              session ID to be set
- * @return     0 if success, error code(<0) if fail\n
-*/
-int pkgmgr_installer_set_session_id(pkgmgr_installer *pi, const char *session_id);
-
-/**
- * @brief      This API creates the certinfo handle.
- *
- *              This API is for package-manager client application.\n
- *
- * @param[out] handle                          pointer to cert info handle
- * @return     0 if success, error code(<0) if fail\n
-*/
-int pkgmgr_installer_create_certinfo_set_handle(pkgmgr_instcertinfo_h *handle);
-
-/**
- * @brief      This API sets cert value for corresponding cert type.
- *
- *              This API is for package-manager client application.\n
- *
- * @param[in]  handle                          pointer to cert info handle
- * @param[in]  cert_type                       enum value for certificate type
- * @param[in]  cert_value                      certificate value
- * @return     0 if success, error code(<0) if fail\n
-*/
-int pkgmgr_installer_set_cert_value(pkgmgr_instcertinfo_h handle, pkgmgr_instcert_type cert_type, char *cert_value);
-
-/**
- * @brief      This API saves cert info in DB.
- *
- *              This API is for package-manager client application.\n
- *
- * @param[in]  pkgid                           package ID
- * @param[in]  handle                          pointer to cert info handle
- * @return     0 if success, error code(<0) if fail\n
-*/
-int pkgmgr_installer_save_certinfo(const char *pkgid, pkgmgr_instcertinfo_h handle, uid_t uid);
-
-/**
- * @brief      This API destroys cert info handle freeing all resources.
- *
- *              This API is for package-manager client application.\n
- *
- * @param[in]  handle                          pointer to cert info handle
- * @return     0 if success, error code(<0) if fail\n
-*/
-int pkgmgr_installer_destroy_certinfo_set_handle(pkgmgr_instcertinfo_h handle);
-
-/**
- * @brief      This API deletes cert info from DB. To be used to cleanup info upon pkg uninstallation
- *
- *              This API is for package-manager client application.\n
- *
- * @param[in]  pkgid                           package ID
- * @return     0 if success, error code(<0) if fail\n
-*/
- int pkgmgr_installer_delete_certinfo(const char *pkgid);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif                         /* __PKGMGR_INSTALLER_H__ */
-
diff --git a/comm/pkgmgr_installer_config.h b/comm/pkgmgr_installer_config.h
deleted file mode 100644 (file)
index 2aeb12c..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * slp-pkgmgr
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
- *
- * 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 __PACKAGE_INSTALLER_CONFIG_H__
-#define __PACKAGE_INSTALLER_CONFIG_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define OPTVAL_PRELOAD 1000
-#define OPTVAL_FORCE_REMOVAL 1001
-
-/* Supported options */
-const char *short_opts = "k:l:i:d:c:m:t:o:r:p:s:b:e:M:y:q";
-const struct option long_opts[] = {
-       { "session-id", 1, NULL, 'k' },
-       { "license-path", 1, NULL, 'l' },
-       { "install", 1, NULL, 'i' },
-       { "uninstall", 1, NULL, 'd' },
-       { "clear", 1, NULL, 'c' },
-       { "move", 1, NULL, 'm' },
-       { "move-type", 1, NULL, 't' },
-       { "optional-data", 0, NULL, 'o' },
-       { "reinstall", 0, NULL, 'r' },
-       { "caller-pkgid", 1, NULL, 'p' },
-       { "tep-path", 1, NULL, 'e' },
-       { "tep-move", 1, NULL, 'M' },
-       { "smack", 1, NULL, 's' },
-       { "direct-manifest-install", 1, NULL, 'y' },
-       { "recovery", 1, NULL, 'b' },
-        { "preload", 0, NULL, OPTVAL_PRELOAD },
-       { "force-remove", 0, NULL, OPTVAL_FORCE_REMOVAL },
-       { 0, 0, 0, 0 }  /* sentinel */
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif                         /* __PACKAGE_INSTALLER_CONFIG_H__ */
diff --git a/include/package-manager-debug.h b/include/package-manager-debug.h
deleted file mode 100644 (file)
index b61b00d..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * slp-pkgmgr
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
-  * Contact: junsuk. oh <junsuk77.oh@samsung.com>
- *
- * 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 __PKG_MANAGER_DEBUG_H__
-#define __PKG_MANAGER_DEBUG_H__
-
-#include <dlog.h>
-
-#ifndef ERR
-#define ERR(fmt, args...) LOGE("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
-#endif
-
-#ifndef DBG
-#define DBG(fmt, args...) LOGD("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
-#endif
-
-#ifndef INFO
-#define INFO(fmt, args...) LOGI("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
-#endif
-
-#endif  /* __PKG_MANAGER_DEBUG_H__ */
diff --git a/installer/CMakeLists.txt b/installer/CMakeLists.txt
new file mode 100644 (file)
index 0000000..aa2afa1
--- /dev/null
@@ -0,0 +1,60 @@
+### Description
+# Communication modules for pkg-mgr client lib and server process
+# By Youmin Ha <youmin.ha@samsung.com>
+
+cmake_minimum_required(VERSION 2.6)
+#set(CMAKE_SKIP_BUILD_RPATH true)
+set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
+
+
+### Versioning
+if(DEFINED ${VERSION})
+       message("VERSION: ${VERSION}")
+else()
+       message("VERSION is not defined. set it as 0.1.0")
+       set(VERSION 0.1.0)
+endif()
+if(DEFINED ${VERSION_MAJOR})
+       message("VERSION_MAJOR: ${VERSION_MAJOR}")
+else()
+       message( "VERSION_MAJOR is not defined. set it as 0")
+       set(VERSION_MAJOR 0)
+endif()
+message(STATUS "version/major : ${VERSION} / ${VERSION_MAJOR}")
+
+### Get required CFLAGS, LDFLAGS from pkg-config
+
+include(FindPkgConfig)
+pkg_check_modules(installer_pkgs REQUIRED glib-2.0 gio-2.0 dlog pkgmgr-info)
+foreach(flag ${installer_pkgs_CFLAGS})
+       set(installer_pkgs_CFLAGS_str "${installer_pkgs_CFLAGS_str} ${flag}")
+endforeach()
+
+### Build modules
+
+## pkgmgr_installer object (by youmin.ha)
+# This library is for installer backend
+add_library(pkgmgr_installer SHARED pkgmgr_installer.c)
+set_target_properties(pkgmgr_installer PROPERTIES SOVERSION ${VERSION_MAJOR})
+set_target_properties(pkgmgr_installer PROPERTIES VERSION ${VERSION})
+set_target_properties(pkgmgr_installer PROPERTIES COMPILE_FLAGS "${installer_pkgs_CFLAGS_str}")
+target_link_libraries(pkgmgr_installer ${installer_pkgs_LDFLAGS})
+
+
+### Create pc file
+configure_file(pkgmgr-installer.pc.in ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr-installer.pc @ONLY)
+
+
+## Install
+INSTALL(TARGETS
+                       pkgmgr_installer
+            DESTINATION ${LIB_INSTALL_DIR}
+               COMPONENT RuntimeLibraries)
+INSTALL(FILES
+                       pkgmgr_installer.h
+               DESTINATION include/pkgmgr)
+
+
+INSTALL(FILES
+               ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr-installer.pc
+        DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
diff --git a/installer/pkgmgr-installer.pc.in b/installer/pkgmgr-installer.pc.in
new file mode 100644 (file)
index 0000000..06c0002
--- /dev/null
@@ -0,0 +1,16 @@
+#
+# Copyright (c) 2008 ~ 2010 Samsung Electronics Co., Ltd.
+# All rights reserved.
+#
+
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: package manager installer library
+Description: SLP package manager's installer lib for each backends
+Version: @VERSION@
+Requires:
+Libs: -L${libdir} -lpkgmgr_installer
+Cflags: -I${includedir}/pkgmgr
diff --git a/installer/pkgmgr_installer.c b/installer/pkgmgr_installer.c
new file mode 100644 (file)
index 0000000..b22d46b
--- /dev/null
@@ -0,0 +1,596 @@
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <getopt.h>
+
+#include <gio/gio.h>
+
+#include "pkgmgr_installer.h"
+#include "pkgmgr_installer_config.h"
+#include "pkgmgr_installer_debug.h"
+
+#include "../client/include/comm_config.h"
+
+#include <pkgmgr-info.h>
+
+/* API export macro */
+#ifndef API
+#define API __attribute__ ((visibility("default")))
+#endif
+
+#define MAX_STRLEN 1024
+#define MAX_QUERY_LEN  4096
+
+#define CHK_PI_RET(r) \
+       do { if (NULL == pi) return (r); } while (0)
+
+struct pkgmgr_installer {
+       int request_type;
+       int move_type;
+       char *pkgmgr_info;
+       char *session_id;
+       char *license_path;
+       char *optional_data;
+       char *caller_pkgid;
+       uid_t target_uid;
+       char *tep_path;
+       int tep_move;
+       int is_tep_included;
+       int is_preload;
+       int force_removal;
+       GDBusConnection *conn;
+};
+
+static const char *__get_signal_name(pkgmgr_installer *pi, const char *key)
+{
+       if (strcmp(key, PKGMGR_INSTALLER_INSTALL_PERCENT_KEY_STR) == 0)
+               return COMM_STATUS_BROADCAST_EVENT_INSTALL_PROGRESS;
+       else if (strcmp(key, PKGMGR_INSTALLER_GET_SIZE_KEY_STR) == 0)
+               return COMM_STATUS_BROADCAST_EVENT_GET_SIZE;
+       else if (strcmp(key, PKGMGR_INSTALLER_APPID_KEY_STR) == 0)
+               return COMM_STATUS_BROADCAST_EVENT_UNINSTALL;
+
+       switch (pi->request_type) {
+       case PKGMGR_REQ_INSTALL:
+               return COMM_STATUS_BROADCAST_EVENT_INSTALL;
+       case PKGMGR_REQ_UNINSTALL:
+               return COMM_STATUS_BROADCAST_EVENT_UNINSTALL;
+       case PKGMGR_REQ_UPGRADE:
+               return COMM_STATUS_BROADCAST_EVENT_UPGRADE;
+       case PKGMGR_REQ_MOVE:
+               return COMM_STATUS_BROADCAST_EVENT_MOVE;
+       case PKGMGR_REQ_ENABLE_APP:
+               return COMM_STATUS_BROADCAST_EVENT_ENABLE_APP;
+       case PKGMGR_REQ_DISABLE_APP:
+               return COMM_STATUS_BROADCAST_EVENT_DISABLE_APP;
+       }
+
+       ERR("cannot find type, send signal with type SIGNAL_STATUS");
+
+       return COMM_STATUS_BROADCAST_SIGNAL_STATUS;
+}
+
+static int __send_signal_for_app_event(pkgmgr_installer *pi, const char *pkg_type,
+               const char *pkgid, const char *appid, const char *key, const char *val)
+{
+       char *sid;
+       const char *name;
+       GError *err = NULL;
+
+       if (!pi || pi->conn == NULL || appid == NULL)
+               return -1;
+
+       sid = pi->session_id;
+       if (!sid)
+               sid = "";
+
+       name = __get_signal_name(pi, key);
+       if (name == NULL) {
+               ERR("unknown signal type");
+               return -1;
+       }
+
+       if (g_dbus_connection_emit_signal(pi->conn, NULL,
+                               COMM_STATUS_BROADCAST_OBJECT_PATH,
+                               COMM_STATUS_BROADCAST_INTERFACE, name,
+                               g_variant_new("(ussssss)", pi->target_uid, sid,
+                                       pkg_type, pkgid, appid, key, val), &err)
+                       != TRUE) {
+               ERR("failed to send dbus signal: %s", err->message);
+               g_error_free(err);
+               return -1;
+       }
+
+       return 0;
+}
+
+static int __send_signal_for_event(pkgmgr_installer *pi, const char *pkg_type,
+               const char *pkgid, const char *key, const char *val)
+{
+       char *sid;
+       const char *name;
+       GError *err = NULL;
+
+       if (!pi || pi->conn == NULL)
+               return -1;
+
+       sid = pi->session_id;
+       if (!sid)
+               sid = "";
+
+       name = __get_signal_name(pi, key);
+       if (name == NULL) {
+               ERR("unknown signal type");
+               return -1;
+       }
+
+       if (g_dbus_connection_emit_signal(pi->conn, NULL,
+                               COMM_STATUS_BROADCAST_OBJECT_PATH,
+                               COMM_STATUS_BROADCAST_INTERFACE, name,
+                               g_variant_new("(ussssss)", pi->target_uid, sid,
+                                       pkg_type, pkgid, "", key, val), &err)
+                       != TRUE) {
+               ERR("failed to send dbus signal: %s", err->message);
+               g_error_free(err);
+               return -1;
+       }
+
+       return 0;
+}
+
+API pkgmgr_installer *pkgmgr_installer_new(void)
+{
+       pkgmgr_installer *pi;
+       GError *err = NULL;
+
+       pi = calloc(1, sizeof(struct pkgmgr_installer));
+       if (pi == NULL)
+               return NULL;
+
+       pi->conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
+       if (pi->conn == NULL) {
+               ERR("failed to get bus: %s", err->message);
+               g_error_free(err);
+               free(pi);
+               return NULL;
+       }
+
+       pi->tep_path = NULL;
+       pi->tep_move = 0;
+       pi->request_type = PKGMGR_REQ_INVALID;
+
+       return pi;
+}
+
+API pkgmgr_installer *pkgmgr_installer_offline_new(void)
+{
+       pkgmgr_installer *pi;
+
+       pi = calloc(1, sizeof(struct pkgmgr_installer));
+       if (pi == NULL)
+               return NULL;
+
+       pi->tep_path = NULL;
+       pi->tep_move = 0;
+       pi->request_type = PKGMGR_REQ_INVALID;
+
+       return pi;
+}
+
+API int pkgmgr_installer_free(pkgmgr_installer *pi)
+{
+       CHK_PI_RET(-EINVAL);
+
+       /* free members */
+       if (pi->pkgmgr_info)
+               free(pi->pkgmgr_info);
+       if (pi->session_id)
+               free(pi->session_id);
+       if (pi->optional_data)
+               free(pi->optional_data);
+       if (pi->caller_pkgid)
+               free(pi->caller_pkgid);
+       if (pi->tep_path)
+               free(pi->tep_path);
+
+       if (pi->conn) {
+               g_dbus_connection_flush_sync(pi->conn, NULL, NULL);
+               g_object_unref(pi->conn);
+       }
+
+       free(pi);
+
+       return 0;
+}
+
+API int
+pkgmgr_installer_receive_request(pkgmgr_installer *pi,
+                                const int argc, char **argv)
+{
+       CHK_PI_RET(-EINVAL);
+
+       int r = 0;
+
+       /* Parse argv */
+       optind = 1;             /* Initialize optind to clear prev. index */
+       int opt_idx = 0;
+       int c;
+       int mode = 0;
+
+       pi->target_uid = getuid();
+       while (1) {
+               c = getopt_long(argc, argv, short_opts, long_opts, &opt_idx);
+               /* printf("c=%d %c\n", c, c); //debug */
+               if (-1 == c)
+                       break;  /* Parse is end */
+               switch (c) {
+               case OPTVAL_PRELOAD:    /* request for preload app */
+                       pi->is_preload = 1;
+                       DBG("preload request [%d]", pi->is_preload );
+                       break;
+               case OPTVAL_FORCE_REMOVAL:      /* request for force-remove */
+                       pi->force_removal = 1;
+                       DBG("force-remove request [%d]", pi->force_removal );
+                       break;
+               case 'k':       /* session id */
+                       if (pi->session_id)
+                               free(pi->session_id);
+                       pi->session_id = strndup(optarg, MAX_STRLEN);
+                       break;
+
+               case 'l':       /* license path */
+                       if (pi->license_path)
+                               free(pi->license_path);
+                       pi->license_path = strndup(optarg, MAX_STRLEN);
+                       break;
+
+               case 'i':       /* install */
+                       if (mode) {
+                               r = -EINVAL;
+                               goto RET;
+                       }
+                       mode = 'i';
+                       pi->request_type = PKGMGR_REQ_INSTALL;
+                       if (pi->pkgmgr_info)
+                               free(pi->pkgmgr_info);
+                       pi->pkgmgr_info = strndup(optarg, MAX_STRLEN);
+                       DBG("option is [i] pkgid[%s]", pi->pkgmgr_info );
+                       if (pi->pkgmgr_info && strlen(pi->pkgmgr_info)==0){
+                               free(pi->pkgmgr_info);
+                       }else{
+                               mode = 'i';
+                       }
+                       break;
+
+               case 'e':       /* install */
+                       if (pi->tep_path)
+                               free(pi->tep_path);
+                       pi->tep_path = strndup(optarg, MAX_STRLEN);
+                       pi->is_tep_included = 1;
+                       DBG("option is [e] tep_path[%s]", pi->tep_path);
+                       break;
+
+               case 'M':       /* install */
+                       if (strcmp(optarg, "tep_move") == 0)
+                               pi->tep_move = 1;
+                       else
+                               pi->tep_move = 0;
+                       DBG("option is [M] tep_move[%d]", pi->tep_move);
+                       break;
+
+               case 'd':       /* uninstall */
+                       if (mode) {
+                               r = -EINVAL;
+                               goto RET;
+                       }
+                       mode = 'd';
+                       pi->request_type = PKGMGR_REQ_UNINSTALL;
+                       if (pi->pkgmgr_info)
+                               free(pi->pkgmgr_info);
+                       pi->pkgmgr_info = strndup(optarg, MAX_STRLEN);
+                       break;
+
+
+               case 'c':       /* clear */
+                       if (mode) {
+                               r = -EINVAL;
+                               goto RET;
+                       }
+                       mode = 'c';
+                       pi->request_type = PKGMGR_REQ_CLEAR;
+                       if (pi->pkgmgr_info)
+                               free(pi->pkgmgr_info);
+                       pi->pkgmgr_info = strndup(optarg, MAX_STRLEN);
+                       break;
+
+               case 'm':       /* move */
+                       if (mode) {
+                               r = -EINVAL;
+                               goto RET;
+                       }
+                       mode = 'm';
+                       pi->request_type = PKGMGR_REQ_MOVE;
+                       if (pi->pkgmgr_info)
+                               free(pi->pkgmgr_info);
+                       pi->pkgmgr_info = strndup(optarg, MAX_STRLEN);
+                       break;
+
+               case 'r':       /* reinstall */
+                       if (mode) {
+                               r = -EINVAL;
+                               goto RET;
+                       }
+                       mode = 'r';
+                       pi->request_type = PKGMGR_REQ_REINSTALL;
+                       if (pi->pkgmgr_info)
+                               free(pi->pkgmgr_info);
+                       pi->pkgmgr_info = strndup(optarg, MAX_STRLEN);
+                       break;
+
+               case 't': /* move type*/
+                       pi->move_type = atoi(optarg);
+                       break;
+
+               case 'p': /* caller pkgid*/
+                       if (pi->caller_pkgid)
+                               free(pi->caller_pkgid);
+                       pi->caller_pkgid = strndup(optarg, MAX_STRLEN);
+
+                       break;
+
+               case 's':       /* smack */
+                       if (mode) {
+                               r = -EINVAL;
+                               goto RET;
+                       }
+                       mode = 's';
+                       pi->request_type = PKGMGR_REQ_SMACK;
+                       if (pi->pkgmgr_info)
+                               free(pi->pkgmgr_info);
+                       pi->pkgmgr_info = strndup(optarg, MAX_STRLEN);
+                       break;
+
+               case 'o': /* optional data*/
+                       pi->optional_data = strndup(optarg, MAX_STRLEN);
+                       break;
+
+               case 'y': /* pkgid for direct manifest installation */
+                       mode = 'y';
+                       pi->request_type = PKGMGR_REQ_MANIFEST_DIRECT_INSTALL;
+                       pi->pkgmgr_info = strndup(optarg, MAX_STRLEN);
+                       break;
+
+               case 'b': /* recovery */
+                       if (mode) {
+                               r = -EINVAL;
+                               goto RET;
+                       }
+                       mode = 'b';
+                       pi->request_type = PKGMGR_REQ_RECOVER;
+                       if (pi->pkgmgr_info)
+                               free(pi->pkgmgr_info);
+                       pi->pkgmgr_info = strndup(optarg, MAX_STRLEN);
+                       break;
+
+                       /* Otherwise */
+               case '?':       /* Not an option */
+                       break;
+
+               case ':':       /* */
+                       break;
+
+               }
+       }
+
+ RET:
+       return r;
+}
+
+API int pkgmgr_installer_get_request_type(pkgmgr_installer *pi)
+{
+       CHK_PI_RET(PKGMGR_REQ_INVALID);
+       return pi->request_type;
+}
+
+API const char *pkgmgr_installer_get_request_info(pkgmgr_installer *pi)
+{
+       CHK_PI_RET(PKGMGR_REQ_INVALID);
+       return pi->pkgmgr_info;
+}
+
+API const char *pkgmgr_installer_get_tep_path(pkgmgr_installer *pi)
+{
+       CHK_PI_RET(PKGMGR_REQ_INVALID);
+       return pi->tep_path;
+}
+
+API int pkgmgr_installer_get_tep_move_type(pkgmgr_installer *pi)
+{
+       CHK_PI_RET(PKGMGR_REQ_INVALID);
+       return pi->tep_move;
+}
+
+API const char *pkgmgr_installer_get_session_id(pkgmgr_installer *pi)
+{
+       CHK_PI_RET(PKGMGR_REQ_INVALID);
+       return pi->session_id;
+}
+
+API const char *pkgmgr_installer_get_license_path(pkgmgr_installer *pi)
+{
+       CHK_PI_RET(PKGMGR_REQ_INVALID);
+       return pi->license_path;
+}
+
+API const char *pkgmgr_installer_get_optional_data(pkgmgr_installer *pi)
+{
+       CHK_PI_RET(PKGMGR_REQ_INVALID);
+       return pi->optional_data;
+}
+
+API int pkgmgr_installer_is_quiet(pkgmgr_installer *pi)
+{
+       return 1;
+}
+
+API int pkgmgr_installer_get_move_type(pkgmgr_installer *pi)
+{
+       CHK_PI_RET(PKGMGR_REQ_INVALID);
+       return pi->move_type;
+}
+
+API const char *pkgmgr_installer_get_caller_pkgid(pkgmgr_installer *pi)
+{
+       CHK_PI_RET(PKGMGR_REQ_INVALID);
+       return pi->caller_pkgid;
+}
+
+API int pkgmgr_installer_get_is_preload(pkgmgr_installer *pi)
+{
+       CHK_PI_RET(PKGMGR_REQ_INVALID);
+       return pi->is_preload;
+}
+
+API int pkgmgr_installer_get_force_removal(pkgmgr_installer *pi)
+{
+       CHK_PI_RET(PKGMGR_REQ_INVALID);
+       return pi->force_removal;
+}
+
+API int pkgmgr_installer_send_app_uninstall_signal(pkgmgr_installer *pi,
+                            const char *pkg_type,
+                            const char *pkgid,
+                            const char *val)
+{
+       int ret = 0;
+       ret = __send_signal_for_event(pi, pkg_type, pkgid,
+                       PKGMGR_INSTALLER_APPID_KEY_STR, val);
+       return ret;
+}
+
+API int pkgmgr_installer_set_uid(pkgmgr_installer *pi, uid_t uid)
+{
+       if (pi == NULL)
+               return -1;
+
+       pi->target_uid = uid;
+
+       return 0;
+}
+
+API int
+pkgmgr_installer_send_app_signal(pkgmgr_installer *pi,
+                            const char *pkg_type,
+                            const char *pkgid,
+                            const char *appid,
+                            const char *key, const char *val)
+{
+       int r = 0;
+
+       if (!pi->conn) {
+               ERR("connection is NULL");
+               return -1;
+       }
+
+       r = __send_signal_for_app_event(pi, pkg_type, pkgid, appid, key, val);
+
+       return r;
+}
+
+API int
+pkgmgr_installer_send_signal(pkgmgr_installer *pi,
+                            const char *pkg_type,
+                            const char *pkgid,
+                            const char *key, const char *val)
+{
+       int r = 0;
+
+       if (!pi->conn) {
+               ERR("connection is NULL");
+               return -1;
+       }
+
+       if (strcmp(key, PKGMGR_INSTALLER_UPGRADE_EVENT_STR) == 0)
+               pi->request_type = PKGMGR_REQ_UPGRADE;
+
+       r = __send_signal_for_event(pi, pkg_type, pkgid, key, val);
+
+       return r;
+}
+
+API int pkgmgr_installer_set_request_type(pkgmgr_installer *pi, int request_type)
+{
+       if (pi == NULL)
+               return -1;
+
+       pi->request_type = request_type;
+       return 0;
+}
+
+API int pkgmgr_installer_set_session_id(pkgmgr_installer *pi, const char *session_id)
+{
+       if (pi == NULL || session_id == NULL)
+               return -1;
+
+       pi->session_id = strndup(session_id, MAX_STRLEN);
+       return 0;
+}
+
+API int pkgmgr_installer_create_certinfo_set_handle(pkgmgr_instcertinfo_h *handle)
+{
+       int ret = 0;
+       ret = pkgmgrinfo_create_certinfo_set_handle(handle);
+       return ret;
+}
+
+API int pkgmgr_installer_set_cert_value(pkgmgr_instcertinfo_h handle, pkgmgr_instcert_type cert_type, char *cert_value)
+{
+       int ret = 0;
+       ret = pkgmgrinfo_set_cert_value(handle, cert_type, cert_value);
+       return ret;
+}
+
+API int pkgmgr_installer_save_certinfo(const char *pkgid, pkgmgr_instcertinfo_h handle, uid_t uid)
+{
+       int ret = 0;
+       ret = pkgmgrinfo_save_certinfo(pkgid, handle, uid);
+       return ret;
+}
+
+API int pkgmgr_installer_destroy_certinfo_set_handle(pkgmgr_instcertinfo_h handle)
+{
+       int ret = 0;
+       ret = pkgmgrinfo_destroy_certinfo_set_handle(handle);
+       return ret;
+}
+
+API int pkgmgr_installer_delete_certinfo(const char *pkgid)
+{
+       int ret = 0;
+       ret = pkgmgrinfo_delete_certinfo(pkgid);
+       return ret;
+}
diff --git a/installer/pkgmgr_installer.h b/installer/pkgmgr_installer.h
new file mode 100644 (file)
index 0000000..fa323f1
--- /dev/null
@@ -0,0 +1,842 @@
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+
+#include <sys/types.h>
+
+#ifndef __PKGMGR_INSTALLER_H__
+#define __PKGMGR_INSTALLER_H__
+
+/**
+ * @file pkgmgr_installer.h
+ * @author Youmin Ha <youmin.ha@samsung.com>
+ * @version 0.1
+ * @brief    This file declares API of pkgmgr_installer
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * pkgmgr_installer is an opaque type for an object
+ */
+typedef struct pkgmgr_installer pkgmgr_installer;
+typedef void* pkgmgr_instcertinfo_h;
+
+/**
+ * @brief listening event type in pkgmgr.
+ */
+#define PKGMGR_INSTALLER_START_KEY_STR           "start"
+#define PKGMGR_INSTALLER_END_KEY_STR             "end"
+#define PKGMGR_INSTALLER_ERROR_KEY_STR           "error"
+#define PKGMGR_INSTALLER_APPID_KEY_STR           "appid"
+#define PKGMGR_INSTALLER_INSTALL_PERCENT_KEY_STR "install_percent"
+#define PKGMGR_INSTALLER_GET_SIZE_KEY_STR        "get_size"
+
+#define PKGMGR_INSTALLER_INSTALL_EVENT_STR       "install"
+#define PKGMGR_INSTALLER_UNINSTALL_EVENT_STR     "uninstall"
+#define PKGMGR_INSTALLER_CLEAR_EVENT_STR         "clear"
+#define PKGMGR_INSTALLER_MOVE_EVENT_STR          "move"
+#define PKGMGR_INSTALLER_UPGRADE_EVENT_STR       "update"
+#define PKGMGR_INSTALLER_OK_EVENT_STR            "ok"
+#define PKGMGR_INSTALLER_FAIL_EVENT_STR          "fail"
+
+#define PKGMGR_INSTALLER_APP_DISABLE_EVENT_STR         "disable_app"
+#define PKGMGR_INSTALLER_APP_ENABLE_EVENT_STR          "enable_app"
+#define PKGMGR_INSTALLER_GLOBAL_APP_DISABLE_FOR_UID    "disable_global_app_for_uid"
+#define PKGMGR_INSTALLER_GLOBAL_APP_ENABLE_FOR_UID     "enable_global_app_for_uid"
+
+
+/**
+ * Request type.
+ */
+enum {
+       PKGMGR_REQ_PERM = -1,
+       PKGMGR_REQ_INVALID = 0,
+       PKGMGR_REQ_INSTALL = 1,
+       PKGMGR_REQ_UNINSTALL = 2,
+       PKGMGR_REQ_CLEAR = 3,
+       PKGMGR_REQ_MOVE = 4,
+       PKGMGR_REQ_RECOVER = 5,
+       PKGMGR_REQ_REINSTALL = 6,
+       PKGMGR_REQ_GETSIZE = 7,
+       PKGMGR_REQ_UPGRADE = 8,
+       PKGMGR_REQ_SMACK = 9,
+       PKGMGR_REQ_MANIFEST_DIRECT_INSTALL = 10,
+       PKGMGR_REQ_ENABLE_APP = 11,
+       PKGMGR_REQ_DISABLE_APP = 12
+};
+
+enum {
+       PKGMGR_INSTALLER_EINVAL = -2,           /**< Invalid argument */
+       PKGMGR_INSTALLER_ERROR = -1,            /**< General error */
+       PKGMGR_INSTALLER_EOK = 0                        /**< General success */
+};
+
+
+typedef enum {
+       PM_SET_AUTHOR_ROOT_CERT = 0,
+       PM_SET_AUTHOR_INTERMEDIATE_CERT = 1,
+       PM_SET_AUTHOR_SIGNER_CERT = 2,
+       PM_SET_DISTRIBUTOR_ROOT_CERT = 3,
+       PM_SET_DISTRIBUTOR_INTERMEDIATE_CERT = 4,
+       PM_SET_DISTRIBUTOR_SIGNER_CERT = 5,
+       PM_SET_DISTRIBUTOR2_ROOT_CERT = 6,
+       PM_SET_DISTRIBUTOR2_INTERMEDIATE_CERT = 7,
+       PM_SET_DISTRIBUTOR2_SIGNER_CERT = 8,
+}pkgmgr_instcert_type;
+
+
+/**
+ * @brief      Create a pkgmgr_installer object.
+ * @pre                None
+ * @post       pkgmgr_installer object must be freed.
+ * @see                pkgmgr_installer_free
+ * @return     pkgmgr_installer object
+ * @retval     NULL    on failure creating an object
+ * @remark     None
+@code
+#include <pkgmgr_installer.h>
+pkgmgr_installer *pi = pkgmgr_installer_new();
+pkgmgr_installer_free(pi);
+@endcode
+ */
+pkgmgr_installer *pkgmgr_installer_new(void);
+
+/**
+ * @brief      Create a pkgmgr_installer object in offline mode
+ * @pre                None
+ * @post       pkgmgr_installer object must be freed.
+ * @see                pkgmgr_installer_free
+ * @return     pkgmgr_installer object
+ * @retval     NULL    on failure creating an object
+ * @remark     None
+@code
+#include <pkgmgr_installer.h>
+pkgmgr_installer *pi = pkgmgr_installer_offline_new();
+pkgmgr_installer_free(pi);
+@endcode
+ */
+pkgmgr_installer *pkgmgr_installer_offline_new(void);
+
+/**
+       @brief          Free a pkgmgr_installer object
+       @pre            pi must be a valid object.
+       @post           None
+       @see            pkgmgr_installer_new
+       @param[in]      pi      A pkgmgr_installer object
+       @return         Operation result
+       @retval         0       on success
+       @retval         -errno  on error
+       @remark         None
+       @code
+#include <pkgmgr_installer.h>
+pkgmgr_installer *pi = pkgmgr_installer_new();
+pkgmgr_installer_free(pi);
+       @endcode
+ */
+int pkgmgr_installer_free(pkgmgr_installer *pi);
+
+/**
+       @brief          Receive a request from argv
+       @pre            None
+       @post           pkgmgr_installer_get_*(), pkgmgr_installer_is_quiet() can be called.
+       @see            pkgmgr_installer_get_request_type, pkgmgr_installer_get_request_info, pkgmgr_installer_get_session_id, pkgmgr_installer_is_quiet
+       @param[in]      pi      a pkgmgr_installer object
+       @param[in]      argc    argc from system
+       @param[in]      argv    argv from system
+       @return         Operation result
+       @retval         0 on success
+       @retval         -errno on failure
+       @remark         None
+       @code
+#include <pkgmgr_installer.h>
+int main(int argc, char **argv)
+{
+       pkgmgr_installer *pi;
+       int r;
+
+       pi = pkgmgr_installer_new();
+       int r = pkgmgr_installer_receive_request(pi, argc, argv);
+       pkgmgr_installer_free(pi);
+
+       return 0;
+}
+       @endcode
+ */
+int pkgmgr_installer_receive_request(pkgmgr_installer *pi,
+                                    const int argc, char **argv);
+
+/**
+       @brief          Get request type
+       @pre            pkgmgr_installer_receive_request() must be called.
+       @post           None
+       @see            pkgmgr_installer_receive_request
+       @param[in]      pi      pkgmgr_installer object
+       @return         Request type (One of PKGMGR_REQ_* enum values)
+       @remark         None
+       @code
+int main(int argc, char **argv)
+{
+       pkgmgr_installer *pi;
+       int r = 0;
+
+       pi = pkgmgr_installer_new();
+       if(!pi) return -1;
+       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
+               r = -1;
+               goto CLEANUP_RET;
+       }
+
+       switch(pkgmgr_installer_get_request_type(pi)) {
+               case PKGMGR_REQ_PERM:
+                       // Do error processing
+                       break;
+               case PKGMGR_REQ_INVALID:
+                       // Do error processing
+                       r = -1;
+                       break;
+               case PKGMGR_REQ_INSTALL:
+                       // Do install processing
+                       break;
+               case PKGMGR_REQ_UNINSTALL:
+                       // Do uninstall processing
+                       break;
+               case PKGMGR_REQ_RECOVER:
+                       // Do recovere processing
+                       break;
+               case PKGMGR_REQ_REINSTALL:
+                       // Do reinstall processing
+                       break;
+               default:
+                       goto CLEANUP_END;
+       }
+CLEANUP_END:
+       pkgmgr_installer_free(pi);
+
+       return r;
+}
+       @endcode
+ */
+int pkgmgr_installer_get_request_type(pkgmgr_installer *pi);
+
+/**
+       @brief          Get request info
+       @pre            pkgmgr_installer_receive_request() must be called.
+       @post           None
+       @see            pkgmgr_installer_receive_request
+       @param[in]      pi      pkgmgr_installer object
+       @return         Request info. When PKGMGR_REQ_INSTALL, this is a package file path to be installed. When PKGMGR_REQ_UNINSTALL, this is a package name to be uninstalled.
+       @retval         NULL    on function failure
+       @remark         Returned string must not be modified.
+       @code
+#include <pkgmgr_installer.h>
+int main(int argc, char **argv)
+{
+       pkgmgr_installer *pi;
+       int r = 0;
+       char *req_info = NULL;
+
+       pi = pkgmgr_installer_new();
+       if(!pi) return -1;
+       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
+               r = -1;
+               goto CLEANUP_RET;
+       }
+       req_info = (char *) pkgmgr_installer_get_request_info(pi);
+
+       // Do something...
+
+       pkgmgr_installer_free(pi);
+       return r;
+}
+       @endcode
+ */
+const char *pkgmgr_installer_get_request_info(pkgmgr_installer *pi);
+
+/**
+       @brief          Get TEP path
+       @pre            pkgmgr_installer_receive_request() must be called.
+       @post           None
+       @see            pkgmgr_installer_receive_request
+       @param[in]      pi      pkgmgr_installer object
+       @return         TEP path if exists
+       @retval         NULL    on function failure
+       @remark         Returned string must not be modified.
+       @code
+#include <pkgmgr_installer.h>
+int main(int argc, char **argv)
+{
+       pkgmgr_installer *pi;
+       int r = 0;
+       char *tep_path = NULL;
+
+       pi = pkgmgr_installer_new();
+       if(!pi) return -1;
+       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
+               r = -1;
+               goto CLEANUP_RET;
+       }
+       tep_path = (char *) pkgmgr_installer_get_tep_path(pi);
+
+       // Do something...
+
+       pkgmgr_installer_free(pi);
+       return r;
+}
+@endcode
+ */
+const char *pkgmgr_installer_get_tep_path(pkgmgr_installer *pi);
+
+/**
+       @brief          Get TEP move type
+       @pre            pkgmgr_installer_receive_request() must be called.
+       @post           None
+       @see            pkgmgr_installer_receive_request
+       @param[in]      pi      pkgmgr_installer object
+       @return         integer value indicates tep move type(0: copy TEP file / 1: move TEP file)
+       @retval         0       on function failure
+       @remark         Returned string must not be modified.
+       @code
+#include <pkgmgr_installer.h>
+int main(int argc, char **argv)
+{
+       pkgmgr_installer *pi;
+       int r = 0;
+       int tep_move_type = -1;
+
+       pi = pkgmgr_installer_new();
+       if(!pi) return -1;
+       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
+               r = -1;
+               goto CLEANUP_RET;
+       }
+       tep_move_type = pkgmgr_installer_get_tep_move_type(pi);
+
+       // Do something...
+
+       pkgmgr_installer_free(pi);
+       return r;
+}
+@endcode
+ */
+int pkgmgr_installer_get_tep_move_type(pkgmgr_installer *pi);
+
+/**
+       @brief          Get session ID for a certain session
+       @pre            pkgmgr_installer_receive_request() must be called.
+       @post           None
+       @see            pkgmgr_installer_receive_request
+       @param[in]      pi      pkgmgr_installer object
+       @return         A session ID
+       @retval         NULL    on function failure
+       @remark         Returned string must not be modified.
+       @code
+#include <pkgmgr_installer.h>
+int main(int argc, char **argv)
+{
+       pkgmgr_installer *pi;
+       int r = 0;
+       char *session_id = NULL;
+
+       pi = pkgmgr_installer_new();
+       if(!pi) return -1;
+       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
+               r = -1;
+               goto CLEANUP_RET;
+       }
+       session_id = (char *) pkgmgr_installer_get_session_id(pi);
+
+       // Do something...
+
+       pkgmgr_installer_free(pi);
+       return r;
+}
+@endcode
+ */
+const char *pkgmgr_installer_get_session_id(pkgmgr_installer *pi);
+
+/**
+       @brief          Get a license path
+       @pre            pkgmgr_installer_receive_request() must be called.
+       @post           None
+       @see            pkgmgr_installer_receive_request
+       @param[in]      pi      pkgmgr_installer object
+       @return         license path
+       @retval         NULL    on function failure
+       @remark         Returned string must not be modified.
+       @code
+#include <pkgmgr_installer.h>
+int main(int argc, char **argv)
+{
+       pkgmgr_installer *pi;
+       int r = 0;
+       char *license_path = NULL;
+
+       pi = pkgmgr_installer_new();
+       if(!pi) return -1;
+       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
+               r = -1;
+               goto CLEANUP_RET;
+       }
+       session_id = (char *) pkgmgr_installer_get_license_path(pi);
+
+       // Do something...
+
+       pkgmgr_installer_free(pi);
+       return r;
+}
+@endcode
+ */
+const char *pkgmgr_installer_get_license_path(pkgmgr_installer *pi);
+
+/**
+       @brief          Get a optional data
+       @pre            pkgmgr_installer_receive_request() must be called.
+       @post           None
+       @see            pkgmgr_installer_receive_request
+       @param[in]      pi      pkgmgr_installer object
+       @return         optional data
+       @retval         NULL    on function failure
+       @remark         Returned string must not be modified.
+       @code
+#include <pkgmgr_installer.h>
+int main(int argc, char **argv)
+{
+       pkgmgr_installer *pi;
+       int r = 0;
+       char *optional_data = NULL;
+
+       pi = pkgmgr_installer_new();
+       if(!pi) return -1;
+       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
+               r = -1;
+               goto CLEANUP_RET;
+       }
+       optional_data = (char *) pkgmgr_installer_get_optional_data(pi);
+
+       // Do something...
+
+       pkgmgr_installer_free(pi);
+       return r;
+}
+@endcode
+ */
+const char *pkgmgr_installer_get_optional_data(pkgmgr_installer *pi);
+
+/**
+       @brief          Get if a request is with quite mode or not
+       @pre            pkgmgr_installer_receive_request() must be called.
+       @post           None
+       @see            pkgmgr_installer_receive_request
+       @param[in]      pi      pkgmgr_installer object
+       @return         Operation result
+       @retval         0 if a request is not quiet mode
+       @retval         1 if a request is quiet mode
+       @remark         None
+       @code
+#include <pkgmgr_installer.h>
+int main(int argc, char **argv)
+{
+       pkgmgr_installer *pi;
+       int r = 0;
+
+       pi = pkgmgr_installer_new();
+       if(!pi) return -1;
+       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
+               r = -1;
+               goto CLEANUP_RET;
+       }
+       if(pkgmgr_installer_is_quiet(pi)) {
+               // Do quiet mode work...
+       } else {
+               // Do normal mode work...
+       }
+
+       pkgmgr_installer_free(pi);
+       return r;
+}
+       @endcode
+ */
+int pkgmgr_installer_is_quiet(pkgmgr_installer *pi);
+
+/**
+       @brief          Get move type
+       @pre            pkgmgr_installer_receive_request() must be called.
+       @post           None
+       @see            pkgmgr_installer_receive_request
+       @param[in]      pi      pkgmgr_installer object
+       @return         Operation result
+       @retval         enum value of move type
+       @remark         None
+       @code
+#include <pkgmgr_installer.h>
+int main(int argc, char **argv)
+{
+       pkgmgr_installer *pi;
+       int r = 0;
+
+       pi = pkgmgr_installer_new();
+       if(!pi) return -1;
+       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
+               r = -1;
+               goto CLEANUP_RET;
+       }
+       move_type = pkgmgr_installer_get_move_type(pi);
+
+       //Do Something
+
+       pkgmgr_installer_free(pi);
+       return r;
+}
+       @endcode
+ */
+int pkgmgr_installer_get_move_type(pkgmgr_installer *pi);
+
+/**
+       @brief          Get caller package id
+       @pre            pkgmgr_installer_receive_request() must be called.
+       @post           None
+       @see            pkgmgr_installer_receive_request
+       @param[in]      pi      pkgmgr_installer object
+       @return         Operation result
+       @retval         enum value of move type
+       @remark         None
+       @code
+#include <pkgmgr_installer.h>
+int main(int argc, char **argv)
+{
+       pkgmgr_installer *pi;
+       int r = 0;
+       char *pkgid = NULL;
+
+       pi = pkgmgr_installer_new();
+       if(!pi) return -1;
+       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
+               r = -1;
+               goto CLEANUP_RET;
+       }
+       pkgid = (char *) pkgmgr_installer_get_caller_pkgid(pi);
+
+       // Do something...
+
+       pkgmgr_installer_free(pi);
+       return r;
+}
+       @endcode
+ */
+const char *pkgmgr_installer_get_caller_pkgid(pkgmgr_installer *pi);
+
+/**
+       @brief          Get if the request is for preload app or not
+       @pre            pkgmgr_installer_receive_request() must be called.
+       @post           None
+       @see            pkgmgr_installer_receive_request
+       @param[in]      pi      pkgmgr_installer object
+       @return         Operation result
+       @retval         0 if a request is not for preload
+       @retval         1 if a request is for preload
+       @remark         None
+       @code
+#include <pkgmgr_installer.h>
+int main(int argc, char **argv)
+{
+       pkgmgr_installer *pi;
+       int r = 0;
+       int is_preload = 0;
+
+       pi = pkgmgr_installer_new();
+       if(!pi) return -1;
+       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
+               r = -1;
+               goto CLEANUP_RET;
+       }
+       is_preload = pkgmgr_installer_get_is_preload(pi);
+
+       // Do something...
+
+       pkgmgr_installer_free(pi);
+       return r;
+}
+       @endcode
+ */
+int pkgmgr_installer_get_is_preload(pkgmgr_installer *pi);
+
+/**
+       @brief          Get if the request is for force-removal
+       @pre            pkgmgr_installer_receive_request() must be called.
+       @post           None
+       @see            pkgmgr_installer_receive_request
+       @param[in]      pi      pkgmgr_installer object
+       @return         Operation result
+       @retval         0 if a request is not for force-removal
+       @retval         1 if a request is for force-removal
+       @remark         None
+       @code
+#include <pkgmgr_installer.h>
+int main(int argc, char **argv)
+{
+       pkgmgr_installer *pi;
+       int r = 0;
+       int force_remove = 0;
+
+       pi = pkgmgr_installer_new();
+       if(!pi) return -1;
+       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
+               r = -1;
+               goto CLEANUP_RET;
+       }
+       force_remove = pkgmgr_installer_get_force_removal(pi);
+
+       // Do something...
+
+       pkgmgr_installer_free(pi);
+       return r;
+}
+       @endcode
+ */
+int pkgmgr_installer_get_force_removal(pkgmgr_installer *pi);
+
+/**
+       @brief          Send a app status signal
+       @pre            None
+       @post           None
+       @see            None
+       @param[in]      pi      pkgmgr_installer object
+       @param[in]      pkg_type        package type: "deb", "jar", "wgt", ...
+       @param[in]      pkgid   package id
+       @param[in]      appid   application id
+       @param[in]      key                     Signal key
+       @param[in]      val                     Signal value
+       @return         Operation result
+       @retval         0 on success
+       @retval         -errno on failure
+       @code
+#include <pkgmgr_installer.h>
+void send_app_singal(uid_t uid, int request_type, int req_id,
+               const char *pkg_type, const char *pkgid, const char *appid,
+               const char *key, const char *val)
+{
+       pkgmgr_installer *pi;
+       int r = 0;
+
+       pi = pkgmgr_installer_new();
+       if(!pi) return -1;
+
+       if (pkgmgr_installer_set_uid(pi, uid))
+               goto CLEANUP_RET;
+       if (pkgmgr_installer_set_request_type(pi, request_type))
+               goto CLEANUP_RET;
+       if ((pkgmgr_installer_set_session_id(pi, req_id))
+               goto CLEANUP_RET;
+       pkgmgr_installer_send_app_signal(pi, pkg_type, pkgid, appid, key, val);
+
+}
+       @endcode
+ */
+int pkgmgr_installer_send_app_signal(pkgmgr_installer *pi,
+                            const char *pkg_type,
+                            const char *pkgid,
+                            const char *appid,
+                            const char *key, const char *val);
+
+/**
+       @brief          Send a process status signal
+       @pre            None
+       @post           None
+       @see            None
+       @param[in]      pi      pkgmgr_installer object
+       @param[in]      pkg_type        package type: "deb", "jar", "wgt", ...
+       @param[in]      pkgid   package id
+       @param[in]      key                     Signal key
+       @param[in]      val                     Signal value
+       @return         Operation result
+       @retval         0 on success
+       @retval         -errno on failure
+       @remark         If pkgmgr_installer_receive_request() is not called, the session ID will be null string (=="/0").
+       @code
+#include <pkgmgr_installer.h>
+int main(int argc, char **argv)
+{
+       pkgmgr_installer *pi;
+       int r = 0;
+       char *session_id = NULL;
+
+       pi = pkgmgr_installer_new();
+       if(!pi) return -1;
+       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
+               r = -1;
+               goto CLEANUP_RET;
+       }
+
+       // Do something...
+       pkgmgr_installer_send_signal(pi,
+        "deb", "org.tizen.foo", "install_percent", "100");
+       // A sample signal
+
+       pkgmgr_installer_free(pi);
+       return r;
+}
+       @endcode
+ */
+int pkgmgr_installer_send_signal(pkgmgr_installer *pi,
+                                const char *pkg_type,
+                                const char *pkgid, const char *key,
+                                const char *val);
+
+/**
+       @brief          Send a signal which indicates application is being uninstalled
+       @pre            None
+       @post           None
+       @see            None
+       @param[in]      pi      pkgmgr_installer object
+       @param[in]      pkg_type        package type: "deb", "jar", "wgt", ...
+       @param[in]      pkgid   package id
+       @param[in]      key                     Signal key
+       @param[in]      val                     Signal value
+       @return         Operation result
+       @retval         0 on success
+       @retval         -errno on failure
+       @code
+#include <pkgmgr_installer.h>
+int main(int argc, char **argv)
+{
+       pkgmgr_installer *pi;
+       int r = 0;
+       char *session_id = NULL;
+
+       pi = pkgmgr_installer_new();
+       if(!pi) return -1;
+       if(pkgmgr_installer_receive_request(pi, argc, argv)) {
+               r = -1;
+               goto CLEANUP_RET;
+       }
+
+       // Do something...
+       pkgmgr_installer_send_app_uninstall_signal(pi,
+        "tpk", "org.tizen.foo");
+       // A sample signal
+
+       pkgmgr_installer_free(pi);
+       return r;
+}
+       @endcode
+ */
+int pkgmgr_installer_send_app_uninstall_signal(pkgmgr_installer *pi,
+                            const char *pkg_type,
+                            const char *pkgid,
+                            const char *val);
+
+/**
+ * @brief      This API sets the uid of given pkgmgr_installer.
+ *
+ *              This API is for package-manager client application.\n
+ *
+ * @param[in]pi                                pointer to pkgmgr_installer
+ * @param[in]uid                               uid
+ * @return     0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_installer_set_uid(pkgmgr_installer *pi, uid_t uid);
+
+/**
+ * @brief      This API sets the requst info of given pkgmgr_installer.
+ *
+ *              This API is for package-manager client application.\n
+ *
+ * @param[in]pi                                pointer to pkgmgr_installer
+ * @param[in]  request_type                            request type
+ * @return     0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_installer_set_request_type(pkgmgr_installer *pi, int request_type);
+
+/**
+ * @brief      This API sets the session ID.
+ *
+ *              This API is for package-manager client application.\n
+ *
+ * @param[in]  pi                              pointer to pkgmgr_installer
+ * @param[in]  session_id                              session ID to be set
+ * @return     0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_installer_set_session_id(pkgmgr_installer *pi, const char *session_id);
+
+/**
+ * @brief      This API creates the certinfo handle.
+ *
+ *              This API is for package-manager client application.\n
+ *
+ * @param[out] handle                          pointer to cert info handle
+ * @return     0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_installer_create_certinfo_set_handle(pkgmgr_instcertinfo_h *handle);
+
+/**
+ * @brief      This API sets cert value for corresponding cert type.
+ *
+ *              This API is for package-manager client application.\n
+ *
+ * @param[in]  handle                          pointer to cert info handle
+ * @param[in]  cert_type                       enum value for certificate type
+ * @param[in]  cert_value                      certificate value
+ * @return     0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_installer_set_cert_value(pkgmgr_instcertinfo_h handle, pkgmgr_instcert_type cert_type, char *cert_value);
+
+/**
+ * @brief      This API saves cert info in DB.
+ *
+ *              This API is for package-manager client application.\n
+ *
+ * @param[in]  pkgid                           package ID
+ * @param[in]  handle                          pointer to cert info handle
+ * @return     0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_installer_save_certinfo(const char *pkgid, pkgmgr_instcertinfo_h handle, uid_t uid);
+
+/**
+ * @brief      This API destroys cert info handle freeing all resources.
+ *
+ *              This API is for package-manager client application.\n
+ *
+ * @param[in]  handle                          pointer to cert info handle
+ * @return     0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_installer_destroy_certinfo_set_handle(pkgmgr_instcertinfo_h handle);
+
+/**
+ * @brief      This API deletes cert info from DB. To be used to cleanup info upon pkg uninstallation
+ *
+ *              This API is for package-manager client application.\n
+ *
+ * @param[in]  pkgid                           package ID
+ * @return     0 if success, error code(<0) if fail\n
+*/
+ int pkgmgr_installer_delete_certinfo(const char *pkgid);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif                         /* __PKGMGR_INSTALLER_H__ */
+
diff --git a/installer/pkgmgr_installer_config.h b/installer/pkgmgr_installer_config.h
new file mode 100644 (file)
index 0000000..2aeb12c
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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 __PACKAGE_INSTALLER_CONFIG_H__
+#define __PACKAGE_INSTALLER_CONFIG_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define OPTVAL_PRELOAD 1000
+#define OPTVAL_FORCE_REMOVAL 1001
+
+/* Supported options */
+const char *short_opts = "k:l:i:d:c:m:t:o:r:p:s:b:e:M:y:q";
+const struct option long_opts[] = {
+       { "session-id", 1, NULL, 'k' },
+       { "license-path", 1, NULL, 'l' },
+       { "install", 1, NULL, 'i' },
+       { "uninstall", 1, NULL, 'd' },
+       { "clear", 1, NULL, 'c' },
+       { "move", 1, NULL, 'm' },
+       { "move-type", 1, NULL, 't' },
+       { "optional-data", 0, NULL, 'o' },
+       { "reinstall", 0, NULL, 'r' },
+       { "caller-pkgid", 1, NULL, 'p' },
+       { "tep-path", 1, NULL, 'e' },
+       { "tep-move", 1, NULL, 'M' },
+       { "smack", 1, NULL, 's' },
+       { "direct-manifest-install", 1, NULL, 'y' },
+       { "recovery", 1, NULL, 'b' },
+        { "preload", 0, NULL, OPTVAL_PRELOAD },
+       { "force-remove", 0, NULL, OPTVAL_FORCE_REMOVAL },
+       { 0, 0, 0, 0 }  /* sentinel */
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif                         /* __PACKAGE_INSTALLER_CONFIG_H__ */
diff --git a/installer/pkgmgr_installer_debug.h b/installer/pkgmgr_installer_debug.h
new file mode 100644 (file)
index 0000000..26df677
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2016 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 __PKGMGR_INSTALLER_DEBUG_H__
+#define __PKGMGR_INSTALLER_DEBUG_H__
+
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif /* LOG_TAG */
+#define LOG_TAG "PKGMGR_INSTALLER"
+
+#ifndef ERR
+#define ERR(fmt, args...) LOGE("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#ifndef DBG
+#define DBG(fmt, args...) LOGD("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#ifndef INFO
+#define INFO(fmt, args...) LOGI("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#endif  /* __PKGMGR_INSTALLER_DEBUG_H__ */
index 26bdc89b4e963125e3c82342234e323efb660c09..6891d64458504235601e09ca3cc968b26043297f 100644 (file)
@@ -152,7 +152,6 @@ useradd %TZ_SYS_GLOBALAPP_USER -r -c "system user for common applications" -g ro
 %manifest %{name}-installer.manifest
 %defattr(-,root,root,-)
 %{_libdir}/libpkgmgr_installer.so.*
-%{_libdir}/libpkgmgr_installer_client.so.*
 
 %files installer-devel
 %manifest %{name}-installer-devel.manifest
@@ -160,15 +159,11 @@ useradd %TZ_SYS_GLOBALAPP_USER -r -c "system user for common applications" -g ro
 %dir %{_includedir}/pkgmgr
 %{_includedir}/pkgmgr/pkgmgr_installer.h
 %{_libdir}/pkgconfig/pkgmgr-installer.pc
-%{_libdir}/pkgconfig/pkgmgr-installer-client.pc
 %{_libdir}/libpkgmgr_installer.so
-%{_libdir}/libpkgmgr_installer_client.so
 
 %files types-devel
 %manifest %{name}-types-devel.manifest
 %defattr(-,root,root,-)
 %{_includedir}/package-manager-types.h
 %{_includedir}/package-manager-plugin.h
-%{_includedir}/package-manager-debug.h
-%{_includedir}/pkgmgr/comm_config.h
 %{_libdir}/pkgconfig/pkgmgr-types.pc