Various patches are applied
[platform/framework/web/livebox-viewer.git] / src / master_rpc.c
index d3b68e1..984ec1a 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright 2012  Samsung Electronics Co., Ltd
+ * Copyright 2013  Samsung Electronics Co., Ltd
  *
- * Licensed under the Flora License, Version 1.0 (the "License");
+ * Licensed under the Flora License, Version 1.1 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- * http://www.tizenopensource.org/license
+ * http://floralicense.org/license/
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -24,6 +24,7 @@
 
 #include <packet.h>
 #include <com-core_packet.h>
+#include <livebox-errno.h>
 
 #include "debug.h"
 #include "dlist.h"
@@ -169,7 +170,7 @@ static int done_cb(pid_t pid, int handle, const struct packet *packet, void *dat
 
        if (packet_get(packet, "i", &ret) != 1) {
                ErrPrint("Invalid result packet\n");
-               ret = -EINVAL;
+               ret = LB_STATUS_ERROR_INVALID;
        }
 
        DbgPrint("[%s] Returns: %d\n", packet_command(packet), ret);
@@ -199,11 +200,8 @@ int master_rpc_async_request(struct livebox *handler, struct packet *packet, int
        command = create_command(handler, packet);
        if (!command) {
                ErrPrint("Failed to create a command\n");
-               if (ret_cb)
-                       ret_cb(handler, NULL, data);
-
                packet_unref(packet);
-               return -EFAULT;
+               return LB_STATUS_ERROR_FAULT;
        }
 
        command->ret_cb = ret_cb;
@@ -217,7 +215,7 @@ int master_rpc_async_request(struct livebox *handler, struct packet *packet, int
                push_command(command);
 
        packet_unref(packet);
-       return 0;
+       return LB_STATUS_SUCCESS;
 }
 
 int master_rpc_request_only(struct livebox *handler, struct packet *packet)
@@ -228,7 +226,7 @@ int master_rpc_request_only(struct livebox *handler, struct packet *packet)
        if (!command) {
                ErrPrint("Failed to create a command\n");
                packet_unref(packet);
-               return -EFAULT;
+               return LB_STATUS_ERROR_FAULT;
        }
 
        command->ret_cb = NULL;
@@ -238,7 +236,7 @@ int master_rpc_request_only(struct livebox *handler, struct packet *packet)
 
        push_command(command);
        packet_unref(packet);
-       return 0;
+       return LB_STATUS_SUCCESS;
 }
 
 int master_rpc_clear_fault_package(const char *pkgname)
@@ -248,7 +246,7 @@ int master_rpc_clear_fault_package(const char *pkgname)
        struct command *command;
 
        if (!pkgname)
-               return -EINVAL;
+               return LB_STATUS_ERROR_INVALID;
 
        DbgPrint("Clear requests of the fault package(%s)\n", pkgname);
 
@@ -297,13 +295,13 @@ int master_rpc_sync_request(struct packet *packet)
        if (result) {
                if (packet_get(result, "i", &ret) != 1) {
                        ErrPrint("Invalid result packet\n");
-                       ret = -EINVAL;
+                       ret = LB_STATUS_ERROR_INVALID;
                }
 
                packet_unref(result);
        } else {
                ErrPrint("Failed to send a sync request\n");
-               ret = -EFAULT;
+               ret = LB_STATUS_ERROR_FAULT;
        }
 
        packet_unref(packet);