Merge "Remove the unused code." into tizen
[platform/core/connectivity/net-config.git] / src / neterror.c
old mode 100644 (file)
new mode 100755 (executable)
index 49ea946..62998ab
@@ -21,6 +21,7 @@
 
 #include "netdbus.h"
 #include "neterror.h"
+#include "log.h"
 
 #define NETCONFIG_ERROR_INTERFACE NETCONFIG_SERVICE ".Error"
 #define CONNMAN_AGENT_ERROR_INTERFACE "net.connman.Agent.Error"
@@ -47,6 +48,7 @@ GQuark netconfig_connman_agent_error_quark(void)
 
 void netconfig_error_no_profile(GDBusMethodInvocation *context)
 {
+       ERR("dbus method return error");
        g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
                        NETCONFIG_ERROR_NO_PROFILE,
                        NETCONFIG_ERROR_INTERFACE ".NoProfile");
@@ -54,6 +56,7 @@ void netconfig_error_no_profile(GDBusMethodInvocation *context)
 
 void netconfig_error_inprogress(GDBusMethodInvocation *context)
 {
+       ERR("dbus method return error");
        g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
                        NETCONFIG_ERROR_INPROGRESS,
                        NETCONFIG_ERROR_INTERFACE ".InProgress");
@@ -61,6 +64,7 @@ void netconfig_error_inprogress(GDBusMethodInvocation *context)
 
 void netconfig_error_already_exists(GDBusMethodInvocation *context)
 {
+       ERR("dbus method return error");
        g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
                        NETCONFIG_ERROR_ALREADYEXISTS,
                        NETCONFIG_ERROR_INTERFACE ".AlreadyExists");
@@ -68,6 +72,7 @@ void netconfig_error_already_exists(GDBusMethodInvocation *context)
 
 void netconfig_error_invalid_parameter(GDBusMethodInvocation *context)
 {
+       ERR("dbus method return error");
        g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
                        NETCONFIG_ERROR_INVALID_PARAMETER,
                        NETCONFIG_ERROR_INTERFACE ".InvalidParameter");
@@ -75,6 +80,7 @@ void netconfig_error_invalid_parameter(GDBusMethodInvocation *context)
 
 void netconfig_error_permission_denied(GDBusMethodInvocation *context)
 {
+       ERR("dbus method return error");
        g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
                        NETCONFIG_ERROR_PERMISSION_DENIED,
                        NETCONFIG_ERROR_INTERFACE ".PermissionDenied");
@@ -82,6 +88,7 @@ void netconfig_error_permission_denied(GDBusMethodInvocation *context)
 
 void netconfig_error_wifi_driver_failed(GDBusMethodInvocation *context)
 {
+       ERR("dbus method return error");
        g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
                        NETCONFIG_ERROR_WIFI_DRIVER_FAILURE,
                        NETCONFIG_ERROR_INTERFACE ".WifiDriverFailed");
@@ -89,41 +96,47 @@ void netconfig_error_wifi_driver_failed(GDBusMethodInvocation *context)
 
 void netconfig_error_wifi_direct_failed(GDBusMethodInvocation *context)
 {
+       ERR("dbus method return error");
        g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
                        NETCONFIG_ERROR_WIFI_DRIVER_FAILURE,
                        NETCONFIG_ERROR_INTERFACE ".WifiDirectFailed");
 }
 
-void netconfig_error_fail_get_imsi(GDBusMethodInvocation *context)
+EXPORT_SYM void netconfig_error_fail_get_imsi(GDBusMethodInvocation *context)
 {
+       ERR("dbus method return error");
        g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
                        NETCONFIG_ERROR_FAILED_GET_IMSI,
                        NETCONFIG_ERROR_INTERFACE".FailGetSimImsi");
 }
 
-void netconfig_error_fail_req_sim_auth(GDBusMethodInvocation *context)
+EXPORT_SYM void netconfig_error_fail_req_sim_auth(GDBusMethodInvocation *context)
 {
+       ERR("dbus method return error");
        g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
                        NETCONFIG_ERROR_FAILED_REQ_SIM_AUTH,
                        NETCONFIG_ERROR_INTERFACE".FailReqSimAuth");
 }
 
-void netconfig_error_fail_req_sim_auth_wrong_param(GDBusMethodInvocation *context)
+EXPORT_SYM void netconfig_error_fail_req_sim_auth_wrong_param(GDBusMethodInvocation *context)
 {
+       ERR("dbus method return error");
        g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
                        NETCONFIG_ERROR_FAILED_REQ_SIM_AUTH_WRONG_PARAM,
                        NETCONFIG_ERROR_INTERFACE".FailReqSimAuthWrongParam");
 }
 
-void netconfig_error_fail_get_sim_auth_wrong_data(GDBusMethodInvocation *context)
+EXPORT_SYM void netconfig_error_fail_get_sim_auth_wrong_data(GDBusMethodInvocation *context)
 {
+       ERR("dbus method return error");
        g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
                        NETCONFIG_ERROR_FAILED_GET_SIM_AUTH_WRONG_DATA,
                        NETCONFIG_ERROR_INTERFACE".FailGetSimAuthWrongData");
 }
 
