2 * Network Configuration Module
4 * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
26 #define NETCONFIG_ERROR_INTERFACE NETCONFIG_SERVICE ".Error"
27 #define CONNMAN_AGENT_ERROR_INTERFACE "net.connman.Agent.Error"
29 GQuark netconfig_error_quark(void)
31 static GQuark quark = 0;
34 quark = g_quark_from_static_string("netconfig_error");
39 GQuark netconfig_connman_agent_error_quark(void)
41 static GQuark quark = 0;
44 quark = g_quark_from_static_string("netconfig_connman_agent_error");
49 void netconfig_error_no_profile(GDBusMethodInvocation *context)
51 ERR("dbus method return error");
52 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
53 NETCONFIG_ERROR_NO_PROFILE,
54 NETCONFIG_ERROR_INTERFACE ".NoProfile");
57 void netconfig_error_inprogress(GDBusMethodInvocation *context)
59 ERR("dbus method return error");
60 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
61 NETCONFIG_ERROR_INPROGRESS,
62 NETCONFIG_ERROR_INTERFACE ".InProgress");
65 void netconfig_error_already_exists(GDBusMethodInvocation *context)
67 ERR("dbus method return error");
68 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
69 NETCONFIG_ERROR_ALREADYEXISTS,
70 NETCONFIG_ERROR_INTERFACE ".AlreadyExists");
73 void netconfig_error_invalid_parameter(GDBusMethodInvocation *context)
75 ERR("dbus method return error");
76 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
77 NETCONFIG_ERROR_INVALID_PARAMETER,
78 NETCONFIG_ERROR_INTERFACE ".InvalidParameter");
81 void netconfig_error_permission_denied(GDBusMethodInvocation *context)
83 ERR("dbus method return error");
84 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
85 NETCONFIG_ERROR_PERMISSION_DENIED,
86 NETCONFIG_ERROR_INTERFACE ".PermissionDenied");
89 void netconfig_error_wifi_driver_failed(GDBusMethodInvocation *context)
91 ERR("dbus method return error");
92 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
93 NETCONFIG_ERROR_WIFI_DRIVER_FAILURE,
94 NETCONFIG_ERROR_INTERFACE ".WifiDriverFailed");
97 void netconfig_error_wifi_direct_failed(GDBusMethodInvocation *context)
99 ERR("dbus method return error");
100 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
101 NETCONFIG_ERROR_WIFI_DRIVER_FAILURE,
102 NETCONFIG_ERROR_INTERFACE ".WifiDirectFailed");
105 EXPORT_SYM void netconfig_error_fail_get_imsi(GDBusMethodInvocation *context)
107 ERR("dbus method return error");
108 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
109 NETCONFIG_ERROR_FAILED_GET_IMSI,
110 NETCONFIG_ERROR_INTERFACE".FailGetSimImsi");
113 EXPORT_SYM void netconfig_error_fail_req_sim_auth(GDBusMethodInvocation *context)
115 ERR("dbus method return error");
116 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
117 NETCONFIG_ERROR_FAILED_REQ_SIM_AUTH,
118 NETCONFIG_ERROR_INTERFACE".FailReqSimAuth");
121 EXPORT_SYM void netconfig_error_fail_req_sim_auth_wrong_param(GDBusMethodInvocation *context)
123 ERR("dbus method return error");
124 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
125 NETCONFIG_ERROR_FAILED_REQ_SIM_AUTH_WRONG_PARAM,
126 NETCONFIG_ERROR_INTERFACE".FailReqSimAuthWrongParam");
129 EXPORT_SYM void netconfig_error_fail_get_sim_auth_wrong_data(GDBusMethodInvocation *context)
131 ERR("dbus method return error");
132 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
133 NETCONFIG_ERROR_FAILED_GET_SIM_AUTH_WRONG_DATA,
134 NETCONFIG_ERROR_INTERFACE".FailGetSimAuthWrongData");
137 EXPORT_SYM void netconfig_error_fail_get_sim_auth_delay(GDBusMethodInvocation *context)
139 ERR("dbus method return error");
140 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
141 NETCONFIG_ERROR_FAILED_GET_SIM_AUTH_DELAY,
142 NETCONFIG_ERROR_INTERFACE".FailGetSimAuthDelay");
145 void netconfig_error_fail_save_congifuration(GDBusMethodInvocation *context)
147 ERR("dbus method return error");
148 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
149 NETCONFIG_ERROR_INTERNAL,
150 NETCONFIG_ERROR_INTERFACE".FailSaveConfiguration");
153 void netconfig_error_fail_ethernet_cable_state(GDBusMethodInvocation *context)
155 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
156 NETCONFIG_ERROR_INTERNAL,
157 NETCONFIG_ERROR_INTERFACE".FailGetEthernetCableState");
160 void netconfig_error_fail_preferred_ipv6_address(GDBusMethodInvocation *context)
162 g_dbus_method_invocation_return_error(context, netconfig_error_quark(),
163 NETCONFIG_ERROR_INTERNAL,
164 NETCONFIG_ERROR_INTERFACE".FailGetPreferredIpv6Address");
167 #include <glib/gprintf.h>
168 void netconfig_error_dbus_method_return(GDBusMethodInvocation *context, netconfig_error_e error, const gchar *message)
172 ERR("dbus method return error");
174 msg = g_strdup_printf("%s.%s", NETCONFIG_ERROR_INTERFACE, message);
175 g_dbus_method_invocation_return_error(context, netconfig_error_quark(), error, "%s", msg);
180 void netconfig_error_init(void)
182 g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
183 NETCONFIG_ERROR_INTERNAL,
184 "net.netconfig.Error.Internal");
186 g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
187 NETCONFIG_ERROR_NO_SERVICE,
188 "net.netconfig.Error.NoService");
190 g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
191 NETCONFIG_ERROR_NO_PROFILE,
192 "net.netconfig.Error.NoProfile");
194 g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
195 NETCONFIG_ERROR_WRONG_PROFILE,
196 "net.netconfig.Error.WrongProfile");
198 g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
199 NETCONFIG_ERROR_INPROGRESS,
200 "net.netconfig.Error.InProgress");
202 g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
203 NETCONFIG_ERROR_ALREADYEXISTS,
204 "net.netconfig.Error.AlreadyExists");
206 g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
207 NETCONFIG_ERROR_INVALID_PARAMETER,
208 "net.netconfig.Error.InvalidParameter");
210 g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
211 NETCONFIG_ERROR_PERMISSION_DENIED,
212 "net.netconfig.Error.PermissionDenied");
214 g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
215 NETCONFIG_ERROR_WIFI_DRIVER_FAILURE,
216 "net.netconfig.Error.WifiDriverFailed");
218 g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
219 NETCONFIG_ERROR_FAILED_GET_IMSI,
220 "net.netconfig.Error.FailGetSimImsi");
222 g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
223 NETCONFIG_ERROR_FAILED_REQ_SIM_AUTH,
224 "net.netconfig.Error.FailReqSimAuthWrongParam");
226 g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
227 NETCONFIG_ERROR_FAILED_REQ_SIM_AUTH_WRONG_PARAM,
228 "net.netconfig.Error.FailReqSimAuthWrongParam");
230 g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
231 NETCONFIG_ERROR_FAILED_GET_SIM_AUTH_WRONG_DATA,
232 "net.netconfig.Error.FailGetSimAuthWrongData");
234 g_dbus_error_register_error(NETCONFIG_ERROR_QUARK,
235 NETCONFIG_ERROR_FAILED_GET_SIM_AUTH_DELAY,
236 "net.netconfig.Error.FailGetSimAuthDelay");