summaryrefslogtreecommitdiff
path: root/include/wifi-aware.h
blob: 4e045fc9d9ccbe2c67383fbed5d3bdacb465a7ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
/*
 * Copyright (c) 2020 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

#ifndef __TIZEN_NET_WIFI_AWARE_H__
#define __TIZEN_NET_WIFI_AWARE_H__

#include <tizen.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @file wifi-aware.h
 */

/**
 * @addtogroup CAPI_NETWORK_WIFI_AWARE_MODULE
 * @{
 */

/**
 * @brief Enumeration for Wi-Fi Aware error code.
 * @since_tizen 6.0
 */
#ifndef TIZEN_ERROR_WIFI_AWARE
#define TIZEN_ERROR_WIFI_AWARE -0x03050000
#endif

typedef enum {
	/**
	 * Successful
	 */
	WIFI_AWARE_ERROR_NONE					= TIZEN_ERROR_NONE,
	/**
	 * Operation not permitted(1)
	 */
	WIFI_AWARE_ERROR_NOT_PERMITTED			= TIZEN_ERROR_NOT_PERMITTED,
	/**
	 * Out of memory(12)
	 */
	WIFI_AWARE_ERROR_OUT_OF_MEMORY			= TIZEN_ERROR_OUT_OF_MEMORY,
	/**
	 * Permission denied(13)
	 */
	WIFI_AWARE_ERROR_PERMISSION_DENIED		= TIZEN_ERROR_PERMISSION_DENIED,
	/**
	 * Device or resource busy(16)
	 */
	WIFI_AWARE_ERROR_RESOURCE_BUSY			= TIZEN_ERROR_RESOURCE_BUSY,
	/**
	 * Invalid function parameter(22)
	 */
	WIFI_AWARE_ERROR_INVALID_PARAMETER		= TIZEN_ERROR_INVALID_PARAMETER,
	/**
	 * Invalid operation(38)
	 */
	WIFI_AWARE_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION,
	/**
	 * Connection timed out(110)
	 */
	// WIFI_AWARE_ERROR_CONNECTION_TIME_OUT   = TIZEN_ERROR_CONNECTION_TIME_OUT,
	/**
	 * Now in progress(115)
	 */
	WIFI_AWARE_ERROR_NOW_IN_PROGRESS		= TIZEN_ERROR_NOW_IN_PROGRESS,
	/**
	 * Not supported
	 */
	WIFI_AWARE_ERROR_NOT_SUPPORTED			= TIZEN_ERROR_NOT_SUPPORTED,
	/**
	 * No initialized
	 */
	WIFI_AWARE_ERROR_NOT_INITIALIZED		= TIZEN_ERROR_WIFI_AWARE|0x01,
	/**
	 * Already initialized
	 */
	WIFI_AWARE_ERROR_ALREADY_INITIALIZED	= TIZEN_ERROR_WIFI_AWARE|0x02,
	/**
	 * Operation failed
	 */
	WIFI_AWARE_ERROR_OPERATION_FAILED		= TIZEN_ERROR_WIFI_AWARE|0x03,
	/**
	 * Rejected by peer
	 */
	WIFI_AWARE_ERROR_REJECTED_BY_PEER		= TIZEN_ERROR_WIFI_AWARE|0x04,
	/**
	 * Wi-Fi Interface is down
	 */
	WIFI_AWARE_ERROR_INTERFACE_DOWN			= TIZEN_ERROR_WIFI_AWARE|0x05,
} wifi_aware_error_e;

typedef enum {
	WIFI_AWARE_TERMINATION_REASON_UNKNOWN = 0,
} wifi_aware_termination_reason_e;

typedef enum {
	WIFI_AWARE_SESSION_PUBLISH = 0,
	WIFI_AWARE_SESSION_SUBSCRIBE,
} wifi_aware_session_type_e;

typedef enum {
	WIFI_AWARE_PUBLISH_TYPE_UNSOLICITED = 0,/**< Unsolicited type */
	WIFI_AWARE_PUBLISH_TYPE_SOLICITED,	/**< Solicited type */
	// TODO:
	// WIFI_AWARE_PUBLISH_TYPE_UNSOLICITED_SOLICITED
} wifi_aware_publish_type_e;

typedef enum {
	WIFI_AWARE_SUBSCRIBE_TYPE_PASSIVE = 0,  /**< Passive type */
	WIFI_AWARE_SUBSCRIBE_TYPE_ACTIVE,   /**< Active type */
} wifi_aware_subscribe_type_e;


/**
 * @brief Wi-Fi Aware Session
 * @since_tizen 6.0
 */
