Fix logical dead code issue
[platform/core/connectivity/wifi-direct-manager.git] / include / wifi-direct-util.h
1 /*
2  * Network Configuration Module
3  *
4  * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
5  *
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
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  *
18  */
19
20 /**
21  * This file declares wifi direct util functions.
22  *
23  * @file                wifi-direct-util.h
24  * @author      Gibyoung Kim (lastkgb.kim@samsung.com)
25  * @version     0.7
26  */
27
28 #ifndef __WIFI_DIRECT_UTIL_H__
29 #define __WIFI_DIRECT_UTIL_H__
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
36 #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
37 #define IP2STR(a) (a)[0], (a)[1], (a)[2], (a)[3]
38 #define IPSTR "%d.%d.%d.%d"
39 #define ZEROIP "0.0.0.0"
40 #define ISZEROIP(a) !((a)[0] | (a)[1] | (a)[2] | (a)[3])
41 #define ISZEROMACADDR(a) !((a)[0] | (a)[1] | (a)[2] | (a)[3] | (a)[4] | (a)[5])
42 #define MAC2SECSTR(a) (a)[0], (a)[4], (a)[5]
43 #define MACSECSTR "%02x:%02x:%02x"
44 #define IP2SECSTR(a) (a)[0], (a)[3]
45 #define IPSECSTR "%d..%d"
46 #define MAX_SIZE_ERROR_BUFFER 256
47
48 #define DHCP_DUMP_FILE "/tmp/dhcp-client-table"
49 #define MAX_DHCP_DUMP_SIZE 64    /* Single lease format: [99:66:dd:00:11:aa 192.168.16.20 00:00:60] */
50
51 #define SOCK_FD_MIN 3
52
53 #if !(__GNUC__ <= 4 && __GNUC_MINOR__ < 8)
54 int wfd_util_get_current_time(unsigned long *cur_time);
55 #endif
56
57 void *wfd_util_plugin_init(wfd_manager_s *manager);
58 int wfd_util_plugin_deinit(wfd_manager_s *manager);
59 void *wfd_util_prd_plugin_init(wfd_manager_s *manager);
60 int wfd_util_prd_plugin_deinit(wfd_manager_s *manager);
61
62 gboolean wfd_util_execute_file(const char *file_path,   char *const args[], char *const envs[]);
63 int wfd_util_freq_to_channel(int freq);
64 int wfd_util_channel_to_freq(int channel);
65 int wfd_util_get_phone_name(char *phone_name);
66 void wfd_util_set_dev_name_notification();
67 void wfd_util_unset_dev_name_notification();
68
69 void wfd_util_check_features(wfd_manager_s *manager);
70 void wfd_util_load_wfd_conf(wfd_manager_s *manager);
71 int wfd_util_check_wifi_state();
72 int wfd_util_check_p2p_hotspot_state();
73 int wfd_util_check_mobile_ap_state();
74 int wfd_util_wifi_direct_activatable();
75 #if 0
76 int wfd_util_get_wifi_direct_state();
77 #endif
78 int wfd_util_set_wifi_direct_state(int state);
79 int wfd_util_get_local_dev_mac(unsigned char *dev_mac);
80
81 int wfd_util_start_wifi_direct_popup();
82 int wfd_util_stop_wifi_direct_popup();
83
84 int wfd_util_dhcps_start(char *ifname);
85 int wfd_util_dhcps_wait_ip_leased(wfd_device_s *peer);
86 int wfd_util_dhcps_stop(char *ifname);
87 int wfd_util_dhcpc_start(char *ifname, wfd_device_s *peer);
88 int wfd_util_dhcpc_stop(char *ifname);
89 int wfd_util_local_get_ip(char *ifname, unsigned char *ip_addr, int is_IPv6);
90 int wfd_util_dhcpc_get_server_ip(unsigned char* ip_addr);
91 int wfd_util_ip_over_eap_assign(wfd_device_s *peer, const char *ifname);
92 int wfd_util_ip_unset(const char *ifname);
93 gboolean wfd_util_is_remove_group_allowed(void);
94
95 #ifdef __cplusplus
96 }
97 #endif
98
99 #endif /* __WIFI_DIRECT_UTIL_H__ */