summaryrefslogtreecommitdiff
path: root/include/hardware_legacy/wifi_nan.h
blob: 55034d131ea15073777e4efa985608fddabc410c (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
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * 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 __NAN_H__
#define __NAN_H__

#include <net/if.h>
#include <stdbool.h>
#include "wifi_hal.h"

#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */

/*****************************************************************************
 * Neighbour Aware Network Service Structures and Functions
 *****************************************************************************/

/*
  Definitions
  All multi-byte fields within all NAN protocol stack messages are assumed to be in Little Endian order.
*/

typedef int NanVersion;
typedef u16 transaction_id;
typedef u32 NanDataPathId;

#define NAN_MAC_ADDR_LEN                6
#define NAN_MAJOR_VERSION               4
#define NAN_MINOR_VERSION               0
#define NAN_MICRO_VERSION               0
#define NAN_MAX_SOCIAL_CHANNELS         3

/* NAN Maximum Lengths */
#define NAN_MAX_SERVICE_NAME_LEN                255
#define NAN_MAX_MATCH_FILTER_LEN                255
#define NAN_MAX_SERVICE_SPECIFIC_INFO_LEN       1024
#define NAN_MAX_VSA_DATA_LEN                    1024
#define NAN_MAX_MESH_DATA_LEN                   32
#define NAN_MAX_INFRA_DATA_LEN                  32
#define NAN_MAX_CLUSTER_ATTRIBUTE_LEN           255
#define NAN_MAX_SUBSCRIBE_MAX_ADDRESS           42
#define NAN_MAX_FAM_CHANNELS                    32
#define NAN_MAX_POSTDISCOVERY_LEN               5
#define NAN_MAX_FRAME_DATA_LEN                  504
#define NAN_DP_MAX_APP_INFO_LEN                 512
#define NAN_ERROR_STR_LEN                       255
#define NAN_PMK_INFO_LEN                        32
#define NAN_MAX_SCID_BUF_LEN                    1024
#define NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN  2048
#define NAN_SECURITY_MIN_PASSPHRASE_LEN         8
#define NAN_SECURITY_MAX_PASSPHRASE_LEN         63
#define NAN_MAX_CHANNEL_INFO_SUPPORTED          4
#define NAN_IDENTITY_KEY_LEN                    16
#define NAN_IDENTITY_TAG_LEN                    8
#define NAN_IDENTITY_NONCE_LEN                  8
#define NAN_MAX_MATCH_IDENTITY_LEN             1024
/*
  Definition of various NanResponseType
*/
typedef enum {
    NAN_RESPONSE_ENABLED                 = 0,
    NAN_RESPONSE_DISABLED                = 1,
    NAN_RESPONSE_PUBLISH                 = 2,
    NAN_RESPONSE_PUBLISH_CANCEL          = 3,
    NAN_RESPONSE_TRANSMIT_FOLLOWUP       = 4,
    NAN_RESPONSE_SUBSCRIBE               = 5,
    NAN_RESPONSE_SUBSCRIBE_CANCEL        = 6,
    NAN_RESPONSE_STATS                   = 7,
    NAN_RESPONSE_CONFIG                  = 8,
    NAN_RESPONSE_TCA                     = 9,
    NAN_RESPONSE_ERROR                   = 10,
    NAN_RESPONSE_BEACON_SDF_PAYLOAD      = 11,
    NAN_GET_CAPABILITIES                 = 12,
    NAN_DP_INTERFACE_CREATE              = 13,
    NAN_DP_INTERFACE_DELETE              = 14,
    NAN_DP_INITIATOR_RESPONSE            = 15,
    NAN_DP_RESPONDER_RESPONSE            = 16,
    NAN_DP_END                           = 17,
    NAN_PAIRING_INITIATOR_RESPONSE       = 18,
    NAN_PAIRING_RESPONDER_RESPONSE       = 19,
    NAN_BOOTSTRAPPING_INITIATOR_RESPONSE = 20,
    NAN_BOOTSTRAPPING_RESPONDER_RESPONSE = 21,
    NAN_PAIRING_END                      = 22,
    NAN_SUSPEND_REQUEST_RESPONSE         = 23,
    NAN_RESUME_REQUEST_RESPONSE          = 24
} NanResponseType;

/* NAN Publish Types */
typedef enum {
    NAN_PUBLISH_TYPE_UNSOLICITED = 0,
    NAN_PUBLISH_TYPE_SOLICITED,
    NAN_PUBLISH_TYPE_UNSOLICITED_SOLICITED
} NanPublishType;

/* NAN Transmit Priorities */
typedef enum {
    NAN_TX_PRIORITY_NORMAL = 0,
    NAN_TX_PRIORITY_HIGH
} NanTxPriority;

/* NAN Statistics Request ID Codes */
typedef enum {
    NAN_STATS_ID_DE_PUBLISH = 0,
    NAN_STATS_ID_DE_SUBSCRIBE,
    NAN_STATS_ID_DE_MAC,
    NAN_STATS_ID_DE_TIMING_SYNC,
    NAN_STATS_ID_DE_DW,
    NAN_STATS_ID_DE
} NanStatsType;

/* NAN Protocol Event ID Codes */
typedef enum {
    NAN_EVENT_ID_DISC_MAC_ADDR = 0,
    NAN_EVENT_ID_STARTED_CLUSTER,
    NAN_EVENT_ID_JOINED_CLUSTER
} NanDiscEngEventType;

/* NAN Data Path type */
typedef enum {
    NAN_DATA_PATH_UNICAST_MSG = 0,
    NAN_DATA_PATH_MULTICAST_MSG
} NdpType;

/* NAN Ranging Configuration */
typedef enum {
    NAN_RANGING_DISABLE = 0,
    NAN_RANGING_ENABLE
} NanRangingState;

/* TCA Type */
typedef enum {
    NAN_TCA_ID_CLUSTER_SIZE = 0
} NanTcaType;

/* pairing request type*/
typedef enum {
    NAN_PAIRING_SETUP = 0,
    NAN_PAIRING_VERIFICATION = 1
} NanPairingRequestType;

/* Nan AKM type */
typedef enum {
    SAE = 0,
    PASN = 1
} NanAkm;

/* NAN Channel Info */
typedef struct {
    u32 channel;
    u32 bandwidth;
    u32 nss;
} NanChannelInfo;

/*
  Various NAN Protocol Response code
*/
typedef enum {
    /* NAN Protocol Response Codes */
    NAN_STATUS_SUCCESS = 0,
    /*  NAN Discovery Engine/Host driver failures */
    NAN_STATUS_INTERNAL_FAILURE = 1,
    /*  NAN OTA failures */
    NAN_STATUS_PROTOCOL_FAILURE = 2,
    /* if the publish/subscribe id is invalid */
    NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID = 3,
    /* If we run out of resources allocated */
    NAN_STATUS_NO_RESOURCE_AVAILABLE = 4,
    /* if invalid params are passed */
    NAN_STATUS_INVALID_PARAM = 5,
    /*  if the requestor instance id is invalid */
    NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID = 6,
    /*  if the ndp id is invalid */
    NAN_STATUS_INVALID_NDP_ID = 7,
    /* if NAN is enabled when wifi is turned off */
    NAN_STATUS_NAN_NOT_ALLOWED = 8,
    /* if over the air ack is not received */
    NAN_STATUS_NO_OTA_ACK = 9,
    /* If NAN is already enabled and we are try to re-enable the same */
    NAN_STATUS_ALREADY_ENABLED = 10,
    /* If followup message internal queue is full */
    NAN_STATUS_FOLLOWUP_QUEUE_FULL = 11,
    /* Unsupported concurrency session enabled, NAN disabled notified */
    NAN_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED = 12,
    /*  if the pairing id is invalid */
    NAN_STATUS_INVALID_PAIRING_ID = 13,
    /*  if the bootstrapping id is invalid */
    NAN_STATUS_INVALID_BOOTSTRAPPING_ID = 14,
    /* If same request is received again */
    NAN_STATUS_REDUNDANT_REQUEST = 15,
    /* If current request is not supported */
    NAN_STATUS_NOT_SUPPORTED = 16,
    /* If no Wifi Aware connection is active */
    NAN_STATUS_NO_CONNECTION = 17,
} NanStatusType;

/* NAN Transmit Types */
typedef enum {
    NAN_TX_TYPE_BROADCAST = 0,
    NAN_TX_TYPE_UNICAST
} NanTxType;

/* NAN Subscribe Type */
typedef enum {
    NAN_SUBSCRIBE_TYPE_PASSIVE = 0,
    NAN_SUBSCRIBE_TYPE_ACTIVE
} NanSubscribeType;

/* NAN Service Response Filter Attribute Bit */
typedef enum {
    NAN_SRF_ATTR_BLOOM_FILTER = 0,
    NAN_SRF_ATTR_PARTIAL_MAC_ADDR
} NanSRFType;

/* NAN Service Response Filter Include Bit */
typedef enum {
    NAN_SRF_INCLUDE_DO_NOT_RESPOND = 0,
    NAN_SRF_INCLUDE_RESPOND
} NanSRFIncludeType;

/* NAN Match indication type */
typedef enum {
    NAN_MATCH_ALG_MATCH_ONCE = 0,
    NAN_MATCH_ALG_MATCH_CONTINUOUS,
    NAN_MATCH_ALG_MATCH_NEVER
} NanMatchAlg;

/* NAN Transmit Window Type */
typedef enum {
    NAN_TRANSMIT_IN_DW = 0,
    NAN_TRANSMIT_IN_FAW
} NanTransmitWindowType;

/* NAN SRF State in Subscribe */
typedef enum {
    NAN_DO_NOT_USE_SRF = 0,
    NAN_USE_SRF
} NanSRFState;

/* NAN Include SSI in MatchInd */
typedef enum {
    NAN_SSI_NOT_REQUIRED_IN_MATCH_IND = 0,
    NAN_SSI_REQUIRED_IN_MATCH_IND
} NanSsiInMatchInd;

/* NAN DP security Configuration */
typedef enum {
    NAN_DP_CONFIG_NO_SECURITY = 0,
    NAN_DP_CONFIG_SECURITY
} NanDataPathSecurityCfgStatus;

typedef enum {
    NAN_QOS_NOT_REQUIRED = 0,
    NAN_QOS_REQUIRED
} NanQosCfgStatus;


/* Data request Responder's response */
typedef enum {
    NAN_DP_REQUEST_ACCEPT = 0,
    NAN_DP_REQUEST_REJECT
} NanDataPathResponseCode;

/* Pairing request Responder's response */
typedef enum {
    NAN_PAIRING_REQUEST_ACCEPT = 0,
    NAN_PAIRING_REQUEST_REJECT
} NanPairingResponseCode;

/* Pairing bootstrapping Responder's response */
typedef enum {
    NAN_BOOTSTRAPPING_REQUEST_ACCEPT = 0,
    NAN_BOOTSTRAPPING_REQUEST_REJECT = 1,
    NAN_BOOTSTRAPPING_REQUEST_COMEBACK = 2
} NanBootstrappingResponseCode;

/* NAN DP channel config options */
typedef enum {
    NAN_DP_CHANNEL_NOT_REQUESTED = 0,
    NAN_DP_REQUEST_CHANNEL_SETUP,
    NAN_DP_FORCE_CHANNEL_SETUP
} NanDataPathChannelCfg;

/* Enable/Disable NAN Ranging Auto response */
typedef enum {
    NAN_RANGING_AUTO_RESPONSE_ENABLE = 1,
    NAN_RANGING_AUTO_RESPONSE_DISABLE
} NanRangingAutoResponse;

/* Enable/Disable NAN service range report */
typedef enum {
    NAN_DISABLE_RANGE_REPORT = 1,
    NAN_ENABLE_RANGE_REPORT
} NanRangeReport;

/* NAN Range Response */
typedef enum {
    NAN_RANGE_REQUEST_ACCEPT = 1,
    NAN_RANGE_REQUEST_REJECT,
    NAN_RANGE_REQUEST_CANCEL
} NanRangeResponse;

/* NAN Security Key Input Type*/
typedef enum {
    NAN_SECURITY_KEY_INPUT_PMK = 1,
    NAN_SECURITY_KEY_INPUT_PASSPHRASE
} NanSecurityKeyInputType;

typedef struct {
    /* pmk length */
    u32 pmk_len;
    /*
       PMK: Info is optional in Discovery phase.
       PMK info can be passed during
       the NDP session.
     */
    u8 pmk[NAN_PMK_INFO_LEN];
} NanSecurityPmk;

typedef struct {
    /* passphrase length */
    u32 passphrase_len;
    /*
       passphrase info is optional in Discovery phase.
       passphrase info can be passed during
       the NDP session.
     */
    u8 passphrase[NAN_SECURITY_MAX_PASSPHRASE_LEN];
} NanSecurityPassPhrase;

typedef struct {
    NanSecurityKeyInputType key_type;
    union {
        NanSecurityPmk pmk_info;
        NanSecurityPassPhrase passphrase_info;
    } body;
} NanSecurityKeyInfo;

/* NAN Security Cipher Suites Mask */
#define NAN_CIPHER_SUITE_SHARED_KEY_NONE               0x00
#define NAN_CIPHER_SUITE_SHARED_KEY_128_MASK           0x01
#define NAN_CIPHER_SUITE_SHARED_KEY_256_MASK           0x02
#define NAN_CIPHER_SUITE_PUBLIC_KEY_2WDH_128_MASK      0x04
#define NAN_CIPHER_SUITE_PUBLIC_KEY_2WDH_256_MASK      0x08
#define NAN_CIPHER_SUITE_PUBLIC_KEY_PASN_128_MASK      0x40
#define NAN_CIPHER_SUITE_PUBLIC_KEY_PASN_256_MASK      0x80

/* NAN ranging indication condition MASKS */
#define NAN_RANGING_INDICATE_CONTINUOUS_MASK   0x01
#define NAN_RANGING_INDICATE_INGRESS_MET_MASK  0x02
#define NAN_RANGING_INDICATE_EGRESS_MET_MASK   0x04

/* NAN schedule update reason MASKS */
#define NAN_SCHEDULE_UPDATE_NSS_MASK   0x01
#define NAN_SCHEDULE_UPDATE_CHANNEL_MASK  0x02

/* NAN pairing bootstrapping method */
#define NAN_PAIRING_BOOTSTRAPPING_OPPORTUNISTIC_MASK       0x01
#define NAN_PAIRING_BOOTSTRAPPING_PIN_CODE_DISPLAY_MASK    0x02
#define NAN_PAIRING_BOOTSTRAPPING_PASSPHRASE_DISPLAY_MASK  0x04
#define NAN_PAIRING_BOOTSTRAPPING_QR_DISPLAY_MASK          0x08
#define NAN_PAIRING_BOOTSTRAPPING_NFC_TAG_MASK             0x10
#define NAN_PAIRING_BOOTSTRAPPING_PIN_CODE_KEYPAD_MASK     0x20
#define NAN_PAIRING_BOOTSTRAPPING_PASSPHRASE_KEYPAD_MASK   0x40
#define NAN_PAIRING_BOOTSTRAPPING_QR_SCAN_MASK             0x80
#define NAN_PAIRING_BOOTSTRAPPING_NFC_READER_MASK          0x100
#define NAN_PAIRING_BOOTSTRAPPING_SERVICE_MANAGED_MASK     0x4000
#define NAN_PAIRING_BOOTSTRAPPING_HANDSHAKE_SHIP_MASK      0x8000

/*
   Structure to set the Service Descriptor Extension
   Attribute (SDEA) passed as part of NanPublishRequest/
   NanSubscribeRequest/NanMatchInd.
*/
typedef struct {
    /*
       Optional configuration of Data Path Enable request.
       configure flag determines whether configuration needs
       to be passed or not.
    */
    u8 config_nan_data_path;
    NdpType ndp_type;
    /*
       NAN secuirty required flag to indicate
       if the security is enabled or disabled
    */
    NanDataPathSecurityCfgStatus security_cfg;
    /*
       NAN ranging required flag to indicate
       if ranging is enabled on disabled
    */
    NanRangingState ranging_state;
    /*
      Enable/Disable Ranging report,
      when configured NanRangeReportInd received
    */
    NanRangeReport range_report;
    /*
      NAN QOS required flag to indicate
      if QOS is required or not.
    */
    NanQosCfgStatus qos_cfg;
    /*
      Config to set FSD with Gas bit
      in the SDEA Control Field.
     */
    u8 config_fsd_gas;
    u8 enable_fsd_gas;

    /*
      Config to set FSD Required bit
      in the SDEA Control Field.
     */
    u8 config_fsd_req;
    u8 enable_fsd_req;

    /*
      Config to set gtk protection bit
      in the SDEA Control Field.
     */
    u8 gtk_protection;
} NanSdeaCtrlParams;

/*
   Nan Ranging Peer Info in MatchInd
*/
typedef struct {
    /*
       Distance to the NAN device with the MAC address indicated
       with ranged mac address.
    */
    u32 range_measurement_mm;
    /* Ranging event matching the configuration of continuous/ingress/egress. */
    u32 ranging_event_type;
} NanRangeInfo;

/* Nan/NDP Capabilites info */
typedef struct {
    u32 max_concurrent_nan_clusters;
    u32 max_publishes;
    u32 max_subscribes;
    u32 max_service_name_len;
    u32 max_match_filter_len;
    u32 max_total_match_filter_len;
    u32 max_service_specific_info_len;
    u32 max_vsa_data_len;
    u32 max_mesh_data_len;
    u32 max_ndi_interfaces;
    u32 max_ndp_sessions;
    u32 max_app_info_len;
    u32 max_queued_transmit_followup_msgs;
    u32 ndp_supported_bands;
    u32 cipher_suites_supported;
    u32 max_scid_len;
    bool is_ndp_security_supported;
    u32 max_sdea_service_specific_info_len;
    u32 max_subscribe_address;
    u32 ndpe_attr_supported;
    bool is_instant_mode_supported;
    bool is_6g_supported;
    bool is_he_supported;
    bool is_pairing_supported;
    bool is_set_cluster_id_supported;
    bool is_suspension_supported;
} NanCapabilities;

/*
  Nan accept policy: Per service basis policy
  Based on this policy(ALL/NONE), responder side
  will send ACCEPT/REJECT
*/
typedef enum {
    NAN_SERVICE_ACCEPT_POLICY_NONE = 0,
    /* Default value */
    NAN_SERVICE_ACCEPT_POLICY_ALL
} NanServiceAcceptPolicy;

/*
  Host can send Vendor specific attributes which the Discovery Engine can
  enclose in Beacons and/or Service Discovery frames transmitted.
  Below structure is used to populate that.
*/
typedef struct {
    /*
       0 = transmit only in the next discovery window
       1 = transmit in next 16 discovery window
    */
    u8 payload_transmit_flag;
    /*
       Below flags will determine in which all frames
       the vendor specific attributes should be included
    */
    u8 tx_in_discovery_beacon;
    u8 tx_in_sync_beacon;
    u8 tx_in_service_discovery;
    /* Organizationally Unique Identifier */
    u32 vendor_oui;
    /*
       vendor specific attribute to be transmitted
       vsa_len : Length of the vsa data.
     */
    u32 vsa_len;
    u8 vsa[NAN_MAX_VSA_DATA_LEN];
} NanTransmitVendorSpecificAttribute;


/*
  Discovery Engine will forward any Vendor Specific Attributes
  which it received as part of this structure.
*/
/* Mask to determine on which frames attribute was received */
#define RX_DISCOVERY_BEACON_MASK  0x01
#define RX_SYNC_BEACON_MASK       0x02
#define RX_SERVICE_DISCOVERY_MASK 0x04
typedef struct {
    /*
       Frames on which this vendor specific attribute
       was received. Mask defined above
    */
    u8 vsa_received_on;
    /* Organizationally Unique Identifier */
    u32 vendor_oui;
    /* vendor specific attribute */
    u32 attr_len;
    u8 vsa[NAN_MAX_VSA_DATA_LEN];
} NanReceiveVendorSpecificAttribute;

/*
   NAN Beacon SDF Payload Received structure
   Discovery engine sends the details of received Beacon or
   Service Discovery Frames as part of this structure.
*/
typedef struct {
    /* Frame data */
    u32 frame_len;
    u8 frame_data[NAN_MAX_FRAME_DATA_LEN];
} NanBeaconSdfPayloadReceive;

/*
  Host can set the Periodic scan parameters for each of the
  3(6, 44, 149) Social channels. Only these channels are allowed
  any other channels are rejected
*/
typedef enum {
    NAN_CHANNEL_24G_BAND = 0,
    NAN_CHANNEL_5G_BAND_LOW,
    NAN_CHANNEL_5G_BAND_HIGH
} NanChannelIndex;

/*
   Structure to set the Social Channel Scan parameters
   passed as part of NanEnableRequest/NanConfigRequest
*/
typedef struct {
    /*
       Dwell time of each social channel in milliseconds
       NanChannelIndex corresponds to the respective channel
       If time set to 0 then the FW default time will be used.
    */
    u8 dwell_time[NAN_MAX_SOCIAL_CHANNELS]; // default value 200 msec

    /*
       Scan period of each social channel in seconds
       NanChannelIndex corresponds to the respective channel
       If time set to 0 then the FW default time will be used.
    */
    u16 scan_period[NAN_MAX_SOCIAL_CHANNELS]; // default value 20 sec
} NanSocialChannelScanParams;

/*
  Host can send Post Connectivity Capability attributes
  to be included in Service Discovery frames transmitted
  as part of this structure.
*/
typedef struct {
    /*
       0 = transmit only in the next discovery window
       1 = transmit in next 16 discovery window
    */
    u8 payload_transmit_flag;
    /* 1 - Wifi Direct supported 0 - Not supported */
    u8 is_wfd_supported;
    /* 1 - Wifi Direct Services supported 0 - Not supported */
    u8 is_wfds_supported;
    /* 1 - TDLS supported 0 - Not supported */
    u8 is_tdls_supported;
    /* 1 - IBSS supported 0 - Not supported */
    u8 is_ibss_supported;
    /* 1 - Mesh supported 0 - Not supported */
    u8 is_mesh_supported;
    /*
       1 - NAN Device currently connect to WLAN Infra AP
       0 - otherwise
    */
    u8 wlan_infra_field;
} NanTransmitPostConnectivityCapability;

/*
  Discovery engine providing the post connectivity capability
  received.
*/
typedef struct {
    /* 1 - Wifi Direct supported 0 - Not supported */
    u8 is_wfd_supported;
    /* 1 - Wifi Direct Services supported 0 - Not supported */
    u8 is_wfds_supported;
    /* 1 - TDLS supported 0 - Not supported */
    u8 is_tdls_supported;
    /* 1 - IBSS supported 0 - Not supported */
    u8 is_ibss_supported;
    /* 1 - Mesh supported 0 - Not supported */
    u8 is_mesh_supported;
    /*
       1 - NAN Device currently connect to WLAN Infra AP
       0 - otherwise
    */
    u8 wlan_infra_field;
} NanReceivePostConnectivityCapability;

/*
  Indicates the availability interval duration associated with the
  Availability Intervals Bitmap field
*/
typedef enum {
    NAN_DURATION_16MS = 0,
    NAN_DURATION_32MS = 1,
    NAN_DURATION_64MS = 2
} NanAvailDuration;

/* Further availability per channel information */
typedef struct {
    /* Defined above */
    NanAvailDuration entry_control;
    /*
       1 byte field indicating the frequency band the NAN Device
       will be available as defined in IEEE Std. 802.11-2012
       Annex E Table E-4 Global Operating Classes
    */
    u8 class_val;
    /*
       1 byte field indicating the channel the NAN Device
       will be available.
    */
    u8 channel;
    /*
        Map Id - 4 bit field which identifies the Further
        availability map attribute.
    */
    u8 mapid;
    /*
       divides the time between the beginnings of consecutive Discovery
       Windows of a given NAN cluster into consecutive time intervals
       of equal durations. The time interval duration is specified by
       the Availability Interval Duration subfield of the Entry Control
       field.

       A Nan device that sets the i-th bit of the Availability
       Intervals Bitmap to 1 shall be present during the corresponding
       i-th time interval in the operation channel indicated by the
       Operating Class and Channel Number fields in the same Availability Entry.

       A Nan device that sets the i-th bit of the Availability Intervals Bitmap to
       0 may be present during the corresponding i-th time interval in the operation
       channel indicated by the Operating Class and Channel Number fields in the same
       Availability Entry.

       The size of the Bitmap is dependent upon the Availability Interval Duration
       chosen in the Entry Control Field.  The size can be either 1, 2 or 4 bytes long

       - Duration field is equal to 0, only AIB[0] is valid
       - Duration field is equal to 1, only AIB [0] and AIB [1] is valid
       - Duration field is equal to 2, AIB [0], AIB [1], AIB [2] and AIB [3] are valid
    */
    u32 avail_interval_bitmap;
} NanFurtherAvailabilityChannel;

/*
  Further availability map which can be sent and received from
  Discovery engine
*/
typedef struct {
    /*
       Number of channels indicates the number of channel
       entries which is part of fam
    */
    u8 numchans;
    NanFurtherAvailabilityChannel famchan[NAN_MAX_FAM_CHANNELS];
} NanFurtherAvailabilityMap;

/*
  Host can send Post-Nan Discovery attributes which the Discovery Engine can
  enclose in Service Discovery frames
*/
/* Possible connection types in Post NAN Discovery attributes */
typedef enum {
    NAN_CONN_WLAN_INFRA = 0,
    NAN_CONN_P2P_OPER = 1,
    NAN_CONN_WLAN_IBSS = 2,
    NAN_CONN_WLAN_MESH = 3,
    NAN_CONN_FURTHER_SERVICE_AVAILABILITY = 4,
    NAN_CONN_WLAN_RANGING = 5
} NanConnectionType;

/* Possible device roles in Post NAN Discovery attributes */
typedef enum {
    NAN_WLAN_INFRA_AP = 0,
    NAN_WLAN_INFRA_STA = 1,
    NAN_P2P_OPER_GO = 2,
    NAN_P2P_OPER_DEV = 3,
    NAN_P2P_OPER_CLI = 4
} NanDeviceRole;

/* Configuration params of NAN Ranging */
typedef struct {
    /*
      Interval in milli sec between two ranging measurements.
      If the Awake DW intervals in NanEnable/Config are larger
      than the ranging intervals priority is given to Awake DW
      Intervals. Only on a match the ranging is initiated for the
      peer
    */
    u32 ranging_interval_msec;
    /*
      Flags indicating the type of ranging event to be notified
      NAN_RANGING_INDICATE_ MASKS are used to set these.
      BIT0 - Continuous Ranging event notification.
      BIT1 - Ingress distance is <=.
      BIT2 - Egress distance is >=.
    */
    u32 config_ranging_indications;
    /* Ingress distance in millimeters (optional) */
    u32 distance_ingress_mm;
    /* Egress distance in millmilliimeters (optional) */
    u32 distance_egress_mm;
} NanRangingCfg;

/* NAN Ranging request's response */
typedef struct {
    /* Publish Id of an earlier Publisher */
    u16 publish_id;
    /*
       A 32 bit Requestor instance Id which is sent to the Application.
       This Id will be used in subsequent RangeResponse on Subscribe side.
    */
    u32 requestor_instance_id;
    /* Peer MAC addr of Range Requestor */
    u8 peer_addr[NAN_MAC_ADDR_LEN];
    /* Response indicating ACCEPT/REJECT/CANCEL of Range Request */
    NanRangeResponse ranging_response;
} NanRangeResponseCfg;

/* Structure of Post NAN Discovery attribute */
typedef struct {
    /* Connection type of the host */
    NanConnectionType  type;
    /*
       Device role of the host based on
       the connection type
    */
    NanDeviceRole role;
    /*
       Flag to send the information as a single shot or repeated
       for next 16 discovery windows
       0 - Single_shot
       1 - next 16 discovery windows
    */
    u8 transmit_freq;
    /* Duration of the availability bitmask */
    NanAvailDuration duration;
    /* Availability interval bitmap based on duration */
    u32 avail_interval_bitmap;
    /*
       Mac address depending on the conn type and device role
       --------------------------------------------------
       | Conn Type  |  Device Role |  Mac address Usage  |
       --------------------------------------------------
       | WLAN_INFRA |  AP/STA      |   BSSID of the AP   |
       --------------------------------------------------
       | P2P_OPER   |  GO          |   GO's address      |
       --------------------------------------------------
       | P2P_OPER   |  P2P_DEVICE  |   Address of who    |
       |            |              |   would become GO   |
       --------------------------------------------------
       | WLAN_IBSS  |  NA          |   BSSID             |
       --------------------------------------------------
       | WLAN_MESH  |  NA          |   BSSID             |
       --------------------------------------------------
    */
    u8 addr[NAN_MAC_ADDR_LEN];
    /*
       Mandatory mesh id value if connection type is WLAN_MESH
       Mesh id contains 0-32 octet identifier and should be
       as per IEEE Std.802.11-2012 spec.
    */
    u16 mesh_id_len;
    u8 mesh_id[NAN_MAX_MESH_DATA_LEN];
    /*
       Optional infrastructure SSID if conn_type is set to
       NAN_CONN_WLAN_INFRA
    */
    u16 infrastructure_ssid_len;
    u8 infrastructure_ssid_val[NAN_MAX_INFRA_DATA_LEN];
} NanTransmitPostDiscovery;

/*
   Discovery engine providing the structure of Post NAN
   Discovery
*/
typedef struct {
    /* Connection type of the host */
    NanConnectionType  type;
    /*
       Device role of the host based on
       the connection type
    */
    NanDeviceRole role;
    /* Duration of the availability bitmask */
    NanAvailDuration duration;
    /* Availability interval bitmap based on duration */
    u32 avail_interval_bitmap;
    /*
       Map Id - 4 bit field which identifies the Further
       availability map attribute.
    */
    u8 mapid;
    /*
       Mac address depending on the conn type and device role
       --------------------------------------------------
       | Conn Type  |  Device Role |  Mac address Usage  |
       --------------------------------------------------
       | WLAN_INFRA |  AP/STA      |   BSSID of the AP   |
       --------------------------------------------------
       | P2P_OPER   |  GO          |   GO's address      |
       --------------------------------------------------
       | P2P_OPER   |  P2P_DEVICE  |   Address of who    |
       |            |              |   would become GO   |
       --------------------------------------------------
       | WLAN_IBSS  |  NA          |   BSSID             |
       --------------------------------------------------
       | WLAN_MESH  |  NA          |   BSSID             |
       --------------------------------------------------
    */
    u8 addr[NAN_MAC_ADDR_LEN];
    /*
       Mandatory mesh id value if connection type is WLAN_MESH
       Mesh id contains 0-32 octet identifier and should be
       as per IEEE Std.802.11-2012 spec.
    */
    u16 mesh_id_len;
    u8 mesh_id[NAN_MAX_MESH_DATA_LEN];
    /*
       Optional infrastructure SSID if conn_type is set to
       NAN_CONN_WLAN_INFRA
    */
    u16 infrastructure_ssid_len;
    u8 infrastructure_ssid_val[NAN_MAX_INFRA_DATA_LEN];
} NanReceivePostDiscovery;

/*
   NAN device level configuration of SDF and Sync beacons in both
   2.4/5GHz bands
*/
typedef struct {
    /* Configure 2.4GHz DW Band */
    u8 config_2dot4g_dw_band;
    /*
       Indicates the interval for Sync beacons and SDF's in 2.4GHz band.
       Valid values of DW Interval are: 1, 2, 3, 4 and 5, 0 is reserved.
       The SDF includes in OTA when enabled. The publish/subscribe period
       values don't override the device level configurations.
    */
    u32 dw_2dot4g_interval_val; // default value 1
    /* Configure 5GHz DW Band */
    u8 config_5g_dw_band;
    /*
       Indicates the interval for Sync beacons and SDF's in 5GHz band
       Valid values of DW Interval are: 1, 2, 3, 4 and 5, 0 no wake up for
       any interval. The SDF includes in OTA when enabled. The publish/subscribe
       period values don't override the device level configurations.
    */
    u32 dw_5g_interval_val; // default value 1 when 5G is enabled
} NanConfigDW;

/*
  Enable Request Message Structure
  The NanEnableReq message instructs the Discovery Engine to enter an operational state
*/
typedef struct {
    /* Mandatory parameters below */
    u8 master_pref; // default value 0x02
    /*
      A cluster_low value matching cluster_high indicates a request to join
      a cluster with that value. If the requested cluster is not found the
      device will start its own cluster.
    */
    u16 cluster_low; // default value 0
    u16 cluster_high; // default value 0xFFFF

    /*
      Optional configuration of Enable request.
      Each of the optional parameters have configure flag which
      determine whether configuration is to be passed or not.
    */
    u8 config_support_5g;
    u8 support_5g_val; // default value 0; turned off by default
    /*
       BIT 0 is used to specify to include Service IDs in Sync/Discovery beacons
       0 - Do not include SIDs in any beacons
       1 - Include SIDs in all beacons.
       Rest 7 bits are count field which allows control over the number of SIDs
       included in the Beacon.  0 means to include as many SIDs that fit into
       the maximum allow Beacon frame size
    */
    u8 config_sid_beacon;
    u8 sid_beacon_val; // default value 0x01
    /*
       The rssi values below should be specified without sign.
       For eg: -70dBm should be specified as 70.
    */
    u8 config_2dot4g_rssi_close;
    u8 rssi_close_2dot4g_val;    // default value -60 dBm

    u8 config_2dot4g_rssi_middle;
    u8 rssi_middle_2dot4g_val;    // default value -70 dBm

    u8 config_2dot4g_rssi_proximity;
    u8 rssi_proximity_2dot4g_val;//  default value -60dBm

    u8 config_hop_count_limit;
    u8 hop_count_limit_val; //  default value 0x02

    /*
       Defines 2.4G channel access support
       0 - No Support
       1 - Supported
    */
    u8 config_2dot4g_support;
    u8 support_2dot4g_val; // default value 0x01
    /*
       Defines 2.4G channels will be used for sync/discovery beacons
       0 - 2.4G channels not used for beacons
       1 - 2.4G channels used for beacons
    */
    u8 config_2dot4g_beacons;
    u8 beacon_2dot4g_val; // default value 1
    /*
       Defines 2.4G channels will be used for Service Discovery frames
       0 - 2.4G channels not used for Service Discovery frames
       1 - 2.4G channels used for Service Discovery frames
    */
    u8 config_2dot4g_sdf;
    u8 sdf_2dot4g_val; // default value 1
    /*
       Defines 5G channels will be used for sync/discovery beacons
       0 - 5G channels not used for beacons
       1 - 5G channels used for beacons
    */
    u8 config_5g_beacons;
    u8 beacon_5g_val; // default value 1 when 5G is enabled
    /*
       Defines 5G channels will be used for Service Discovery frames
       0 - 5G channels not used for Service Discovery frames
       1 - 5G channels used for Service Discovery frames
    */
    u8 config_5g_sdf;
    u8 sdf_5g_val; // default value is 0 when 5G is enabled
    /*
       1 byte value which defines the RSSI in
       dBm for a close by Peer in 5 Ghz channels.
       The rssi values should be specified without sign.
       For eg: -70dBm should be specified as 70.
    */
    u8 config_5g_rssi_close;
    u8 rssi_close_5g_val; // default value -60dBm when 5G is enabled
    /*
       1 byte value which defines the RSSI value in
       dBm for a close by Peer in 5 Ghz channels.
       The rssi values should be specified without sign.
       For eg: -70dBm should be specified as 70.
    */
    u8 config_5g_rssi_middle;
    u8 rssi_middle_5g_val; // default value -75dBm when 5G is enabled
    /*
       1 byte value which defines the RSSI filter
       threshold.  Any Service Descriptors received above this
       value that are configured for RSSI filtering will be dropped.
       The rssi values should be specified without sign.
       For eg: -70dBm should be specified as 70.
    */
    u8 config_5g_rssi_close_proximity;
    u8 rssi_close_proximity_5g_val; // default value -60dBm when 5G is enabled
    /*
       1 byte quantity which defines the window size over
       which the “average RSSI” will be calculated over.
    */
    u8 config_rssi_window_size;
    u8 rssi_window_size_val; // default value 0x08
    /*
       The 24 bit Organizationally Unique ID + the 8 bit Network Id.
    */
    u8 config_oui;
    u32 oui_val; // default value {0x51, 0x6F, 0x9A, 0x01, 0x00, 0x00}
    /*
       NAN Interface Address, If not configured the Discovery Engine
       will generate a 6 byte Random MAC.
    */
    u8 config_intf_addr;
    u8 intf_addr_val[NAN_MAC_ADDR_LEN];
    /*
       If set to 1, the Discovery Engine will enclose the Cluster
       Attribute only sent in Beacons in a Vendor Specific Attribute
       and transmit in a Service Descriptor Frame.
    */
    u8 config_cluster_attribute_val;
    /*
       The periodicity in seconds between full scan’s to find any new
       clusters available in the area.  A Full scan should not be done
       more than every 10 seconds and should not be done less than every
       30 seconds.
    */
    u8 config_scan_params;
    NanSocialChannelScanParams scan_params_val;
    /*
       1 byte quantity which forces the Random Factor to a particular
       value for all transmitted Sync/Discovery beacons
    */
    u8 config_random_factor_force;
    u8 random_factor_force_val; // default value off and set to 0x00
    /*
       1 byte quantity which forces the HC for all transmitted Sync and
       Discovery Beacon NO matter the real HC being received over the
       air.
    */
    u8 config_hop_count_force;
    u8 hop_count_force_val; // default value 0x00

    /* channel frequency in MHz to enable Nan on */
    u8 config_24g_channel;
    wifi_channel channel_24g_val; // default value channel 0x6

    u8 config_5g_channel;
    wifi_channel channel_5g_val; // default value channel 44 or 149 regulatory
                                 // domain
    /* Configure 2.4/5GHz DW */
    NanConfigDW config_dw;

    /*
       By default discovery MAC address randomization is enabled
       and default interval value is 30 minutes i.e. 1800 seconds.
       The value 0 is used to disable MAC addr randomization.
    */
    u8 config_disc_mac_addr_randomization;
    u32 disc_mac_addr_rand_interval_sec; // default value 1800 sec

    /*
      Set/Enable corresponding bits to disable Discovery indications:
      BIT0 - Disable Discovery MAC Address Event.
      BIT1 - Disable Started Cluster Event.
      BIT2 - Disable Joined Cluster Event.
    */
    u8 discovery_indication_cfg;  // default value 0x0
    /*
       BIT 0 is used to specify to include Service IDs in Sync/Discovery beacons
       0 - Do not include SIDs in any beacons
       1 - Include SIDs in all beacons.
       Rest 7 bits are count field which allows control over the number of SIDs
       included in the Beacon.  0 means to include as many SIDs that fit into
       the maximum allow Beacon frame size
    */
    u8 config_subscribe_sid_beacon;
    u32 subscribe_sid_beacon_val; // default value 0x0
    /*
       Discovery Beacon Interval config.
       Default value is 128 msec in 2G DW and 176 msec in 2G/5G DW.
       When 0 value is passed it is reset to default value of 128 or 176 msec.
    */
    u8 config_discovery_beacon_int;
    u32 discovery_beacon_interval;
    /*
       Enable Number of Spatial Streams.
       This is NAN Power Optimization feature for NAN discovery.
    */
    u8 config_nss;
    // default value is implementation specific and passing 0 sets it to default
    u32 nss;
    /*
       Enable device level NAN Ranging feature.
       0 - Disable
       1 - Enable
    */
    u8 config_enable_ranging;
    u32 enable_ranging;
    /*
       Enable/Disable DW Early termination.
       0 - Disable
       1 - Enable
    */
    u8 config_dw_early_termination;
    u32 enable_dw_termination;
    /*
       Indicate whether to use NDPE attribute to bring-up TCP/IP connection.
       If config_ndpe_attr is not configured, the default behavior is
       not using NDPE attr, and the capability is not advertised.
       0 - Not use
       1 - Use
    */
    u8 config_ndpe_attr;
    u32 use_ndpe_attr;
    /*
        Enable NAN v3.1 instant communication mode.
        0 - Disable
        1 - Enable
    */
    u8 config_enable_instant_mode;
    u32 enable_instant_mode;
    /*
        Config NAN v3.1 instant communication channel frequency selected over NFC/OOB method.
        If dual band is supported default channel is 149 or 44 as per regulatory domain,
        else channel 6 (send frequency in MHz).
        Sometimes depending on country code retrictions, even 149/44 may be restricted
        in those cases instant channel will be operational only in 2.4GHz.
        Use wifi_get_usable_channels() API to get supported bands/channels before
        Instant mode NFC handshake is triggered
    */
    u8 config_instant_mode_channel;
    wifi_channel instant_mode_channel;

    /*
       Enable/Disable unsync service discovery.
       0 - Disable
       1 - Enable
    */
    u8 config_unsync_srvdsc;
    u8 enable_unsync_srvdsc;

    /*
      Configure regulatory information.
    */
    u8 config_reg_info;
    u8 reg_info_val;
} NanEnableRequest;

/*
  NAN pairing config.
*/
typedef struct {

    /*
      Enable Nan pairing setup
    */
    u32 enable_pairing_setup;

    /*
      Enable cache NIK/NPK after Nan pairing setup
    */
    u32 enable_pairing_cache;

    /*
      Enable Nan pairing verification with cached NIK/NPK
    */
    u32 enable_pairing_verification;

    /*
      The set of supported bootstrapping methods.
    */
    u16 supported_bootstrapping_methods;
} NanPairingConfig;

/*
  Publish Msg Structure
  Message is used to request the DE to publish the Service Name
  using the parameters passed into the Discovery Window
*/
typedef struct {
    u16 publish_id;/* id  0 means new publish, any other id is existing publish */
    u16 ttl; /* how many seconds to run for. 0 means forever until canceled */
    /*
       period: Awake DW Interval for publish(service)
       Indicates the interval between two Discovery Windows in which
       the device supporting the service is awake to transmit or
       receive the Service Discovery frames.
       Valid values of Awake DW Interval are: 1, 2, 4, 8 and 16, value 0 will
       default to 1.
    */
    u16 period;
    NanPublishType publish_type;/* 0= unsolicited, solicited = 1, 2= both */
    NanTxType tx_type; /* 0 = broadcast, 1= unicast  if solicited publish */
    u8 publish_count; /* number of OTA Publish, 0 means forever until canceled */
    u16 service_name_len; /* length of service name */
    u8 service_name[NAN_MAX_SERVICE_NAME_LEN];/* UTF-8 encoded string identifying the service */
    /*
       Field which specifies how the matching indication to host is controlled.
       0 - Match and Indicate Once
       1 - Match and Indicate continuous
       2 - Match and Indicate never. This means don't indicate the match to the host.
       3 - Reserved
    */
    NanMatchAlg publish_match_indicator;

    /*
       Sequence of values
       NAN Device that has invoked a Subscribe method corresponding to this Publish method
    */
    u16 service_specific_info_len;
    u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN];

    /*
       Ordered sequence of <length, value> pairs which specify further response conditions
       beyond the service name used to filter subscribe messages to respond to.
       This is only needed when the PT is set to NAN_SOLICITED or NAN_SOLICITED_UNSOLICITED.
    */
    u16 rx_match_filter_len;
    u8 rx_match_filter[NAN_MAX_MATCH_FILTER_LEN];

    /*
       Ordered sequence of <length, value> pairs to be included in the Discovery Frame.
       If present it is always sent in a Discovery Frame
    */
    u16 tx_match_filter_len;
    u8 tx_match_filter[NAN_MAX_MATCH_FILTER_LEN];

    /*
       flag which specifies that the Publish should use the configured RSSI
       threshold and the received RSSI in order to filter requests
       0 – ignore the configured RSSI threshold when running a Service
           Descriptor attribute or Service ID List Attribute through the DE matching logic.
       1 – use the configured RSSI threshold when running a Service
           Descriptor attribute or Service ID List Attribute through the DE matching logic.

    */
    u8 rssi_threshold_flag;

    /*
       8-bit bitmap which allows the Host to associate this publish
       with a particular Post-NAN Connectivity attribute
       which has been sent down in a NanConfigureRequest/NanEnableRequest
       message.  If the DE fails to find a configured Post-NAN
       connectivity attributes referenced by the bitmap,
       the DE will return an error code to the Host.
       If the Publish is configured to use a Post-NAN Connectivity
       attribute and the Host does not refresh the Post-NAN Connectivity
       attribute the Publish will be canceled and the Host will be sent
       a PublishTerminatedIndication message.
    */
    u8 connmap;
    /*
      Set/Enable corresponding bits to disable any indications that follow a publish.
      BIT0 - Disable publish termination indication.
      BIT1 - Disable match expired indication.
      BIT2 - Disable followUp indication received (OTA).
      BIT3 - Disable publishReplied indication.
    */
    u8 recv_indication_cfg;
    /*
      Nan accept policy for the specific service(publish)
    */
    NanServiceAcceptPolicy service_responder_policy;
    /* NAN Cipher Suite Type */
    u32 cipher_type;
    /*
       Nan Security Key Info is optional in Discovery phase.
       PMK or passphrase info can be passed during
       the NDP session.
    */
    NanSecurityKeyInfo key_info;

    /* Security Context Identifiers length */
    u32 scid_len;
    /*
       Security Context Identifier attribute contains PMKID
       shall be included in NDP setup and response messages.
       Security Context Identifier, Identifies the Security
       Context. For NAN Shared Key Cipher Suite, this field
       contains the 16 octet PMKID identifying the PMK used
       for setting up the Secure Data Path.
    */
    u8 scid[NAN_MAX_SCID_BUF_LEN];

    /* NAN configure service discovery extended attributes */
    NanSdeaCtrlParams sdea_params;

    /* NAN Ranging configuration */
    NanRangingCfg ranging_cfg;

    /* Enable/disable NAN serivce Ranging auto response mode */
    NanRangingAutoResponse ranging_auto_response;

    /*
      When the ranging_auto_response_cfg is not set, NanRangeRequestInd is
      received. Nan Range Response to Peer MAC Addr is notified to indicate
      ACCEPT/REJECT/CANCEL to the requestor.
    */
    NanRangeResponseCfg range_response_cfg;

    /*
       Sequence of values indicating the service specific info in SDEA
    */
    u16 sdea_service_specific_info_len;
    u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN];

    /*
       The Identity key for pairing, used to generate NIRA
    */
    u8 nan_identity_key[NAN_IDENTITY_KEY_LEN];

    /*
      The config for Nan pairing
    */
    NanPairingConfig nan_pairing_config;

    /*
      Specifies whether suspension can be possible in this publish session.
      The request would fail if enable_suspendability is true but
      is_suspension_supported is false in NanCapabilities.
    */
    bool enable_suspendability;

    /* s3 capabilities */
    u16 s3_capabilities;

    /* cipher capabilities */
    u8 cipher_capabilities;
} NanPublishRequest;