typedef void *wifi_aware_session_h;

/**
 * @brief Handle for Wi-Fi Aware Publish configuration.
 * @since_tizen 6.0
 */
typedef void *wifi_aware_publish_h;

/**
 * @brief Handle for Wi-Fi Aware Subscribe configuration.
 * @since_tizen 6.0
 */
typedef void *wifi_aware_subscribe_h;

/**
 * @brief Handle for Wi-Fi Aware peer.
 * @since_tizen 6.0
 */
typedef void *wifi_aware_peer_h;

/**
 * @brief Handle for Wi-Fi Aware Data Path.
 * @since_tizen 6.0
 */
typedef void *wifi_aware_data_path_h;


/**
 * @brief
 * @since_tizen 6.0
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 * @retval	#WIFI_AWARE_ERROR_ALREADY_INITIALIZED
 * @see	wifi_aware_deinitialize
 */
int wifi_aware_initialize();

/**
 * @brief
 * @since_tizen 6.0
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 * @see	wifi_aware_initialize
 */
int wifi_aware_deinitialize();

/**
 * @brief Create a Publish request.
 * @since_tizen 6.0
 * @param[out] publish
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 * @see	wifi_aware_publish_destroy
 */
int wifi_aware_publish_create(wifi_aware_publish_h *publish);

/**
 * @brief Destroy a Publish request.
 * @since_tizen 6.0
 * @param[in] publish
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 * @see	wifi_aware_publish_create
 */
int wifi_aware_publish_destroy(wifi_aware_publish_h publish);

/**
 * @brief Create a Subscribe request.
 * @since_tizen 6.0
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 * @see	wifi_aware_subscribe_destroy
 */
int wifi_aware_subscribe_create(wifi_aware_subscribe_h *subscribe);

/**
 * @brief Destroy a Subscribe request.
 * @since_tizen 6.0
 * @param[in] subscribe
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 * @see	wifi_aware_subscribe_create
 */
int wifi_aware_subscribe_destroy(wifi_aware_subscribe_h subscribe);

/**
 * @brief
 * @since_tizen 6.0
 * @param[in] publish
 * @param[in] ttl
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_publish_set_ttl(wifi_aware_publish_h publish, unsigned short ttl);

/**
 * @brief Set the type of the service as solicited or unsolicited.
 * @since_tizen 6.0
 * @param[in] publish
 * @param[in] publish_type
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_publish_set_type(wifi_aware_publish_h publish, wifi_aware_publish_type_e publish_type);

/**
 * @brief Set the name of the service. The length should be less than or equal to 255
 * @since_tizen 6.0
 * @param[in] publish
 * @param[in] service_name UTF-8 name which identifies the service
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_publish_set_service_name(wifi_aware_publish_h publish, const char *service_name);

/**
 * @brief Set the specific information for the service.
 * @since_tizen 6.0
 * @param[in] publish
 * @param[in] service_specific_info
 * @param[in] len
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_publish_set_service_specific_info(wifi_aware_publish_h publish, const unsigned char *service_specific_info, size_t len);

/**
 * @brief Set the match filter of the service. It is used to decide whether accepting a subscribe request or not.
 * @since_tizen 6.0
 * @param[in] publish
 * @param[in] match_filter An ordered sequence of <length, value> pairs
 * @param[in] len
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_publish_set_match_filter(wifi_aware_publish_h publish, const unsigned char *match_filter, size_t len);

/**
 * @brief Set whether the ranging function is supported or not.
 * @since_tizen 6.0
 * @param[in] publish
 * @param[in] enable
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_publish_set_enable_ranging(wifi_aware_publish_h publish, bool enable);



// subscribe_config

/**
 * @brief
 * @since_tizen 6.0
 * @param[in] subscribe
 * @param[in] ttl
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_subscribe_set_ttl(wifi_aware_subscribe_h subscribe, unsigned short ttl);

/**
 * @brief
 * @since_tizen 6.0
 * @param[in] subscribe
 * @param[in] subscribe_type
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_subscribe_set_type(wifi_aware_subscribe_h subscribe, wifi_aware_subscribe_type_e subscribe_type);

/**
 * @brief Set the name of the service. The length should be less than or equal to 255
 * @since_tizen 6.0
 * @param[in] subscribe
 * @param[in] service_name UTF-8 name which identifies the service
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_subscribe_set_service_name(wifi_aware_subscribe_h subscribe, const char *service_name);

/**
 * @brief
 * @since_tizen 6.0
 * @param[in] subscribe
 * @param[in] service_specific_info
 * @param[in] len
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_subscribe_set_service_specific_info(wifi_aware_subscribe_h subscribe, const unsigned char *service_specific_info, size_t len);

/**
 * @brief
 * @since_tizen 6.0
 * @param[in] subscribe
 * @param[in] match_filter An ordered sequence of <length, value> pairs
 * @param[in] len
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_subscribe_set_match_filter(wifi_aware_subscribe_h subscribe, const unsigned char *match_filter, size_t len);

/**
 * @brief
 * @since_tizen 6.0
 * @param[in] subscribe
 * @param[in] distance
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_subscribe_set_max_distance(wifi_aware_subscribe_h subscribe, int distance);

/**
 * @brief
 * @since_tizen 6.0
 * @param[in] subscribe
 * @param[in] distance
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_subscribe_set_min_distance(wifi_aware_subscribe_h subscribe, int distance);


/**
 * @brief
 * @since_tizen 6.0
 * @param[in] error
 * @param[in] user_data
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
typedef void(*wifi_aware_enabled_cb)(wifi_aware_error_e error, void *user_data);

/**
 * @brief Enable Wi-Fi Aware functions.
 *        If Wi-Fi Aware is already enabled, the callback to return success is immediately invoked.
 * @remarks If the enable request is sucessfully done, the application can get the MAC address.
 *		TODO: Does an application need to know MAC address (NMI)?
 * @since_tizen 6.0
 * @param[in] callback The result of enable request is asynchrously delivered
 * @param[in] user_data User data
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_enable(wifi_aware_enabled_cb callback, void *user_data);

/**
 * @brief Disable Wi-Fi Aware functions.
 * @since_tizen 6.0
 * @return 0 on success, otherwise a negative error value
 * @retval #WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_disable();

/**
 * @brief
 * @since_tizen 6.0
 * @param[in] session_type
 * @param[in] session
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_session_create(wifi_aware_session_type_e session_type, wifi_aware_session_h *session);

/**
 * @brief
 * @since_tizen 6.0
 * @param[in] session
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_session_destroy(wifi_aware_session_h session);

/**
 * @brief Callback to notify that the Wi-Fi Aware Session has been lost.
 * @since_tizen 6.0
 * @param[in] session
 * @param[in] reason
 * @param[in] user_data
 */
