2 * Network Configuration Module
4 * Copyright (c) 2021 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.
20 #include <curl/curl.h>
25 #ifdef USE_NETCONFIG_LOG
30 #define NETCONFIG_TAG "NETCONFIG"
31 #define __LOG(level, format, arg...) \
33 SLOG(level, NETCONFIG_TAG, format, ## arg); \
36 #define DBG(format, arg...) __LOG(LOG_DEBUG, format, ## arg)
37 #define ERR(format, arg...) __LOG(LOG_ERROR, format, ## arg)
40 #define ONLINE_MONITOR_CONF "/var/lib/net-config/online_monitor.conf"
43 ONLINE_MONITOR_STATE_UNINITIALIZED = 0,
44 ONLINE_MONITOR_STATE_INITIALIZED = 1,
45 ONLINE_MONITOR_STATE_MONITORING_STARTED = 2,
46 ONLINE_MONITOR_STATE_MONITORING_STOPPED = 3,
47 ONLINE_MONITOR_STATE_OFFLINE_DETECTED = 4,
48 ONLINE_MONITOR_STATE_URL_CHECK_SUCCEEDED = 5,
49 ONLINE_MONITOR_STATE_URL_CHECK_FAILED = 6,
50 } online_monitor_state_e;
53 ONLINE_MONITOR_DETECTION_NONE = 0,
54 ONLINE_MONITOR_DETECTION_UNREACHABLE = 1,
55 ONLINE_MONITOR_DETECTION_DNS_REFUSED = 2,
56 ONLINE_MONITOR_DETECTION_NO_DNS_RESPONSE = 3,
57 } online_monitor_detection_e;
63 gboolean supplicant_log;
67 } online_monitor_config_t;
69 typedef void(*online_monitor_state_chaged_cb)
70 (online_monitor_state_e state, char *ifname, online_monitor_detection_e reason);
72 void online_monitor_url_check_result(gboolean result);
73 void online_monitor_notifier_register(online_monitor_state_chaged_cb notifier);
74 void online_monitor_notifier_unregister(online_monitor_state_chaged_cb notifier);
75 online_monitor_config_t *online_monitor_get_configuration(void);
77 int report_manager_init(void);
78 int report_manager_deinit(void);
79 int url_checker_init(void);
80 int url_checker_deinit(void);