/*
  Publish Cancel Msg Structure
  The PublishServiceCancelReq Message is used to request the DE to stop publishing
  the Service Name identified by the Publish Id in the message.
*/
typedef struct {
    u16 publish_id;
} NanPublishCancelRequest;

/*
  NAN Subscribe Structure
  The SubscribeServiceReq message is sent to the Discovery Engine
  whenever the Upper layers would like to listen for a Service Name
*/
typedef struct {
    u16 subscribe_id; /* id 0 means new subscribe, non zero is existing subscribe */
    u16 ttl; /* how many seconds to run for. 0 means forever until canceled */
    /*
       period: Awake DW Interval for subscribe(service)
       Indicates the interval between two Discovery Windows in which
       the device supporting the service is awake to transmit or
       receive the Service Discovery frames.
       Valid values of Awake DW Interval are: 1, 2, 4, 8 and 16, value 0 will
       default to 1.
    */
    u16 period;

    /* Flag which specifies how the Subscribe request shall be processed. */
    NanSubscribeType subscribe_type; /* 0 - PASSIVE , 1- ACTIVE */

    /* Flag which specifies on Active Subscribes how the Service Response Filter attribute is populated.*/
    NanSRFType serviceResponseFilter; /* 0 - Bloom Filter, 1 - MAC Addr */

    /* Flag which specifies how the Service Response Filter Include bit is populated.*/
    NanSRFIncludeType serviceResponseInclude; /* 0=Do not respond if in the Address Set, 1= Respond */

    /* Flag which specifies if the Service Response Filter should be used when creating Subscribes.*/
    NanSRFState useServiceResponseFilter; /* 0=Do not send the Service Response Filter,1= send */

    /*
       Flag which specifies if the Service Specific Info is needed in
       the Publish message before creating the MatchIndication
    */
    NanSsiInMatchInd ssiRequiredForMatchIndication; /* 0=Not needed, 1= Required */

    /*
       Field which specifies how the matching indication to host is controlled.
       0 - Match and Indicate Once
       1 - Match and Indicate continuous
       2 - Match and Indicate never. This means don't indicate the match to the host.
       3 - Reserved
    */
    NanMatchAlg subscribe_match_indicator;

    /*
       The number of Subscribe Matches which should occur
       before the Subscribe request is automatically terminated.
    */
    u8 subscribe_count; /* If this value is 0 this field is not used by the DE.*/

    u16 service_name_len;/* length of service name */
    u8 service_name[NAN_MAX_SERVICE_NAME_LEN]; /* UTF-8 encoded string identifying the service */

    /* Sequence of values which further specify the published service beyond the service name*/
    u16 service_specific_info_len;
    u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN];

    /*
       Ordered sequence of <length, value> pairs used to filter out received publish discovery messages.
       This can be sent both for a Passive or an Active Subscribe
    */
    u16 rx_match_filter_len;
    u8 rx_match_filter[NAN_MAX_MATCH_FILTER_LEN];

    /*
       Ordered sequence of <length, value> pairs  included in the
       Discovery Frame when an Active Subscribe is used.
    */
    u16 tx_match_filter_len;
    u8 tx_match_filter[NAN_MAX_MATCH_FILTER_LEN];

    /*
       Flag which specifies that the Subscribe should use the configured RSSI
       threshold and the received RSSI in order to filter requests
       0 – ignore the configured RSSI threshold when running a Service
           Descriptor attribute or Service ID List Attribute through the DE matching logic.
       1 – use the configured RSSI threshold when running a Service
           Descriptor attribute or Service ID List Attribute through the DE matching logic.

    */
    u8 rssi_threshold_flag;

    /*
       8-bit bitmap which allows the Host to associate this Active
       Subscribe with a particular Post-NAN Connectivity attribute
       which has been sent down in a NanConfigureRequest/NanEnableRequest
       message.  If the DE fails to find a configured Post-NAN
       connectivity attributes referenced by the bitmap,
       the DE will return an error code to the Host.
       If the Subscribe is configured to use a Post-NAN Connectivity
       attribute and the Host does not refresh the Post-NAN Connectivity
       attribute the Subscribe will be canceled and the Host will be sent
       a SubscribeTerminatedIndication message.
    */
    u8 connmap;
    /*
       NAN Interface Address, conforming to the format as described in
       8.2.4.3.2 of IEEE Std. 802.11-2012.
    */
    u8 num_intf_addr_present;
    u8 intf_addr[NAN_MAX_SUBSCRIBE_MAX_ADDRESS][NAN_MAC_ADDR_LEN];
    /*
      Set/Enable corresponding bits to disable indications that follow a subscribe.
      BIT0 - Disable subscribe termination indication.
      BIT1 - Disable match expired indication.
      BIT2 - Disable followUp indication received (OTA).
    */
    u8 recv_indication_cfg;

    /* NAN Cipher Suite Type */
    u32 cipher_type;
    /*
       Nan Security Key Info is optional in Discovery phase.
       PMK or passphrase info can be passed during
       the NDP session.
    */
    NanSecurityKeyInfo key_info;

    /* Security Context Identifiers length */
    u32 scid_len;
    /*
       Security Context Identifier attribute contains PMKID
       shall be included in NDP setup and response messages.
       Security Context Identifier, Identifies the Security
       Context. For NAN Shared Key Cipher Suite, this field
       contains the 16 octet PMKID identifying the PMK used
       for setting up the Secure Data Path.
    */
    u8 scid[NAN_MAX_SCID_BUF_LEN];

    /* NAN configure service discovery extended attributes */
    NanSdeaCtrlParams sdea_params;

    /* NAN Ranging configuration */
    NanRangingCfg ranging_cfg;

    /* Enable/disable NAN serivce Ranging auto response mode */
    NanRangingAutoResponse ranging_auto_response;

    /*
      When the ranging_auto_response_cfg is not set, NanRangeRequestInd is
      received. Nan Range Response to Peer MAC Addr is notified to indicate
      ACCEPT/REJECT/CANCEL to the requestor.
    */
    NanRangeResponseCfg range_response_cfg;

    /*
       Sequence of values indicating the service specific info in SDEA
    */
    u16 sdea_service_specific_info_len;
    u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN];
    /*
       The Identity key for pairing, used to generate NIRA
    */
    u8 nan_identity_key[NAN_IDENTITY_KEY_LEN];

    /*
      The config for Nan pairing
    */
    NanPairingConfig nan_pairing_config;

    /*
      Specifies whether suspension can be possible in this subscribe session.
      The request would fail if enable_suspendability is true but
      is_suspension_supported is false in NanCapabilities.
    */
    bool enable_suspendability;

    /* cipher capabilities */
    u8 cipher_capabilities;
} NanSubscribeRequest;

