4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Sungsik Jang <sungsik.jang@samsung.com>, Dongwook Lee <dwmax.lee@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
22 #ifndef __WIFI_DIRECT_INTERNAL_H_
23 #define __WIFI_DIRECT_INTERNAL_H_
25 #include "wifi-direct.h"
31 #define WFD_INVALID_ID -1
35 #define O_NONBLOCK O_NDELAY
36 #endif /** O_NONBLOCK */
39 #ifndef _UINT32_TYPE_H_
40 #define _UINT32_TYPE_H_
41 typedef unsigned int uint32;
42 #endif /** _UINT32_TYPE_H_ */
44 typedef unsigned int ipv4_addr_t;
54 #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
55 #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
56 #define IP2STR(a) (a)[0], (a)[1], (a)[2], (a)[3]
58 #define IPSTR "%d.%d.%d.%d"
60 #define WIFI_DIRECT_WPA_LEN 8
61 #define WIFI_DIRECT_MAX_SSID_LEN 32
62 #define WIFI_DIRECT_MAX_DEVICE_NAME_LEN 32
63 #define WIFI_DIRECT_WPS_PIN_LEN 8
64 #define WIFI_DIRECT_MAC_ADDRESS_INFO_FILE "/opt/etc/.mac.info"
66 #define VCONFKEY_IFNAME "memory/private/wifi_direct_manager/p2p_ifname"
67 #define VCONFKEY_LOCAL_IP "memory/private/wifi_direct_manager/p2p_local_ip"
68 #define VCONFKEY_SUBNET_MASK "memory/private/wifi_direct_manager/p2p_subnet_mask"
69 #define VCONFKEY_GATEWAY "memory/private/wifi_direct_manager/p2p_gateway"
73 WIFI_DIRECT_CMD_INVALID,
74 WIFI_DIRECT_CMD_REGISTER,
75 WIFI_DIRECT_CMD_INIT_ASYNC_SOCKET,
76 WIFI_DIRECT_CMD_DEREGISTER,
77 WIFI_DIRECT_CMD_ACTIVATE,
78 WIFI_DIRECT_CMD_DEACTIVATE,
79 WIFI_DIRECT_CMD_START_DISCOVERY,
80 WIFI_DIRECT_CMD_CANCEL_DISCOVERY,
81 WIFI_DIRECT_CMD_GET_DISCOVERY_RESULT,
82 WIFI_DIRECT_CMD_GET_LINK_STATUS,
83 WIFI_DIRECT_CMD_CONNECT,
85 WIFI_DIRECT_CMD_DISCONNECT_ALL,
86 WIFI_DIRECT_CMD_CREATE_GROUP,
87 WIFI_DIRECT_CMD_IS_GROUPOWNER,
88 WIFI_DIRECT_CMD_GET_SSID,
89 WIFI_DIRECT_CMD_SET_SSID,
90 WIFI_DIRECT_CMD_GET_IP_ADDR,
91 WIFI_DIRECT_CMD_GET_CONFIG,
92 WIFI_DIRECT_CMD_SET_CONFIG,
93 WIFI_DIRECT_CMD_SEND_PROVISION_DISCOVERY_REQ,
94 WIFI_DIRECT_CMD_SEND_CONNECT_REQ,
96 WIFI_DIRECT_CMD_ACTIVATE_PUSHBUTTON,
97 WIFI_DIRECT_CMD_SET_WPS_PIN,
98 WIFI_DIRECT_CMD_GET_WPS_PIN,
99 WIFI_DIRECT_CMD_GENERATE_WPS_PIN,
100 WIFI_DIRECT_CMD_GET_INCOMMING_PEER_INFO,
101 WIFI_DIRECT_CMD_SET_WPA,
102 WIFI_DIRECT_CMD_GET_PASSPHRASE,
103 WIFI_DIRECT_CMD_GET_SUPPORTED_WPS_MODE,
104 WIFI_DIRECT_CMD_GET_LOCAL_WPS_MODE,
105 WIFI_DIRECT_CMD_SET_REQ_WPS_MODE, //30
107 WIFI_DIRECT_CMD_GET_REQ_WPS_MODE,
108 WIFI_DIRECT_CMD_GET_CONNECTED_PEERS_INFO,
109 WIFI_DIRECT_CMD_CANCEL_GROUP,
110 WIFI_DIRECT_CMD_CANCEL_CONNECTION,
111 WIFI_DIRECT_CMD_REJECT_CONNECTION,
112 WIFI_DIRECT_CMD_DISCONNECT,
113 WIFI_DIRECT_CMD_SET_GO_INTENT,
114 WIFI_DIRECT_CMD_GET_GO_INTENT,
115 WIFI_DIRECT_CMD_GET_DEVICE_MAC,
116 WIFI_DIRECT_CMD_IS_AUTONOMOUS_GROUP,
118 WIFI_DIRECT_CMD_SET_MAX_CLIENT,
119 WIFI_DIRECT_CMD_GET_MAX_CLIENT,
120 WIFI_DIRECT_CMD_SET_AUTOCONNECTION_MODE,
121 WIFI_DIRECT_CMD_IS_AUTOCONNECTION_MODE,
122 WIFI_DIRECT_CMD_IS_DISCOVERABLE,
123 WIFI_DIRECT_CMD_IS_LISTENING_ONLY,
124 WIFI_DIRECT_CMD_GET_OWN_GROUP_CHANNEL,
125 WIFI_DIRECT_CMD_ACTIVATE_PERSISTENT_GROUP,
126 WIFI_DIRECT_CMD_DEACTIVATE_PERSISTENT_GROUP,
127 WIFI_DIRECT_CMD_IS_PERSISTENT_GROUP,
129 WIFI_DIRECT_CMD_GET_PERSISTENT_GROUP_INFO,
131 WIFI_DIRECT_CMD_REMOVE_PERSISTENT_GROUP,
132 WIFI_DIRECT_CMD_GET_DEVICE_NAME,
134 WIFI_DIRECT_CMD_SET_DEVICE_NAME,
136 WIFI_DIRECT_CMD_SET_OEM_LOGLEVEL,
142 * Wi-Fi Direct client event for IPC
146 WIFI_DIRECT_CLI_EVENT_INVALID = -1, /**< */
148 WIFI_DIRECT_CLI_EVENT_ACTIVATION, /**< */
149 WIFI_DIRECT_CLI_EVENT_DEACTIVATION, /**< */
151 WIFI_DIRECT_CLI_EVENT_DISCOVER_START, /**< 80211 scan*/
152 WIFI_DIRECT_CLI_EVENT_DISCOVER_START_LISTEN_ONLY, /**< listen only mode*/
153 WIFI_DIRECT_CLI_EVENT_DISCOVER_START_SEARCH_LISTEN, /**< search, listen*/
154 WIFI_DIRECT_CLI_EVENT_DISCOVER_END, /**< */
155 WIFI_DIRECT_CLI_EVENT_DISCOVER_FOUND_PEERS, /**< */
157 WIFI_DIRECT_CLI_EVENT_CONNECTION_START, /**< */
158 WIFI_DIRECT_CLI_EVENT_CONNECTION_REQ, /**< */
159 WIFI_DIRECT_CLI_EVENT_CONNECTION_RSP, /**< */
160 WIFI_DIRECT_CLI_EVENT_CONNECTION_WPS_REQ, /**< */
162 WIFI_DIRECT_CLI_EVENT_DISCONNECTION_RSP, /**< */
163 WIFI_DIRECT_CLI_EVENT_DISCONNECTION_IND, /**< */
164 WIFI_DIRECT_CLI_EVENT_DISASSOCIATION_IND, /**< */
166 WIFI_DIRECT_CLI_EVENT_GROUP_CREATE_RSP, /**< */
167 WIFI_DIRECT_CLI_EVENT_GROUP_DESTROY_RSP, /**< */
169 WIFI_DIRECT_CLI_EVENT_IP_LEASED_IND, /**< */
170 WIFI_DIRECT_CLI_EVENT_INVITATION_REQ,
171 } wfd_client_event_e;
174 * Wi-Fi Direct configuration data structure for IPC
178 char device_name[WIFI_DIRECT_MAX_DEVICE_NAME_LEN + 1];
180 wifi_direct_wps_type_e wps_config;
181 wifi_direct_wps_type_e req_wps_config;
184 int group_owner_intent;
185 bool want_persistent_group;
187 bool auto_connection;
188 wifi_direct_primary_device_type_e primary_dev_type;
189 wifi_direct_secondary_device_type_e secondary_dev_type;
194 * Wi-Fi Direct buffer structure to store result of peer discovery for IPC
199 char device_name[WIFI_DIRECT_MAX_DEVICE_NAME_LEN + 1];
200 unsigned char mac_address[6];
203 unsigned int services;
204 bool is_persistent_go;
205 unsigned char intf_mac_address[6];
206 unsigned int wps_device_pwd_id;
207 unsigned int wps_cfg_methods;
208 unsigned int category;
209 unsigned int subcategory;
211 } wfd_discovery_entry_s;
215 * Wi-Fi Direct buffer structure to store information of connected peer
219 char device_name[WIFI_DIRECT_MAX_DEVICE_NAME_LEN + 1];
220 unsigned char ip_address[4];
221 unsigned char mac_address[6];
222 unsigned char intf_mac_address[6];
223 unsigned int services;
225 unsigned short category;
227 } wfd_connected_peer_info_s;
232 char ssid[WIFI_DIRECT_MAX_SSID_LEN + 1];
233 unsigned char go_mac_address[6];
234 } wfd_persistent_group_info_s;
240 unsigned char mac_addr[6];
241 } wifi_direct_client_request_data_s;
246 wifi_direct_cmd_e cmd;
248 wifi_direct_client_request_data_s data;
249 } wifi_direct_client_request_s;
253 wifi_direct_cmd_e cmd;
254 wifi_direct_error_e result;
260 } wifi_direct_client_response_s;
264 wfd_client_event_e event;
265 wifi_direct_error_e error;
268 } wifi_direct_client_noti_s;
271 #endif //__WIFI_DIRECT_INTERNAL_H_