typedef void(*wifi_aware_session_terminated_cb)(wifi_aware_session_h session,
		wifi_aware_termination_reason_e reason, void *user_data);

/**
 * @brief
 * @since_tizen 6.0
 * @param[in] session
 * @param[in] callback
 * @param[in] user_data
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_session_set_terminated_cb(wifi_aware_session_h session,
		wifi_aware_session_terminated_cb callback, void *user_data);

/**
 * @brief
 * @since_tizen 6.0
 * @param[in] session
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_session_unset_terminated_cb(wifi_aware_session_h session);

/**
 * @brief This callback delivers the result of a Publish request.
 * @since_tizen 6.0
 * @param[in] session
 * @param[in] error
 * @param[in] user_data
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 * @see wifi_aware_session_publish()
 * @see wifi_aware_session_update_publish()
 */
typedef void(*wifi_aware_published_cb)(wifi_aware_session_h session,
		wifi_aware_error_e error, void *user_data);

/**
 * @brief Publish a Wi-Fi Aware service so that neighboring devices can find it.
 * @since_tizen 6.0
 * @param[in] sesssion
 * @param[in] publish
 * @param[in] callback
 * @param[in] user_data
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_session_publish(wifi_aware_session_h session,
		wifi_aware_publish_h publish,
		wifi_aware_published_cb callback,
		void *user_data);

/**
 * @brief Update the configuration for a Wi-Fi Aware service that has already been published.
 * @since_tizen 6.0
 * @param[in] sesssion
 * @param[in] publish
 * @param[in] callback
 * @param[in] user_data
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_session_update_publish(wifi_aware_session_h session,
		wifi_aware_publish_h publish,
		wifi_aware_published_cb callback, void *user_data);

/**
 * @brief
 * @since_tizen 6.0
 * @param[in] session
 * @param[in] error
 * @param[in] user_data
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
typedef void(*wifi_aware_subscribed_cb)(wifi_aware_session_h session,
		wifi_aware_error_e error, void *user_data);

/**
 * @brief Start to find Wi-Fi Aware services.
 * @since_tizen 6.0
 * @param[in] session
 * @param[in] subscribe
 * @param[in] callback
 * @param[in] user_data
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_session_subscribe(wifi_aware_session_h,
		wifi_aware_subscribe_h subscribe,
		wifi_aware_subscribed_cb callback, void *user_data);

/**
 * @brief Stop a Wi-Fi Aware session. The function of the session, Publish or Subscribe,  will be cancelled.
 * @since_tizen 6.0
 * @param[in] session
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_session_stop(wifi_aware_session_h session);

/**
 * @brief Update the configuration for a Wi-Fi Aware service that has already been subscribed.
 * @since_tizen 6.0
 * @param[in] session
 * @param[in] subscribe
 * @param[in] callback
 * @param[in] user_data
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_session_update_subscribe(wifi_aware_session_h session,
		wifi_aware_subscribe_h subscribe,
		wifi_aware_subscribed_cb callback, void *user_data);

/**
 * @brief
 * @since_tizen 6.0
 * @param[in] session
 * @param[in] peer
 * @param[in] service_specific_info
 * @param[in] service_specific_info_len
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
typedef void(*wifi_aware_service_discovered_cb)(wifi_aware_session_h session,
		wifi_aware_peer_h peer,
		const unsigned char *service_specific_info, size_t service_specific_info_len,
		void *user_data);

/**
 * @brief
 * @since_tizen 6.0
 * @param[in] session
 * @param[in] callback
 * @param[in] user_data
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_session_set_service_discovered_cb(wifi_aware_session_h session,
		wifi_aware_service_discovered_cb callback, void *user_data);

/**
 * @brief
 * @since_tizen 6.0
 * @param[in] session
 * @param[in] user_data
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_session_unset_service_discovered_cb(wifi_aware_session_h session);

/**
 * @brief
 * @since_tizen 6.0
 * @param[in] error
 * @param[in] session
 * @param[in] user_data
 */