/*
  NAN Subscribe Cancel Structure
  The SubscribeCancelReq Message is used to request the DE to stop looking for the Service Name.
*/
typedef struct {
    u16 subscribe_id;
} NanSubscribeCancelRequest;

/*
  Transmit follow up Structure
  The TransmitFollowupReq message is sent to the DE to allow the sending of the Service_Specific_Info
  to a particular MAC address.
*/
typedef struct {
    /* Publish or Subscribe Id of an earlier Publish/Subscribe */
    u16 publish_subscribe_id;

    /*
       This Id is the Requestor Instance that is passed as
       part of earlier MatchInd/FollowupInd message.
    */
    u32 requestor_instance_id;
    u8 addr[NAN_MAC_ADDR_LEN]; /* Unicast address */
    NanTxPriority priority; /* priority of the request 2=high */
    NanTransmitWindowType dw_or_faw; /* 0= send in a DW, 1=send in FAW */

    /*
       Sequence of values which further specify the published service beyond
       the service name.
    */
    u16 service_specific_info_len;
    u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN];
    /*
      Set/Enable corresponding bits to disable responses after followUp.
      BIT0 - Disable followUp response from FW.
    */
    u8 recv_indication_cfg;

    /*
       Sequence of values indicating the service specific info in SDEA
    */
    u16 sdea_service_specific_info_len;
    u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN];

    /*
       Add shared key descriptor attribute to the Followup request when the
       flag is set
    */
    u8 shared_key_desc_flag;
} NanTransmitFollowupRequest;

/*
  Stats Request structure
  The Discovery Engine can be queried at runtime by the Host processor for statistics
  concerning various parts of the Discovery Engine.
*/
typedef struct {
    NanStatsType stats_type; /* NAN Statistics Request Type */
    u8 clear; /* 0= Do not clear the stats and return the current contents , 1= Clear the associated stats  */
} NanStatsRequest;

/*
  Suspend Request Structure
  The SuspendRequest message is used to request that the specified session is suspended.
  The session can be resumed using the NanResumeRequest message.
*/
typedef struct {
    u16 publish_subscribe_id;
} NanSuspendRequest;

/*
  Resume Request Structure
  The ResumeRequest message is used to request that the specified session is resumed.
*/
typedef struct {
    u16 publish_subscribe_id;
} NanResumeRequest;

/*
  Config Structure
  The NanConfigurationReq message is sent by the Host to the
  Discovery Engine in order to configure the Discovery Engine during runtime.
*/
typedef struct {
    u8 config_sid_beacon;
    u8 sid_beacon;
    u8 config_rssi_proximity;
    u8 rssi_proximity; // default value -60dBm
    u8 config_master_pref;
    u8 master_pref; // default value 0x02
    /*
       1 byte value which defines the RSSI filter threshold.
       Any Service Descriptors received above this value
       that are configured for RSSI filtering will be dropped.
       The rssi values should be specified without sign.
       For eg: -70dBm should be specified as 70.
    */
    u8 config_5g_rssi_close_proximity;
    u8 rssi_close_proximity_5g_val;  // default value -60dBm
    /*
      Optional configuration of Configure request.
      Each of the optional parameters have configure flag which
      determine whether configuration is to be passed or not.
    */
    /*
       1 byte quantity which defines the window size over
       which the “average RSSI” will be calculated over.
    */
    u8 config_rssi_window_size;
    u8 rssi_window_size_val; // default value 0x08
    /*
       If set to 1, the Discovery Engine will enclose the Cluster
       Attribute only sent in Beacons in a Vendor Specific Attribute
       and transmit in a Service Descriptor Frame.
    */
    u8 config_cluster_attribute_val;
    /*
      The periodicity in seconds between full scan’s to find any new
      clusters available in the area.  A Full scan should not be done
      more than every 10 seconds and should not be done less than every
      30 seconds.
    */
    u8 config_scan_params;
    NanSocialChannelScanParams scan_params_val;
    /*
       1 byte quantity which forces the Random Factor to a particular
       value for all transmitted Sync/Discovery beacons
    */
    u8 config_random_factor_force;
    u8 random_factor_force_val; // default value 0x00
    /*
       1 byte quantity which forces the HC for all transmitted Sync and
       Discovery Beacon NO matter the real HC being received over the
       air.
    */
    u8 config_hop_count_force;
    u8 hop_count_force_val; // default value of 0
    /* NAN Post Connectivity Capability */
    u8 config_conn_capability;
    NanTransmitPostConnectivityCapability conn_capability_val;
    /* NAN Post Discover Capability */
    u8 num_config_discovery_attr;
    NanTransmitPostDiscovery discovery_attr_val[NAN_MAX_POSTDISCOVERY_LEN];
    /* NAN Further availability Map */
    u8 config_fam;
    NanFurtherAvailabilityMap fam_val;
    /* Configure 2.4/5GHz DW */
    NanConfigDW config_dw;
    /*
       By default discovery MAC address randomization is enabled
       and default interval value is 30 minutes i.e. 1800 seconds.
       The value 0 is used to disable MAC addr randomization.
    */
    u8 config_disc_mac_addr_randomization;
    u32 disc_mac_addr_rand_interval_sec; // default value of 30 minutes

    /*
      Set/Enable corresponding bits to disable Discovery indications:
      BIT0 - Disable Discovery MAC Address Event.
      BIT1 - Disable Started Cluster Event.
      BIT2 - Disable Joined Cluster Event.
    */
    u8 discovery_indication_cfg; // default value of 0
    /*
       BIT 0 is used to specify to include Service IDs in Sync/Discovery beacons
       0 - Do not include SIDs in any beacons
       1 - Include SIDs in all beacons.
       Rest 7 bits are count field which allows control over the number of SIDs
       included in the Beacon.  0 means to include as many SIDs that fit into
       the maximum allow Beacon frame size
    */
    u8 config_subscribe_sid_beacon;
    u32 subscribe_sid_beacon_val; // default value 0x0
    /*
       Discovery Beacon Interval config.
       Default value is 128 msec in 2G DW and 176 msec in 2G/5G DW.
       When 0 value is passed it is reset to default value of 128 or 176 msec.
    */
    u8 config_discovery_beacon_int;
    u32 discovery_beacon_interval;
    /*
       Enable Number of Spatial Streams.
       This is NAN Power Optimization feature for NAN discovery.
    */
    u8 config_nss;
    // default value is implementation specific and passing 0 sets it to default
    u32 nss;
    /*
       Enable device level NAN Ranging feature.
       0 - Disable
       1 - Enable
    */
    u8 config_enable_ranging;
    u32 enable_ranging;
    /*
       Enable/Disable DW Early termination.
       0 - Disable
       1 - Enable
    */
    u8 config_dw_early_termination;
    u32 enable_dw_termination;
    /*
       Indicate whether to use NDPE attribute to bring-up TCP/IP connection
       If config_ndpe_attr is not configured, the default behavior is
       not using NDPE attr, and the capability is not advertised.
       0 - Not use
       1 - Use
    */
    u8 config_ndpe_attr;
    u32 use_ndpe_attr;
    /*
            Enable NAN v3.1 instant communication mode.
            0 - Disable
            1 - Enable
    */
    u8 config_enable_instant_mode;
    u32 enable_instant_mode;
    /*
        Config NAN v3.1 instant communication channel selected over NFC/OOB method.
        If dual band is supported default channel is 149 or 44 as per regulatory domain,
        else channel 6 (send frequency in MHz).
        Sometimes depending on country code retrictions, even 149/44 may be restricted
        in those cases instant channel will be operational only in 2.4GHz.
        Use wifi_get_usable_channels() API to get supported bands/channels before
        Instant mode NFC handshake is triggered
    */
    u8 config_instant_mode_channel;
    wifi_channel instant_mode_channel;
    /*
       Config cluster ID with the cluster ID selected over NFC/OOB method.
    */
    u8 config_cluster_id;
    u16 cluster_id_val; // default value 0x0
} NanConfigRequest;