-void netconfig_error_fail_get_sim_auth_delay(GDBusMethodInvocation *context)
+EXPORT_SYM void netconfig_error_fail_get_sim_auth_delay(GDBusMethodInvocation *context)
 {
+       ERR("dbus method return error");
        g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
                        NETCONFIG_ERROR_FAILED_GET_SIM_AUTH_DELAY,
                        NETCONFIG_ERROR_INTERFACE".FailGetSimAuthDelay");
@@ -131,6 +144,7 @@ void netconfig_error_fail_get_sim_auth_delay(GDBusMethodInvocation *context)
 
 void netconfig_error_fail_save_congifuration(GDBusMethodInvocation *context)
 {
+       ERR("dbus method return error");
        g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
                        NETCONFIG_ERROR_INTERNAL,
                        NETCONFIG_ERROR_INTERFACE".FailSaveConfiguration");
@@ -143,26 +157,81 @@ void netconfig_error_fail_ethernet_cable_state(GDBusMethodInvocation *context)
                        NETCONFIG_ERROR_INTERFACE".FailGetEthernetCableState");
 }
 
+void netconfig_error_fail_preferred_ipv6_address(GDBusMethodInvocation *context)
+{
+       g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
+                       NETCONFIG_ERROR_INTERNAL,
+                       NETCONFIG_ERROR_INTERFACE".FailGetPreferredIpv6Address");
+}
+
+#include <glib/gprintf.h>
 void netconfig_error_dbus_method_return(GDBusMethodInvocation *context, netconfig_error_e error, const gchar *message)
 {
        gchar *msg = NULL;
 
+       ERR("dbus method return error");
+
        msg = g_strdup_printf("%s.%s", NETCONFIG_ERROR_INTERFACE, message);
-       g_dbus_method_invocation_return_error_literal(context, netconfig_error_quark(), error, msg);
+       g_dbus_method_invocation_return_error(context, netconfig_error_quark(), error, "%s", msg);
 
        g_free(msg);
 }
 
 void netconfig_error_init(void)
 {
-       /* TODO: register GError domain to make error_name */
-       /*
-       dbus_g_error_domain_register(NETCONFIG_ERROR_QUARK,
-                       NETCONFIG_ERROR_INTERFACE,
-                       code_num_netconfig);
+       g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
+                       NETCONFIG_ERROR_INTERNAL,
+                       "net.netconfig.Error.Internal");
+
+       g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
+                       NETCONFIG_ERROR_NO_SERVICE,
+                       "net.netconfig.Error.NoService");
+
+       g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
+                       NETCONFIG_ERROR_NO_PROFILE,
+                       "net.netconfig.Error.NoProfile");
+
+       g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
+                       NETCONFIG_ERROR_WRONG_PROFILE,
+                       "net.netconfig.Error.WrongProfile");
+
+       g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
+                       NETCONFIG_ERROR_INPROGRESS,
+                       "net.netconfig.Error.InProgress");
+
+       g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
+                       NETCONFIG_ERROR_ALREADYEXISTS,
+                       "net.netconfig.Error.AlreadyExists");
 
-       dbus_g_error_domain_register(NETCONFIG_CONNMAN_AGENT_ERROR_QUARK,
-                       CONNMAN_AGENT_ERROR_INTERFACE,
-                       code_num_connman);
-       */
+       g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
+                       NETCONFIG_ERROR_INVALID_PARAMETER,
+                       "net.netconfig.Error.InvalidParameter");
+
+       g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
+                       NETCONFIG_ERROR_PERMISSION_DENIED,
+                       "net.netconfig.Error.PermissionDenied");
+
+       g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
+                       NETCONFIG_ERROR_WIFI_DRIVER_FAILURE,
+                       "net.netconfig.Error.WifiDriverFailed");
+
+       g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
+                       NETCONFIG_ERROR_FAILED_GET_IMSI,
+                       "net.netconfig.Error.FailGetSimImsi");
+
+       g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
+                       NETCONFIG_ERROR_FAILED_REQ_SIM_AUTH,
+                       "net.netconfig.Error.FailReqSimAuthWrongParam");
+
+       g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
+                       NETCONFIG_ERROR_FAILED_REQ_SIM_AUTH_WRONG_PARAM,
+                       "net.netconfig.Error.FailReqSimAuthWrongParam");
+
+       g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
+                       NETCONFIG_ERROR_FAILED_GET_SIM_AUTH_WRONG_DATA,
+                       "net.netconfig.Error.FailGetSimAuthWrongData");
+
+       g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
+                       NETCONFIG_ERROR_FAILED_GET_SIM_AUTH_DELAY,
+                       "net.netconfig.Error.FailGetSimAuthDelay");
 }