typedef void pkgmgr_client;
typedef void pkgmgr_info;
-typedef void *pkgmgr_res_event_info_h;
+typedef void pkgmgr_res_event_info;
typedef struct {
long long data_size;
pkgmgr_updateinfo_type type;
} pkg_update_info_t;
-typedef struct {
- char *pkgid;
-} pkgmgr_res_event_info_t;
-
typedef int (*pkgmgr_iter_fn)(const char *pkg_type, const char *pkgid,
const char *version, void *data);
typedef void (*pkgmgr_res_copy_handler)(uid_t target_uid, int req_id,
const char *pkgid, const char *request_type, const char *status,
- pkgmgr_res_event_info_h handle, void *user_data);
+ pkgmgr_res_event_info *handle, void *user_data);
typedef enum {
PC_REQUEST = 0,
int pkgmgr_client_res_uninstall(pkgmgr_client *pc, const char *pkgid, pkgmgr_res_copy_handler event_cb, void *user_data);
int pkgmgr_client_res_usr_uninstall(pkgmgr_client *pc, const char *pkgid, pkgmgr_res_copy_handler event_cb, void *user_data, uid_t uid);
+/**
+ * @brief This API creates resource event info.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @return resource event info object
+ * @retval NULL on failure creating an object
+*/
+pkgmgr_res_event_info *pkgmgr_res_event_info_new();
+
+/**
+ * @brief This API delete resource event info.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] info resource event info
+ * @return Operation result;
+ * @retval PKGMGR_R_OK success
+ * @retval PKGMGR_R_EINVAL invalid argument
+ * @retval PKGMGR_R_ERROR internal error
+*/
+int pkgmgr_res_event_info_free(pkgmgr_res_event_info *info);
+
+/**
+ * @brief This API gets the error code from resource callback handle
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle resource event information handle
+ * @param[in] error_code error code about resource event
+ * @retval PKGMGR_R_OK success
+ * @retval PKGMGR_R_EINVAL invalid argument
+*/
+int pkgmgr_res_event_info_set_error_code(pkgmgr_res_event_info *handle, int error_code);
+
+/**
+ * @brief This API gets the error code from resource callback handle
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle resource event information handle
+ * @param[out] error_code error code about resource event
+ * @retval PKGMGR_R_OK success
+ * @retval PKGMGR_R_EINVAL invalid argument
+*/
+int pkgmgr_res_event_info_get_error_code(pkgmgr_res_event_info *handle, int *error_code);
+
/** @} */
#include <tzplatform_config.h>
#include "package-manager.h"
+#include "package-manager-types.h"
#include "pkgmgr_client_debug.h"
#include "pkgmgr_client_internal.h"
return cb_info->req_id;
}
+
+API pkgmgr_res_event_info *pkgmgr_res_event_info_new()
+{
+ pkgmgr_res_event_info_t *info;
+
+ info = calloc(1, sizeof(pkgmgr_res_event_info_t));
+ if (info == NULL) {
+ ERR("out of memory");
+ return NULL;
+ }
+
+ return (pkgmgr_res_event_info *)info;
+}
+
+API int pkgmgr_res_event_info_free(pkgmgr_res_event_info *info)
+{
+ pkgmgr_res_event_info_t *event_info =
+ (pkgmgr_res_event_info_t *)info;
+
+ if (event_info == NULL) {
+ ERR("invalid argument");
+ return PKGMGR_R_EINVAL;
+ }
+
+ free(event_info);
+
+ return PKGMGR_R_OK;
+}
+
+API int pkgmgr_res_event_info_set_error_code(pkgmgr_res_event_info *handle, int error_code)
+{
+ pkgmgr_res_event_info_t *info = handle;
+ if (info == NULL) {
+ ERR("invalid parameter");
+ return PKGMGR_R_EINVAL;
+ }
+
+ info->error_code = error_code;
+ return PKGMGR_R_OK;
+}
+
+API int pkgmgr_res_event_info_get_error_code(pkgmgr_res_event_info *handle, int *error_code)
+{
+ pkgmgr_res_event_info_t *info = handle;
+ if (info == NULL || error_code == NULL) {
+ ERR("invalid parameter");
+ return PKGMGR_R_EINVAL;
+ }
+
+ *error_code = info->error_code;
+ return PKGMGR_R_OK;
+}
#include <gio/gio.h>
#include "package-manager.h"
+#include "package-manager-types.h"
#include "pkgmgr_client_debug.h"
#include "pkgmgr_client_internal.h"
#include "../../installer/pkgmgr_installer.h"
char *status = NULL;
struct cb_info *cb_info = (struct cb_info *)user_data;
int signal_type;
+ GVariant *extra_param = NULL;
+ pkgmgr_res_event_info_t event_info;
if (!cb_info->res_copy_event_cb)
return;
- g_variant_get(parameters, "(u&s&s&s)", &target_uid, &req_id, &pkgid, &status);
+ g_variant_get(parameters, "(u&s&s&sv)", &target_uid, &req_id, &pkgid, &status, &extra_param);
+ if (!g_variant_type_equal(G_VARIANT_TYPE("(i)"),
+ g_variant_get_type(extra_param))) {
+ ERR("invalid extra parameter");
+ g_variant_unref(extra_param);
+ return;
+ }
if (cb_info->req_key) {
- if (strcmp(cb_info->req_key, req_id) != 0)
+ if (strcmp(cb_info->req_key, req_id) != 0) {
+ g_variant_unref(extra_param);
return;
+ }
} else {
signal_type = __get_signal_type(signal_name);
- if (signal_type < 0 || !(cb_info->status_type & signal_type))
+ if (signal_type < 0 || !(cb_info->status_type & signal_type)) {
+ g_variant_unref(extra_param);
return;
+ }
}
+ g_variant_get(extra_param, "(i)", &event_info.error_code);
cb_info->res_copy_event_cb(target_uid, cb_info->req_id, pkgid, signal_name,
- status, NULL, cb_info->data);
+ status, &event_info, cb_info->data);
+ g_variant_unref(extra_param);
}
static void __signal_handler(GDBusConnection *conn, const gchar *sender_name,
#include "pkgmgr_installer_debug.h"
#include "pkgmgr_installer_info.h"
#include "pkgmgr_installer_error.h"
+#include "package-manager-types.h"
#include <pkgmgr-info.h>
return 0;
}
+static GVariant *__get_gvariant_from_event_info(pkgmgr_res_event_info *event_info)
+{
+ pkgmgr_res_event_info_t *info = event_info;
+
+ return g_variant_new("(i)", info->error_code);
+}
+
API int pkgmgr_installer_send_res_copy_signal(pkgmgr_installer *pi,
const char *pkgid, const char *status,
- pkgmgr_res_event_info_h event_info)
+ pkgmgr_res_event_info *event_info)
{
char *sid;
const char *signal_name;
if (g_dbus_connection_emit_signal(pi->conn, NULL,
PKGMGR_INSTALLER_DBUS_OBJECT_PATH,
PKGMGR_INSTALLER_DBUS_INTERFACE, signal_name,
- g_variant_new("(usss)", pi->target_uid, sid,
- pkgid, status), &err) != TRUE) {
+ g_variant_new("(usssv)", pi->target_uid, sid,
+ pkgid, status,
+ __get_gvariant_from_event_info(
+ event_info)),
+ &err) != TRUE) {
ERR("failed to send dbus signal");
if (err) {
ERR("err: %s", err->message);
API int pkgmgr_installer_send_res_copy_signal_for_uid(pkgmgr_installer *pi,
uid_t uid, const char *pkgid, const char *status,
- pkgmgr_res_event_info_h event_info)
+ pkgmgr_res_event_info *event_info)
{
char *sid;
size_t data_len;
name_size = strlen(signal_name) + 1;
data_len += name_size;
- gv = g_variant_new("(usss)", pi->target_uid, sid, pkgid, status);
+ gv = g_variant_new("(usssv)", pi->target_uid, sid,
+ pkgid, status,
+ __get_gvariant_from_event_info(event_info));
if (gv == NULL) {
ERR("failed to create GVariant instance");
return -1;
#include <pkgmgr_installer.h>
void send_res_copy_singal(uid_t uid, int request_type, const char *session_id,
const char *pkgid, const char *status,
- pkgmgr_res_event_info_h event_info)
+ pkgmgr_res_event_info *event_info)
{
pkgmgr_installer *pi;
int r = 0;
*/
int pkgmgr_installer_send_res_copy_signal(pkgmgr_installer *pi,
const char *pkgid, const char *status,
- pkgmgr_res_event_info_h event_info);
+ pkgmgr_res_event_info *event_info);
/**
@brief Send a signal of the resource copy event status
*/
int pkgmgr_installer_send_res_copy_signal_for_uid(pkgmgr_installer *pi,
uid_t uid, const char *pkgid, const char *status,
- pkgmgr_res_event_info_h event_info);
+ pkgmgr_res_event_info *event_info);
#ifdef __cplusplus
}
GList *dependency_list;
} package_manager_pkg_detail_info_t;
+typedef struct _pkgmgr_res_event_info_t {
+ int error_code;
+} pkgmgr_res_event_info_t;
+
/** @} */
#ifdef __cplusplus