/*
  TCA Structure
  The Discovery Engine can be configured to send up Events whenever a configured
  Threshold Crossing Alert (TCA) Type crosses an integral threshold in a particular direction.
*/
typedef struct {
    NanTcaType tca_type; /* Nan Protocol Threshold Crossing Alert (TCA) Codes */

    /* flag which control whether or not an event is generated for the Rising direction */
    u8 rising_direction_evt_flag; /* 0 - no event, 1 - event */

    /* flag which control whether or not an event is generated for the Falling direction */
    u8 falling_direction_evt_flag;/* 0 - no event, 1 - event */

    /* flag which requests a previous TCA request to be cleared from the DE */
    u8 clear;/*0= Do not clear the TCA, 1=Clear the TCA */

    /* 32 bit value which represents the threshold to be used.*/
    u32 threshold;
} NanTCARequest;

/*
  Beacon Sdf Payload Structure
  The Discovery Engine can be configured to publish vendor specific attributes as part of
  beacon or service discovery frame transmitted as part of this request..
*/
typedef struct {
    /*
       NanVendorAttribute will have the Vendor Specific Attribute which the
       vendor wants to publish as part of Discovery or Sync or Service discovery frame
    */
    NanTransmitVendorSpecificAttribute vsa;
} NanBeaconSdfPayloadRequest;

/* Publish statistics. */
typedef struct
{
    u32 validPublishServiceReqMsgs;
    u32 validPublishServiceRspMsgs;
    u32 validPublishServiceCancelReqMsgs;
    u32 validPublishServiceCancelRspMsgs;
    u32 validPublishRepliedIndMsgs;
    u32 validPublishTerminatedIndMsgs;
    u32 validActiveSubscribes;
    u32 validMatches;
    u32 validFollowups;
    u32 invalidPublishServiceReqMsgs;
    u32 invalidPublishServiceCancelReqMsgs;
    u32 invalidActiveSubscribes;
    u32 invalidMatches;
    u32 invalidFollowups;
    u32 publishCount;
    u32 publishNewMatchCount;
    u32 pubsubGlobalNewMatchCount;
} NanPublishStats;

/* Subscribe statistics. */
typedef struct
{
    u32 validSubscribeServiceReqMsgs;
    u32 validSubscribeServiceRspMsgs;
    u32 validSubscribeServiceCancelReqMsgs;
    u32 validSubscribeServiceCancelRspMsgs;
    u32 validSubscribeTerminatedIndMsgs;
    u32 validSubscribeMatchIndMsgs;
    u32 validSubscribeUnmatchIndMsgs;
    u32 validSolicitedPublishes;
    u32 validMatches;
    u32 validFollowups;
    u32 invalidSubscribeServiceReqMsgs;
    u32 invalidSubscribeServiceCancelReqMsgs;
    u32 invalidSubscribeFollowupReqMsgs;
    u32 invalidSolicitedPublishes;
    u32 invalidMatches;
    u32 invalidFollowups;
    u32 subscribeCount;
    u32 bloomFilterIndex;
    u32 subscribeNewMatchCount;
    u32 pubsubGlobalNewMatchCount;
} NanSubscribeStats;

/* NAN DW Statistics*/
typedef struct
{
    /* RX stats */
    u32 validFrames;
    u32 validActionFrames;
    u32 validBeaconFrames;
    u32 ignoredActionFrames;
    u32 ignoredBeaconFrames;
    u32 invalidFrames;
    u32 invalidActionFrames;
    u32 invalidBeaconFrames;
    u32 invalidMacHeaders;
    u32 invalidPafHeaders;
    u32 nonNanBeaconFrames;

    u32 earlyActionFrames;
    u32 inDwActionFrames;
    u32 lateActionFrames;

    /* TX stats */
    u32 framesQueued;
    u32 totalTRSpUpdates;
    u32 completeByTRSp;
    u32 completeByTp75DW;
    u32 completeByTendDW;
    u32 lateActionFramesTx;
} NanDWStats;

/* NAN MAC Statistics. */
typedef struct
{
    /* RX stats */
    u32 validFrames;
    u32 validActionFrames;
    u32 validBeaconFrames;
    u32 ignoredActionFrames;
    u32 ignoredBeaconFrames;
    u32 invalidFrames;
    u32 invalidActionFrames;
    u32 invalidBeaconFrames;
    u32 invalidMacHeaders;
    u32 invalidPafHeaders;
    u32 nonNanBeaconFrames;

    u32 earlyActionFrames;
    u32 inDwActionFrames;
    u32 lateActionFrames;

    /* TX stats */
    u32 framesQueued;
    u32 totalTRSpUpdates;
    u32 completeByTRSp;
    u32 completeByTp75DW;
    u32 completeByTendDW;
    u32 lateActionFramesTx;

    u32 twIncreases;
    u32 twDecreases;
    u32 twChanges;
    u32 twHighwater;
    u32 bloomFilterIndex;
} NanMacStats;

/* NAN Sync Statistics*/
typedef struct
{
    u64 currTsf;
    u64 myRank;
    u64 currAmRank;
    u64 lastAmRank;
    u32 currAmBTT;
    u32 lastAmBTT;
    u8  currAmHopCount;
    u8  currRole;
    u16 currClusterId;

    u64 timeSpentInCurrRole;
    u64 totalTimeSpentAsMaster;
    u64 totalTimeSpentAsNonMasterSync;
    u64 totalTimeSpentAsNonMasterNonSync;
    u32 transitionsToAnchorMaster;
    u32 transitionsToMaster;
    u32 transitionsToNonMasterSync;
    u32 transitionsToNonMasterNonSync;
    u32 amrUpdateCount;
    u32 amrUpdateRankChangedCount;
    u32 amrUpdateBTTChangedCount;
    u32 amrUpdateHcChangedCount;
    u32 amrUpdateNewDeviceCount;
    u32 amrExpireCount;
    u32 mergeCount;
    u32 beaconsAboveHcLimit;
    u32 beaconsBelowRssiThresh;
    u32 beaconsIgnoredNoSpace;
    u32 beaconsForOurCluster;
    u32 beaconsForOtherCluster;
    u32 beaconCancelRequests;
    u32 beaconCancelFailures;
    u32 beaconUpdateRequests;
    u32 beaconUpdateFailures;
    u32 syncBeaconTxAttempts;
    u32 syncBeaconTxFailures;
    u32 discBeaconTxAttempts;
    u32 discBeaconTxFailures;
    u32 amHopCountExpireCount;
    u32 ndpChannelFreq;
    u32 ndpChannelFreq2;
    u32 schedUpdateChannelFreq;
} NanSyncStats;

/* NAN Misc DE Statistics */
typedef struct
{
    u32 validErrorRspMsgs;
    u32 validTransmitFollowupReqMsgs;
    u32 validTransmitFollowupRspMsgs;
    u32 validFollowupIndMsgs;
    u32 validConfigurationReqMsgs;
    u32 validConfigurationRspMsgs;
    u32 validStatsReqMsgs;
    u32 validStatsRspMsgs;
    u32 validEnableReqMsgs;
    u32 validEnableRspMsgs;
    u32 validDisableReqMsgs;
    u32 validDisableRspMsgs;
    u32 validDisableIndMsgs;
    u32 validEventIndMsgs;
    u32 validTcaReqMsgs;
    u32 validTcaRspMsgs;
    u32 validTcaIndMsgs;
    u32 invalidTransmitFollowupReqMsgs;
    u32 invalidConfigurationReqMsgs;
    u32 invalidStatsReqMsgs;
    u32 invalidEnableReqMsgs;
    u32 invalidDisableReqMsgs;
    u32 invalidTcaReqMsgs;
} NanDeStats;

/* Publish Response Message structure */
typedef struct {
    u16 publish_id;
} NanPublishResponse;

/* Subscribe Response Message structure */
typedef struct {
    u16 subscribe_id;
} NanSubscribeResponse;

/*
  Stats Response Message structure
  The Discovery Engine response to a request by the Host for statistics.
*/
typedef struct {
    NanStatsType stats_type;
    union {
        NanPublishStats publish_stats;
        NanSubscribeStats subscribe_stats;
        NanMacStats mac_stats;
        NanSyncStats sync_stats;
        NanDeStats de_stats;
        NanDWStats dw_stats;
    } data;
} NanStatsResponse;

/* Response returned for Initiators Data request */
typedef struct {
    /*
      Unique token Id generated on the initiator
      side used for a NDP session between two NAN devices
    */
    NanDataPathId ndp_instance_id;
} NanDataPathRequestResponse;

/* Response returned for Initiators pairing request */
typedef struct {
    /*
      Unique token Id generated on the initiator
      side used for a pairing session between two NAN devices
    */
    u32 paring_instance_id;
} NanPairingRequestResponse;

/* Response returned for Initiators bootstrapping request */
typedef struct {
    /*
      Unique token Id generated on the initiator
      side used for a bootstrapping session between two NAN devices
    */
    u32 bootstrapping_instance_id;
} NanBootstrappingRequestResponse;

/*
  NAN Response messages
*/
typedef struct {
    NanStatusType status; /* contains the result code */
    char nan_error[NAN_ERROR_STR_LEN]; /* Describe the NAN error type */
    NanResponseType response_type; /* NanResponseType Definitions */
    union {
        NanPublishResponse publish_response;
        NanSubscribeResponse subscribe_response;
        NanStatsResponse stats_response;
        NanDataPathRequestResponse data_request_response;
        NanCapabilities nan_capabilities;
        NanPairingRequestResponse pairing_request_response;
        NanBootstrappingRequestResponse bootstrapping_request_response;
    } body;
} NanResponseMsg;

/*
  Publish Replied Indication
  The PublishRepliedInd Message is sent by the DE when an Active Subscribe is
  received over the air and it matches a Solicited PublishServiceReq which had
  been created with the replied_event_flag set.
*/
typedef struct {
    /*
       A 32 bit Requestor Instance Id which is sent to the Application.
       This Id will be sent in any subsequent UnmatchInd/FollowupInd
       messages
    */
    u32 requestor_instance_id;
    u8 addr[NAN_MAC_ADDR_LEN];
    /*
       If RSSI filtering was configured in NanPublishRequest then this
       field will contain the received RSSI value. 0 if not
    */
    u8 rssi_value;
} NanPublishRepliedInd;

/*
  Publish Terminated
  The PublishTerminatedInd message is sent by the DE whenever a Publish
  terminates from a user-specified timeout or a unrecoverable error in the DE.
*/
typedef struct {
    /* Id returned during the initial Publish */
    u16 publish_id;
    /*
      For all user configured termination NAN_STATUS_SUCCESS
      and no other reasons expected from firmware.
    */
    NanStatusType reason;
    char nan_reason[NAN_ERROR_STR_LEN]; /* Describe the NAN reason type */
} NanPublishTerminatedInd;

/* The NIRA used to identify the pairing devices*/
typedef struct {
    u8 nonce[NAN_IDENTITY_NONCE_LEN];
    u8 tag[NAN_IDENTITY_TAG_LEN];
} NanIdentityResolutionAttribute;

