#include <string.h>
#include <fcntl.h>
-#include "bluetooth_ipsp_agent.h"
+#include "bluetooth-ipsp-agent.h"
#include "bluetooth-api.h"
#include <net_connection.h>
#include <sys/socket.h>
}
}
-GDBusConnection * _bt_ipsp_get_gdbus_connection(void)
+static GDBusConnection *__bt_ipsp_get_gdbus_connection(void)
{
GError *err = NULL;
BT_DBG("");
- conn = _bt_ipsp_get_gdbus_connection();
+ conn = __bt_ipsp_get_gdbus_connection();
if (!conn)
return;
return BT_ERROR_NONE;
}
-static int _execute_ip_command(const char *ip_args)
+static int __execute_ip_command(const char *ip_args)
{
if (ip_args == NULL) {
BT_ERR("Invalid param\n");
snprintf(args, sizeof(args), IPV6_NEIGH_PROXY,
ip, if_name);
- if (_execute_ip_command(args)) {
+ if (__execute_ip_command(args)) {
BT_ERR("%s is failed\n", args);
return FALSE;
}
ip, prefix, if_name);
}
- if (_execute_ip_command(args)) {
+ if (__execute_ip_command(args)) {
BT_ERR("%s is failed\n", args);
return FALSE;
}
gchar *path;
GDBusConnection *conn;
- conn = _bt_ipsp_get_gdbus_connection();
+ conn = __bt_ipsp_get_gdbus_connection();
if (!conn)
return FALSE;
--- /dev/null
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+#ifndef __BLUETOOTH_IPSP_AGENT_H__
+#define __BLUETOOTH_IPSP_AGENT_H__
+
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <dlog.h>
+#include <glib.h>
+#include <linux/types.h>
+#include <gio/gio.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define CONNMAN_DBUS_NAME "net.connman"
+#define CONNMAN_BLUETOOTH_TECHNOLOGY_PATH "/net/connman/technology/bluetooth"
+#define CONNMAN_BLUETOTOH_TECHNOLOGY_INTERFACE "net.connman.Technology"
+
+#define BT_IPSP_NAME "org.projectx.bt_ipsp"
+#define BT_IPSP_PATH "/org/projectx/bt_ipsp"
+
+#define LOG_COLOR_RESET "\033[0m"
+#define LOG_COLOR_RED "\033[31m"
+#define LOG_COLOR_YELLOW "\033[33m"
+#define LOG_COLOR_GREEN "\033[32m"
+#define LOG_COLOR_BLUE "\033[36m"
+#define LOG_COLOR_PURPLE "\033[35m"
+
+#define BT_INFO_C(fmt, arg...) \
+ SLOGI_IF(TRUE, LOG_COLOR_GREEN" "fmt" "LOG_COLOR_RESET, ##arg)
+#define BT_ERR_C(fmt, arg...) \
+ SLOGI_IF(TRUE, LOG_COLOR_RED" "fmt" "LOG_COLOR_RESET, ##arg)
+
+
+#define MH_MAX_IPV6_ADDRESS_STR_LEN 40
+#define MH_IF_INET6_PATH "/proc/net/if_inet6"
+#define MH_MAX_INTERFACE_NAME_LEN 20
+#define MAX_BUF_SIZE (256u)
+
+ typedef enum {
+ MOBILE_AP_IPV6_SCOPE_GLOBAL = 0,
+ MOBILE_AP_IPV6_SCOPE_LINK = 20,
+ MOBILE_AP_IPV6_SCOPE_SITE = 40,
+} mobile_ap_ipv6_scope_e;
+
+#define DNSMASQ_CONF_LEN 1024
+#define DNSMASQ_LEASES_FILE "/var/lib/misc/dnsmasq.leases"
+#define DNSMASQ_CONF_FILE "/tmp/dnsmasq.conf"
+#define DNSMASQ_CONF6 \
+ "dhcp-range=192.168.43.3,192.168.43.254,255.255.255.0\n" \
+ "dhcp-range=192.168.130.2,192.168.130.150,255.255.255.0\n" \
+ "dhcp-range=192.168.131.2,192.168.131.150,255.255.255.0\n" \
+ "dhcp-range=192.168.132.2,192.168.132.150,255.255.255.0\n" \
+ "dhcp-range=192.168.133.2,192.168.133.150,255.255.255.0\n" \
+ "dhcp-range=192.168.134.2,192.168.134.150,255.255.255.0\n" \
+ "dhcp-range=192.168.135.2,192.168.135.150,255.255.255.0\n" \
+ "dhcp-range=192.168.136.2,192.168.136.150,255.255.255.0\n" \
+ "dhcp-range=192.168.137.2,192.168.137.150,255.255.255.0\n" \
+ "dhcp-range=set:blue,192.168.129.4,192.168.129.150,255.255.255.0\n"\
+ "enable-dbus\n" \
+ "group=system\n" \
+ "user=system\n" \
+ "dhcp-option=tag:blue,option:router,192.168.129.3\n" \
+ "dhcp-option=6,%s\n" \
+ "log-dhcp\n"\
+ "log-queries\n"\
+ "log-facility=/opt/var/log/dnsmasq.log\n"\
+ "enable-ra\n" \
+ "dhcp-range=%s::, ra-names, ra-stateless, 64, 12h\n"
+
+#define IPV6_FORWARDING "/proc/sys/net/ipv6/conf/all/forwarding"
+#define IPV6_PROXY_NDP "/proc/sys/net/ipv6/conf/all/proxy_ndp"
+
+#define IPV6_INTERFACE_ROUTING "%s/%d dev %s"
+#define IPV6_NEIGH_PROXY "proxy %s dev %s"
+#define IP_CMD "/usr/sbin/ip"
+
+void _bt_ipsp_gdbus_deinit_proxys(void);
+void _bt_ipsp_terminate(void);
+gboolean _bt_ipsp_register_dbus(void);
+void _bt_ipsp_unregister_dbus(void);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif