60be73c4f3fd02e5cf7f89acf2639b1fbcb44408
[platform/core/connectivity/wifi-direct-manager.git] / oem / wifi-direct-oem.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 oem functions and structures.
22  *
23  * @file                wifi-direct-ome.h
24  * @author      Gibyoung Kim (lastkgb.kim@samsung.com)
25  * @version     0.7
26  */
27
28 #ifndef __WIFI_DIRECT_OEM_H__
29 #define __WIFI_DIRECT_OEM_H__
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 #define SUPPL_PLUGIN_PATH "/usr/lib/wifi-direct-plugin-wpasupplicant.so"
36 #define SUPPL_PLUGIN_64BIT_PATH "/usr/lib64/wifi-direct-plugin-wpasupplicant.so"
37
38 #if defined TIZEN_ENABLE_PRD
39 #define SUPPL_PRD_PLUGIN_PATH "/usr/lib/wifi-direct-prd-plugin-wpasupplicant.so"
40 #define SUPPL_PRD_PLUGIN_64BIT_PATH "/usr/lib64/wifi-direct-prd-plugin-wpasupplicant.so"
41 #endif /* TIZEN_ENABLE_PRD */
42
43 #define COMMON_IFACE_NAME "wlan0"
44 #define P2P_IFACE_NAME "p2p0"
45 #define GROUP_IFACE_NAME "p2p0"
46 #define GROUP_IFACE_PREFIX "p2p"
47 #define PRIMARY_DEVICE_TYPE "\x00\x0a\x00\x50\xf2\x04\x00\x05"
48 #define DEFAULT_DEVICE_NAME "Tizen"
49 #define DEFAULT_GO_INTENT 7
50 #define DEFAULT_PERSISTENT_RECONNECT 1
51 #define DEFAULT_LISTEN_REG_CLASS 81
52 #define DEFAULT_LISTEN_CHANNEL 1
53 #define DEFAULT_OPER_REG_CLASS 81
54 #define DEFAULT_OPER_CHANNEL 1
55 #define DEFAULT_CONFIG_METHOD "display push_button keypad p2ps"
56 #define DEFAULT_NO_GROUP_IFACE 0
57
58 #define OEM_MACSTR_LEN 18
59 #define OEM_MACADDR_LEN 6
60 #define OEM_IPADDR_LEN 4
61 #define OEM_PINSTR_LEN 8
62 #define OEM_PASS_PHRASE_LEN 64
63 #define OEM_DEV_NAME_LEN 32
64 #define OEM_IFACE_NAME_LEN 16
65 #define OEM_SERVICE_TYPE_LEN 8
66 #define OEM_QUERY_ID_LEN 15
67 #define OEM_SERVICE_MAX_LEN 1024
68 #define OEM_CONFIG_METHOD_LEN 256
69 #define OEM_VSIE_MAX_LEN 1024
70
71 /* Referring to Wi-Fi Peer-to-Peer Services Technical Specification v1.1
72  * The default P2Ps PIN is 12345670. Any device decided to be GO will use
73  * that as device password
74  */
75 #define OEM_DEFAULT_P2PS_PIN "12345670"
76
77 #define OEM_MAX_PEER_NUM 8
78
79 #define P2P_MAX_CHANNELS 50
80
81 typedef enum {
82         WFD_OEM_SC_SUCCESS = 0,
83         WFD_OEM_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE = 1,
84         WFD_OEM_SC_FAIL_INCOMPATIBLE_PARAMS = 2,
85         WFD_OEM_SC_FAIL_LIMIT_REACHED = 3,
86         WFD_OEM_SC_FAIL_INVALID_PARAMS = 4,
87         WFD_OEM_SC_FAIL_UNABLE_TO_ACCOMMODATE = 5,
88         WFD_OEM_SC_FAIL_PREV_PROTOCOL_ERROR = 6,
89         WFD_OEM_SC_FAIL_NO_COMMON_CHANNELS = 7,
90         WFD_OEM_SC_FAIL_UNKNOWN_GROUP = 8,
91         WFD_OEM_SC_FAIL_BOTH_GO_INTENT_15 = 9,
92         WFD_OEM_SC_FAIL_INCOMPATIBLE_PROV_METHOD = 10,
93         WFD_OEM_SC_FAIL_REJECTED_BY_USER = 11,
94         WFD_OEM_SC_SUCCESS_ACCEPTED_BY_USER = 12,
95 } wfd_oem_status_code_e;
96
97 typedef enum {
98         WFD_OEM_WPA_STATE_DISCONNECTED,
99         WFD_OEM_WPA_STATE_INTERFACE_DISABLED,
100         WFD_OEM_WPA_STATE_INACTIVE,
101         WFD_OEM_WPA_STATE_SCANNING,
102         WFD_OEM_WPA_STATE_AUTHENTICATING,
103         WFD_OEM_WPA_STATE_ASSOCIATING,
104         WFD_OEM_WPA_STATE_ASSOCIATED,
105         WFD_OEM_WPA_STATE_4WAY_HANDSHAKE,
106         WFD_OEM_WPA_STATE_GROUP_HANDSHAKE,
107         WFD_OEM_WPA_STATE_COMPLETED,
108         WFD_OEM_WPA_STATE_MAX,
109 } ws_wpa_state_type_e;
110
111 typedef enum {
112         WFD_OEM_ASP_WPS_TYPE_NONE = 0x00,  /**< No WPS type */
113         WFD_OEM_ASP_WPS_TYPE_DEFAULT = 0x00,  /**< Default WPS type both P2PS and PIN */
114         WFD_OEM_ASP_WPS_TYPE_PIN_BOTH = 0x02,  /**< WPS type PIN code both display and keypad*/
115         WFD_OEM_ASP_WPS_TYPE_PIN_DISPLAY = 0x03,  /**< WPS type display PIN code only*/
116         WFD_OEM_ASP_WPS_TYPE_PIN_KEYPAD = 0x04,  /**< WPS type keypad to input the PIN only*/
117 } asp_wps_type_e;
118
119 typedef enum {
120         WFD_OEM_ASP_SESSION_ROLE_NONE = 0x00,  /**< Session network role none */
121         WFD_OEM_ASP_SESSION_ROLE_NEW = 0x01,  /**< Session network role new */
122         WFD_OEM_ASP_SESSION_ROLE_CLIENT = 0x02,  /**< Session network role client */
123         WFD_OEM_ASP_SESSION_ROLE_GO = 0x04,  /**< Session network role GO */
124 } wfd_oem_asp_network_role_e;
125
126 typedef enum {
127         WFD_OEM_EVENT_NONE,
128         WFD_OEM_EVENT_DEACTIVATED,
129         WFD_OEM_EVENT_PEER_FOUND,
130         WFD_OEM_EVENT_PEER_DISAPPEARED,
131         WFD_OEM_EVENT_DISCOVERY_FINISHED,
132
133         WFD_OEM_EVENT_PROV_DISC_REQ,    /* 5 */
134         WFD_OEM_EVENT_PROV_DISC_RESP,
135         WFD_OEM_EVENT_PROV_DISC_FAIL,
136
137         WFD_OEM_EVENT_GO_NEG_REQ,
138         WFD_OEM_EVENT_GO_NEG_FAIL,
139         WFD_OEM_EVENT_GO_NEG_DONE,      /* 10 */
140         WFD_OEM_EVENT_WPS_FAIL,
141         WFD_OEM_EVENT_WPS_DONE,
142         WFD_OEM_EVENT_KEY_NEG_FAIL,
143         WFD_OEM_EVENT_KEY_NEG_DONE,
144
145         WFD_OEM_EVENT_CONN_FAIL,        /* 15 */
146         WFD_OEM_EVENT_CONN_DONE,
147
148         WFD_OEM_EVENT_GROUP_CREATED,
149         WFD_OEM_EVENT_GROUP_DESTROYED,
150
151         WFD_OEM_EVENT_INVITATION_REQ,
152         WFD_OEM_EVENT_INVITATION_RES,   /* 20 */
153         WFD_OEM_EVENT_STA_CONNECTED,
154         WFD_OEM_EVENT_STA_DISCONNECTED,
155
156         WFD_OEM_EVENT_TERMINATING,      /* 23 */
157
158         WFD_OEM_EVENT_SERV_DISC_RESP,
159         WFD_OEM_EVENT_SERV_DISC_STARTED,
160
161         WFD_OEM_EVENT_GROUP_FORMATION_FAILURE,
162         WFD_OEM_EVENT_INVITATION_ACCEPTED,
163
164         WFD_OEM_EVENT_ASP_SERV_RESP,
165         WFD_OEM_EVENT_ASP_PROV_START,
166         WFD_OEM_EVENT_ASP_PROV_DONE,
167
168         WFD_OEM_EVENT_MAX,
169 } wfd_oem_event_e;
170
171 /**
172  * This enumeration is used in frame id value in vsie method calls
173  */
174 typedef enum {
175         WFD_OEM_VSIE_FRAME_P2P_PROBE_REQ = 0,
176         WFD_OEM_VSIE_FRAME_P2P_PROBE_RESP = 1,
177         WFD_OEM_VSIE_FRAME_P2P_GO_PROBE_RESP = 2,
178         WFD_OEM_VSIE_FRAME_P2P_GO_BEACON = 3,
179         WFD_OEM_VSIE_FRAME_P2P_PD_REQ = 4,
180         WFD_OEM_VSIE_FRAME_P2P_PD_RESP = 5,
181         WFD_OEM_VSIE_FRAME_P2P_GO_NEG_REQ = 6,
182         WFD_OEM_VSIE_FRAME_P2P_GO_NEG_RESP = 7,
183         WFD_OEM_VSIE_FRAME_P2P_GO_NEG_CONF = 8,
184         WFD_OEM_VSIE_FRAME_P2P_INV_REQ = 9,
185         WFD_OEM_VSIE_FRAME_P2P_INV_RESP = 10,
186         WFD_OEM_VSIE_FRAME_P2P_ASSOC_REQ = 11,
187         WFD_OEM_VSIE_FRAME_P2P_ASSOC_RESP = 12,
188         WFD_OEM_VSIE_FRAME_ASSOC_REQ = 13,
189         WFD_OEM_VSIE_FRAME_MAX
190 } wfd_oem_vsie_frames_e;
191
192 typedef enum {
193         WFD_OEM_DISPLAY_TYPE_SOURCE,
194         WFD_OEM_DISPLAY_TYPE_PRISINK,
195         WFD_OEM_DISPLAY_TYPE_SECSINK,
196         WFD_OEM_DISPLAY_TYPE_DUAL,
197 } wfd_oem_display_type_e;
198
199 typedef struct {
200         char ifname[OEM_IFACE_NAME_LEN+1];
201         char p2p_ifname[OEM_IFACE_NAME_LEN+1];
202         char group_ifname[OEM_IFACE_NAME_LEN+1];
203         char device_name[OEM_DEV_NAME_LEN+1];
204         int pri_dev_type;
205         int sec_dev_type;
206         int go_intent;
207         gboolean persistent_reconnect;
208         int listen_reg_class;
209         int listen_channel;
210         int operating_reg_class;
211         int operating_channel;
212         char config_methods[OEM_CONFIG_METHOD_LEN+1];
213         gboolean no_group_iface;
214         int group_operating_freq;
215 } wfd_oem_config_s;
216
217 typedef struct {
218         int type;
219         int availability;
220         int wsd_support;
221         int tdls_support;
222         int hdcp_support;
223         int sync_support;
224         int port;
225         int max_tput;
226 } wfd_oem_display_s;
227
228 typedef struct {
229         unsigned int adv_id;
230         unsigned int config_method;
231         long long unsigned search_id;
232         unsigned char service_type_length;
233         char *service_type;
234         unsigned char instance_name_length;
235         char *instance_name;
236 } wfd_oem_advertise_service_s;
237
238 typedef struct {
239         int age;
240         char dev_name[OEM_DEV_NAME_LEN+1];
241         unsigned char dev_addr[OEM_MACADDR_LEN];
242         unsigned char intf_addr[OEM_MACADDR_LEN];
243         unsigned char go_dev_addr[OEM_MACADDR_LEN];
244         int channel;
245         int dev_role;
246         int config_methods;
247         int pri_dev_type;
248         int sec_dev_type;
249         int dev_flags;
250         int group_flags;
251         int wps_mode;
252         wfd_oem_display_s display;
253         int rssi;
254         char *vsie;
255 } wfd_oem_device_s;
256
257 typedef struct {
258         unsigned char p2p_dev_addr[OEM_MACADDR_LEN];
259         unsigned char p2p_intf_addr[OEM_MACADDR_LEN];
260         char name[OEM_DEV_NAME_LEN + 1];
261         int pri_dev_type;
262         int sec_dev_type;
263         int config_methods;
264         int dev_flags;
265         int group_flags;
266         int dev_role;
267         int device_go_intent;
268         wfd_oem_display_s display;
269         unsigned char p2p_go_addr[OEM_MACADDR_LEN];
270         int has_asp_services;
271         int has_asp2_services;
272         int rssi;
273         char *vsie;
274 } wfd_oem_dev_data_s;
275
276 typedef struct {
277         char ssid[OEM_DEV_NAME_LEN+1];
278         unsigned char peer_device_addr[OEM_MACADDR_LEN];
279         unsigned char peer_intf_addr[OEM_MACADDR_LEN];
280         int persistent_group;
281         int wps_mode;
282         int status;
283         int error;
284 } wfd_oem_conn_data_s;
285
286 typedef struct {
287         unsigned char sa[OEM_MACADDR_LEN];
288         unsigned char go_dev_addr[OEM_MACADDR_LEN];
289         unsigned char bssid[OEM_MACADDR_LEN];
290         int persistent_id;
291         int oper_freq;
292         int listen;
293         int status;
294 } wfd_oem_invite_data_s;
295
296 typedef struct {
297         char ssid[OEM_DEV_NAME_LEN+1];
298         int freq;
299         int is_persistent;
300         char pass[OEM_PASS_PHRASE_LEN+1];
301         unsigned char go_dev_addr[OEM_MACADDR_LEN];
302         unsigned char ip_addr[OEM_IPADDR_LEN];
303         unsigned char ip_addr_mask[OEM_IPADDR_LEN];
304         unsigned char ip_addr_go[OEM_IPADDR_LEN];
305 } wfd_oem_group_data_s;
306
307 typedef enum {
308         WFD_OEM_SERV_STATUS_SUCCESS,
309         WFD_OEM_SERV_STATUS_FAIL,
310 } wfd_oem_serv_status_e;
311
312 typedef enum {
313         WFD_OEM_SERV_TYPE_ALL,
314         WFD_OEM_SERV_TYPE_BTADDR,
315 } wfd_oem_serv_type_e;
316
317 typedef struct {
318         int status;
319         int type;
320         unsigned char data[OEM_MACADDR_LEN];
321         unsigned char value[20];
322 } wfd_oem_service_data_s;
323
324 typedef struct {
325         int event_id;
326         unsigned char dev_addr[OEM_MACADDR_LEN];        /* device address */
327         unsigned char intf_addr[OEM_MACADDR_LEN];
328         int wps_mode;
329         char wps_pin[OEM_PINSTR_LEN+1]; /* just for DISPLAY */
330         char ifname[OEM_IFACE_NAME_LEN+1];
331         int dev_role;
332         unsigned char ip_addr_peer[OEM_IPADDR_LEN];
333         int edata_type;
334         void *edata;
335         void *asp_services;
336         void *asp2_services;
337 } wfd_oem_event_s;
338
339 typedef enum {
340         WFD_OEM_EDATA_TYPE_NONE,
341         WFD_OEM_EDATA_TYPE_DEVICE,
342         WFD_OEM_EDATA_TYPE_CONN,
343         WFD_OEM_EDATA_TYPE_INVITE,
344         WFD_OEM_EDATA_TYPE_GROUP,
345         WFD_OEM_EDATA_TYPE_SERVICE,
346         WFD_OEM_EDATA_TYPE_NEW_SERVICE,
347         WFD_OEM_EDATA_TYPE_ASP_SERVICE,
348         WFD_OEM_EDATA_TYPE_ASP_PROV,
349 } ws_event_type_e;
350
351 typedef enum {
352         WFD_OEM_SCAN_MODE_ACTIVE,
353         WFD_OEM_SCAN_MODE_PASSIVE,
354 } wfd_oem_scan_mode_e;
355
356 typedef enum {
357         WFD_OEM_SCAN_TYPE_FULL,
358         WFD_OEM_SCAN_TYPE_SOCIAL,
359         WFD_OEM_SCAN_TYPE_SPECIFIC,
360         WFD_OEM_SCAN_TYPE_CHANNEL1,
361         WFD_OEM_SCAN_TYPE_CHANNEL6,
362         WFD_OEM_SCAN_TYPE_CHANNEL11,
363         WFD_OEM_SCAN_TYPE_GO_FREQ,
364 } wfd_oem_scan_type_e;
365
366 typedef enum {
367         WFD_OEM_WPS_MODE_NONE,
368         WFD_OEM_WPS_MODE_PBC = 0x1,
369         WFD_OEM_WPS_MODE_DISPLAY = 0x2,
370         WFD_OEM_WPS_MODE_KEYPAD = 0x4,
371         WFD_OEM_WPS_MODE_P2PS = 0x8,
372 } wfd_oem_wps_mode_e;
373
374 #define WFD_OEM_GROUP_FLAG_GROUP_OWNER 0x1
375 #define WFD_OEM_GROUP_FLAG_PERSISTENT_GROUP 0x2
376
377 typedef enum {
378         WFD_OEM_CONN_TYPE_NONE,
379         WFD_OEM_CONN_TYPE_JOIN,
380         WFD_OEM_CONN_TYPE_AUTH,
381         WFD_OEM_CONN_TYPE_PERSISTENT = 0x4,
382 } wfd_oem_conn_flag_e;
383
384 typedef enum {
385         WFD_OEM_DEV_ROLE_NONE,
386         WFD_OEM_DEV_ROLE_GC,
387         WFD_OEM_DEV_ROLE_GO,
388 } wfd_oem_dev_role_e;
389
390 typedef struct {
391         int scan_mode;
392         int scan_time;
393         int scan_type;
394         int freq;
395         int refresh;
396         char *seek;
397 } wfd_oem_scan_param_s;
398
399 typedef struct {
400         int wps_mode;
401         int conn_flags; /* join, auth, persistent */
402         int go_intent;
403         int freq;
404         char wps_pin[OEM_PINSTR_LEN+1];
405 } wfd_oem_conn_param_s;
406
407 typedef struct {
408         int persistent;
409         int persistent_group_id;
410         int freq;
411         char passphrase[OEM_PASS_PHRASE_LEN + 1];
412         char ssid[OEM_DEV_NAME_LEN + 1];
413 } wfd_oem_group_param_s;
414
415 typedef struct {
416         int net_id;
417         char *ifname;
418         unsigned char go_dev_addr[OEM_MACADDR_LEN];
419 } wfd_oem_invite_param_s;
420
421 typedef enum {
422         WFD_OEM_CONFIG_ATTR_STR_DEVICE_NAME,
423         WFD_OEM_CONFIG_ATTR_STR_SSID_POSTFIX,
424         WFD_OEM_CONFIG_ATTR_STR_COUNTRY,
425         WFD_OEM_CONFIG_ATTR_NUM_GO_INTENT,
426         WFD_OEM_CONFIG_ATTR_NUM_LISTEN_FREQ,
427         WFD_OEM_CONFIG_ATTR_NUM_OPER_FREQ,
428         WFD_OEM_CONFIG_ATTR_NUM_PREF_FREQ,
429         WFD_OEM_CONFIG_ATTR_NUM_PERSIST_RECONN,
430         WFD_OEM_CONFIG_ATTR_NUM_WIFI_DISPLAY,
431         WFD_OEM_CONFIG_ATTR_NUM_P2P_DISABLED,
432         WFD_OEM_CONFIG_ATTR_NUM_MAX_STA,
433         WFD_OEM_CONFIG_ATTR_LIMIT = WFD_OEM_CONFIG_ATTR_NUM_MAX_STA,
434 } wfd_oem_conf_attr_e;
435
436 typedef enum {
437         WFD_OEM_SERVICE_TYPE_ALL,
438         WFD_OEM_SERVICE_TYPE_BONJOUR,
439         WFD_OEM_SERVICE_TYPE_UPNP,
440         WFD_OEM_SERVICE_TYPE_WS_DISCOVERY,
441         WFD_OEM_SERVICE_TYPE_WIFI_DISPLAY,
442         WFD_OEM_SERVICE_TYPE_VENDOR = 0xff,
443 } wfd_oem_service_type_e;
444
445 typedef enum {
446         WFD_OEM_BONJOUR_RDATA_PTR = 0x0c,
447         WFD_OEM_BONJOUR_RDATA_TXT = 0x10,
448 } wfd_oem_bonjour_rdata_type_e;
449
450 typedef struct {
451         /** Device address for which service discovery is requested */
452         char dev_addr[OEM_MACSTR_LEN+1];
453
454         /** service type requested */
455         char service_type[OEM_SERVICE_TYPE_LEN+1];
456
457         /** query identifier returned by wpa_supplicant for each service discovery request */
458         char query_id[OEM_QUERY_ID_LEN+1];
459 } wfd_oem_service_s;
460
461 typedef struct {
462         int protocol;
463         int trans_id;
464         int status;
465         char *str_ptr;
466         union {
467                 struct {
468                         char *version;
469                         char *service;
470                 } upnp;
471                 struct {
472                         char *query;
473                         char *rdata;
474                         wfd_oem_bonjour_rdata_type_e rdata_type;
475                 } bonjour;
476                 struct {
477                         char *data1;
478                         char *data2;
479                 } vendor;
480         } data;
481 } wfd_oem_new_service_s;
482
483 #define WFD_OEM_STR_PROTO_WPA "WPA"
484 #define WFD_OEM_STR_PROTO_RSN "RSN"
485 #define WFD_OEM_STR_KEY_MGMT_IEEE8021X "WPA-EAP"
486 #define WFD_OEM_STR_KEY_MGMT_PSK "WPA-PSK"
487 #define WFD_OEM_STR_KEY_MGMT_NONE "WPA-NONE"
488 #define WFD_OEM_STR_CIPHER_NONE "NONE"
489 #define WFD_OEM_STR_CIPHER_WEP40 "WEP40"
490 #define WFD_OEM_STR_CIPHER_WEP104 "WEP104"
491 #define WFD_OEM_STR_CIPHER_TKIP "TKIP"
492 #define WFD_OEM_STR_CIPHER_CCMP "CCMP"
493 #define WFD_OEM_STR_AUTH_ALG_OPEN "OPEN"
494 #define WFD_OEM_STR_MODE_GC "0"
495 #define WFD_OEM_STR_MODE_GO "3"
496
497 typedef enum {
498         WFD_OEM_PROTO_WPA = 0x01, /* WPA */
499         WFD_OEM_PROTO_RSN = 0x02, /* RSN */
500 } wfd_oem_proto_e;
501
502 typedef enum {
503         WFD_OEM_KEY_MGMT_IEEE8021X = 0x01,      /* WPA-EAP */
504         WFD_OEM_KEY_MGMT_PSK = 0x02,    /* WPA-PSK */
505         WFD_OEM_KEY_MGMT_NONE = 0x04, /* WPA-NONE */
506 } wfd_oem_key_mgmt_e;
507
508 typedef enum {
509         WFD_OEM_CIPHER_NONE = 0x01, /* NONE */
510         WFD_OEM_CIPHER_WEP40 = 0x02, /* WEP40 */
511         WFD_OEM_CIPHER_WEP104 = 0x04, /* WEP104 */
512         WFD_OEM_CIPHER_TKIP = 0x08, /* TKIP */
513         WFD_OEM_CIPHER_CCMP = 0x10, /* CCMP */
514 } wfd_oem_cipher_e;
515
516 typedef enum {
517         WFD_OEM_AUTH_ALG_OPEN = 0x01, /* OPEN */
518 } wfd_oem_auth_alg_e;
519
520 typedef enum {
521         WFD_OEM_PERSISTENT_MODE_GC = 0x1,
522         WFD_OEM_PERSISTENT_MODE_GO = 0x2,
523 } wfd_oem_persistent_mode_e;
524
525 typedef enum {
526         WFD_OEM_TYPE_ADVERTISE,
527         WFD_OEM_TYPE_SEEK,
528         WFD_OEM_TYPE_MAX,
529 } wfd_oem_asp_service_type_e;
530
531 typedef struct {
532         wfd_oem_asp_service_type_e type;
533         unsigned int adv_id;
534         long long unsigned asp_search_id;
535         long long unsigned search_id;
536         int auto_accept;
537         int discovery_tech;
538         unsigned char preferred_connection;
539
540         unsigned char status;
541         unsigned char role;
542         unsigned int config_method;
543         unsigned char tran_id;
544
545         char *instance_name;
546         char *service_name;
547         char *service_type;
548         char *service_info;
549         char *rsp_info;
550 } wfd_oem_asp_service_s;
551
552 typedef struct {
553         unsigned char session_mac[OEM_MACADDR_LEN];
554         unsigned int session_id;
555         unsigned int adv_id;
556         int network_config;
557         int network_role;
558         int port;
559         int persist;
560         int persistent_group_id;
561         char *session_information;
562         int proto;
563         int status;
564         int deferring;
565         unsigned char service_mac[OEM_MACADDR_LEN];
566         unsigned char group_mac[OEM_MACADDR_LEN];
567         char wps_pin[OEM_PINSTR_LEN+1];
568         unsigned char ip_addr[OEM_IPADDR_LEN];
569 } wfd_oem_asp_prov_s;
570
571 typedef struct {
572         int network_id;
573         char ssid[OEM_DEV_NAME_LEN + 1];
574         unsigned char go_mac_address[OEM_MACADDR_LEN];
575         char psk[OEM_PASS_PHRASE_LEN +1];
576         int proto;
577         int key_mgmt;
578         int pairwise;
579         int group;
580         int auth_alg;
581         int mode;
582         int p2p_client_num;
583         unsigned char p2p_client_list[OEM_MAX_PEER_NUM][OEM_MACADDR_LEN];
584 } wfd_oem_persistent_group_s;
585
586 typedef struct {
587         int channels[P2P_MAX_CHANNELS];
588         int count;
589 } wfd_oem_supported_channels_s;
590
591 typedef struct {
592         void (*deactivated_cb) (wfd_oem_event_s *event);
593         void (*peer_found_cb) (wfd_oem_event_s *event);
594         void (*peer_disappeared_cb) (wfd_oem_event_s *event);
595         void (*discovery_finished_cb) (wfd_oem_event_s *event);
596
597         void (*prov_disc_req_cb) (wfd_oem_event_s *event);
598         void (*prov_disc_resp_cb) (wfd_oem_event_s *event);
599         void (*prov_disc_fail_cb) (wfd_oem_event_s *event);
600
601         void (*go_neg_req_cb) (wfd_oem_event_s *event);
602         void (*go_neg_fail_cb) (wfd_oem_event_s *event);
603         void (*go_neg_done_cb) (wfd_oem_event_s *event);
604
605         void (*wps_fail_cb) (wfd_oem_event_s *event);
606         void (*wps_done_cb) (wfd_oem_event_s *event);
607         void (*key_neg_fail_cb) (wfd_oem_event_s *event);
608         void (*key_neg_done_cb) (wfd_oem_event_s *event);
609
610         void (*conn_fail_cb) (wfd_oem_event_s *event);
611         void (*conn_done_cb) (wfd_oem_event_s *event);
612
613         void (*group_created_cb) (wfd_oem_event_s *event);
614         void (*group_destroyed_cb) (wfd_oem_event_s *event);
615
616         void (*invitation_req_cb) (wfd_oem_event_s *event);
617         void (*invitation_resp_cb) (wfd_oem_event_s *event);
618         void (*sta_connected_cb) (wfd_oem_event_s *event);
619         void (*sta_disconnected_cb) (wfd_oem_event_s *event);
620
621         void (*terminating_cb) (wfd_oem_event_s *event);
622
623         void (*serv_disc_resp_cb) (wfd_oem_event_s *event);
624         void (*serv_disc_started_cb) (wfd_oem_event_s *event);
625
626         void (*group_formation_failure_cb) (wfd_oem_event_s *event);
627         void (*invitation_accepted_cb) (wfd_oem_event_s *event);
628
629         void (*asp_serv_resp_cb) (wfd_oem_event_s *event);
630         void (*asp_prov_start_cb) (wfd_oem_event_s *event);
631         void (*asp_prov_done_cb) (wfd_oem_event_s *event);
632
633         void *extra_data;
634 } wfd_oem_event_cbs_s;
635
636 typedef struct {
637         int (*configure) (wfd_oem_config_s *conf);
638         int (*init) (wfd_oem_event_cbs_s *event_cbs);
639         int (*deinit) (void);
640         int (*activate) (int concurrent);
641         int (*deactivate) (int concurrent);
642
643         int (*start_scan) (wfd_oem_scan_param_s *param);
644         int (*stop_scan) (void);
645         int (*get_visibility) (int *visibility);
646         int (*set_visibility) (int visibility);
647         int (*get_scan_result) (GList **peers, int *peer_count);
648         int (*get_peer_info) (unsigned char *peer_addr, wfd_oem_device_s **peer);
649         int (*prov_disc_req) (unsigned char *peer_addr, wfd_oem_wps_mode_e wps_mode, int join);
650         int (*connect) (unsigned char *peer_addr, wfd_oem_conn_param_s *param);
651         int (*disconnect) (unsigned char *peer_addr, int is_iface_addr);
652         int (*reject_connection) (unsigned char *peer_addr);
653         int (*cancel_connection) (unsigned char *peer_addr);
654         int (*get_connected_peers) (GList **peers, int *peer_count);
655         int (*wps_start) (unsigned char *peer_addr, int wps_mode, const char *pin);
656         int (*enrollee_start) (unsigned char *peer_addr, int wps_mode, const char *pin);
657         int (*wps_cancel) (void);
658         int (*get_pin) (char *pin);
659         int (*set_pin) (char *pin);
660         int (*generate_pin) (char **pin);
661         int (*get_supported_wps_mode) (int *wps_mode);
662         int (*create_group) (wfd_oem_group_param_s *param);
663         int (*destroy_group) (const char *ifname);
664         int (*invite) (unsigned char *peer_addr, wfd_oem_invite_param_s *param);
665
666         int (*get_dev_name) (char *dev_name);
667         int (*set_dev_name) (char *dev_name);
668         int (*get_dev_mac) (char *dev_mac);
669         int (*get_dev_type) (int *pri_dev_type, int *sec_dev_type);
670         int (*set_dev_type) (int pri_dev_type, int sec_dev_type);
671         int (*get_go_intent) (int *go_intent);
672         int (*set_go_intent) (int go_intent);
673         int (*set_country) (char *ccode);
674
675         int (*get_persistent_groups) (wfd_oem_persistent_group_s **groups, int *group_count);
676         int (*remove_persistent_group) (char *ssid, unsigned char *bssid);
677         int (*set_persistent_reconnect) (unsigned char *bssid, int reconnect);
678
679         int (*start_service_discovery) (unsigned char mac_addr[6], int service_type);
680         int (*cancel_service_discovery) (unsigned char mac_addr[6], int service_type);
681
682         int (*serv_add) (wfd_oem_new_service_s *service);
683         int (*serv_del) (wfd_oem_new_service_s *service);
684         int (*serv_disc_start) (wfd_oem_new_service_s *service);
685         int (*serv_disc_stop) (int handle);
686
687         int (*miracast_init) (int enable);
688         int (*set_display) (wfd_oem_display_s *wifi_display);
689
690         int (*refresh) (void);
691         int (*save_config) (void);
692         int (*set_operating_channel)(int channel);
693         int (*remove_all_network)(void);
694         int (*get_wpa_status)(int *wpa_status);
695
696         int (*advertise_service)(wfd_oem_asp_service_s *service, int replace);
697         int (*cancel_advertise_service)(wfd_oem_asp_service_s *service);
698         int (*seek_service)(wfd_oem_asp_service_s *service);
699         int (*cancel_seek_service)(wfd_oem_asp_service_s *service);
700         int (*asp_prov_disc_req)(wfd_oem_asp_prov_s *params);
701
702         int (*set_eapol_ip_config)(int enable);
703
704         int (*add_vsie)(wfd_oem_vsie_frames_e frame_id, const char* vsie);
705         int (*get_vsie)(wfd_oem_vsie_frames_e frame_id, char **vsie);
706         int (*remove_vsie)(wfd_oem_vsie_frames_e frame_id, const char *vsie);
707         int (*set_supported_wps_mode) (int wps_mode);
708         int (*remove_persistent_device) (unsigned char *peer_mac_addr);
709         int (*remove_all_persistent_device) (void);
710
711         int (*get_supported_channels) (wfd_oem_supported_channels_s *data);
712
713         void *extra_data;
714 } wfd_oem_ops_s;
715
716 int wfd_oem_configure(wfd_oem_ops_s *ops, wfd_oem_config_s *conf);
717 int wfd_oem_init(wfd_oem_ops_s *ops);
718 int wfd_oem_destroy(wfd_oem_ops_s *ops);
719 int wfd_oem_activate(wfd_oem_ops_s *ops, int concurrent);
720 int wfd_oem_deactivate(wfd_oem_ops_s *ops, int concurrent);
721
722 int wfd_oem_start_scan(wfd_oem_ops_s *ops, wfd_oem_scan_param_s *param);
723 int wfd_oem_stop_scan(wfd_oem_ops_s *ops);
724 int wfd_oem_get_visibility(wfd_oem_ops_s *ops, int *visibility);
725 int wfd_oem_set_visibility(wfd_oem_ops_s *ops, int visibility);
726 int wfd_oem_get_scan_result(wfd_oem_ops_s *ops, GList **peers, int *peer_count);
727 int wfd_oem_get_peer_info(wfd_oem_ops_s *ops, unsigned char *peer_addr, wfd_oem_device_s **peer);
728 int wfd_oem_prov_disc_req(wfd_oem_ops_s *ops, unsigned char *peer_addr, wfd_oem_wps_mode_e wps_mode, int join);
729 int wfd_oem_connect(wfd_oem_ops_s *ops, unsigned char *peer_addr, wfd_oem_conn_param_s *param);
730 int wfd_oem_disconnect(wfd_oem_ops_s *ops, unsigned char *peer_addr, int is_iface_addr);
731 int wfd_oem_reject_connection(wfd_oem_ops_s *ops, unsigned char *peer_addr);
732 int wfd_oem_cancel_connection(wfd_oem_ops_s *ops, unsigned char *peer_addr);
733 int wfd_oem_get_connected_peers(wfd_oem_ops_s *ops, GList **peers, int *peer_count);
734 int wfd_oem_wps_start(wfd_oem_ops_s *ops, unsigned char *peer_addr, int wps_mode, const char *pin);
735 int wfd_oem_enrollee_start(wfd_oem_ops_s *ops, unsigned char *peer_addr, int wps_mode, const char *pin);
736 int wfd_oem_wps_cancel(wfd_oem_ops_s *ops);
737 int wfd_oem_get_pin(wfd_oem_ops_s *ops, char *pin);
738 int wfd_oem_set_pin(wfd_oem_ops_s *ops, char *pin);
739 int wfd_oem_generate_pin(wfd_oem_ops_s *ops, char **pin);
740 int wfd_oem_get_supported_wps_mode(wfd_oem_ops_s *ops, int *wps_mode);
741 int wfd_oem_create_group(wfd_oem_ops_s *ops, wfd_oem_group_param_s *param);
742 int wfd_oem_destroy_group(wfd_oem_ops_s *ops, const char *ifname);
743 int wfd_oem_invite(wfd_oem_ops_s *ops, unsigned char *peer_addr, wfd_oem_invite_param_s *param);
744
745 int wfd_oem_get_dev_name(wfd_oem_ops_s *ops, char *dev_name);
746 int wfd_oem_set_dev_name(wfd_oem_ops_s *ops, char *dev_name);
747 int wfd_oem_get_dev_mac(wfd_oem_ops_s *ops, char *dev_mac);
748 int wfd_oem_get_dev_type(wfd_oem_ops_s *ops, int *pri_dev_type, int *sec_dev_type);
749 int wfd_oem_set_dev_type(wfd_oem_ops_s *ops, int priv_dev_type, int sec_dev_type);
750 int wfd_oem_get_go_intent(wfd_oem_ops_s *ops, int *go_intent);
751 int wfd_oem_set_go_intent(wfd_oem_ops_s *ops, int go_intent);
752 int wfd_oem_set_country(wfd_oem_ops_s *ops, char *ccode);
753
754 int wfd_oem_get_persistent_groups(wfd_oem_ops_s *ops, wfd_oem_persistent_group_s **groups, int *group_count);
755 int wfd_oem_remove_persistent_group(wfd_oem_ops_s *ops, char *ssid, unsigned char *bssid);
756 int wfd_oem_set_persistent_reconnect(wfd_oem_ops_s *ops, unsigned char *bssid, int reconnect);
757
758 int wfd_oem_start_service_discovery(wfd_oem_ops_s *ops, unsigned char *peer_addr, int service_type);
759 int wfd_oem_cancel_service_discovery(wfd_oem_ops_s *ops, unsigned char *peer_addr, int service_type);
760
761 int wfd_oem_serv_add(wfd_oem_ops_s *ops, wfd_oem_new_service_s *service);
762 int wfd_oem_serv_del(wfd_oem_ops_s *ops, wfd_oem_new_service_s *service);
763 int wfd_oem_serv_disc_start(wfd_oem_ops_s *ops, wfd_oem_new_service_s *service);
764 int wfd_oem_serv_disc_stop(wfd_oem_ops_s *ops, int handle);
765
766 int wfd_oem_miracast_init(wfd_oem_ops_s *ops, int enable);
767 int wfd_oem_set_display(wfd_oem_ops_s *ops, wfd_oem_display_s *wifi_display);
768
769 int wfd_oem_refresh(wfd_oem_ops_s *ops);
770
771 int wfd_oem_advertise_service(wfd_oem_ops_s *ops, wfd_oem_asp_service_s *service, int replace);
772 int wfd_oem_cancel_advertise_service(wfd_oem_ops_s *ops, wfd_oem_asp_service_s *service);
773 int wfd_oem_seek_service(wfd_oem_ops_s *ops, wfd_oem_asp_service_s *service);
774 int wfd_oem_cancel_seek_service(wfd_oem_ops_s *ops, wfd_oem_asp_service_s *service);
775 int wfd_oem_asp_prov_disc_req(wfd_oem_ops_s *ops, wfd_oem_asp_prov_s *params);
776
777 int wfd_oem_set_eapol_ip_config(wfd_oem_ops_s *ops, int enable);
778
779 int wfd_oem_add_vsie(wfd_oem_ops_s *ops, wfd_oem_vsie_frames_e frame_id,
780                      const char* vsie);
781 int wfd_oem_get_vsie(wfd_oem_ops_s *ops, wfd_oem_vsie_frames_e frame_id,
782                      char **vsie);
783 int wfd_oem_remove_vsie(wfd_oem_ops_s *ops, wfd_oem_vsie_frames_e frame_id,
784                         const char *vsie);
785 int wfd_oem_get_supported_wps_mode(wfd_oem_ops_s *ops, int *wps_mode);
786 int wfd_oem_set_supported_wps_mode(wfd_oem_ops_s *ops, int wps_mode);
787 int wfd_oem_remove_persistent_device(wfd_oem_ops_s *ops, unsigned char *peer_mac_address);
788 int wfd_oem_remove_all_persistent_device(wfd_oem_ops_s *ops);
789
790 int wfd_oem_get_supported_channels(wfd_oem_ops_s *ops, wfd_oem_supported_channels_s *data);
791
792 #if defined TIZEN_ENABLE_PRD
793 typedef struct {
794         void (*prd_example_cb) (wfd_oem_event_s *event);
795 } wfd_oem_prd_event_cbs_s;
796
797 typedef struct {
798         int (*prd_init) (wfd_oem_event_cbs_s *event_cbs);
799 } wfd_oem_prd_ops_s;
800
801 int wfd_oem_prd_init(wfd_oem_ops_s *ops);
802 #endif /* TIZEN_ENABLE_PRD */
803
804 #ifdef __cplusplus
805 }
806 #endif
807
808 #endif /* __WIFI_DIRECT_OEM_H__ */