/*
  Match Indication
  The MatchInd message is sent once per responding MAC address whenever
  the Discovery Engine detects a match for a previous SubscribeServiceReq
  or PublishServiceReq.
*/
typedef struct {
    /* Publish or Subscribe Id of an earlier Publish/Subscribe */
    u16 publish_subscribe_id;
    /*
       A 32 bit Requestor Instance Id which is sent to the Application.
       This Id will be sent in any subsequent UnmatchInd/FollowupInd
       messages
    */
    u32 requestor_instance_id;
    u8 addr[NAN_MAC_ADDR_LEN];

    /*
       Sequence of octets which were received in a Discovery Frame matching the
       Subscribe Request.
    */
    u16 service_specific_info_len;
    u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN];

    /*
       Ordered sequence of <length, value> pairs received in the Discovery Frame
       matching the Subscribe Request.
    */
    u16 sdf_match_filter_len;
    u8 sdf_match_filter[NAN_MAX_MATCH_FILTER_LEN];

    /*
       flag to indicate if the Match occurred in a Beacon Frame or in a
       Service Discovery Frame.
         0 - Match occured in a Service Discovery Frame
         1 - Match occured in a Beacon Frame
    */
    u8 match_occured_flag;

    /*
       flag to indicate FW is out of resource and that it can no longer
       track this Service Name. The Host still need to send the received
       Match_Handle but duplicate MatchInd messages may be received on
       this Handle until the resource frees up.
         0 - FW is caching this match
         1 - FW is unable to cache this match
    */
    u8 out_of_resource_flag;

    /*
       If RSSI filtering was configured in NanSubscribeRequest then this
       field will contain the received RSSI value. 0 if not.
       All rssi values should be specified without sign.
       For eg: -70dBm should be specified as 70.
    */
    u8 rssi_value;

    /*
       optional attributes. Each optional attribute is associated with a flag
       which specifies whether the attribute is valid or not
    */
    /* NAN Post Connectivity Capability received */
    u8 is_conn_capability_valid;
    NanReceivePostConnectivityCapability conn_capability;

    /* NAN Post Discover Capability */
    u8 num_rx_discovery_attr;
    NanReceivePostDiscovery discovery_attr[NAN_MAX_POSTDISCOVERY_LEN];

    /* NAN Further availability Map */
    u8 num_chans;
    NanFurtherAvailabilityChannel famchan[NAN_MAX_FAM_CHANNELS];

    /* NAN Cluster Attribute */
    u8 cluster_attribute_len;
    u8 cluster_attribute[NAN_MAX_CLUSTER_ATTRIBUTE_LEN];

    /* NAN Cipher Suite */
    u32 peer_cipher_type;

    /* Security Context Identifiers length */
    u32 scid_len;
    /*
       Security Context Identifier attribute contains PMKID
       shall be included in NDP setup and response messages.
       Security Context Identifier, Identifies the Security
       Context. For NAN Shared Key Cipher Suite, this field
       contains the 16 octet PMKID identifying the PMK used
       for setting up the Secure Data Path.
    */
    u8 scid[NAN_MAX_SCID_BUF_LEN];

    /* Peer service discovery extended attributes */
    NanSdeaCtrlParams peer_sdea_params;

    /*
      Ranging indication and NanMatchAlg are not tied.
      Ex: NanMatchAlg can indicate Match_ONCE, but ranging
      indications can be continuous. All ranging indications
      depend on SDEA control parameters of ranging required for
      continuous, and ingress/egress values in the ranging config.
      Ranging indication data is notified if:
      1) Ranging required is enabled in SDEA.
         range info notified continuous.
      2) if range_limit ingress/egress MASKS are enabled
         notify once for ingress >= ingress_distance
         and egress <= egress_distance, same for ingress_egress_both
      3) if the Awake DW intervals are higher than the ranging intervals,
         priority is given to the device DW intervalsi.
    */
    /*
      Range Info includes:
      1) distance to the NAN device with the MAC address indicated
         with ranged mac address.
      2) Ranging event matching the configuration of continuous/ingress/egress.
    */
    NanRangeInfo range_info;

    /*
       Sequence of values indicating the service specific info in SDEA
    */
    u16 sdea_service_specific_info_len;
    u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN];

    /*
      The config for Nan pairing set by the peer
    */
    NanPairingConfig peer_pairing_config;

    /*
      The NIRA from peer for Nan pairing verification
    */
    NanIdentityResolutionAttribute nira;
} NanMatchInd;

/*
  MatchExpired Indication
  The MatchExpiredInd message is sent whenever the Discovery Engine detects that
  a previously Matched Service has been gone for too long. If the previous
  MatchInd message for this Publish/Subscribe Id had the out_of_resource_flag
  set then this message will not be received
*/
typedef struct {
    /* Publish or Subscribe Id of an earlier Publish/Subscribe */
    u16 publish_subscribe_id;
    /*
       32 bit value sent by the DE in a previous
       MatchInd/FollowupInd to the application.
    */
    u32 requestor_instance_id;
} NanMatchExpiredInd;

/*
  Subscribe Terminated
  The SubscribeTerminatedInd message is sent by the DE whenever a
  Subscribe terminates from a user-specified timeout or a unrecoverable error in the DE.
*/
typedef struct {
    /* Id returned during initial Subscribe */
    u16 subscribe_id;
    /*
      For all user configured termination NAN_STATUS_SUCCESS
      and no other reasons expected from firmware.
    */
    NanStatusType reason;
    char nan_reason[NAN_ERROR_STR_LEN]; /* Describe the NAN reason type */
} NanSubscribeTerminatedInd;

/*
  Followup Indication Message
  The FollowupInd message is sent by the DE to the Host whenever it receives a
  Followup message from another peer.
*/
typedef struct {
    /* Publish or Subscribe Id of an earlier Publish/Subscribe */
    u16 publish_subscribe_id;
    /*
       A 32 bit Requestor instance Id which is sent to the Application.
       This Id will be used in subsequent UnmatchInd/FollowupInd messages.
    */
    u32 requestor_instance_id;
    u8 addr[NAN_MAC_ADDR_LEN];

    /* Flag which the DE uses to decide if received in a DW or a FAW*/
    u8 dw_or_faw; /* 0=Received  in a DW, 1 = Received in a FAW*/

    /*
       Sequence of values which further specify the published service beyond
       the service name
    */
    u16 service_specific_info_len;
    u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN];

    /*
       Sequence of values indicating the service specific info in SDEA
    */
    u16 sdea_service_specific_info_len;
    u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN];
} NanFollowupInd;

/*
   Event data notifying the Mac address of the Discovery engine.
   which is reported as one of the Discovery engine event
*/
typedef struct {
    u8 addr[NAN_MAC_ADDR_LEN];
} NanMacAddressEvent;

/*
   Event data notifying the Cluster address of the cluster
   which is reported as one of the Discovery engine event
*/
typedef struct {
    u8 addr[NAN_MAC_ADDR_LEN];
} NanClusterEvent;

/*
  Discovery Engine Event Indication
  The Discovery Engine can inform the Host when significant events occur
  The data following the EventId is dependent upon the EventId type.
  In other words, each new event defined will carry a different
  structure of information back to the host.
*/
typedef struct {
    NanDiscEngEventType event_type; /* NAN Protocol Event Codes */
    union {
        /*
           MacAddressEvent which will have 6 byte mac address
           of the Discovery engine.
        */
        NanMacAddressEvent mac_addr;
        /*
           Cluster Event Data which will be obtained when the
           device starts a new cluster or joins a cluster.
           The event data will have 6 byte octet string of the
           cluster started or joined.
        */
        NanClusterEvent cluster;
    } data;
} NanDiscEngEventInd;

/* Cluster size TCA event*/
typedef struct {
    /* size of the cluster*/
    u32 cluster_size;
} NanTcaClusterEvent;

/*
  NAN TCA Indication
  The Discovery Engine can inform the Host when significant events occur.
  The data following the TcaId is dependent upon the TcaId type.
  In other words, each new event defined will carry a different structure
  of information back to the host.
*/
typedef struct {
    NanTcaType tca_type;
    /* flag which defines if the configured Threshold has risen above the threshold */
    u8 rising_direction_evt_flag; /* 0 - no event, 1 - event */

    /* flag which defines if the configured Threshold has fallen below the threshold */
    u8 falling_direction_evt_flag;/* 0 - no event, 1 - event */
    union {
        /*
           This event in obtained when the cluser size threshold
           is crossed. Event will have the cluster size
        */
        NanTcaClusterEvent cluster;
    } data;
} NanTCAInd;

/*
  NAN Disabled Indication
  The NanDisableInd message indicates to the upper layers that the Discovery
  Engine has flushed all state and has been shutdown.  When this message is received
  the DE is guaranteed to have left the NAN cluster it was part of and will have terminated
  any in progress Publishes or Subscribes.
*/
typedef struct {
    /*
      Following reasons expected:
      NAN_STATUS_SUCCESS
      NAN_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED
    */
    NanStatusType reason;
    char nan_reason[NAN_ERROR_STR_LEN]; /* Describe the NAN reason type */
} NanDisabledInd;

/*
  NAN Beacon or SDF Payload Indication
  The NanBeaconSdfPayloadInd message indicates to the upper layers that information
  elements were received either in a Beacon or SDF which needs to be delivered
  outside of a Publish/Subscribe Handle.
*/
typedef struct {
    /* The MAC address of the peer which sent the attributes.*/
    u8 addr[NAN_MAC_ADDR_LEN];
    /*
       Optional attributes. Each optional attribute is associated with a flag
       which specifies whether the attribute is valid or not
    */
    /* NAN Receive Vendor Specific Attribute*/
    u8 is_vsa_received;
    NanReceiveVendorSpecificAttribute vsa;

    /* NAN Beacon or SDF Payload Received*/
    u8 is_beacon_sdf_payload_received;
    NanBeaconSdfPayloadReceive data;
} NanBeaconSdfPayloadInd;

/*
  Event Indication notifying the
  transmit followup in progress
*/
typedef struct {
   transaction_id id;
   /*
     Following reason codes returned:
     NAN_STATUS_SUCCESS
     NAN_STATUS_NO_OTA_ACK
     NAN_STATUS_PROTOCOL_FAILURE
   */
   NanStatusType reason;
   char nan_reason[NAN_ERROR_STR_LEN]; /* Describe the NAN reason type */
} NanTransmitFollowupInd;

/*
  Data request Initiator/Responder
  app/service related info
*/
typedef struct {
    u16 ndp_app_info_len;
    u8 ndp_app_info[NAN_DP_MAX_APP_INFO_LEN];
} NanDataPathAppInfo;

/* QoS configuration */
typedef enum {
    NAN_DP_CONFIG_NO_QOS = 0,
    NAN_DP_CONFIG_QOS
} NanDataPathQosCfg;

/* Configuration params of Data request Initiator/Responder */
typedef struct {
    /* Status Indicating Security/No Security */
    NanDataPathSecurityCfgStatus security_cfg;
    NanDataPathQosCfg qos_cfg;
} NanDataPathCfg;

/* Nan Data Path Initiator requesting a data session */
typedef struct {
    /*
     Unique Instance Id identifying the Responder's service.
     This is same as publish_id notified on the subscribe side
     in a publish/subscribe scenario
    */
    u32 requestor_instance_id; /* Value 0 for no publish/subscribe */

    /* Config flag for channel request */
    NanDataPathChannelCfg channel_request_type;
    /* Channel frequency in MHz to start data-path */
    wifi_channel channel;
    /*
      Discovery MAC addr of the publisher/peer
    */
    u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN];
    /*
     Interface name on which this NDP session is to be started.
     This will be the same interface name provided during interface
     create.
    */
    char ndp_iface[IFNAMSIZ+1];
    /* Initiator/Responder Security/QoS configuration */
    NanDataPathCfg ndp_cfg;
    /* App/Service information of the Initiator */
    NanDataPathAppInfo app_info;
    /* NAN Cipher Suite Type */
    u32 cipher_type;
    /*
       Nan Security Key Info is optional in Discovery phase.
       PMK or passphrase info can be passed during
       the NDP session.
    */
    NanSecurityKeyInfo key_info;
    /* length of service name */
    u32 service_name_len;
    /*
       UTF-8 encoded string identifying the service name.
       The service name field is only used if a Nan discovery
       is not associated with the NDP (out-of-band discovery).
    */
    u8 service_name[NAN_MAX_SERVICE_NAME_LEN];

    /* Security Context Identifiers length */
    u32 scid_len;
    /*
       Security Context Identifier attribute contains PMKID
       shall be included in NDP setup and response messages.
       Security Context Identifier, Identifies the Security
       Context. For NAN Shared Key Cipher Suite, this field
       contains the 16 octet PMKID identifying the PMK used
       for setting up the Secure Data Path.
    */
    u8 scid[NAN_MAX_SCID_BUF_LEN];

    /* Publish or Subscribe Id of an earlier Publish/Subscribe */
    u16 publish_subscribe_id;

    /* configure CSIA (Cipher Suite Information attribute) capability to specify GTK, IGTK, BIGTK
       are supported or not
    */
    u8 csia_capabilities;

    /* configure GTK(Group Transient Key) protection required or not */
    u8 gtk_protection;

} NanDataPathInitiatorRequest;

/*
  Data struct to initiate a data response on the responder side
  for an indication received with a data request
*/
typedef struct {
    /*
      Unique token Id generated on the initiator/responder
      side used for a NDP session between two NAN devices
    */
    NanDataPathId ndp_instance_id;
    /*
     Interface name on which this NDP session is to be started.
     This will be the same interface name provided during interface
     create.
    */
    char ndp_iface[IFNAMSIZ+1];
    /* Initiator/Responder Security/QoS configuration */
    NanDataPathCfg ndp_cfg;
    /* App/Service information of the responder */
    NanDataPathAppInfo app_info;
    /* Response Code indicating ACCEPT/REJECT/DEFER */
    NanDataPathResponseCode rsp_code;
    /* NAN Cipher Suite Type */
    u32 cipher_type;
    /*
       Nan Security Key Info is optional in Discovery phase.
       PMK or passphrase info can be passed during
       the NDP session.
    */
    NanSecurityKeyInfo key_info;
    /* length of service name */
    u32 service_name_len;
    /*
       UTF-8 encoded string identifying the service name.
       The service name field is only used if a Nan discovery
       is not associated with the NDP (out-of-band discovery).
    */
    u8 service_name[NAN_MAX_SERVICE_NAME_LEN];

    /* Security Context Identifiers length */
    u32 scid_len;
    /*
       Security Context Identifier attribute contains PMKID
       shall be included in NDP setup and response messages.
       Security Context Identifier, Identifies the Security
       Context. For NAN Shared Key Cipher Suite, this field
       contains the 16 octet PMKID identifying the PMK used
       for setting up the Secure Data Path.
    */
    u8 scid[NAN_MAX_SCID_BUF_LEN];

    /* Publish or Subscribe Id of an earlier Publish/Subscribe */
    u16 publish_subscribe_id;

    /*
      Discovery MAC addr of the publisher/peer
    */
    u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN];

    /* configure CSIA (Cipher Suite Information attribute) capability to specify GTK, IGTK, BIGTK
       are supported or not
    */
    u8 csia_capabilities;

    /* configure GTK(Group Transient Key) protection required or not */
    u8 gtk_protection;
} NanDataPathIndicationResponse;

/* Sub slot parameters */
typedef struct {
    u8 entry_control;
    u16 time_bitmap_control;
    u32 time_bitmap;
} NanS3Params;

/* NDP termination info */
typedef struct {
    u8 num_ndp_instances;
    /*
      Unique token Id generated on the initiator/responder side
      used for a NDP session between two NAN devices
    */
    NanDataPathId ndp_instance_id[];
} NanDataPathEndRequest;

