957f6a54f6a49c099425a143d91355038f967848
[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         .start_service_discovery = ws_start_service_discovery,
60         .cancel_service_discovery = ws_cancel_service_discovery,
61
62         .serv_add = ws_serv_add,
63         .serv_del = ws_serv_del,
64
65         .miracast_init = ws_miracast_init,
66         .set_display = ws_set_display,
67         .save_config = ws_save_config,
68         .set_operating_channel = ws_set_operating_channel,
69         .remove_all_network = ws_remove_all_network,
70         .get_wpa_status = ws_get_wpa_status,
71
72 #if defined(TIZEN_FEATURE_ASP)
73         .advertise_service = ws_advertise_service,
74         .cancel_advertise_service = ws_cancel_advertise_service,
75         .seek_service = ws_seek_service,
76         .cancel_seek_service = ws_cancel_seek_service,
77         .asp_prov_disc_req = ws_asp_prov_disc_req,
78 #endif /* TIZEN_FEATURE_ASP */
79
80         .add_vsie = ws_add_vsie,
81         .get_vsie = ws_get_vsie,
82         .remove_vsie = ws_remove_vsie,
83
84         };
85
86 int wfd_plugin_load(wfd_oem_ops_s **ops)
87 {
88         __WDP_LOG_FUNC_ENTER__;
89         if (!ops) {
90                 WDP_LOGE("Invalid parameter");
91                 __WDP_LOG_FUNC_EXIT__;
92                 return -1;
93         }
94
95         *ops = &supplicant_ops;
96
97         __WDP_LOG_FUNC_EXIT__;
98         return 0;
99 }
100
101 int ws_init(wfd_oem_event_cbs_s *event_cbs)
102 {
103         __WDP_LOG_FUNC_ENTER__;
104
105         __WDP_LOG_FUNC_EXIT__;
106         return -1;
107 }
108
109 int ws_deinit(void)
110 {
111         __WDP_LOG_FUNC_ENTER__;
112
113         __WDP_LOG_FUNC_EXIT__;
114         return -1;
115 }
116
117 int ws_activate(int concurrent)
118 {
119         __WDP_LOG_FUNC_ENTER__;
120
121         __WDP_LOG_FUNC_EXIT__;
122         return -1;
123 }
124
125 int ws_deactivate(int concurrent)
126 {
127         __WDP_LOG_FUNC_ENTER__;
128
129         __WDP_LOG_FUNC_EXIT__;
130         return -1;
131 }
132
133 int ws_start_scan(wfd_oem_scan_param_s *param)
134 {
135         __WDP_LOG_FUNC_ENTER__;
136
137         __WDP_LOG_FUNC_EXIT__;
138         return -1;
139 }
140
141 int ws_stop_scan()
142 {
143         __WDP_LOG_FUNC_ENTER__;
144
145         __WDP_LOG_FUNC_EXIT__;
146         return -1;
147 }
148
149 int ws_get_visibility(int *visibility)
150 {
151         __WDP_LOG_FUNC_ENTER__;
152
153         __WDP_LOG_FUNC_EXIT__;
154         return -1;
155 }
156
157 int ws_set_visibility(int visibility)
158 {
159         __WDP_LOG_FUNC_ENTER__;
160
161         __WDP_LOG_FUNC_EXIT__;
162         return -1;
163 }
164
165 int ws_get_scan_result(GList **peers, int *peer_count)
166 {
167         __WDP_LOG_FUNC_ENTER__;
168
169         __WDP_LOG_FUNC_EXIT__;
170         return -1;
171 }
172
173 int ws_get_peer_info(unsigned char *peer_addr, wfd_oem_device_s **peer)
174 {
175         __WDP_LOG_FUNC_ENTER__;
176
177         __WDP_LOG_FUNC_EXIT__;
178         return -1;
179 }
180
181 int ws_prov_disc_req(unsigned char *peer_addr, wfd_oem_wps_mode_e wps_mode, int join)
182 {
183         __WDP_LOG_FUNC_ENTER__;
184
185         __WDP_LOG_FUNC_EXIT__;
186         return -1;
187 }
188
189 int ws_connect(unsigned char *peer_addr, wfd_oem_conn_param_s *param)
190 {
191         __WDP_LOG_FUNC_ENTER__;
192
193         __WDP_LOG_FUNC_EXIT__;
194         return -1;
195 }
196
197 int ws_disconnect(unsigned char *peer_addr, int is_iface_addr)
198 {
199         __WDP_LOG_FUNC_ENTER__;
200
201         __WDP_LOG_FUNC_EXIT__;
202         return -1;
203 }
204
205 int ws_reject_connection(unsigned char *peer_addr)
206 {
207         __WDP_LOG_FUNC_ENTER__;
208
209         __WDP_LOG_FUNC_EXIT__;
210         return 0;
211 }
212
213 int ws_cancel_connection(unsigned char *peer_addr)
214 {
215         __WDP_LOG_FUNC_ENTER__;
216
217         __WDP_LOG_FUNC_EXIT__;
218         return 0;
219 }
220
221 int ws_get_connected_peers(GList **peers, int *peer_count)
222 {
223         __WDP_LOG_FUNC_ENTER__;
224
225         __WDP_LOG_FUNC_EXIT__;
226         return -1;
227 }
228
229 int ws_get_pin(char *pin)
230 {
231         __WDP_LOG_FUNC_ENTER__;
232
233         __WDP_LOG_FUNC_EXIT__;
234         return -1;
235 }
236
237 int ws_set_pin(char *pin)
238 {
239         __WDP_LOG_FUNC_ENTER__;
240
241         __WDP_LOG_FUNC_EXIT__;
242         return -1;
243 }
244
245 int ws_generate_pin(char **pin)
246 {
247         __WDP_LOG_FUNC_ENTER__;
248
249         __WDP_LOG_FUNC_EXIT__;
250         return -1;
251 }
252
253 int ws_get_supported_wps_mode()
254 {
255         __WDP_LOG_FUNC_ENTER__;
256
257         __WDP_LOG_FUNC_EXIT__;
258         return -1;
259 }
260
261 int ws_create_group(wfd_oem_group_param_s *param)
262 {
263         __WDP_LOG_FUNC_ENTER__;
264
265         __WDP_LOG_FUNC_EXIT__;
266         return -1;
267 }
268
269 int ws_destroy_group(const char *ifname)
270 {
271         __WDP_LOG_FUNC_ENTER__;
272
273         __WDP_LOG_FUNC_EXIT__;
274         return -1;
275 }
276
277 int ws_invite(unsigned char *peer_addr, wfd_oem_invite_param_s *param)
278 {
279         __WDP_LOG_FUNC_ENTER__;
280
281         __WDP_LOG_FUNC_EXIT__;
282         return -1;
283 }
284
285 int ws_wps_start(unsigned char *peer_addr, int wps_mode, const char *pin)
286 {
287         __WDP_LOG_FUNC_ENTER__;
288
289         __WDP_LOG_FUNC_EXIT__;
290         return -1;
291 }
292
293 int ws_enrollee_start(unsigned char *peer_addr, int wps_mode, const char *pin)
294 {
295         __WDP_LOG_FUNC_ENTER__;
296
297         __WDP_LOG_FUNC_EXIT__;
298         return -1;
299 }
300
301 int ws_wps_cancel()
302 {
303         __WDP_LOG_FUNC_ENTER__;
304
305         __WDP_LOG_FUNC_EXIT__;
306         return -1;
307 }
308
309 int ws_set_static_ip(unsigned char *ip_addr)
310 {
311         __WDP_LOG_FUNC_ENTER__;
312
313         __WDP_LOG_FUNC_EXIT__;
314         return -1;
315 }
316
317 int ws_get_dev_name(char *dev_name)
318 {
319         __WDP_LOG_FUNC_ENTER__;
320
321         __WDP_LOG_FUNC_EXIT__;
322         return -1;
323 }
324
325 int ws_set_dev_name(char *dev_name)
326 {
327         __WDP_LOG_FUNC_ENTER__;
328
329         __WDP_LOG_FUNC_EXIT__;
330         return -1;
331 }
332
333 int ws_get_dev_mac(char *dev_mac)
334 {
335         __WDP_LOG_FUNC_ENTER__;
336
337         __WDP_LOG_FUNC_EXIT__;
338         return -1;
339 }
340
341 int ws_get_dev_type(int *pri_dev_type, int *sec_dev_type)
342 {
343         __WDP_LOG_FUNC_ENTER__;
344
345         __WDP_LOG_FUNC_EXIT__;
346         return -1;
347 }
348
349 int ws_set_dev_type(int pri_dev_type, int sec_dev_type)
350 {
351         __WDP_LOG_FUNC_ENTER__;
352
353         __WDP_LOG_FUNC_EXIT__;
354         return -1;
355 }
356
357 int ws_get_go_intent(int *go_intent)
358 {
359         __WDP_LOG_FUNC_ENTER__;
360
361         __WDP_LOG_FUNC_EXIT__;
362         return -1;
363 }
364
365 int ws_set_go_intent(int go_intent)
366 {
367         __WDP_LOG_FUNC_ENTER__;
368
369         __WDP_LOG_FUNC_EXIT__;
370         return -1;
371 }
372
373 int ws_get_persistent_groups(wfd_oem_persistent_group_s **groups, int *group_count)
374 {
375         __WDP_LOG_FUNC_ENTER__;
376
377         __WDP_LOG_FUNC_EXIT__;
378         return -1;
379 }
380
381 int ws_remove_persistent_group(char *ssid, unsigned char *bssid)
382 {
383         __WDP_LOG_FUNC_ENTER__;
384
385         __WDP_LOG_FUNC_EXIT__;
386         return -1;
387 }
388
389 int ws_set_persistent_reconnect(unsigned char *bssid, int reconnect)
390 {
391         __WDP_LOG_FUNC_ENTER__;
392
393         __WDP_LOG_FUNC_EXIT__;
394         return -1;
395 }
396
397 int ws_start_service_discovery(unsigned char *mac_addr, int service_type)
398 {
399         __WDP_LOG_FUNC_ENTER__;
400
401         __WDP_LOG_FUNC_EXIT__;
402         return -1;
403 }
404
405 int ws_cancel_service_discovery(unsigned char *mac_addr, int service_type)
406 {
407         __WDP_LOG_FUNC_ENTER__;
408
409         __WDP_LOG_FUNC_EXIT__;
410         return -1;
411 }
412
413 int ws_serv_add(wfd_oem_new_service_s *service)
414 {
415         __WDP_LOG_FUNC_ENTER__;
416
417         __WDP_LOG_FUNC_EXIT__;
418         return -1;
419 }
420
421 int ws_serv_del(wfd_oem_new_service_s *service)
422 {
423         __WDP_LOG_FUNC_ENTER__;
424
425         __WDP_LOG_FUNC_EXIT__;
426         return -1;
427 }
428
429 int ws_miracast_init(int enable)
430 {
431         __WDP_LOG_FUNC_ENTER__;
432
433         __WDP_LOG_FUNC_EXIT__;
434         return -1;
435 }
436
437 int ws_set_display(wfd_oem_display_s *wifi_display)
438 {
439         __WDP_LOG_FUNC_ENTER__;
440
441         __WDP_LOG_FUNC_EXIT__;
442         return -1;
443 }
444
445 int ws_save_config(void)
446 {
447         __WDP_LOG_FUNC_ENTER__;
448
449         __WDP_LOG_FUNC_EXIT__;
450         return -1;
451 }
452
453 int ws_set_operating_channel(int channel)
454 {
455         __WDP_LOG_FUNC_ENTER__;
456
457         __WDP_LOG_FUNC_EXIT__;
458         return -1;
459 }
460
461 int ws_remove_all_network()
462 {
463         __WDP_LOG_FUNC_ENTER__;
464
465         __WDP_LOG_FUNC_EXIT__;
466         return -1;
467 }
468
469 int ws_get_wpa_status(int *wpa_status)
470 {
471         __WDP_LOG_FUNC_ENTER__;
472
473         __WDP_LOG_FUNC_EXIT__;
474         return -1;
475 }
476
477 #if defined(TIZEN_FEATURE_ASP)
478 int ws_advertise_service(wfd_oem_asp_service_s *service, int replace)
479 {
480         __WDP_LOG_FUNC_ENTER__;
481
482         __WDP_LOG_FUNC_EXIT__;
483         return -1;
484 }
485
486 int ws_cancel_advertise_service(wfd_oem_asp_service_s *service)
487 {
488         __WDP_LOG_FUNC_ENTER__;
489
490         __WDP_LOG_FUNC_EXIT__;
491         return -1;
492 }
493
494 int ws_seek_service(wfd_oem_asp_service_s *service)
495 {
496         __WDP_LOG_FUNC_ENTER__;
497
498         __WDP_LOG_FUNC_EXIT__;
499         return -1;
500 }
501
502 int ws_cancel_seek_service(wfd_oem_asp_service_s *service)
503 {
504         __WDP_LOG_FUNC_ENTER__;
505
506         __WDP_LOG_FUNC_EXIT__;
507         return -1;
508 }
509
510 int ws_asp_prov_disc_req(wfd_oem_asp_prov_s *asp_params)
511 {
512         __WDP_LOG_FUNC_ENTER__;
513
514         __WDP_LOG_FUNC_EXIT__;
515         return -1;
516 }
517 #endif /* TIZEN_FEATURE_ASP */
518
519 int ws_add_vsie(wfd_oem_vsie_frames_e frame_id, const char* vsie)
520 {
521         __WDP_LOG_FUNC_ENTER__;
522
523         __WDP_LOG_FUNC_EXIT__;
524         return -1;
525 }
526
527 int ws_get_vsie(wfd_oem_vsie_frames_e frame_id, char **vsie)
528 {
529         __WDP_LOG_FUNC_ENTER__;
530
531         __WDP_LOG_FUNC_EXIT__;
532         return -1;
533 }
534
535 int ws_remove_vsie(wfd_oem_vsie_frames_e frame_id, const char *vsie)
536 {
537         __WDP_LOG_FUNC_ENTER__;
538
539         __WDP_LOG_FUNC_EXIT__;
540         return -1;
541 }