+++ /dev/null
-/*
- * Network Monitoring Module
- *
- * Copyright (c) 2018 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.
- *
- */
-
-/**
- * This file implements functions for error.
- *
- * @file nm-error.c
- * @author Jiung Yu (jiung.yu@samsung.com)
- * @version 0.1
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <glib.h>
-#include <gio/gio.h>
-
-#include "inm-manager.h"
-#include "inm-util.h"
-#include "inm-manager-log.h"
-#include "inm-error.h"
-
-
-#define INM_MANAGER_ERROR_QUARK g_quark_from_string("nm-manager-error-quark")
-
-#define INM_ERR_STR_INVALID_PARAM "net.inmmanager.Error.InvalidParameter"
-#define INM_ERR_STR_NOT_PERMITTED "net.inmmanager.Error.NotPermitted"
-#define INM_ERR_STR_OUT_OF_MEMORY "net.inmmanager.Error.OutOfMemory"
-#define INM_ERR_STR_OP_FAILED "net.inmmanager.Error.OperationFailed"
-#define INM_ERR_STR_IN_PROGRESS "net.inmmanager.Error.InProgress"
-
-//LCOV_EXCL_START
-static void inm_error_invalid_parameter(GError **error)
-{
- *error = g_dbus_error_new_for_dbus_error(
- INM_ERR_STR_INVALID_PARAM,
- INM_ERR_STR_INVALID_PARAM);
-}
-
-static void inm_error_not_permitted(GError **error)
-{
- *error = g_dbus_error_new_for_dbus_error(
- INM_ERR_STR_NOT_PERMITTED,
- INM_ERR_STR_NOT_PERMITTED);
-}
-
-static void inm_error_out_of_memory(GError **error)
-{
- *error = g_dbus_error_new_for_dbus_error(
- INM_ERR_STR_OUT_OF_MEMORY,
- INM_ERR_STR_OUT_OF_MEMORY);
-}
-
-static void inm_error_operation_failed(GError **error)
-{
- *error = g_dbus_error_new_for_dbus_error(
- INM_ERR_STR_OP_FAILED,
- INM_ERR_STR_OP_FAILED);
-}
-
-static void inm_error_in_progress(GError **error)
-{
- *error = g_dbus_error_new_for_dbus_error(
- INM_ERR_STR_IN_PROGRESS,
- INM_ERR_STR_IN_PROGRESS);
-}
-
-
-void inm_error_set_gerror(inm_manager_error_e error_code, GError **error)
-{
- switch (error_code) {
- case INM_MANAGER_ERROR_INVALID_PARAM:
- inm_error_invalid_parameter(error);
- break;
- case INM_MANAGER_ERROR_NOT_PERMITTED:
- inm_error_not_permitted(error);
- break;
- case INM_MANAGER_ERROR_OUT_OF_MEMORY:
- inm_error_out_of_memory(error);
- break;
- case INM_MANAGER_ERROR_OPERATION_FAILED:
- inm_error_operation_failed(error);
- break;
- case INM_MANAGER_ERROR_IN_PROGRESS:
- inm_error_in_progress(error);
- break;
- default:
- INM_LOGI("Error Not handled [%d]", error_code);
- inm_error_operation_failed(error);
- }
-}
-void inm_error_register(void)
-{
- g_dbus_error_register_error(INM_MANAGER_ERROR_QUARK,
- INM_MANAGER_ERROR_INVALID_PARAM,
- INM_ERR_STR_INVALID_PARAM);
-
- g_dbus_error_register_error(INM_MANAGER_ERROR_QUARK,
- INM_MANAGER_ERROR_NOT_PERMITTED,
- INM_ERR_STR_NOT_PERMITTED);
-
- g_dbus_error_register_error(INM_MANAGER_ERROR_QUARK,
- INM_MANAGER_ERROR_OUT_OF_MEMORY,
- INM_ERR_STR_OUT_OF_MEMORY);
-
- g_dbus_error_register_error(INM_MANAGER_ERROR_QUARK,
- INM_MANAGER_ERROR_OPERATION_FAILED,
- INM_ERR_STR_OP_FAILED);
-
- g_dbus_error_register_error(INM_MANAGER_ERROR_QUARK,
- INM_MANAGER_ERROR_IN_PROGRESS,
- INM_ERR_STR_IN_PROGRESS);
-
-}
-
-void inm_error_deregister(void)
-{
- g_dbus_error_unregister_error(INM_MANAGER_ERROR_QUARK,
- INM_MANAGER_ERROR_INVALID_PARAM,
- INM_ERR_STR_INVALID_PARAM);
-
-
- g_dbus_error_unregister_error(INM_MANAGER_ERROR_QUARK,
- INM_MANAGER_ERROR_NOT_PERMITTED,
- INM_ERR_STR_NOT_PERMITTED);
-
-
- g_dbus_error_unregister_error(INM_MANAGER_ERROR_QUARK,
- INM_MANAGER_ERROR_OUT_OF_MEMORY,
- INM_ERR_STR_OUT_OF_MEMORY);
-
- g_dbus_error_unregister_error(INM_MANAGER_ERROR_QUARK,
- INM_MANAGER_ERROR_OPERATION_FAILED,
- INM_ERR_STR_OP_FAILED);
-
- g_dbus_error_unregister_error(INM_MANAGER_ERROR_QUARK,
- INM_MANAGER_ERROR_IN_PROGRESS,
- INM_ERR_STR_IN_PROGRESS);
-
-}
-//LCOV_EXCL_STOP
#include "inm-error.h"
#include "inm-gdbus.h"
+#define INM_MANAGER_ERROR_QUARK g_quark_from_string("nm-manager-error-quark")
+
+#define INM_ERR_STR_INVALID_PARAM "net.inmmanager.Error.InvalidParameter"
+#define INM_ERR_STR_NOT_PERMITTED "net.inmmanager.Error.NotPermitted"
+#define INM_ERR_STR_OUT_OF_MEMORY "net.inmmanager.Error.OutOfMemory"
+#define INM_ERR_STR_OP_FAILED "net.inmmanager.Error.OperationFailed"
+#define INM_ERR_STR_IN_PROGRESS "net.inmmanager.Error.InProgress"
+
#define INM_WIFI_SERVICE INM_MANAGER_SERVICE ".wifi"
#define INM_WIFI_IFACE INM_MANAGER_SERVICE ".wifi"
#define INM_WIFI_OBJ INM_MANAGER_OBJ "/wifi"
gdbus_mon_s gdbus_mon;
+//LCOV_EXCL_START
+static void inm_error_invalid_parameter(GError **error)
+{
+ *error = g_dbus_error_new_for_dbus_error(
+ INM_ERR_STR_INVALID_PARAM,
+ INM_ERR_STR_INVALID_PARAM);
+}
+
+static void inm_error_not_permitted(GError **error)
+{
+ *error = g_dbus_error_new_for_dbus_error(
+ INM_ERR_STR_NOT_PERMITTED,
+ INM_ERR_STR_NOT_PERMITTED);
+}
+
+static void inm_error_out_of_memory(GError **error)
+{
+ *error = g_dbus_error_new_for_dbus_error(
+ INM_ERR_STR_OUT_OF_MEMORY,
+ INM_ERR_STR_OUT_OF_MEMORY);
+}
+
+static void inm_error_operation_failed(GError **error)
+{
+ *error = g_dbus_error_new_for_dbus_error(
+ INM_ERR_STR_OP_FAILED,
+ INM_ERR_STR_OP_FAILED);
+}
+
+static void inm_error_in_progress(GError **error)
+{
+ *error = g_dbus_error_new_for_dbus_error(
+ INM_ERR_STR_IN_PROGRESS,
+ INM_ERR_STR_IN_PROGRESS);
+}
+
+void inm_error_set_gerror(inm_manager_error_e error_code, GError **error)
+{
+ switch (error_code) {
+ case INM_MANAGER_ERROR_INVALID_PARAM:
+ inm_error_invalid_parameter(error);
+ break;
+ case INM_MANAGER_ERROR_NOT_PERMITTED:
+ inm_error_not_permitted(error);
+ break;
+ case INM_MANAGER_ERROR_OUT_OF_MEMORY:
+ inm_error_out_of_memory(error);
+ break;
+ case INM_MANAGER_ERROR_OPERATION_FAILED:
+ inm_error_operation_failed(error);
+ break;
+ case INM_MANAGER_ERROR_IN_PROGRESS:
+ inm_error_in_progress(error);
+ break;
+ default:
+ INM_LOGI("Error Not handled [%d]", error_code);
+ inm_error_operation_failed(error);
+ }
+}
+
+void inm_error_register(void)
+{
+ g_dbus_error_register_error(INM_MANAGER_ERROR_QUARK,
+ INM_MANAGER_ERROR_INVALID_PARAM,
+ INM_ERR_STR_INVALID_PARAM);
+
+ g_dbus_error_register_error(INM_MANAGER_ERROR_QUARK,
+ INM_MANAGER_ERROR_NOT_PERMITTED,
+ INM_ERR_STR_NOT_PERMITTED);
+
+ g_dbus_error_register_error(INM_MANAGER_ERROR_QUARK,
+ INM_MANAGER_ERROR_OUT_OF_MEMORY,
+ INM_ERR_STR_OUT_OF_MEMORY);
+
+ g_dbus_error_register_error(INM_MANAGER_ERROR_QUARK,
+ INM_MANAGER_ERROR_OPERATION_FAILED,
+ INM_ERR_STR_OP_FAILED);
+
+ g_dbus_error_register_error(INM_MANAGER_ERROR_QUARK,
+ INM_MANAGER_ERROR_IN_PROGRESS,
+ INM_ERR_STR_IN_PROGRESS);
+
+}
+
+void inm_error_deregister(void)
+{
+ g_dbus_error_unregister_error(INM_MANAGER_ERROR_QUARK,
+ INM_MANAGER_ERROR_INVALID_PARAM,
+ INM_ERR_STR_INVALID_PARAM);
+
+
+ g_dbus_error_unregister_error(INM_MANAGER_ERROR_QUARK,
+ INM_MANAGER_ERROR_NOT_PERMITTED,
+ INM_ERR_STR_NOT_PERMITTED);
+
+
+ g_dbus_error_unregister_error(INM_MANAGER_ERROR_QUARK,
+ INM_MANAGER_ERROR_OUT_OF_MEMORY,
+ INM_ERR_STR_OUT_OF_MEMORY);
+
+ g_dbus_error_unregister_error(INM_MANAGER_ERROR_QUARK,
+ INM_MANAGER_ERROR_OPERATION_FAILED,
+ INM_ERR_STR_OP_FAILED);
+
+ g_dbus_error_unregister_error(INM_MANAGER_ERROR_QUARK,
+ INM_MANAGER_ERROR_IN_PROGRESS,
+ INM_ERR_STR_IN_PROGRESS);
+
+}
+//LCOV_EXCL_STOP
+
GDBusConnection *inm_gdbus_get_connection(void)
{
return gdbus_mon.conn;