2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include "stc-manager.h"
20 #include "stc-plugin.h"
21 #include "stc-manager-plugin.h"
23 static gboolean stc_plugin_enabled = FALSE;
24 static void *handle_plugin;
25 static stc_plugin_s *stc_plugin;
27 void stc_manager_plugin_init(void)
29 __STC_LOG_FUNC_ENTER__;
31 handle_plugin = dlopen(STC_PLUGIN_FILEPATH, RTLD_NOW);
33 STC_LOGE("Can't load %s: %s", STC_PLUGIN_FILEPATH, dlerror());
37 stc_plugin = dlsym(handle_plugin, "stc_plugin");
39 STC_LOGE("Can't load symbol: %s", dlerror());
40 dlclose(handle_plugin);
44 stc_plugin_enabled = TRUE;
46 __STC_LOG_FUNC_EXIT__;
49 void stc_manager_plugin_deinit(void)
51 __STC_LOG_FUNC_ENTER__;
53 if (!stc_plugin_enabled)
56 stc_plugin_enabled = FALSE;
57 dlclose(handle_plugin);
59 __STC_LOG_FUNC_EXIT__;
62 int stc_send_warn_message_to_net_popup(const char *content,
63 const char *type, const char *app_id, const char *iftype, const char *warn)
65 __STC_LOG_FUNC_ENTER__;
67 if (!stc_plugin_enabled) {
68 STC_LOGE("Plugin wasn't enabled");
73 STC_LOGE("Plugin wasn't loaded");
77 return stc_plugin->send_warn_message_to_net_popup(content, type, app_id, iftype, warn);
80 int stc_send_restriction_message_to_net_popup(const char *content,
81 const char *type, const char *app_id, const char *iftype, const char *limit)
83 __STC_LOG_FUNC_ENTER__;
85 if (!stc_plugin_enabled) {
86 STC_LOGE("Plugin wasn't enabled");
91 STC_LOGE("Plugin wasn't loaded");
95 return stc_plugin->send_restriction_message_to_net_popup(content, type, app_id, iftype, limit);