[Support Legacy Connection] Update peer disconnection logic.
[platform/core/connectivity/wifi-direct-manager.git] / plugin / wpasupplicant / emul / wfd-plugin-wpasupplicant-emul.c
1 #include <stdio.h>
2 #include <string.h>
3 #include <sys/types.h>
4 #include <sys/socket.h>
5 #include <unistd.h>
6 #include <poll.h>
7 #include <errno.h>
8
9 #include <glib.h>
10
11 #include "wifi-direct-oem.h"
12 #include "wfd-plugin-wpasupplicant.h"
13
14
15 static wfd_oem_ops_s supplicant_ops = {
16         .init = ws_init,
17         .deinit = ws_deinit,
18         .activate = ws_activate,
19         .deactivate = ws_deactivate,
20
21         .start_scan = ws_start_scan,
22         .stop_scan = ws_stop_scan,
23         .get_visibility = ws_get_visibility,
24         .set_visibility = ws_set_visibility,
25         .get_scan_result = ws_get_scan_result,
26         .get_peer_info = ws_get_peer_info,
27
28         .prov_disc_req = ws_prov_disc_req,
29
30         .connect = ws_connect,
31         .disconnect = ws_disconnect,
32         .reject_connection = ws_reject_connection,
33         .cancel_connection = ws_cancel_connection,
34
35         .get_connected_peers = ws_get_connected_peers,
36         .get_pin = ws_get_pin,
37         .set_pin = ws_set_pin,
38         .generate_pin = ws_generate_pin,
39         .get_supported_wps_mode = ws_get_supported_wps_mode,
40
41         .create_group = ws_create_group,
42         .destroy_group = ws_destroy_group,
43         .invite = ws_invite,
44         .wps_start = ws_wps_start,
45         .enrollee_start = ws_enrollee_start,
46         .wps_cancel = ws_wps_cancel,
47
48         .get_dev_name = ws_get_dev_name,
49         .set_dev_name = ws_set_dev_name,
50         .get_dev_mac = ws_get_dev_mac,
51         .get_dev_type = ws_get_dev_type,
52         .set_dev_type = ws_set_dev_type,
53         .get_go_intent = ws_get_go_intent,
54         .set_go_intent = ws_set_go_intent,
55         .get_persistent_groups = ws_get_persistent_groups,
56         .remove_persistent_group = ws_remove_persistent_group,
57         .set_persistent_reconnect = ws_set_persistent_reconnect,
58
59 #ifdef TIZEN_FEATURE_SERVICE_DISCOVERY
60         .start_service_discovery = ws_start_service_discovery,
61         .cancel_service_discovery = ws_cancel_service_discovery,
62
63         .serv_add = ws_serv_add,
64         .serv_del = ws_serv_del,
65 #endif /* TIZEN_FEATURE_SERVICE_DISCOVERY */
66
67 #ifdef TIZEN_FEATURE_WIFI_DISPLAY
68         .miracast_init = ws_miracast_init,
69         .set_display = ws_set_display,
70 #endif /* TIZEN_FEATURE_WIFI_DISPLAY */
71         .save_config = ws_save_config,
72         .set_operating_channel = ws_set_operating_channel,
73         .remove_all_network = ws_remove_all_network,
74         .get_wpa_status = ws_get_wpa_status,
75
76 #if defined(TIZEN_FEATURE_ASP)
77         .advertise_service = ws_advertise_service,
78         .cancel_advertise_service = ws_cancel_advertise_service,
79         .seek_service = ws_seek_service,
80         .cancel_seek_service = ws_cancel_seek_service,
81         .asp_prov_disc_req = ws_asp_prov_disc_req,
82 #endif /* TIZEN_FEATURE_ASP */
83         };
84
85 int wfd_plugin_load(wfd_oem_ops_s **ops)
86 {
87         __WDP_LOG_FUNC_ENTER__;
88         if (!ops) {
89                 WDP_LOGE("Invalid parameter");
90                 __WDP_LOG_FUNC_EXIT__;
91                 return -1;
92         }
93
94         *ops = &supplicant_ops;
95
96         __WDP_LOG_FUNC_EXIT__;
97         return 0;
98 }
99
100 int ws_init(wfd_oem_event_cb callback, void *user_data)
101 {
102         __WDP_LOG_FUNC_ENTER__;
103
104         __WDP_LOG_FUNC_EXIT__;
105         return -1;
106 }
107
108 int ws_deinit()
109 {
110         __WDP_LOG_FUNC_ENTER__;
111
112         __WDP_LOG_FUNC_EXIT__;
113         return -1;
114 }
115
116 int ws_activate(int concurrent)
117 {
118         __WDP_LOG_FUNC_ENTER__;
119
120         __WDP_LOG_FUNC_EXIT__;
121         return -1;
122 }
123
124 int ws_deactivate(int concurrent)
125 {
126         __WDP_LOG_FUNC_ENTER__;
127
128         __WDP_LOG_FUNC_EXIT__;
129         return -1;
130 }
131
132 int ws_start_scan(wfd_oem_scan_param_s *param)
133 {
134         __WDP_LOG_FUNC_ENTER__;
135
136         __WDP_LOG_FUNC_EXIT__;
137         return -1;
138 }
139
140 int ws_stop_scan()
141 {
142         __WDP_LOG_FUNC_ENTER__;
143
144         __WDP_LOG_FUNC_EXIT__;
145         return -1;
146 }
147
148 int ws_get_visibility(int *visibility)
149 {
150         __WDP_LOG_FUNC_ENTER__;
151
152         __WDP_LOG_FUNC_EXIT__;
153         return -1;
154 }
155
156 int ws_set_visibility(int visibility)
157 {
158         __WDP_LOG_FUNC_ENTER__;
159
160         __WDP_LOG_FUNC_EXIT__;
161         return -1;
162 }
163
164 int ws_get_scan_result(GList **peers, int *peer_count)
165 {
166         __WDP_LOG_FUNC_ENTER__;
167
168         __WDP_LOG_FUNC_EXIT__;
169         return -1;
170 }
171
172 int ws_get_peer_info(unsigned char *peer_addr, wfd_oem_device_s **peer)
173 {
174         __WDP_LOG_FUNC_ENTER__;
175
176         __WDP_LOG_FUNC_EXIT__;
177         return -1;
178 }
179
180 int ws_prov_disc_req(unsigned char *peer_addr, wfd_oem_wps_mode_e wps_mode, int join)
181 {
182         __WDP_LOG_FUNC_ENTER__;
183
184         __WDP_LOG_FUNC_EXIT__;
185         return -1;
186 }
187
188 int ws_connect(unsigned char *peer_addr, wfd_oem_conn_param_s *param)
189 {
190         __WDP_LOG_FUNC_ENTER__;
191
192         __WDP_LOG_FUNC_EXIT__;
193         return -1;
194 }
195
196 int ws_disconnect(unsigned char *peer_addr, int is_iface_addr)
197 {
198         __WDP_LOG_FUNC_ENTER__;
199
200         __WDP_LOG_FUNC_EXIT__;
201         return -1;
202 }
203
204 int ws_reject_connection(unsigned char *peer_addr)
205 {
206         __WDP_LOG_FUNC_ENTER__;
207
208         __WDP_LOG_FUNC_EXIT__;
209         return 0;
210 }
211
212 int ws_cancel_connection(unsigned char *peer_addr)
213 {
214         __WDP_LOG_FUNC_ENTER__;
215
216         __WDP_LOG_FUNC_EXIT__;
217         return 0;
218 }
219
220 int ws_get_connected_peers(GList **peers, int *peer_count)
221 {
222         __WDP_LOG_FUNC_ENTER__;
223
224         __WDP_LOG_FUNC_EXIT__;
225         return -1;
226 }
227
228 int ws_get_pin(char *pin)
229 {
230         __WDP_LOG_FUNC_ENTER__;
231
232         __WDP_LOG_FUNC_EXIT__;
233         return -1;
234 }
235
236 int ws_set_pin(char *pin)
237 {
238         __WDP_LOG_FUNC_ENTER__;
239
240         __WDP_LOG_FUNC_EXIT__;
241         return -1;
242 }
243
244 int ws_generate_pin(char **pin)
245 {
246         __WDP_LOG_FUNC_ENTER__;
247
248         __WDP_LOG_FUNC_EXIT__;
249         return -1;
250 }
251
252 int ws_get_supported_wps_mode()
253 {
254         __WDP_LOG_FUNC_ENTER__;
255
256         __WDP_LOG_FUNC_EXIT__;
257         return -1;
258 }
259
260 int ws_create_group(wfd_oem_group_param_s *param)
261 {
262         __WDP_LOG_FUNC_ENTER__;
263
264         __WDP_LOG_FUNC_EXIT__;
265         return -1;
266 }
267
268 int ws_destroy_group(const char *ifname)
269 {
270         __WDP_LOG_FUNC_ENTER__;
271
272         __WDP_LOG_FUNC_EXIT__;
273         return -1;
274 }
275
276 int ws_invite(unsigned char *peer_addr, wfd_oem_invite_param_s *param)
277 {
278         __WDP_LOG_FUNC_ENTER__;
279
280         __WDP_LOG_FUNC_EXIT__;
281         return -1;
282 }
283
284 int ws_wps_start(unsigned char *peer_addr, int wps_mode, const char *pin)
285 {
286         __WDP_LOG_FUNC_ENTER__;
287
288         __WDP_LOG_FUNC_EXIT__;
289         return -1;
290 }
291
292 int ws_enrollee_start(unsigned char *peer_addr, int wps_mode, const char *pin)
293 {
294         __WDP_LOG_FUNC_ENTER__;
295
296         __WDP_LOG_FUNC_EXIT__;
297         return -1;
298 }
299
300 int ws_wps_cancel()
301 {
302         __WDP_LOG_FUNC_ENTER__;
303
304         __WDP_LOG_FUNC_EXIT__;
305         return -1;
306 }
307
308 int ws_set_static_ip(unsigned char *ip_addr)
309 {
310         __WDP_LOG_FUNC_ENTER__;
311
312         __WDP_LOG_FUNC_EXIT__;
313         return -1;
314 }
315
316 int ws_get_dev_name(char *dev_name)
317 {
318         __WDP_LOG_FUNC_ENTER__;
319
320         __WDP_LOG_FUNC_EXIT__;
321         return -1;
322 }
323
324 int ws_set_dev_name(char *dev_name)
325 {
326         __WDP_LOG_FUNC_ENTER__;
327
328         __WDP_LOG_FUNC_EXIT__;
329         return -1;
330 }
331
332 int ws_get_dev_mac(char *dev_mac)
333 {
334         __WDP_LOG_FUNC_ENTER__;
335
336         __WDP_LOG_FUNC_EXIT__;
337         return -1;
338 }
339
340 int ws_get_dev_type(int *pri_dev_type, int *sec_dev_type)
341 {
342         __WDP_LOG_FUNC_ENTER__;
343
344         __WDP_LOG_FUNC_EXIT__;
345         return -1;
346 }
347
348 int ws_set_dev_type(int pri_dev_type, int sec_dev_type)
349 {
350         __WDP_LOG_FUNC_ENTER__;
351
352         __WDP_LOG_FUNC_EXIT__;
353         return -1;
354 }
355
356 int ws_get_go_intent(int *go_intent)
357 {
358         __WDP_LOG_FUNC_ENTER__;
359
360         __WDP_LOG_FUNC_EXIT__;
361         return -1;
362 }
363
364 int ws_set_go_intent(int go_intent)
365 {
366         __WDP_LOG_FUNC_ENTER__;
367
368         __WDP_LOG_FUNC_EXIT__;
369         return -1;
370 }
371
372 int ws_get_persistent_groups(wfd_oem_persistent_group_s **groups, int *group_count)
373 {
374         __WDP_LOG_FUNC_ENTER__;
375
376         __WDP_LOG_FUNC_EXIT__;
377         return -1;
378 }
379
380 int ws_remove_persistent_group(char *ssid, unsigned char *bssid)
381 {
382         __WDP_LOG_FUNC_ENTER__;
383
384         __WDP_LOG_FUNC_EXIT__;
385         return -1;
386 }
387
388 int ws_set_persistent_reconnect(unsigned char *bssid, int reconnect)
389 {
390         __WDP_LOG_FUNC_ENTER__;
391
392         __WDP_LOG_FUNC_EXIT__;
393         return -1;
394 }
395
396 #ifdef TIZEN_FEATURE_SERVICE_DISCOVERY
397
398 int ws_start_service_discovery(unsigned char *mac_addr, int service_type)
399 {
400         __WDP_LOG_FUNC_ENTER__;
401
402         __WDP_LOG_FUNC_EXIT__;
403         return -1;
404 }
405
406 int ws_cancel_service_discovery(unsigned char *mac_addr, int service_type)
407 {
408         __WDP_LOG_FUNC_ENTER__;
409
410         __WDP_LOG_FUNC_EXIT__;
411         return -1;
412 }
413
414 int ws_serv_add(wfd_oem_new_service_s *service)
415 {
416         __WDP_LOG_FUNC_ENTER__;
417
418         __WDP_LOG_FUNC_EXIT__;
419         return -1;
420 }
421
422 int ws_serv_del(wfd_oem_new_service_s *service)
423 {
424         __WDP_LOG_FUNC_ENTER__;
425
426         __WDP_LOG_FUNC_EXIT__;
427         return -1;
428 }
429 #endif /* TIZEN_FEATURE_SERVICE_DISCOVERY */
430
431 #ifdef TIZEN_FEATURE_WIFI_DISPLAY
432 int ws_miracast_init(int enable)
433 {
434         __WDP_LOG_FUNC_ENTER__;
435
436         __WDP_LOG_FUNC_EXIT__;
437         return -1;
438 }
439
440 int ws_set_display(wfd_oem_display_s *wifi_display)
441 {
442         __WDP_LOG_FUNC_ENTER__;
443
444         __WDP_LOG_FUNC_EXIT__;
445         return -1;
446 }
447
448 #endif /* TIZEN_FEATURE_WIFI_DISPLAY */
449
450 int ws_save_config(void)
451 {
452         __WDP_LOG_FUNC_ENTER__;
453
454         __WDP_LOG_FUNC_EXIT__;
455         return -1;
456 }
457
458 int ws_set_operating_channel(int channel)
459 {
460         __WDP_LOG_FUNC_ENTER__;
461
462         __WDP_LOG_FUNC_EXIT__;
463         return -1;
464 }
465
466 int ws_remove_all_network()
467 {
468         __WDP_LOG_FUNC_ENTER__;
469
470         __WDP_LOG_FUNC_EXIT__;
471         return -1;
472 }
473
474 int ws_get_wpa_status(int *wpa_status)
475 {
476         __WDP_LOG_FUNC_ENTER__;
477
478         __WDP_LOG_FUNC_EXIT__;
479         return -1;
480 }
481
482 #if defined(TIZEN_FEATURE_ASP)
483 int ws_advertise_service(wfd_oem_asp_service_s *service, int replace)
484 {
485         __WDP_LOG_FUNC_ENTER__;
486
487         __WDP_LOG_FUNC_EXIT__;
488         return -1;
489 }
490
491 int ws_cancel_advertise_service(wfd_oem_asp_service_s *service)
492 {
493         __WDP_LOG_FUNC_ENTER__;
494
495         __WDP_LOG_FUNC_EXIT__;
496         return -1;
497 }
498
499 int ws_seek_service(wfd_oem_asp_service_s *service)
500 {
501         __WDP_LOG_FUNC_ENTER__;
502
503         __WDP_LOG_FUNC_EXIT__;
504         return -1;
505 }
506
507 int ws_cancel_seek_service(wfd_oem_asp_service_s *service)
508 {
509         __WDP_LOG_FUNC_ENTER__;
510
511         __WDP_LOG_FUNC_EXIT__;
512         return -1;
513 }
514
515 int ws_asp_prov_disc_req(wfd_oem_asp_prov_s *asp_params)
516 {
517         __WDP_LOG_FUNC_ENTER__;
518
519         __WDP_LOG_FUNC_EXIT__;
520         return -1;
521 }
522 #endif /* TIZEN_FEATURE_ASP */