int inm_manager_arp_request_stop(char *target_ip);
int inm_manager_default_gateway_start_checking(int timeout);
int inm_manager_default_gateway_stop_checking();
-int inm_manager_add_reacher_url(const char *url);
-int inm_manager_remove_reacher_url(const char *url);
-int inm_manager_start_reacher(int type);
-int inm_manager_stop_reacher(int type);
-int inm_manager_get_reacher_is_running(gboolean *is_running);
+int inm_manager_add_url_to_check(const char *url);
+int inm_manager_remove_url_to_check(const char *url);
+int inm_manager_reachable_urls_start_checking(int type);
+int inm_manager_reachable_urls_stop_checking(int type);
+int inm_manager_reachable_urls_is_check_running(gboolean *is_running);
int inm_manager_start_default_dns_lookup();
int inm_manager_get_wifi_scan_state(gboolean *state);
<check send_destination="net.inm_manager" send_interface="net.inm_manager" send_member="DefaultGatewayStartChecking" privilege="http://tizen.org/privilege/network.get" />
<check send_destination="net.inm_manager" send_interface="net.inm_manager" send_member="DefaultGatewayStopChecking" privilege="http://tizen.org/privilege/network.get" />
<check send_destination="net.inm_manager" send_interface="net.inm_manager" send_member="DefaultDnsLookupCheck" privilege="http://tizen.org/privilege/network.get" />
+ <check send_destination="net.inm_manager" send_interface="net.inm_manager" send_member="AddUrltoCheck" privilege="http://tizen.org/privilege/network.get" />
+ <check send_destination="net.inm_manager" send_interface="net.inm_manager" send_member="RemoveUrltoCheck" privilege="http://tizen.org/privilege/network.get" />
+ <check send_destination="net.inm_manager" send_interface="net.inm_manager" send_member="ReachableUrlsStartChecking" privilege="http://tizen.org/privilege/network.get" />
+ <check send_destination="net.inm_manager" send_interface="net.inm_manager" send_member="ReachableUrlsStopChecking" privilege="http://tizen.org/privilege/network.get" />
+ <check send_destination="net.inm_manager" send_interface="net.inm_manager" send_member="ReachableUrlIsCheckRunning" privilege="http://tizen.org/privilege/network.get" />
<check send_destination="net.inm_manager" send_interface="net.inm_manager" send_member="GetWifiState" privilege="http://tizen.org/privilege/network.get" />
<check send_destination="net.inm_manager" send_interface="net.inm_manager" send_member="GetEthernetState" privilege="http://tizen.org/privilege/network.get" />
<check send_destination="net.inm_manager" send_interface="net.inm_manager" send_member="GetCurrentConnection" privilege="http://tizen.org/privilege/network.get" />
__INM_FUNC_EXIT__;
}
-static inline void __handle_add_reacher_url(GVariant *parameters,
+static inline void __handle_add_url_to_check(GVariant *parameters,
GDBusMethodInvocation *invocation)
{
const gchar *url = NULL;
__INM_FUNC_ENTER__;
g_variant_get(parameters, "(&s)", &url);
- ret = inm_manager_add_reacher_url(url);
+ ret = inm_manager_add_url_to_check(url);
if (ret != INM_MANAGER_ERROR_NONE) {
__dbus_return_err(ret, invocation);
return;
__INM_FUNC_EXIT__;
}
-static inline void __handle_remove_reacher_url(GVariant *parameters,
+static inline void __handle_remove_url_to_check(GVariant *parameters,
GDBusMethodInvocation *invocation)
{
const gchar *url = NULL;
__INM_FUNC_ENTER__;
g_variant_get(parameters, "(&s)", &url);
- ret = inm_manager_remove_reacher_url(url);
+ ret = inm_manager_remove_url_to_check(url);
if (ret != INM_MANAGER_ERROR_NONE) {
__dbus_return_err(ret, invocation);
return;
__INM_FUNC_EXIT__;
}
-static inline void __handle_start_reacher(GVariant *parameters,
+static inline void __handle_reachable_urls_start_checking(GVariant *parameters,
GDBusMethodInvocation *invocation)
{
int type;
__INM_FUNC_ENTER__;
g_variant_get(parameters, "(i)", &type);
- ret = inm_manager_start_reacher(type);
+ ret = inm_manager_reachable_urls_start_checking(type);
if (ret != INM_MANAGER_ERROR_NONE) {
__dbus_return_err(ret, invocation);
return;
__INM_FUNC_EXIT__;
}
-static inline void __handle_stop_reacher(GVariant *parameters,
+static inline void __handle_reachable_urls_stop_checking(GVariant *parameters,
GDBusMethodInvocation *invocation)
{
int type;
__INM_FUNC_ENTER__;
g_variant_get(parameters, "(i)", &type);
- ret = inm_manager_stop_reacher(type);
+ ret = inm_manager_reachable_urls_stop_checking(type);
if (ret != INM_MANAGER_ERROR_NONE) {
__dbus_return_err(ret, invocation);
return;
__INM_FUNC_EXIT__;
}
-static inline void __handle_reacher_is_running(GVariant *parameters,
+static inline void __handle_reachable_urls_is_check_running(GVariant *parameters,
GDBusMethodInvocation *invocation)
{
gboolean is_running = FALSE;
int ret = INM_MANAGER_ERROR_NONE;
__INM_FUNC_ENTER__;
- ret = inm_manager_get_reacher_is_running(&is_running);
+ ret = inm_manager_reachable_urls_is_check_running(&is_running);
if (ret < 0) {
INM_LOGW("Failed to get reacher is running");
__dbus_return_err(INM_MANAGER_ERROR_OPERATION_FAILED, invocation);
__handle_default_gateway_start_checking(parameters, invocation);
else if (g_strcmp0(method_name, "DefaultGatewayStopChecking") == 0)
__handle_default_gateway_stop_checking(parameters, invocation);
- else if (g_strcmp0(method_name, "AddReacherUrl") == 0)
- __handle_add_reacher_url(parameters, invocation);
- else if (g_strcmp0(method_name, "RemoveReacherUrl") == 0)
- __handle_remove_reacher_url(parameters, invocation);
- else if (g_strcmp0(method_name, "StartReacher") == 0)
- __handle_start_reacher(parameters, invocation);
- else if (g_strcmp0(method_name, "StopReacher") == 0)
- __handle_stop_reacher(parameters, invocation);
- else if (g_strcmp0(method_name, "ReacherIsRunning") == 0)
- __handle_reacher_is_running(parameters, invocation);
+ else if (g_strcmp0(method_name, "AddUrltoCheck") == 0)
+ __handle_add_url_to_check(parameters, invocation);
+ else if (g_strcmp0(method_name, "RemoveUrltoCheck") == 0)
+ __handle_remove_url_to_check(parameters, invocation);
+ else if (g_strcmp0(method_name, "ReachableUrlsStartChecking") == 0)
+ __handle_reachable_urls_start_checking(parameters, invocation);
+ else if (g_strcmp0(method_name, "ReachableUrlsStopChecking") == 0)
+ __handle_reachable_urls_stop_checking(parameters, invocation);
+ else if (g_strcmp0(method_name, "ReachableUrlIsCheckRunning") == 0)
+ __handle_reachable_urls_is_check_running(parameters, invocation);
else if (g_strcmp0(method_name, "DefaultDnsLookupCheck") == 0)
__handle_default_dns_lookup(parameters, invocation);
else if (g_strcmp0(method_name, "GetLinks") == 0)
"</method>"
"<method name='DefaultGatewayStopChecking'>"
"</method>"
- "<method name='AddReacherUrl'>"
+ "<method name='AddUrltoCheck'>"
"<arg type='s' name='url' direction='in'/>"
"</method>"
- "<method name='RemoveReacherUrl'>"
+ "<method name='RemoveUrltoCheck'>"
"<arg type='s' name='url' direction='in'/>"
"</method>"
- "<method name='StartReacher'>"
+ "<method name='ReachableUrlsStartChecking'>"
"<arg type='i' name='type' direction='in'/>"
"</method>"
- "<method name='StopReacher'>"
+ "<method name='ReachableUrlsStopChecking'>"
"<arg type='i' name='type' direction='in'/>"
"</method>"
- "<method name='ReacherIsRunning'>"
+ "<method name='ReachableUrlIsCheckRunning'>"
"<arg type='b' name='is_running' direction='out'/>"
"</method>"
"<method name='DefaultDnsLookupCheck'>"
return ret;
}
-int inm_manager_add_reacher_url(const char *url)
+int inm_manager_add_url_to_check(const char *url)
{
int ret = 0;
return INM_MANAGER_ERROR_NONE;
}
-int inm_manager_remove_reacher_url(const char *url)
+int inm_manager_remove_url_to_check(const char *url)
{
int ret = 0;
return;
}
-int inm_manager_start_reacher(int type)
+int inm_manager_reachable_urls_start_checking(int type)
{
int ret = 0;
return INM_MANAGER_ERROR_NONE;
}
-int inm_manager_stop_reacher(int type)
+int inm_manager_reachable_urls_stop_checking(int type)
{
int ret = 0;
return INM_MANAGER_ERROR_NONE;
}
-int inm_manager_get_reacher_is_running(gboolean *is_running)
+int inm_manager_reachable_urls_is_check_running(gboolean *is_running)
{
int ret = 0;
if (!g_reacher) {\
__INM_FUNC_EXIT__;\
return INM_REACHER_ERROR_NOT_INITIALIZED;\
- }\
+ } \
} while (0)
#define RET_ERR_IF_INVALID_PARAM(param)\
do {\
if (!(param)) {\
__INM_FUNC_EXIT__;\
return INM_REACHER_ERROR_INVALID_PARAM;\
- }\
+ } \
} while (0)
/* Information associated with a specific easy handle */
reacher_data_s *g_reacher;
static const char *default_urls[] = {
- "http://www.microsoft.com",
- "http://www.opensource.org",
- "http://www.google.com",
- "http://www.yahoo.com",
- "http://www.ibm.com",
- "http://www.mysql.com",
- "http://www.oracle.com",
- "http://www.ripe.net",
- "http://www.iana.org",
- "http://www.amazon.com",
- "http://www.netcraft.com",
- "http://www.heise.de",
- "http://www.chip.de",
- "http://www.ca.com",
- "http://www.cnet.com",
- "http://www.news.com",
- "http://www.cnn.com",
- "http://www.wikipedia.org",
- "http://www.dell.com",
- "http://www.hp.com",
- "http://www.cert.org",
- "http://www.mit.edu",
- "http://www.nist.gov",
- "http://www.ebay.com",
- "http://www.playstation.com",
- "http://www.uefa.com",
- "http://www.ieee.org",
- "http://www.apple.com",
- "http://www.symantec.com",
- "http://www.zdnet.com",
- "http://www.fujitsu.com",
- "http://www.supermicro.com",
- "http://www.hotmail.com",
- "http://www.ecma.com",
- "http://www.bbc.co.uk",
- "http://news.google.com",
- "http://www.foxnews.com",
- "http://www.msn.com",
- "http://www.wired.com",
- "http://www.sky.com",
- "http://www.usatoday.com",
- "http://www.cbs.com",
- "http://www.nbc.com",
- "http://slashdot.org",
- "http://www.techweb.com",
- "http://www.newslink.org",
- "http://www.un.org",
+ "https://www.microsoft.com",
+ "https://www.opensource.org",
+ "https://www.google.com",
+ "https://www.yahoo.com",
+ "https://www.ibm.com",
+ "https://www.mysql.com",
+ "https://www.oracle.com",
+ "https://www.iana.org",
+ "https://www.amazon.com",
+ "https://www.mozilla.org",
+ "https://www.cnn.com",
+ "https://www.wikipedia.org",
+ "https://www.dell.com",
+ "https://www.hp.com",
+ "https://www.cert.org",
+ "https://www.mit.edu",
+ "https://www.nist.gov",
+ "https://www.ebay.com",
+ "https://www.playstation.com",
+ "https://www.ieee.org",
+ "https://www.apple.com",
+ "https://www.symantec.com",
+ "https://www.zdnet.com",
+ "https://www.fujitsu.com",
+ "https://www.bbc.co.uk",
+ "https://news.google.com",
+ "https://www.foxnews.com",
+ "https://www.msn.com",
+ "https://www.usatoday.com",
+ "https://www.nbc.com",
};
#define URL_CNT sizeof(default_urls)/sizeof(char *)
return 0;
}
+static int __deinit_curl_multi_handle(reacher_data_s *reacher)
+{
+ CURLM *p_mh;
+
+ if (!reacher)
+ return -1;
+
+ p_mh = reacher->p_mh;
+ if (!p_mh)
+ return -1;
+
+ curl_multi_cleanup(reacher->p_mh);
+ reacher->p_mh = 0;
+
+ return 0;
+}
+
static inline void __check_next(reacher_data_s *reacher)
{
if (reacher->type == INM_REACHER_CHECK_DEFAULT_URLS) {
if (reacher->once && reacher->current_index == URL_CNT) {
__clear_running_mult_data(reacher);
+ __deinit_curl_multi_handle(reacher);
INM_LOGI("Reached to end");
g_reacher->running = FALSE;
return;
} else {
if (reacher->once && reacher->current == NULL) {
__clear_running_mult_data(reacher);
+ __deinit_curl_multi_handle(reacher);
INM_LOGI("Reached to end");
g_reacher->running = FALSE;
return;
sock_data->ch = g_io_channel_unix_new(sock);
__set_sock(sock_data, sock, sock_data->p_eh, action, reacher);
+ g_io_channel_unref(sock_data->ch);
curl_multi_assign(reacher->p_mh, sock, sock_data);
}
return 0;
}
-int __init_curl_muti_handle(reacher_data_s *reacher)
+static int __init_curl_muti_handle(reacher_data_s *reacher)
{
CURLM *p_mh;
return 0;
}
-int __deinit_curl_multi_handle(reacher_data_s *reacher)
-{
- CURLM *p_mh;
-
- if (!reacher)
- return -1;
-
- p_mh = reacher->p_mh;
- if (!p_mh)
- return -1;
-
- curl_multi_cleanup(reacher->p_mh);
- reacher->p_mh = 0;
-
- return 0;
-}
-
int inm_reacher_init(void)
{
gint ret = INM_REACHER_ERROR_NONE;
return ret;
}
+ INM_LOGI("%s Added", url);
g_reacher->user_added_url =
g_slist_prepend(g_reacher->user_added_url, g_strdup(url));
return INM_REACHER_ERROR_IN_PROGRESS;
}
+ INM_LOGI("%s Removed", url);
__remove_url(url);
__INM_FUNC_EXIT__;