/*
  Event indication received on the
  responder side when a Nan Data request or
  NDP session is initiated on the Initiator side
*/
typedef struct {
    /*
      Unique Instance Id corresponding to a service/session.
      This is similar to the publish_id generated on the
      publisher side
    */
    u16 service_instance_id;
    /* Discovery MAC addr of the peer/initiator */
    u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN];
    /*
      Unique token Id generated on the initiator/responder side
      used for a NDP session between two NAN devices
    */
    NanDataPathId ndp_instance_id;
    /* Initiator/Responder Security/QoS configuration */
    NanDataPathCfg ndp_cfg;
    /* App/Service information of the initiator */
    NanDataPathAppInfo app_info;

    /* Security Context Identifiers length */
    u32 scid_len;
    /*
       Security Context Identifier attribute contains PMKID
       shall be included in NDP setup and response messages.
       Security Context Identifier, Identifies the Security
       Context. For NAN Shared Key Cipher Suite, this field
       contains the 16 octet PMKID identifying the PMK used
       for setting up the Secure Data Path.
    */
    u8 scid[NAN_MAX_SCID_BUF_LEN];

    /* configure CSIA (Cipher Suite Information attribute) capability to specify GTK, IGTK, BIGTK
       are supported or not
    */
    u8 csia_capabilities;

    /* configure GTK(Group Transient Key) protection required or not */
    u8 gtk_protection;
} NanDataPathRequestInd;

/*
 Event indication of data confirm is received on both
 initiator and responder side confirming a NDP session
*/
typedef struct {
    /*
      Unique token Id generated on the initiator/responder side
      used for a NDP session between two NAN devices
    */
    NanDataPathId ndp_instance_id;
    /*
      NDI mac address of the peer
      (required to derive target ipv6 address)
    */
    u8 peer_ndi_mac_addr[NAN_MAC_ADDR_LEN];
    /* App/Service information of Initiator/Responder */
    NanDataPathAppInfo app_info;
    /* Response code indicating ACCEPT/REJECT/DEFER */
    NanDataPathResponseCode rsp_code;
    /*
      Reason code indicating the cause for REJECT.
      NAN_STATUS_SUCCESS and NAN_STATUS_PROTOCOL_FAILURE are
      expected reason codes.
    */
    NanStatusType reason_code;
    /* Number of channels for which info is indicated */
    u32 num_channels;
    /*
      Data indicating the Channel list and BW of the channel.
    */
    NanChannelInfo channel_info[NAN_MAX_CHANNEL_INFO_SUPPORTED];
} NanDataPathConfirmInd;

/*
 Event indication of schedule update is received on both
 initiator and responder when a schedule change occurs
*/
typedef struct {
    /*
      NMI mac address
    */
    u8 peer_mac_addr[NAN_MAC_ADDR_LEN];
    /*
      Reason code indicating the cause of schedule update.
      BIT_0 NSS Update
      BIT_1 Channel list update
    */
    u32 schedule_update_reason_code;
    /* Number of channels for which info is indicated */
    u32 num_channels;
    /*
      Data indicating the Channel list and BW of the channel.
    */
    NanChannelInfo channel_info[NAN_MAX_CHANNEL_INFO_SUPPORTED];
    /* Number of NDP instance Ids */
    u8 num_ndp_instances;
    /*
      Unique token Id generated on the initiator/responder side
      used for a NDP session between two NAN devices
    */
    NanDataPathId ndp_instance_id[];
} NanDataPathScheduleUpdateInd;

/*
  Event indication received on the
  initiator/responder side terminating
  a NDP session
*/
typedef struct {
    u8 num_ndp_instances;
    /*
      Unique token Id generated on the initiator/responder side
      used for a NDP session between two NAN devices
    */
    NanDataPathId ndp_instance_id[];
} NanDataPathEndInd;

/*
  Event indicating Range Request received on the
  Published side.
*/
typedef struct {
    u16 publish_id;/* id is existing publish */
    /* Range Requestor's MAC address */
    u8 range_req_intf_addr[NAN_MAC_ADDR_LEN];
} NanRangeRequestInd;

/*
  Event indicating Range report on the
  Published side.
*/
typedef struct {
    u16 publish_id;/* id is existing publish */
    /* Range Requestor's MAC address */
    u8 range_req_intf_addr[NAN_MAC_ADDR_LEN];
    /*
       Distance to the NAN device with the MAC address indicated
       with ranged mac address.
    */
    u32 range_measurement_mm;
} NanRangeReportInd;

/*
  NAN pairing initator request
*/
typedef struct {
    /*
       This Id is the Requestor Instance that is passed as
       part of earlier MatchInd/FollowupInd message.
    */
    u32 requestor_instance_id;

    /*
      Discovery MAC addr of the publisher/peer
    */
    u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN];

    /*
      Indicate the pairing session is of setup or verification
    */
    NanPairingRequestType nan_pairing_request_type;

    /*
      whether the pairing is opportunistic or password
    */
    u8 is_opportunistic;

    /*
      Security key info used for the pairing setup or verification
    */
    NanSecurityKeyInfo key_info;
    /*
      AKM used for the pairing verification
    */
    NanAkm akm;

    /*
      Whether should cache the negotiated NIK/NPK for future verification
    */
    u8 enable_pairing_cache;

    /*
      The Identity key for pairing, can be used for pairing verification
    */
    u8 nan_identity_key[NAN_IDENTITY_KEY_LEN];

    /*
      NAN Cipher Suite Type
    */
    u32 cipher_type;

} NanPairingRequest;

/*
  Data struct to initiate a pairing response on the responder side for an indication received with a
  pairing request
*/
typedef struct {

    /*
      Unique token Id generated on the initiator/responder side
      used for a pairing session between two NAN devices
    */
    u32 pairing_instance_id;

    /*
      Indicate the pairing session is setup or verification
    */
    NanPairingRequestType nan_pairing_request_type;

    /* Response Code indicating ACCEPT/REJECT */
    NanPairingResponseCode rsp_code;

    /*
      whether the pairing is opportunistic or password
    */
    u8 is_opportunistic;

    /*
      Security key info used for the pairing setup or verification
    */
    NanSecurityKeyInfo key_info;

    /*
      AKM used for the pairing verification
    */
    NanAkm akm;

    /*
      Whether should cache the negotiated NIK/NPK for future verification
    */
    u8 enable_pairing_cache;

    /*
      The Identity key for pairing, can be used for pairing verification
    */
    u8 nan_identity_key[NAN_IDENTITY_KEY_LEN];

    /*
      NAN Cipher Suite Type
    */
    u32 cipher_type;
} NanPairingIndicationResponse;

typedef struct {
    /*
      Unique token Id generated on the initiator/responder side
      used for a pairing session between two NAN devices
    */
    u32 pairing_instance_id;
} NanPairingEndRequest;

/*
  Event indication received on the responder side when a Nan pairing session is initiated on the
  Initiator side
*/
typedef struct {
    /* Publish instance id generated on Publisher side corresponding to a session */
    u16 publish_subscribe_id;
    /*
      This Id is the Requestor Instance that is passed as
      part of earlier MatchInd/FollowupInd message.
    */
    u32 requestor_instance_id;
    /*
      Unique Instance Id corresponding to a service/session.
      This is similar to the publish_id generated on the
      publisher side
    */
    u32 pairing_instance_id;
    /* Discovery MAC addr of the peer/initiator */
    u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN];
    /* Indicate the pairing session is setup or verification */
    NanPairingRequestType nan_pairing_request_type;
    /* Whether should cache the negotiated NIK/NPK for future verification */
    u8 enable_pairing_cache;
    /* The NIRA from peer for Nan pairing verification */
    NanIdentityResolutionAttribute nira;
} NanPairingRequestInd;

/*
  The security info negotiate after the pairing setup for caching
*/
typedef struct {
    /* The inentity key of peer device*/
    u8 peer_nan_identity_key[NAN_IDENTITY_KEY_LEN];
    /* The inentity key of local device*/
    u8 local_nan_identity_key[NAN_IDENTITY_KEY_LEN];
    /* The PMK excahnge between two devices*/
    NanSecurityPmk npk;
    /* The AKM used during the key exchange*/
    NanAkm akm;
    /* NAN Cipher Suite Type */
    u32 cipher_type;
} NpkSecurityAssociation;

/*
 Event indication of pairing confirm is received on both
 initiator and responder side confirming a pairing session
*/
typedef struct {
    /*
      Unique token Id generated on the initiator/responder side
      used for a pairing session between two NAN devices
    */
    u32 pairing_instance_id;
    /* Response code indicating ACCEPT/REJECT */
    NanPairingResponseCode rsp_code;
    /*
      Reason code indicating the cause for REJECT.
      NAN_STATUS_SUCCESS and NAN_STATUS_PROTOCOL_FAILURE are
      expected reason codes.
    */
    NanStatusType reason_code;
    /*
      Indicate the pairing session is setup or verification
    */
    NanPairingRequestType nan_pairing_request_type;
    /* Whether should cache the negotiated NIK/NPK for future verification */
    u8 enable_pairing_cache;
    /*
      The security association info negotiated in the pairing setup, used for future verification
    */
    NpkSecurityAssociation npk_security_association;
} NanPairingConfirmInd;

/*
  NAN pairing bootstrapping initiator request
*/
typedef struct {
    /* Publish or Subscribe Id of local Publish/Subscribe */
    u16 publish_subscribe_id;

    /*
       This Id is the Requestor Instance that is passed as
       part of earlier MatchInd/FollowupInd message.
    */
    u32 requestor_instance_id;

    /*
      Discovery MAC addr of the publisher/peer
    */
    u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN];

    /* Proposed bootstrapping method */
    u16 request_bootstrapping_method;

    /*
       Sequence of values which further specify the published service beyond
       the service name.
    */
    u16 service_specific_info_len;
    u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN];

    /*
       Sequence of values indicating the service specific info in SDEA
       Used for service managed bootstrapping method
    */
    u16 sdea_service_specific_info_len;
    u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN];

    /* Indicates that this is comeback Bootstrapping request */
    u8 comeback;

    /* The length of cookie. */
    u32 cookie_length;

    /* Cookie for the follow up request */
    u8 cookie[];

} NanBootstrappingRequest;
/*
 NAN pairing bootstrapping response from responder to a initate request
*/
typedef struct {
    /* Publish or Subscribe Id of local Publish/Subscribe */
    u16 publish_subscribe_id;

    /*
       This Id is the Peer Instance that is passed as
       part of earlier MatchInd/FollowupInd message.
    */
    u32 service_instance_id;

    /* Discovery MAC addr of the peer/initiator */
    u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN];

    /*
       Sequence of values which further specify the published service beyond
       the service name.
    */
    u16 service_specific_info_len;
    u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN];

    /*
       Sequence of values indicating the service specific info in SDEA
       Used for service managed bootstrapping method
    */
    u16 sdea_service_specific_info_len;
    u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN];

    /* Response Code indicating ACCEPT/REJECT */
    NanBootstrappingResponseCode rsp_code;

    /* The delay of bootstrapping in seconds */
    u32 come_back_delay;

    /* The length of cookie. */
    u32 cookie_length;

    /* Cookie for the follow up response */
    u8 cookie[];

} NanBootstrappingIndicationResponse;

/*
  Event indication received on the responder side when a Nan bootsrapping session is initiated on
  the Initiator side
*/
typedef struct {
    /* Publish or Subscribe Id of an earlier Publish/Subscribe */
    u16 publish_subscribe_id;
    /*
      Unique Instance Id corresponding to a service/session.
      This is similar to the publish_id generated on the
      publisher side
    */
    u32 bootstrapping_instance_id;
    /*
      This Id is the Requestor Instance that is passed as
      part of earlier MatchInd/FollowupInd message.
    */
    u32 requestor_instance_id;
    /* Discovery MAC addr of the peer/initiator */
    u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN];
    /* Proposed bootstrapping method from peer*/
    u16 request_bootstrapping_method;

} NanBootstrappingRequestInd;

/*
 Event indication of bootstapping confirm is received on both
 initiator side confirming a bootstrapping method
*/
typedef struct {
    /*
      Unique token Id generated on the initiator/responder side
      used for a bootstrapping session between two NAN devices
    */
    u32 bootstrapping_instance_id;
    /* Response Code indicating ACCEPT/REJECT */
    NanBootstrappingResponseCode rsp_code;
    /*
      Reason code indicating the cause for REJECT.
      NAN_STATUS_SUCCESS and NAN_STATUS_PROTOCOL_FAILURE are
      expected reason codes.
    */
    NanStatusType reason_code;
    /* The delay of bootstrapping in seconds */
    u32 come_back_delay;

    /* The length of cookie. */
    u32 cookie_length;

    /* Cookie received from the comeback response */
    u8 cookie[];

} NanBootstrappingConfirmInd;

/*
 Event indication the device enter or exist the suspension mode
*/
typedef struct {
    /* Indication the device is suspended or not */
    bool is_suspended;
} NanSuspensionModeChangeInd;

/* Response and Event Callbacks */
typedef struct {
    /* NotifyResponse invoked to notify the status of the Request */
    void (*NotifyResponse)(transaction_id id, NanResponseMsg* rsp_data);
    /* Callbacks for various Events */
    void (*EventPublishReplied)(NanPublishRepliedInd *event);
    void (*EventPublishTerminated)(NanPublishTerminatedInd* event);
    void (*EventMatch) (NanMatchInd* event);
    void (*EventMatchExpired) (NanMatchExpiredInd* event);
    void (*EventSubscribeTerminated) (NanSubscribeTerminatedInd* event);
    void (*EventFollowup) (NanFollowupInd* event);
    void (*EventDiscEngEvent) (NanDiscEngEventInd* event);
    void (*EventDisabled) (NanDisabledInd* event);
    void (*EventTca) (NanTCAInd* event);
    void (*EventBeaconSdfPayload) (NanBeaconSdfPayloadInd* event);
    void (*EventDataRequest)(NanDataPathRequestInd* event);
    void (*EventDataConfirm)(NanDataPathConfirmInd* event);
    void (*EventDataEnd)(NanDataPathEndInd* event);
    void (*EventTransmitFollowup) (NanTransmitFollowupInd* event);
    void (*EventRangeRequest) (NanRangeRequestInd* event);
    void (*EventRangeReport) (NanRangeReportInd* event);
    void (*EventScheduleUpdate) (NanDataPathScheduleUpdateInd* event);
    void (*EventPairingRequest) (NanPairingRequestInd* event);
    void (*EventPairingConfirm) (NanPairingConfirmInd* event);
    void (*EventBootstrappingRequest) (NanBootstrappingRequestInd* event);
    void (*EventBootstrappingConfirm) (NanBootstrappingConfirmInd* event);
    void (*EventSuspensionModeChange) (NanSuspensionModeChangeInd* event);
} NanCallbackHandler;

/**@brief nan_enable_request
 *        Enable NAN functionality
 *
 * @param transaction_id:
 * @param wifi_interface_handle:
 * @param NanEnableRequest:
 * @return Synchronous wifi_error
 * @return Asynchronous NotifyResponse CB return
 *                      NAN_STATUS_SUCCESS
 *                      NAN_STATUS_ALREADY_ENABLED
 *                      NAN_STATUS_INVALID_PARAM
 *                      NAN_STATUS_INTERNAL_FAILURE
 *                      NAN_STATUS_PROTOCOL_FAILURE
 *                      NAN_STATUS_NAN_NOT_ALLOWED
 */
