2 * Network Configuration Module
4 * Copyright (c) 2012 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.
21 * This file declares wifi direct util functions.
23 * @file wifi-direct-util.h
24 * @author Gibyoung Kim (lastkgb.kim@samsung.com)
28 #ifndef __WIFI_DIRECT_UTIL_H__
29 #define __WIFI_DIRECT_UTIL_H__
31 #define DEFAULT_MAC_FILE_PATH "/opt/etc/.mac.info"
32 #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
33 #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
34 #define IP2STR(a) (a)[0], (a)[1], (a)[2], (a)[3]
35 #define IPSTR "%d.%d.%d.%d"
37 #define VCONFKEY_DHCPS_IP_LEASE "memory/private/wifi_direct_manager/dhcp_ip_lease"
38 #define VCONFKEY_DHCPC_SERVER_IP "memory/private/wifi_direct_manager/dhcpc_server_ip"
39 #define DHCP_DUMP_FILE "/tmp/dhcp-client-table"
40 #define MAX_DHCP_DUMP_SIZE 64 // Single lease format: [99:66:dd:00:11:aa 192.168.16.20 00:00:60]
48 #define LOG_TAG "WIFI_DIRECT_MANAGER"
50 #define WDS_LOGV(format, args...) LOGV(format, ##args)
51 #define WDS_LOGD(format, args...) LOGD(format, ##args)
52 #define WDS_LOGI(format, args...) LOGI(format, ##args)
53 #define WDS_LOGW(format, args...) LOGW(format, ##args)
54 #define WDS_LOGE(format, args...) LOGE(format, ##args)
55 #define WDS_LOGF(format, args...) LOGF(format, ##args)
57 #define __WDS_LOG_FUNC_ENTER__ LOGV("Enter")
58 #define __WDS_LOG_FUNC_EXIT__ LOGV("Quit")
62 #define WDS_LOGV(format, args...)
63 #define WDS_LOGD(format, args...)
64 #define WDS_LOGI(format, args...)
65 #define WDS_LOGW(format, args...)
66 #define WDS_LOGE(format, args...)
67 #define WDS_LOGF(format, args...)
69 #define __WDS_LOG_FUNC_ENTER__
70 #define __WDS_LOG_FUNC_EXIT__
74 int wfd_util_freq_to_channel(int freq);
75 int wfd_util_get_phone_name(char *phone_name);
76 void wfd_util_set_dev_name_notification();
77 void wfd_util_unset_dev_name_notification();
78 int wfd_util_check_wifi_state();
79 int wfd_util_check_mobile_ap_state();
80 int wfd_util_wifi_direct_activatable();
81 int wfd_util_get_wifi_direct_state();
82 int wfd_util_set_wifi_direct_state(int state);
83 int wfd_util_get_local_dev_mac(unsigned char *dev_mac);
84 int wfd_util_start_wifi_direct_popup();
85 int wfd_util_dhcps_start();
86 int wfd_util_dhcps_wait_ip_leased(wfd_device_s *peer);
87 int wfd_util_dhcps_stop();
88 int wfd_util_dhcpc_start(wfd_device_s *peer);
89 int wfd_util_dhcpc_stop();
90 int wfd_util_dhcpc_get_ip(char *ifname, unsigned char *ip_addr, int is_IPv6);
91 int wfd_util_dhcpc_get_server_ip(unsigned char* ip_addr);
93 #endif /* __WIFI_DIRECT_UTIL_H__ */