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