wifi_error nan_enable_request(transaction_id id,
                              wifi_interface_handle iface,
                              NanEnableRequest* msg);

/**@brief nan_disbale_request
 *        Disable NAN functionality.
 *
 * @param transaction_id:
 * @param wifi_interface_handle:
 * @param NanDisableRequest:
 * @return Synchronous wifi_error
 * @return Asynchronous NotifyResponse CB return
 *                      NAN_STATUS_SUCCESS
 *                      NAN_STATUS_PROTOCOL_FAILURE
 *
 */
wifi_error nan_disable_request(transaction_id id,
                               wifi_interface_handle iface);

/**@brief nan_publish_request
 *        Publish request to advertize a service
 *
 * @param transaction_id:
 * @param wifi_interface_handle:
 * @param NanPublishRequest:
 * @return Synchronous wifi_error
 * @return Asynchronous NotifyResponse CB return
 *                      NAN_STATUS_SUCCESS
 *                      NAN_STATUS_INVALID_PARAM
 *                      NAN_STATUS_PROTOCOL_FAILURE
 *                      NAN_STATUS_NO_RESOURCE_AVAILABLE
 *                      NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID
 */
wifi_error nan_publish_request(transaction_id id,
                               wifi_interface_handle iface,
                               NanPublishRequest* msg);

/**@brief nan_publish_cancel_request
 *        Cancel previous publish request
 *
 * @param transaction_id:
 * @param wifi_interface_handle:
 * @param NanPublishCancelRequest:
 * @return Synchronous wifi_error
 * @return Asynchronous NotifyResponse CB return
 *                      NAN_STATUS_SUCCESS
 *                      NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID
 *                      NAN_STATUS_INTERNAL_FAILURE
 */
wifi_error nan_publish_cancel_request(transaction_id id,
                                      wifi_interface_handle iface,
                                      NanPublishCancelRequest* msg);

/**@brief nan_subscribe_request
 *        Subscribe request to search for a service
 *
 * @param transaction_id:
 * @param wifi_interface_handle:
 * @param NanSubscribeRequest:
 * @return Synchronous wifi_error
 * @return Asynchronous NotifyResponse CB return
 *                      NAN_STATUS_SUCCESS
 *                      NAN_STATUS_INVALID_PARAM
 *                      NAN_STATUS_PROTOCOL_FAILURE
 *                      NAN_STATUS_INTERNAL_FAILURE
 *                      NAN_STATUS_NO_SPACE_AVAILABLE
 *                      NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID
 */
wifi_error nan_subscribe_request(transaction_id id,
                                 wifi_interface_handle iface,
                                 NanSubscribeRequest* msg);

/**@brief nan_subscribe_cancel_request
 *         Cancel previous subscribe requests.
 *
 * @param transaction_id:
 * @param wifi_interface_handle:
 * @param NanSubscribeRequest:
 * @return Synchronous wifi_error
 * @return Asynchronous NotifyResponse CB return
 *                      NAN_STATUS_SUCCESS
 *                      NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID
 *                      NAN_STATUS_INTERNAL_FAILURE
 */
wifi_error nan_subscribe_cancel_request(transaction_id id,
                                        wifi_interface_handle iface,
                                        NanSubscribeCancelRequest* msg);

/**@brief nan_transmit_followup_request
 *         NAN transmit follow up request
 *
 * @param transaction_id:
 * @param wifi_interface_handle:
 * @param NanTransmitFollowupRequest:
 * @return Synchronous wifi_error
 * @return Asynchronous NotifyResponse CB return
 *                      NAN_STATUS_SUCCESS
 *                      NAN_STATUS_INVALID_PARAM
 *                      NAN_STATUS_INTERNAL_FAILURE
 *                      NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID
 *                      NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID
 *                      NAN_STATUS_FOLLOWUP_QUEUE_FULL
 * @return Asynchronous TransmitFollowupInd CB return
 *                      NAN_STATUS_SUCCESS
 *                      NAN_STATUS_PROTOCOL_FAILURE
 *                      NAN_STATUS_NO_OTA_ACK
 */
wifi_error nan_transmit_followup_request(transaction_id id,
                                         wifi_interface_handle iface,
                                         NanTransmitFollowupRequest* msg);

/**@brief nan_stats_request
 *        Request NAN statistics from Discovery Engine.
 *
 * @param transaction_id:
 * @param wifi_interface_handle:
 * @param NanStatsRequest:
 * @return Synchronous wifi_error
 * @return Asynchronous NotifyResponse CB return
 *                      NAN_STATUS_SUCCESS
 *                      NAN_STATUS_INTERNAL_FAILURE
 *                      NAN_STATUS_INVALID_PARAM
 */
wifi_error nan_stats_request(transaction_id id,
                             wifi_interface_handle iface,
                             NanStatsRequest* msg);

/**@brief nan_config_request
 *        NAN configuration request.
 *
 * @param transaction_id:
 * @param wifi_interface_handle:
 * @param NanConfigRequest:
 * @return Synchronous wifi_error
 * @return Asynchronous NotifyResponse CB return
 *                      NAN_STATUS_SUCCESS
 *                      NAN_STATUS_INVALID_PARAM
 *                      NAN_STATUS_PROTOCOL_FAILURE
 *                      NAN_STATUS_INTERNAL_FAILURE
 */
wifi_error nan_config_request(transaction_id id,
                              wifi_interface_handle iface,
                              NanConfigRequest* msg);

/**@brief nan_tca_request
 *        Configure the various Threshold crossing alerts
 *
 * @param transaction_id:
 * @param wifi_interface_handle:
 * @param NanStatsRequest:
 * @return Synchronous wifi_error
 * @return Asynchronous NotifyResponse CB return
 *                      NAN_STATUS_SUCCESS
 *                      NAN_STATUS_INVALID_PARAM
 *                      NAN_STATUS_INTERNAL_FAILURE
 */
wifi_error nan_tca_request(transaction_id id,
                           wifi_interface_handle iface,
                           NanTCARequest* msg);

/**@brief nan_beacon_sdf_payload_request
 *        Set NAN Beacon or sdf payload to discovery engine.
 *          This instructs the Discovery Engine to begin publishing the
 *        received payload in any Beacon or Service Discovery Frame transmitted
 *
 * @param transaction_id:
 * @param wifi_interface_handle:
 * @param NanStatsRequest:
 * @return Synchronous wifi_error
 * @return Asynchronous NotifyResponse CB return
 *                      NAN_STATUS_SUCCESS
 *                      NAN_STATUS_INVALID_PARAM
 *                      NAN_STATUS_INTERNAL_FAILURE
 */
wifi_error nan_beacon_sdf_payload_request(transaction_id id,
                                         wifi_interface_handle iface,
                                         NanBeaconSdfPayloadRequest* msg);

/* Register NAN callbacks. */
wifi_error nan_register_handler(wifi_interface_handle iface,
                                NanCallbackHandler handlers);

/*  Get NAN HAL version. */
wifi_error nan_get_version(wifi_handle handle,
                           NanVersion* version);

/**@brief nan_get_capabilities
 *        Get NAN Capabilities
 *
 * @param transaction_id:
 * @param wifi_interface_handle:
 * @return Synchronous wifi_error
 * @return Asynchronous NotifyResponse CB return
 *                      NAN_STATUS_SUCCESS
 */
/*  Get NAN capabilities. */
wifi_error nan_get_capabilities(transaction_id id,
                                wifi_interface_handle iface);

/* ========== Nan Data Path APIs ================ */
/**@brief nan_data_interface_create
 *        Create NAN Data Interface.
 *
 * @param transaction_id:
 * @param wifi_interface_handle:
 * @param iface_name:
 * @return Synchronous wifi_error
 * @return Asynchronous NotifyResponse CB return
 *                      NAN_STATUS_SUCCESS
 *                      NAN_STATUS_INVALID_PARAM
 *                      NAN_STATUS_INTERNAL_FAILURE
 */
wifi_error nan_data_interface_create(transaction_id id,
                                     wifi_interface_handle iface,
                                     char* iface_name);

/**@brief nan_data_interface_delete
 *        Delete NAN Data Interface.
 *
 * @param transaction_id:
 * @param wifi_interface_handle:
 * @param iface_name:
 * @return Synchronous wifi_error
 * @return Asynchronous NotifyResponse CB return
 *                      NAN_STATUS_SUCCESS
 *                      NAN_STATUS_INVALID_PARAM
 *                      NAN_STATUS_INTERNAL_FAILURE
 */
wifi_error nan_data_interface_delete(transaction_id id,
                                     wifi_interface_handle iface,
                                     char* iface_name);

/**@brief nan_data_request_initiator
 *        Initiate a NAN Data Path session.
 *
 * @param transaction_id:
 * @param wifi_interface_handle:
 * @param NanDataPathInitiatorRequest:
 * @return Synchronous wifi_error
 * @return Asynchronous NotifyResponse CB return
 *                      NAN_STATUS_SUCCESS
 *                      NAN_STATUS_INVALID_PARAM
 *                      NAN_STATUS_INTERNAL_FAILURE
 *                      NAN_STATUS_PROTOCOL_FAILURE
 *                      NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID
 */
wifi_error nan_data_request_initiator(transaction_id id,
                                      wifi_interface_handle iface,
                                      NanDataPathInitiatorRequest* msg);

/**@brief nan_data_indication_response
 *         Response to a data indication received
 *         corresponding to a NDP session. An indication
 *         is received with a data request and the responder
 *         will send a data response
 *
 * @param transaction_id:
 * @param wifi_interface_handle:
 * @param NanDataPathIndicationResponse:
 * @return Synchronous wifi_error
 * @return Asynchronous NotifyResponse CB return
 *                      NAN_STATUS_SUCCESS
 *                      NAN_STATUS_INVALID_PARAM
 *                      NAN_STATUS_INTERNAL_FAILURE
 *                      NAN_STATUS_PROTOCOL_FAILURE
 *                      NAN_STATUS_INVALID_NDP_ID
 */
wifi_error nan_data_indication_response(transaction_id id,
                                        wifi_interface_handle iface,
                                        NanDataPathIndicationResponse* msg);

/**@brief nan_data_end
 *         NDL termination request: from either Initiator/Responder
 *
 * @param transaction_id:
 * @param wifi_interface_handle:
 * @param NanDataPathEndRequest:
 * @return Synchronous wifi_error
 * @return Asynchronous NotifyResponse CB return
 *                      NAN_STATUS_SUCCESS
 *                      NAN_STATUS_INVALID_PARAM
 *                      NAN_STATUS_INTERNAL_FAILURE
 *                      NAN_STATUS_PROTOCOL_FAILURE
 *                      NAN_STATUS_INVALID_NDP_ID
 */
wifi_error nan_data_end(transaction_id id,
                        wifi_interface_handle iface,
                        NanDataPathEndRequest* msg);
/**@brief nan_pairing_request
 *        Initiate a NAN Pairingsession.
 *
 * @param transaction_id:
 * @param wifi_interface_handle:
 * @param NanPairingRequest:
 * @return Synchronous wifi_error
 * @return Asynchronous NotifyResponse CB return
 *                      NAN_STATUS_SUCCESS
 *                      NAN_STATUS_INVALID_PARAM
 *                      NAN_STATUS_INTERNAL_FAILURE
 *                      NAN_STATUS_PROTOCOL_FAILURE
 *                      NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID
 */
wifi_error nan_pairing_request(transaction_id id, wifi_interface_handle iface,
                               NanPairingRequest* msg);

/**@brief nan_pairing_indication_response
 *        Response to a pairing indication received
 *        corresponding to a pairing session. An indication
 *        is received with a pairing request and the responder
 *        will send a pairing response
 *
 * @param transaction_id:
 * @param wifi_interface_handle:
 * @param NanPairingIndicationResponse:
 * @return Synchronous wifi_error
 * @return Asynchronous NotifyResponse CB return
 *                      NAN_STATUS_SUCCESS
 *                      NAN_STATUS_INVALID_PARAM
 *                      NAN_STATUS_INTERNAL_FAILURE
 *                      NAN_STATUS_PROTOCOL_FAILURE
 *                      NAN_STATUS_INVALID_PAIRING_ID
 */
wifi_error nan_pairing_indication_response(transaction_id id, wifi_interface_handle iface,
                                           NanPairingIndicationResponse* msg);

/**@brief nan_pairing_end
 *        Cancel and remove the existing Pairing setups
 *
 * @param transaction_id:
 * @param wifi_interface_handle:
 * @param NanPairingEndRequest:
 * @return Synchronous wifi_error
 * @return Asynchronous NotifyResponse CB return
 *                      NAN_STATUS_SUCCESS
 *                      NAN_STATUS_INVALID_PARAM
 *                      NAN_STATUS_INTERNAL_FAILURE
 *                      NAN_STATUS_PROTOCOL_FAILURE
 *                      NAN_STATUS_INVALID_PAIRING_ID
 */
wifi_error nan_pairing_end(transaction_id id, wifi_interface_handle iface,
                                                 NanPairingEndRequest* msg);

/**@brief nan_bootstrapping_request
 *        Initiate a NAN Bootstrapping session.
 *
 * @param transaction_id:
 * @param wifi_interface_handle:
 * @param NanBootstrappingRequest:
 * @return Synchronous wifi_error
 * @return Asynchronous NotifyResponse CB return
 *                      NAN_STATUS_SUCCESS
 *                      NAN_STATUS_INVALID_PARAM
 *                      NAN_STATUS_INTERNAL_FAILURE
 *                      NAN_STATUS_PROTOCOL_FAILURE
 *                      NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID
 */
wifi_error nan_bootstrapping_request(transaction_id id, wifi_interface_handle iface,
                                     NanBootstrappingRequest* msg);

/**@brief nan_bootstrapping_indication_response
 *         Response to a pairing indication received
 *         corresponding to a pairing session. An indication
 *         is received with a pairing request and the responder
 *         will send a pairing response
 *
 * @param transaction_id:
 * @param wifi_interface_handle:
 * @param NanBootstrappingIndicationResponse:
 * @return Synchronous wifi_error
 * @return Asynchronous NotifyResponse CB return
 *                      NAN_STATUS_SUCCESS
 *                      NAN_STATUS_INVALID_PARAM
 *                      NAN_STATUS_INTERNAL_FAILURE
 *                      NAN_STATUS_PROTOCOL_FAILURE
 *                      NAN_STATUS_INVALID_BOOTSTRAPPING_ID
 */
wifi_error nan_bootstrapping_indication_response(transaction_id id, wifi_interface_handle iface,
                                                 NanBootstrappingIndicationResponse* msg);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* __NAN_H__ */