4 * Copyright (c) 2000 - 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_MAX_SSID_LEN 32
61 #define WIFI_DIRECT_WPS_PIN_LEN 8
62 #define WIFI_DIRECT_MAC_ADDRESS_INFO_FILE "/opt/etc/.mac.info"
64 #define VCONFKEY_IFNAME "memory/private/wifi_direct_manager/p2p_ifname"
65 #define VCONFKEY_LOCAL_IP "memory/private/wifi_direct_manager/p2p_local_ip"
66 #define VCONFKEY_SUBNET_MASK "memory/private/wifi_direct_manager/p2p_subnet_mask"
67 #define VCONFKEY_GATEWAY "memory/private/wifi_direct_manager/p2p_gateway"
71 WIFI_DIRECT_CMD_INVALID,
72 WIFI_DIRECT_CMD_REGISTER,
73 WIFI_DIRECT_CMD_INIT_ASYNC_SOCKET,
74 WIFI_DIRECT_CMD_DEREGISTER,
75 WIFI_DIRECT_CMD_ACTIVATE,
76 WIFI_DIRECT_CMD_DEACTIVATE,
77 WIFI_DIRECT_CMD_START_DISCOVERY,
78 WIFI_DIRECT_CMD_CANCEL_DISCOVERY,
79 WIFI_DIRECT_CMD_GET_DISCOVERY_RESULT,
80 WIFI_DIRECT_CMD_GET_LINK_STATUS,
81 WIFI_DIRECT_CMD_CONNECT,
82 WIFI_DIRECT_CMD_DISCONNECT_ALL,
83 WIFI_DIRECT_CMD_CREATE_GROUP,
84 WIFI_DIRECT_CMD_IS_GROUPOWNER,
85 WIFI_DIRECT_CMD_GET_SSID,
86 WIFI_DIRECT_CMD_SET_SSID,
87 WIFI_DIRECT_CMD_GET_IP_ADDR,
88 WIFI_DIRECT_CMD_GET_CONFIG,
89 WIFI_DIRECT_CMD_SET_CONFIG,
90 WIFI_DIRECT_CMD_SEND_PROVISION_DISCOVERY_REQ,
91 WIFI_DIRECT_CMD_SEND_CONNECT_REQ,
92 WIFI_DIRECT_CMD_ACTIVATE_PUSHBUTTON,
93 WIFI_DIRECT_CMD_SET_WPS_PIN,
94 WIFI_DIRECT_CMD_GET_WPS_PIN,
95 WIFI_DIRECT_CMD_GENERATE_WPS_PIN,
96 WIFI_DIRECT_CMD_GET_INCOMMING_PEER_INFO,
97 WIFI_DIRECT_CMD_SET_WPA,
98 WIFI_DIRECT_CMD_GET_SUPPORTED_WPS_MODE,
99 WIFI_DIRECT_CMD_SET_CURRENT_WPS_MODE,
100 WIFI_DIRECT_CMD_GET_CONNECTED_PEERS_INFO,
101 WIFI_DIRECT_CMD_CANCEL_GROUP,
102 WIFI_DIRECT_CMD_DISCONNECT,
103 WIFI_DIRECT_CMD_SET_GO_INTENT,
104 WIFI_DIRECT_CMD_GET_GO_INTENT,
105 WIFI_DIRECT_CMD_GET_DEVICE_MAC,
106 WIFI_DIRECT_CMD_IS_AUTONOMOUS_GROUP,
107 WIFI_DIRECT_CMD_SET_MAX_CLIENT,
108 WIFI_DIRECT_CMD_GET_MAX_CLIENT,
109 WIFI_DIRECT_CMD_SET_AUTOCONNECTION_MODE,
110 WIFI_DIRECT_CMD_IS_DISCOVERABLE,
111 WIFI_DIRECT_CMD_GET_OWN_GROUP_CHANNEL,
113 WIFI_DIRECT_CMD_SET_OEM_LOGLEVEL,
119 * Wi-Fi Direct client event for IPC
123 WIFI_DIRECT_CLI_EVENT_INVALID = -1, /**< */
125 WIFI_DIRECT_CLI_EVENT_ACTIVATION, /**< */
126 WIFI_DIRECT_CLI_EVENT_DEACTIVATION, /**< */
128 WIFI_DIRECT_CLI_EVENT_DISCOVER_START, /**< 80211 scan*/
129 WIFI_DIRECT_CLI_EVENT_DISCOVER_START_LISTEN_ONLY, /**< listen only mode*/
130 WIFI_DIRECT_CLI_EVENT_DISCOVER_START_SEARCH_LISTEN, /**< search, listen*/
131 WIFI_DIRECT_CLI_EVENT_DISCOVER_END, /**< */
132 WIFI_DIRECT_CLI_EVENT_DISCOVER_FOUND_PEERS, /**< */
134 WIFI_DIRECT_CLI_EVENT_CONNECTION_START, /**< */
135 WIFI_DIRECT_CLI_EVENT_CONNECTION_REQ, /**< */
136 WIFI_DIRECT_CLI_EVENT_CONNECTION_RSP, /**< */
137 WIFI_DIRECT_CLI_EVENT_CONNECTION_WPS_REQ, /**< */
139 WIFI_DIRECT_CLI_EVENT_DISCONNECTION_RSP, /**< */
140 WIFI_DIRECT_CLI_EVENT_DISCONNECTION_IND, /**< */
141 WIFI_DIRECT_CLI_EVENT_DISASSOCIATION_IND, /**< */
143 WIFI_DIRECT_CLI_EVENT_GROUP_CREATE_RSP, /**< */
144 WIFI_DIRECT_CLI_EVENT_GROUP_DESTROY_RSP, /**< */
146 WIFI_DIRECT_CLI_EVENT_IP_LEASED_IND, /**< */
147 } wfd_client_event_e;
150 * Wi-Fi Direct configuration data structure for IPC
154 char ssid[WIFI_DIRECT_MAX_SSID_LEN + 1];
156 wifi_direct_wps_type_e wps_config;
159 int group_owner_intent;
160 bool want_persistent_group;
161 bool auto_connection;
162 wifi_direct_primary_device_type_e primary_dev_type;
163 wifi_direct_secondary_device_type_e secondary_dev_type;
168 * Wi-Fi Direct buffer structure to store result of peer discovery for IPC
173 char ssid[WIFI_DIRECT_MAX_SSID_LEN + 1];
174 unsigned char mac_address[6];
177 unsigned int services;
178 bool is_persistent_go;
179 unsigned char intf_mac_address[6];
180 unsigned int wps_device_pwd_id;
181 unsigned int wps_cfg_methods;
182 unsigned int category;
183 unsigned int subcategory;
185 } wfd_discovery_entry_s;
189 * Wi-Fi Direct buffer structure to store information of connected peer
193 char ssid[WIFI_DIRECT_MAX_SSID_LEN + 1];
194 unsigned char ip_address[4];
195 unsigned char mac_address[6];
196 unsigned char intf_mac_address[6];
197 unsigned int services;
199 unsigned short category;
201 } wfd_connected_peer_info_s;
210 unsigned char mac_addr[6];
212 } wifi_direct_client_request_data_s;
217 wifi_direct_cmd_e cmd;
219 wifi_direct_client_request_data_s data;
220 } wifi_direct_client_request_s;
224 wifi_direct_cmd_e cmd;
225 wifi_direct_error_e result;
231 } wifi_direct_client_response_s;
235 wfd_client_event_e event;
236 wifi_direct_error_e error;
239 } wifi_direct_client_noti_s;
242 #endif //__WIFI_DIRECT_INTERNAL_H_