typedef void(*wifi_aware_send_message_result_cb)(wifi_aware_session_h session,
		wifi_aware_error_e error, void *user_data);

/**
 * @brief
 * @since_tizen 6.0
 * @param[in] session
 * @param[in] peer
 * @param[in] message
 * @param[in] len
 * @param[in] callback
 * @param[in] user_data
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_session_send_message(
		wifi_aware_session_h session,
		wifi_aware_peer_h peer,
		const unsigned char *message, size_t len,
		wifi_aware_send_message_result_cb callback, void *user_data);

/**
 * @brief
 * @since_tizen 6.0
 * @param[in] session
 * @param[in] peer
 * @param[in] message
 * @param[in] len
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
typedef void(*wifi_aware_message_received_cb)(
		wifi_aware_session_h session,
		wifi_aware_peer_h peer,
		const unsigned char *message, size_t len, void *user_data);

/**
 * @brief
 * @since_tizen 6.0
 * @param[in] session
 * @param[in] callback
 * @param[in] user_data
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_session_set_message_received_cb(wifi_aware_session_h session,
		wifi_aware_message_received_cb callback, void *user_data);

/**
 * @brief
 * @since_tizen 6.0
 * @param[in] session
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_session_unset_message_received_cb(wifi_aware_session_h session);

/**
 * @brief
 * @since_tizen 6.0
 * @param[out] cloned
 * @param[in] origin
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_peer_clone(wifi_aware_peer_h *cloned, wifi_aware_peer_h origin);

/**
 * @brief
 * @since_tizen 6.0
 * @param[in] peer
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_peer_destroy(wifi_aware_peer_h peer);

/**
 * @brief Get the MAC address (NAN Management Interface) of Wi-Fi Aware peer.
 * @remarks @a mac should be freed using free().
 * @since_tizen 6.0
 * @param[in] peer
 * @param[out] mac
 */
int wifi_aware_peer_get_mac(wifi_aware_peer_h peer, unsigned char **mac);

typedef enum {
	WIFI_AWARE_SECURITY_TYPE_OPEN,
	WIFI_AWARE_SECURITY_TYPE_PSK,
	WIFI_AWARE_SECURITY_TYPE_PMK,
} wifi_aware_security_type_e;

/**
 * @brief Create a handle to be used for Wi-Fi Aware Data Path
 * @since_tizen 6.0
 * @param[in] session
 * @param[in] peer
 * @param[out] data_path
 */
int wifi_aware_data_path_create(wifi_aware_session_h session, wifi_aware_peer_h peer,
		wifi_aware_data_path_h *data_path);

/**
 * @brief Set a security type
 * @since_tizen 6.0
 * @param[in] data_path
 * @param[in] security_type
 */
int wifi_aware_data_path_set_security(wifi_aware_data_path_h data_path, wifi_aware_security_type_e security_type);

/**
 * @brief Set a passphrase for Wi-Fi Aware Data Path. It can be used only when secury_type is WIFI_AWARE_SECURITY_TYPE_PSK.
 * @since_tizen 6.0
 * @param[in] data_path
 * @param[in] key
 */
