--- /dev/null
+/*
+ * Network Monitoring Module
+ *
+ * Copyright (c) 2019 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 defines macros and declares functions for dns-look-up.
+ *
+ * @file inm-dns-lookup.h
+ * @author Jiung Yu (jiung.yu@samsung.com)
+ */
+
+#ifndef __INM_DNS_LOOKUP_H__
+#define __INM_DNS_LOOKUP_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+ INM_DNS_LOOKUP_ERROR_NONE = 0,
+ INM_DNS_LOOKUP_ERROR_NOT_INITIALIZED,
+ INM_DNS_LOOKUP_ERROR_INVALID_PARAMETER,
+ INM_DNS_LOOKUP_ERROR_OPERATION_FAILED,
+ INM_DNS_LOOKUP_ERROR_IN_PROGRESS,
+ INM_DNS_LOOKUP_ERROR_TIMEOUT,
+} inm_dns_lookup_error_e;
+
+int inm_dns_lookup_init();
+int inm_dns_lookup_deinit();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __INM_DNS_LOOKUP_H__ */
BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(libcurl)
BuildRequires: pkgconfig(libnl-2.0)
+BuildRequires: pkgconfig(libcares)
BuildRequires: python
BuildRequires: python-xml
Requires: security-config
libnl-2.0
vconf
libcurl
+ libcares
)
SET(REQUIRED_LIBS "-ldl")
${CMAKE_SOURCE_DIR}/src/inm-icmp-ping.c
${CMAKE_SOURCE_DIR}/src/inm-trace-route.c
${CMAKE_SOURCE_DIR}/src/inm-rtnl.c
+ ${CMAKE_SOURCE_DIR}/src/inm-dns-lookup.c
)
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fpic -Wall -Werror-implicit-function-declaration -fvisibility=hidden")
--- /dev/null
+/*
+ * Network Monitoring Module
+ *
+ * Copyright (c) 2019 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 DNS lookup functions.
+ *
+ * @file inm-dns-lookup.c
+ * @author Jiung Yu (jiung.yu@samsung.com)
+ */
+
+#include <ares.h>
+#include <glib.h>
+
+#include "inm-manager-log.h"
+#include "inm-manager.h"
+#include "inm-util.h"
+#include "inm-dns-lookup.h"
+
+int inm_dns_lookup_init()
+{
+ int version;
+
+ INM_LOGI("c-ares version %s", ares_version(&version));
+
+ return INM_DNS_LOOKUP_ERROR_NONE;
+}
+
+int inm_dns_lookup_deinit()
+{
+ return INM_DNS_LOOKUP_ERROR_NONE;
+}
#include "inm-connman.h"
#include "inm-manager.h"
#include "inm-rtnl.h"
+#include "inm-dns-lookup.h"
#include "inm-manager-log.h"
#include "inm-error.h"
__INM_FUNC_EXIT__;
return;
}
+
+static inline void __init_dns_lookup()
+{
+ __INM_FUNC_ENTER__;
+ if (inm_dns_lookup_init() < 0) {
+ INM_LOGW("dns lookup init failed");
+ __INM_FUNC_EXIT__;
+ return;
+ }
+
+ __INM_FUNC_EXIT__;
+}
+
+static inline void __deinit_dns_lookup()
+{
+ __INM_FUNC_ENTER__;
+
+ if (inm_dns_lookup_deinit() < 0)
+ INM_LOGW("dns lookup deinit failed");
+
+ __INM_FUNC_EXIT__;
+ return;
+}
+
static void __ethernet_cable_state_changed_cb(char *iface_name, int state, void *user_data)
{
gboolean is_attached = FALSE;
__init_retry_tx_rate_monitor();
__init_channel_interference_monitor();
__init_congestion_mon();
+ __init_dns_lookup();
__INM_FUNC_EXIT__;
return ret;
__deinit_retry_tx_rate_monitor();
__deinit_channel_interference_monitor();
__deinit_congestion_mon();
+ __deinit_dns_lookup();
g_free(g_inm_manager);