int wifi_aware_data_path_set_psk(wifi_aware_data_path_h data_path, const char *key);

/**
 * @brief Set a PMK for Wi-Fi Aware Data Path. It can be used only when secury_type is WIFI_AWARE_SECURITY_TYPE_PMK.
 * @since_tizen 6.0
 * @param[in] data_path
 * @param[in] key Pairwise Master Key. Its length shall be of length 32.
 */
int wifi_aware_data_path_set_pmk(wifi_aware_data_path_h data_path, const unsigned char *key);

// only for responder
/**
 * @brief
 * @remarks This is only for Data Path Responder
 * @since_tizen 6.0
 * @param[in] data_path
 * @param[in] port
 * @return	0 on success, otherwise a negative error value
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_data_path_set_port(wifi_aware_data_path_h data_path, int port);

// We are considering to add wifi_aware_data_path_set_ip_address().

/**
 * @brief Destroy a handle for Wi-Fi Aware Data Path
 * @since_tizen 6.0
 * @param[in] data_path
 */
int wifi_aware_data_path_destroy(wifi_aware_data_path_h data_path);


/**
 * @brief This callback is invoked when wifi_aware_data_path_open is done with a result (success/failure)
 * @since_tizen 6.0
 * @param[in] data_path
 * @param[in] error
 * @param[in] mac peer's NDI (NAN Data Interface)
 * @param[in] user_data
 */
typedef void(*wifi_aware_data_path_open_cb)(wifi_aware_data_path_h data_path, wifi_aware_error_e error,
		void *user_data);

/**
 * @brief Start to open a Wi-Fi Aware Data Path.
 * @remarks The @a callback will be always invoked whether the open request succeeds or fails.
 * @since_tizen 6.0
 * @param[in] data_path
 * @param[in] callback
 * @param[in] user_data
 */
int wifi_aware_data_path_open(wifi_aware_data_path_h data_path,
		wifi_aware_data_path_open_cb callback, void *user_data);

/**
 * @brief Close a Wi-Fi Aware Data Path.
 * @since_tizen 6.0
 * @param[in] data_path
 */
int wifi_aware_data_path_close(wifi_aware_data_path_h data_path);

/**
 * @brief
 * @remarks This is only for Data Path Initiator
 * @since_tizen 6.0
 * @param[in]
 * @param[out]
 * @return
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_data_path_get_peer_port(wifi_aware_data_path_h data_path, int* port);

/**
 * @brief
 * @remarks This is only for Data Path Initiator
 * @remarks @a ipv6_address should be freed by using free().
 * @since_tizen 6.0
 * @param[in]
 * @param[out]
 * @return
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_data_path_get_peer_ipv6_address(wifi_aware_data_path_h data_path, char **ipv6_address);

/**
 * @brief
 * @remarks @a interface should be freed by using free().
 * @since_tizen 6.0
 * @param[in]
 * @param[out]
 * @return
 * @retval	#WIFI_AWARE_ERROR_NONE
 */
int wifi_aware_data_path_get_interface(wifi_aware_data_path_h data_path, char **interface);

// get peer NDI?

/**
 * @brief Callback to notify that the Wi-Fi Aware Data Path has been lost.
 * @since_tizen 6.0
 * @param[in] data_path
 * @param[in] reason
 * @param[in] user_data
 */
typedef void(*wifi_aware_data_path_terminated_cb)(wifi_aware_data_path_h data_path, wifi_aware_termination_reason_e reason, void *user_data);

/**
 * @brief
 * @since_tizen 6.0
 * @param[in] data_path
 * @param[in] callback
 * @param[in] user_data
 */
int wifi_aware_data_path_set_terminated_cb(wifi_aware_data_path_h data_path, wifi_aware_data_path_terminated_cb callback, void *user_data);

/**
 * @brief
 * @since_tizen 6.0
 * @param[in] data_path
 */
int wifi_aware_data_path_unset_terminated_cb(wifi_aware_data_path_h data_path);


// TODO
// DataUpdate


// Can APIs to get peer information using wifi_aware_peer_h?
// wifi_aware_peer_get_mac_address(): Which mac address should this API show, NMI or NDI?


//
// callback for termination notification


// network state changed
//

// What should be used for the first parameter???
/*
typedef void(*wifi_aware_changed_mac_address_cb)(unsigned char *mac, size_t len);

int wifi_aware_set_changed_mac_address_cb(wifi_aware_changed_mac_address_cb callback);
*/

/**
 * @}
 */


#ifdef __cplusplus
}
#endif

#endif /* __TIZEN_NET_WIFI_AWARE_H__ */