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
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
|
/*
* Driver interface definition
* Copyright (c) 2003-2012, Jouni Malinen <j@w1.fi>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
*
* This file defines a driver interface used by both %wpa_supplicant and
* hostapd. The first part of the file defines data structures used in various
* driver operations. This is followed by the struct wpa_driver_ops that each
* driver wrapper will beed to define with callback functions for requesting
* driver operations. After this, there are definitions for driver event
* reporting with wpa_supplicant_event() and some convenience helper functions
* that can be used to report events.
*/
#ifndef DRIVER_H
#define DRIVER_H
#define WPA_SUPPLICANT_DRIVER_VERSION 4
#include "common/defs.h"
#define HOSTAPD_CHAN_DISABLED 0x00000001
#define HOSTAPD_CHAN_PASSIVE_SCAN 0x00000002
#define HOSTAPD_CHAN_NO_IBSS 0x00000004
#define HOSTAPD_CHAN_RADAR 0x00000008
#define HOSTAPD_CHAN_HT40PLUS 0x00000010
#define HOSTAPD_CHAN_HT40MINUS 0x00000020
#define HOSTAPD_CHAN_HT40 0x00000040
/**
* struct hostapd_channel_data - Channel information
*/
struct hostapd_channel_data {
/**
* chan - Channel number (IEEE 802.11)
*/
short chan;
/**
* freq - Frequency in MHz
*/
short freq;
/**
* flag - Channel flags (HOSTAPD_CHAN_*)
*/
int flag;
/**
* max_tx_power - maximum transmit power in dBm
*/
u8 max_tx_power;
};
#define HOSTAPD_MODE_FLAG_HT_INFO_KNOWN BIT(0)
/**
* struct hostapd_hw_modes - Supported hardware mode information
*/
struct hostapd_hw_modes {
/**
* mode - Hardware mode
*/
enum hostapd_hw_mode mode;
/**
* num_channels - Number of entries in the channels array
*/
int num_channels;
/**
* channels - Array of supported channels
*/
struct hostapd_channel_data *channels;
/**
* num_rates - Number of entries in the rates array
*/
int num_rates;
/**
* rates - Array of supported rates in 100 kbps units
*/
int *rates;
/**
* ht_capab - HT (IEEE 802.11n) capabilities
*/
u16 ht_capab;
/**
* mcs_set - MCS (IEEE 802.11n) rate parameters
*/
u8 mcs_set[16];
/**
* a_mpdu_params - A-MPDU (IEEE 802.11n) parameters
*/
u8 a_mpdu_params;
/**
* vht_capab - VHT (IEEE 802.11ac) capabilities
*/
u32 vht_capab;
/**
* vht_mcs_set - VHT MCS (IEEE 802.11ac) rate parameters
*/
u8 vht_mcs_set[8];
unsigned int flags; /* HOSTAPD_MODE_FLAG_* */
};
#define IEEE80211_MODE_INFRA 0
#define IEEE80211_MODE_IBSS 1
#define IEEE80211_MODE_AP 2
#define IEEE80211_CAP_ESS 0x0001
#define IEEE80211_CAP_IBSS 0x0002
#define IEEE80211_CAP_PRIVACY 0x0010
#define WPA_SCAN_QUAL_INVALID BIT(0)
#define WPA_SCAN_NOISE_INVALID BIT(1)
#define WPA_SCAN_LEVEL_INVALID BIT(2)
#define WPA_SCAN_LEVEL_DBM BIT(3)
#define WPA_SCAN_AUTHENTICATED BIT(4)
#define WPA_SCAN_ASSOCIATED BIT(5)
/**
* struct wpa_scan_res - Scan result for an BSS/IBSS
* @flags: information flags about the BSS/IBSS (WPA_SCAN_*)
* @bssid: BSSID
* @freq: frequency of the channel in MHz (e.g., 2412 = channel 1)
* @beacon_int: beacon interval in TUs (host byte order)
* @caps: capability information field in host byte order
* @qual: signal quality
* @noise: noise level
* @level: signal level
* @tsf: Timestamp
* @age: Age of the information in milliseconds (i.e., how many milliseconds
* ago the last Beacon or Probe Response frame was received)
* @ie_len: length of the following IE field in octets
* @beacon_ie_len: length of the following Beacon IE field in octets
*
* This structure is used as a generic format for scan results from the
* driver. Each driver interface implementation is responsible for converting
* the driver or OS specific scan results into this format.
*
* If the driver does not support reporting all IEs, the IE data structure is
* constructed of the IEs that are available. This field will also need to
* include SSID in IE format. All drivers are encouraged to be extended to
* report all IEs to make it easier to support future additions.
*/
struct wpa_scan_res {
unsigned int flags;
u8 bssid[ETH_ALEN];
int freq;
u16 beacon_int;
u16 caps;
int qual;
int noise;
int level;
u64 tsf;
unsigned int age;
size_t ie_len;
size_t beacon_ie_len;
/*
* Followed by ie_len octets of IEs from Probe Response frame (or if
* the driver does not indicate source of IEs, these may also be from
* Beacon frame). After the first set of IEs, another set of IEs may
* follow (with beacon_ie_len octets of data) if the driver provides
* both IE sets.
*/
};
/**
* struct wpa_scan_results - Scan results
* @res: Array of pointers to allocated variable length scan result entries
* @num: Number of entries in the scan result array
*/
struct wpa_scan_results {
struct wpa_scan_res **res;
size_t num;
};
/**
* struct wpa_interface_info - Network interface information
* @next: Pointer to the next interface or NULL if this is the last one
* @ifname: Interface name that can be used with init() or init2()
* @desc: Human readable adapter description (e.g., vendor/model) or NULL if
* not available
* @drv_name: struct wpa_driver_ops::name (note: unlike other strings, this one
* is not an allocated copy, i.e., get_interfaces() caller will not free
* this)
*/
struct wpa_interface_info {
struct wpa_interface_info *next;
char *ifname;
char *desc;
const char *drv_name;
};
#define WPAS_MAX_SCAN_SSIDS 16
/**
* struct wpa_driver_scan_params - Scan parameters
* Data for struct wpa_driver_ops::scan2().
*/
struct wpa_driver_scan_params {
/**
* ssids - SSIDs to scan for
*/
struct wpa_driver_scan_ssid {
/**
* ssid - specific SSID to scan for (ProbeReq)
* %NULL or zero-length SSID is used to indicate active scan
* with wildcard SSID.
*/
const u8 *ssid;
/**
* ssid_len: Length of the SSID in octets
*/
size_t ssid_len;
} ssids[WPAS_MAX_SCAN_SSIDS];
/**
* num_ssids - Number of entries in ssids array
* Zero indicates a request for a passive scan.
*/
size_t num_ssids;
/**
* extra_ies - Extra IE(s) to add into Probe Request or %NULL
*/
const u8 *extra_ies;
/**
* extra_ies_len - Length of extra_ies in octets
*/
size_t extra_ies_len;
/**
* freqs - Array of frequencies to scan or %NULL for all frequencies
*
* The frequency is set in MHz. The array is zero-terminated.
*/
int *freqs;
/**
* filter_ssids - Filter for reporting SSIDs
*
* This optional parameter can be used to request the driver wrapper to
* filter scan results to include only the specified SSIDs. %NULL
* indicates that no filtering is to be done. This can be used to
* reduce memory needs for scan results in environments that have large
* number of APs with different SSIDs.
*
* The driver wrapper is allowed to take this allocated buffer into its
* own use by setting the pointer to %NULL. In that case, the driver
* wrapper is responsible for freeing the buffer with os_free() once it
* is not needed anymore.
*/
struct wpa_driver_scan_filter {
u8 ssid[32];
size_t ssid_len;
} *filter_ssids;
/**
* num_filter_ssids - Number of entries in filter_ssids array
*/
size_t num_filter_ssids;
/**
* filter_rssi - Filter by RSSI
*
* The driver may filter scan results in firmware to reduce host
* wakeups and thereby save power. Specify the RSSI threshold in s32
* dBm.
*/
s32 filter_rssi;
/**
* p2p_probe - Used to disable CCK (802.11b) rates for P2P probes
*
* When set, the driver is expected to remove rates 1, 2, 5.5, and 11
* Mbps from the support rates element(s) in the Probe Request frames
* and not to transmit the frames at any of those rates.
*/
u8 p2p_probe;
};
/**
* struct wpa_driver_auth_params - Authentication parameters
* Data for struct wpa_driver_ops::authenticate().
*/
struct wpa_driver_auth_params {
int freq;
const u8 *bssid;
const u8 *ssid;
size_t ssid_len;
int auth_alg;
const u8 *ie;
size_t ie_len;
const u8 *wep_key[4];
size_t wep_key_len[4];
int wep_tx_keyidx;
int local_state_change;
/**
* p2p - Whether this connection is a P2P group
*/
int p2p;
};
enum wps_mode {
WPS_MODE_NONE /* no WPS provisioning being used */,
WPS_MODE_OPEN /* WPS provisioning with AP that is in open mode */,
WPS_MODE_PRIVACY /* WPS provisioning with AP that is using protection
*/
};
/**
* struct wpa_driver_associate_params - Association parameters
* Data for struct wpa_driver_ops::associate().
*/
struct wpa_driver_associate_params {
/**
* bssid - BSSID of the selected AP
* This can be %NULL, if ap_scan=2 mode is used and the driver is
* responsible for selecting with which BSS to associate. */
const u8 *bssid;
/**
* ssid - The selected SSID
*/
const u8 *ssid;
/**
* ssid_len - Length of the SSID (1..32)
*/
size_t ssid_len;
/**
* freq - Frequency of the channel the selected AP is using
* Frequency that the selected AP is using (in MHz as
* reported in the scan results)
*/
int freq;
/**
* bg_scan_period - Background scan period in seconds, 0 to disable
* background scan, or -1 to indicate no change to default driver
* configuration
*/
int bg_scan_period;
/**
* wpa_ie - WPA information element for (Re)Association Request
* WPA information element to be included in (Re)Association
* Request (including information element id and length). Use
* of this WPA IE is optional. If the driver generates the WPA
* IE, it can use pairwise_suite, group_suite, and
* key_mgmt_suite to select proper algorithms. In this case,
* the driver has to notify wpa_supplicant about the used WPA
* IE by generating an event that the interface code will
* convert into EVENT_ASSOCINFO data (see below).
*
* When using WPA2/IEEE 802.11i, wpa_ie is used for RSN IE
* instead. The driver can determine which version is used by
* looking at the first byte of the IE (0xdd for WPA, 0x30 for
* WPA2/RSN).
*
* When using WPS, wpa_ie is used for WPS IE instead of WPA/RSN IE.
*/
const u8 *wpa_ie;
/**
* wpa_ie_len - length of the wpa_ie
*/
size_t wpa_ie_len;
/**
* wpa_proto - Bitfield of WPA_PROTO_* values to indicate WPA/WPA2
*/
unsigned int wpa_proto;
/**
* pairwise_suite - Selected pairwise cipher suite
*
* This is usually ignored if @wpa_ie is used.
*/
enum wpa_cipher pairwise_suite;
/**
* group_suite - Selected group cipher suite
*
* This is usually ignored if @wpa_ie is used.
*/
enum wpa_cipher group_suite;
/**
* key_mgmt_suite - Selected key management suite
*
* This is usually ignored if @wpa_ie is used.
*/
enum wpa_key_mgmt key_mgmt_suite;
/**
* auth_alg - Allowed authentication algorithms
* Bit field of WPA_AUTH_ALG_*
*/
int auth_alg;
/**
* mode - Operation mode (infra/ibss) IEEE80211_MODE_*
*/
int mode;
/**
* wep_key - WEP keys for static WEP configuration
*/
const u8 *wep_key[4];
/**
* wep_key_len - WEP key length for static WEP configuration
*/
size_t wep_key_len[4];
/**
* wep_tx_keyidx - WEP TX key index for static WEP configuration
*/
int wep_tx_keyidx;
/**
* mgmt_frame_protection - IEEE 802.11w management frame protection
*/
enum mfp_options mgmt_frame_protection;
/**
* ft_ies - IEEE 802.11r / FT information elements
* If the supplicant is using IEEE 802.11r (FT) and has the needed keys
* for fast transition, this parameter is set to include the IEs that
* are to be sent in the next FT Authentication Request message.
* update_ft_ies() handler is called to update the IEs for further
* FT messages in the sequence.
*
* The driver should use these IEs only if the target AP is advertising
* the same mobility domain as the one included in the MDIE here.
*
* In ap_scan=2 mode, the driver can use these IEs when moving to a new
* AP after the initial association. These IEs can only be used if the
* target AP is advertising support for FT and is using the same MDIE
* and SSID as the current AP.
*
* The driver is responsible for reporting the FT IEs received from the
* AP's response using wpa_supplicant_event() with EVENT_FT_RESPONSE
* type. update_ft_ies() handler will then be called with the FT IEs to
* include in the next frame in the authentication sequence.
*/
const u8 *ft_ies;
/**
* ft_ies_len - Length of ft_ies in bytes
*/
size_t ft_ies_len;
/**
* ft_md - FT Mobility domain (6 octets) (also included inside ft_ies)
*
* This value is provided to allow the driver interface easier access
* to the current mobility domain. This value is set to %NULL if no
* mobility domain is currently active.
*/
const u8 *ft_md;
/**
* passphrase - RSN passphrase for PSK
*
* This value is made available only for WPA/WPA2-Personal (PSK) and
* only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE. This is
* the 8..63 character ASCII passphrase, if available. Please note that
* this can be %NULL if passphrase was not used to generate the PSK. In
* that case, the psk field must be used to fetch the PSK.
*/
const char *passphrase;
/**
* psk - RSN PSK (alternative for passphrase for PSK)
*
* This value is made available only for WPA/WPA2-Personal (PSK) and
* only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE. This is
* the 32-octet (256-bit) PSK, if available. The driver wrapper should
* be prepared to handle %NULL value as an error.
*/
const u8 *psk;
/**
* drop_unencrypted - Enable/disable unencrypted frame filtering
*
* Configure the driver to drop all non-EAPOL frames (both receive and
* transmit paths). Unencrypted EAPOL frames (ethertype 0x888e) must
* still be allowed for key negotiation.
*/
int drop_unencrypted;
/**
* prev_bssid - Previously used BSSID in this ESS
*
* When not %NULL, this is a request to use reassociation instead of
* association.
*/
const u8 *prev_bssid;
/**
* wps - WPS mode
*
* If the driver needs to do special configuration for WPS association,
* this variable provides more information on what type of association
* is being requested. Most drivers should not need ot use this.
*/
enum wps_mode wps;
/**
* p2p - Whether this connection is a P2P group
*/
int p2p;
/**
* uapsd - UAPSD parameters for the network
* -1 = do not change defaults
* AP mode: 1 = enabled, 0 = disabled
* STA mode: bits 0..3 UAPSD enabled for VO,VI,BK,BE
*/
int uapsd;
/**
* fixed_bssid - Whether to force this BSSID in IBSS mode
* 1 = Fix this BSSID and prevent merges.
* 0 = Do not fix BSSID.
*/
int fixed_bssid;
/**
* disable_ht - Disable HT (IEEE 802.11n) for this connection
*/
int disable_ht;
/**
* HT Capabilities over-rides. Only bits set in the mask will be used,
* and not all values are used by the kernel anyway. Currently, MCS,
* MPDU and MSDU fields are used.
*/
const u8 *htcaps; /* struct ieee80211_ht_capabilities * */
const u8 *htcaps_mask; /* struct ieee80211_ht_capabilities * */
};
enum hide_ssid {
NO_SSID_HIDING,
HIDDEN_SSID_ZERO_LEN,
HIDDEN_SSID_ZERO_CONTENTS
};
struct wpa_driver_ap_params {
/**
* head - Beacon head from IEEE 802.11 header to IEs before TIM IE
*/
const u8 *head;
/**
* head_len - Length of the head buffer in octets
*/
size_t head_len;
/**
* tail - Beacon tail following TIM IE
*/
const u8 *tail;
/**
* tail_len - Length of the tail buffer in octets
*/
size_t tail_len;
/**
* dtim_period - DTIM period
*/
int dtim_period;
/**
* beacon_int - Beacon interval
*/
int beacon_int;
/**
* basic_rates: -1 terminated array of basic rates in 100 kbps
*
* This parameter can be used to set a specific basic rate set for the
* BSS. If %NULL, default basic rate set is used.
*/
int *basic_rates;
/**
* proberesp - Probe Response template
*
* This is used by drivers that reply to Probe Requests internally in
* AP mode and require the full Probe Response template.
*/
const u8 *proberesp;
/**
* proberesp_len - Length of the proberesp buffer in octets
*/
size_t proberesp_len;
/**
* ssid - The SSID to use in Beacon/Probe Response frames
*/
const u8 *ssid;
/**
* ssid_len - Length of the SSID (1..32)
*/
size_t ssid_len;
/**
* hide_ssid - Whether to hide the SSID
*/
enum hide_ssid hide_ssid;
/**
* pairwise_ciphers - WPA_CIPHER_* bitfield
*/
unsigned int pairwise_ciphers;
/**
* group_cipher - WPA_CIPHER_*
*/
unsigned int group_cipher;
/**
* key_mgmt_suites - WPA_KEY_MGMT_* bitfield
*/
unsigned int key_mgmt_suites;
/**
* auth_algs - WPA_AUTH_ALG_* bitfield
*/
unsigned int auth_algs;
/**
* wpa_version - WPA_PROTO_* bitfield
*/
unsigned int wpa_version;
/**
* privacy - Whether privacy is used in the BSS
*/
int privacy;
/**
* beacon_ies - WPS/P2P IE(s) for Beacon frames
*
* This is used to add IEs like WPS IE and P2P IE by drivers that do
* not use the full Beacon template.
*/
const struct wpabuf *beacon_ies;
/**
* proberesp_ies - P2P/WPS IE(s) for Probe Response frames
*
* This is used to add IEs like WPS IE and P2P IE by drivers that
* reply to Probe Request frames internally.
*/
const struct wpabuf *proberesp_ies;
/**
* assocresp_ies - WPS IE(s) for (Re)Association Response frames
*
* This is used to add IEs like WPS IE by drivers that reply to
* (Re)Association Request frames internally.
*/
const struct wpabuf *assocresp_ies;
/**
* isolate - Whether to isolate frames between associated stations
*
* If this is non-zero, the AP is requested to disable forwarding of
* frames between associated stations.
*/
int isolate;
/**
* cts_protect - Whether CTS protection is enabled
*/
int cts_protect;
/**
* preamble - Whether short preamble is enabled
*/
int preamble;
/**
* short_slot_time - Whether short slot time is enabled
*
* 0 = short slot time disable, 1 = short slot time enabled, -1 = do
* not set (e.g., when 802.11g mode is not in use)
*/
int short_slot_time;
/**
* ht_opmode - HT operation mode or -1 if HT not in use
*/
int ht_opmode;
/**
* interworking - Whether Interworking is enabled
*/
int interworking;
/**
* hessid - Homogeneous ESS identifier or %NULL if not set
*/
const u8 *hessid;
/**
* access_network_type - Access Network Type (0..15)
*
* This is used for filtering Probe Request frames when Interworking is
* enabled.
*/
u8 access_network_type;
/**
* ap_max_inactivity - Timeout in seconds to detect STA's inactivity
*
* This is used by driver which advertises this capability.
*/
int ap_max_inactivity;
};
/**
* struct wpa_driver_capa - Driver capability information
*/
struct wpa_driver_capa {
#define WPA_DRIVER_CAPA_KEY_MGMT_WPA 0x00000001
#define WPA_DRIVER_CAPA_KEY_MGMT_WPA2 0x00000002
#define WPA_DRIVER_CAPA_KEY_MGMT_WPA_PSK 0x00000004
#define WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK 0x00000008
#define WPA_DRIVER_CAPA_KEY_MGMT_WPA_NONE 0x00000010
#define WPA_DRIVER_CAPA_KEY_MGMT_FT 0x00000020
#define WPA_DRIVER_CAPA_KEY_MGMT_FT_PSK 0x00000040
unsigned int key_mgmt;
#define WPA_DRIVER_CAPA_ENC_WEP40 0x00000001
#define WPA_DRIVER_CAPA_ENC_WEP104 0x00000002
#define WPA_DRIVER_CAPA_ENC_TKIP 0x00000004
#define WPA_DRIVER_CAPA_ENC_CCMP 0x00000008
#define WPA_DRIVER_CAPA_ENC_WEP128 0x00000010
unsigned int enc;
#define WPA_DRIVER_AUTH_OPEN 0x00000001
#define WPA_DRIVER_AUTH_SHARED 0x00000002
#define WPA_DRIVER_AUTH_LEAP 0x00000004
unsigned int auth;
/* Driver generated WPA/RSN IE */
#define WPA_DRIVER_FLAGS_DRIVER_IE 0x00000001
/* Driver needs static WEP key setup after association command */
#define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC 0x00000002
/* unused: 0x00000004 */
/* Driver takes care of RSN 4-way handshake internally; PMK is configured with
* struct wpa_driver_ops::set_key using alg = WPA_ALG_PMK */
#define WPA_DRIVER_FLAGS_4WAY_HANDSHAKE 0x00000008
#define WPA_DRIVER_FLAGS_WIRED 0x00000010
/* Driver provides separate commands for authentication and association (SME in
* wpa_supplicant). */
#define WPA_DRIVER_FLAGS_SME 0x00000020
/* Driver supports AP mode */
#define WPA_DRIVER_FLAGS_AP 0x00000040
/* Driver needs static WEP key setup after association has been completed */
#define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE 0x00000080
/* Driver takes care of P2P management operations */
#define WPA_DRIVER_FLAGS_P2P_MGMT 0x00000100
/* Driver supports concurrent P2P operations */
#define WPA_DRIVER_FLAGS_P2P_CONCURRENT 0x00000200
/*
* Driver uses the initial interface as a dedicated management interface, i.e.,
* it cannot be used for P2P group operations or non-P2P purposes.
*/
#define WPA_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE 0x00000400
/* This interface is P2P capable (P2P Device, GO, or P2P Client */
#define WPA_DRIVER_FLAGS_P2P_CAPABLE 0x00000800
/* Driver supports concurrent operations on multiple channels */
#define WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT 0x00001000
/*
* Driver uses the initial interface for P2P management interface and non-P2P
* purposes (e.g., connect to infra AP), but this interface cannot be used for
* P2P group operations.
*/
#define WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P 0x00002000
/*
* Driver is known to use sane error codes, i.e., when it indicates that
* something (e.g., association) fails, there was indeed a failure and the
* operation does not end up getting completed successfully later.
*/
#define WPA_DRIVER_FLAGS_SANE_ERROR_CODES 0x00004000
/* Driver supports off-channel TX */
#define WPA_DRIVER_FLAGS_OFFCHANNEL_TX 0x00008000
/* Driver indicates TX status events for EAPOL Data frames */
#define WPA_DRIVER_FLAGS_EAPOL_TX_STATUS 0x00010000
/* Driver indicates TX status events for Deauth/Disassoc frames */
#define WPA_DRIVER_FLAGS_DEAUTH_TX_STATUS 0x00020000
/* Driver supports roaming (BSS selection) in firmware */
#define WPA_DRIVER_FLAGS_BSS_SELECTION 0x00040000
/* Driver supports operating as a TDLS peer */
#define WPA_DRIVER_FLAGS_TDLS_SUPPORT 0x00080000
/* Driver requires external TDLS setup/teardown/discovery */
#define WPA_DRIVER_FLAGS_TDLS_EXTERNAL_SETUP 0x00100000
/* Driver indicates support for Probe Response offloading in AP mode */
#define WPA_DRIVER_FLAGS_PROBE_RESP_OFFLOAD 0x00200000
/* Driver supports U-APSD in AP mode */
#define WPA_DRIVER_FLAGS_AP_UAPSD 0x00400000
/* Driver supports inactivity timer in AP mode */
#define WPA_DRIVER_FLAGS_INACTIVITY_TIMER 0x00800000
unsigned int flags;
int max_scan_ssids;
int max_sched_scan_ssids;
int sched_scan_supported;
int sched_scan_intervals_supported;
int max_match_sets;
/**
* max_remain_on_chan - Maximum remain-on-channel duration in msec
*/
unsigned int max_remain_on_chan;
/**
* max_stations - Maximum number of associated stations the driver
* supports in AP mode
*/
unsigned int max_stations;
/**
* probe_resp_offloads - Bitmap of supported protocols by the driver
* for Probe Response offloading.
*/
/* Driver Probe Response offloading support for WPS ver. 1 */
#define WPA_DRIVER_PROBE_RESP_OFFLOAD_WPS 0x00000001
/* Driver Probe Response offloading support for WPS ver. 2 */
#define WPA_DRIVER_PROBE_RESP_OFFLOAD_WPS2 0x00000002
/* Driver Probe Response offloading support for P2P */
#define WPA_DRIVER_PROBE_RESP_OFFLOAD_P2P 0x00000004
/* Driver Probe Response offloading support for IEEE 802.11u (Interworking) */
#define WPA_DRIVER_PROBE_RESP_OFFLOAD_INTERWORKING 0x00000008
unsigned int probe_resp_offloads;
};
struct hostapd_data;
struct hostap_sta_driver_data {
unsigned long rx_packets, tx_packets, rx_bytes, tx_bytes;
unsigned long current_tx_rate;
unsigned long inactive_msec;
unsigned long flags;
unsigned long num_ps_buf_frames;
unsigned long tx_retry_failed;
unsigned long tx_retry_count;
int last_rssi;
int last_ack_rssi;
};
struct hostapd_sta_add_params {
const u8 *addr;
u16 aid;
u16 capability;
const u8 *supp_rates;
size_t supp_rates_len;
u16 listen_interval;
const struct ieee80211_ht_capabilities *ht_capabilities;
u32 flags; /* bitmask of WPA_STA_* flags */
int set; /* Set STA parameters instead of add */
u8 qosinfo;
};
struct hostapd_freq_params {
int mode;
int freq;
int channel;
int ht_enabled;
int sec_channel_offset; /* 0 = HT40 disabled, -1 = HT40 enabled,
* secondary channel below primary, 1 = HT40
* enabled, secondary channel above primary */
};
struct hostapd_channel_switch {
int freq;
int tx_block; /* immediately block the tx on the
* operational channel
* (prior channel switch) */
int post_switch_block_tx; /* block tx on the target ch (after
* channel switch) */
int ch_switch_count;
};
enum wpa_driver_if_type {
/**
* WPA_IF_STATION - Station mode interface
*/
WPA_IF_STATION,
/**
* WPA_IF_AP_VLAN - AP mode VLAN interface
*
* This interface shares its address and Beacon frame with the main
* BSS.
*/
WPA_IF_AP_VLAN,
/**
* WPA_IF_AP_BSS - AP mode BSS interface
*
* This interface has its own address and Beacon frame.
*/
WPA_IF_AP_BSS,
/**
* WPA_IF_P2P_GO - P2P Group Owner
*/
WPA_IF_P2P_GO,
/**
* WPA_IF_P2P_CLIENT - P2P Client
*/
WPA_IF_P2P_CLIENT,
/**
* WPA_IF_P2P_GROUP - P2P Group interface (will become either
* WPA_IF_P2P_GO or WPA_IF_P2P_CLIENT, but the role is not yet known)
*/
WPA_IF_P2P_GROUP
};
struct wpa_init_params {
void *global_priv;
const u8 *bssid;
const char *ifname;
const u8 *ssid;
size_t ssid_len;
const char *test_socket;
int use_pae_group_addr;
char **bridge;
size_t num_bridge;
u8 *own_addr; /* buffer for writing own MAC address */
};
struct wpa_bss_params {
/** Interface name (for multi-SSID/VLAN support) */
const char *ifname;
/** Whether IEEE 802.1X or WPA/WPA2 is enabled */
int enabled;
int wpa;
int ieee802_1x;
int wpa_group;
int wpa_pairwise;
int wpa_key_mgmt;
int rsn_preauth;
enum mfp_options ieee80211w;
};
#define WPA_STA_AUTHORIZED BIT(0)
#define WPA_STA_WMM BIT(1)
#define WPA_STA_SHORT_PREAMBLE BIT(2)
#define WPA_STA_MFP BIT(3)
#define WPA_STA_TDLS_PEER BIT(4)
/**
* struct p2p_params - P2P parameters for driver-based P2P management
*/
struct p2p_params {
const char *dev_name;
u8 pri_dev_type[8];
#define DRV_MAX_SEC_DEV_TYPES 5
u8 sec_dev_type[DRV_MAX_SEC_DEV_TYPES][8];
size_t num_sec_dev_types;
};
enum tdls_oper {
TDLS_DISCOVERY_REQ,
TDLS_SETUP,
TDLS_TEARDOWN,
TDLS_ENABLE_LINK,
TDLS_DISABLE_LINK,
TDLS_ENABLE,
TDLS_DISABLE
};
/**
* struct wpa_signal_info - Information about channel signal quality
*/
struct wpa_signal_info {
u32 frequency;
int above_threshold;
int current_signal;
int current_noise;
int current_txrate;
};
/**
* struct wpa_driver_ops - Driver interface API definition
*
* This structure defines the API that each driver interface needs to implement
* for core wpa_supplicant code. All driver specific functionality is captured
* in this wrapper.
*/
struct wpa_driver_ops {
/** Name of the driver interface */
const char *name;
/** One line description of the driver interface */
const char *desc;
/**
* get_bssid - Get the current BSSID
* @priv: private driver interface data
* @bssid: buffer for BSSID (ETH_ALEN = 6 bytes)
*
* Returns: 0 on success, -1 on failure
*
* Query kernel driver for the current BSSID and copy it to bssid.
* Setting bssid to 00:00:00:00:00:00 is recommended if the STA is not
* associated.
*/
int (*get_bssid)(void *priv, u8 *bssid);
/**
* get_ssid - Get the current SSID
* @priv: private driver interface data
* @ssid: buffer for SSID (at least 32 bytes)
*
* Returns: Length of the SSID on success, -1 on failure
*
* Query kernel driver for the current SSID and copy it to ssid.
* Returning zero is recommended if the STA is not associated.
*
* Note: SSID is an array of octets, i.e., it is not nul terminated and
* can, at least in theory, contain control characters (including nul)
* and as such, should be processed as binary data, not a printable
* string.
*/
int (*get_ssid)(void *priv, u8 *ssid);
/**
* set_key - Configure encryption key
* @ifname: Interface name (for multi-SSID/VLAN support)
* @priv: private driver interface data
* @alg: encryption algorithm (%WPA_ALG_NONE, %WPA_ALG_WEP,
* %WPA_ALG_TKIP, %WPA_ALG_CCMP, %WPA_ALG_IGTK, %WPA_ALG_PMK);
* %WPA_ALG_NONE clears the key.
* @addr: Address of the peer STA (BSSID of the current AP when setting
* pairwise key in station mode), ff:ff:ff:ff:ff:ff for
* broadcast keys, %NULL for default keys that are used both for
* broadcast and unicast; when clearing keys, %NULL is used to
* indicate that both the broadcast-only and default key of the
* specified key index is to be cleared
* @key_idx: key index (0..3), usually 0 for unicast keys; 0..4095 for
* IGTK
* @set_tx: configure this key as the default Tx key (only used when
* driver does not support separate unicast/individual key
* @seq: sequence number/packet number, seq_len octets, the next
* packet number to be used for in replay protection; configured
* for Rx keys (in most cases, this is only used with broadcast
* keys and set to zero for unicast keys); %NULL if not set
* @seq_len: length of the seq, depends on the algorithm:
* TKIP: 6 octets, CCMP: 6 octets, IGTK: 6 octets
* @key: key buffer; TKIP: 16-byte temporal key, 8-byte Tx Mic key,
* 8-byte Rx Mic Key
* @key_len: length of the key buffer in octets (WEP: 5 or 13,
* TKIP: 32, CCMP: 16, IGTK: 16)
*
* Returns: 0 on success, -1 on failure
*
* Configure the given key for the kernel driver. If the driver
* supports separate individual keys (4 default keys + 1 individual),
* addr can be used to determine whether the key is default or
* individual. If only 4 keys are supported, the default key with key
* index 0 is used as the individual key. STA must be configured to use
* it as the default Tx key (set_tx is set) and accept Rx for all the
* key indexes. In most cases, WPA uses only key indexes 1 and 2 for
* broadcast keys, so key index 0 is available for this kind of
* configuration.
*
* Please note that TKIP keys include separate TX and RX MIC keys and
* some drivers may expect them in different order than wpa_supplicant
* is using. If the TX/RX keys are swapped, all TKIP encrypted packets
* will trigger Michael MIC errors. This can be fixed by changing the
* order of MIC keys by swapping te bytes 16..23 and 24..31 of the key
* in driver_*.c set_key() implementation, see driver_ndis.c for an
* example on how this can be done.
*/
int (*set_key)(const char *ifname, void *priv, enum wpa_alg alg,
const u8 *addr, int key_idx, int set_tx,
const u8 *seq, size_t seq_len,
const u8 *key, size_t key_len);
/**
* init - Initialize driver interface
* @ctx: context to be used when calling wpa_supplicant functions,
* e.g., wpa_supplicant_event()
* @ifname: interface name, e.g., wlan0
*
* Returns: Pointer to private data, %NULL on failure
*
* Initialize driver interface, including event processing for kernel
* driver events (e.g., associated, scan results, Michael MIC failure).
* This function can allocate a private configuration data area for
* @ctx, file descriptor, interface name, etc. information that may be
* needed in future driver operations. If this is not used, non-NULL
* value will need to be returned because %NULL is used to indicate
* failure. The returned value will be used as 'void *priv' data for
* all other driver_ops functions.
*
* The main event loop (eloop.c) of wpa_supplicant can be used to
* register callback for read sockets (eloop_register_read_sock()).
*
* See below for more information about events and
* wpa_supplicant_event() function.
*/
void * (*init)(void *ctx, const char *ifname);
/**
* deinit - Deinitialize driver interface
* @priv: private driver interface data from init()
*
* Shut down driver interface and processing of driver events. Free
* private data buffer if one was allocated in init() handler.
*/
void (*deinit)(void *priv);
/**
* set_param - Set driver configuration parameters
* @priv: private driver interface data from init()
* @param: driver specific configuration parameters
*
* Returns: 0 on success, -1 on failure
*
* Optional handler for notifying driver interface about configuration
* parameters (driver_param).
*/
int (*set_param)(void *priv, const char *param);
/**
* set_countermeasures - Enable/disable TKIP countermeasures
* @priv: private driver interface data
* @enabled: 1 = countermeasures enabled, 0 = disabled
*
* Returns: 0 on success, -1 on failure
*
* Configure TKIP countermeasures. When these are enabled, the driver
* should drop all received and queued frames that are using TKIP.
*/
int (*set_countermeasures)(void *priv, int enabled);
/**
* deauthenticate - Request driver to deauthenticate
* @priv: private driver interface data
* @addr: peer address (BSSID of the AP)
* @reason_code: 16-bit reason code to be sent in the deauthentication
* frame
*
* Returns: 0 on success, -1 on failure
*/
int (*deauthenticate)(void *priv, const u8 *addr, int reason_code);
/**
* disassociate - Request driver to disassociate
* @priv: private driver interface data
* @addr: peer address (BSSID of the AP)
* @reason_code: 16-bit reason code to be sent in the disassociation
* frame
*
* Returns: 0 on success, -1 on failure
*/
int (*disassociate)(void *priv, const u8 *addr, int reason_code);
/**
* associate - Request driver to associate
* @priv: private driver interface data
* @params: association parameters
*
* Returns: 0 on success, -1 on failure
*/
int (*associate)(void *priv,
struct wpa_driver_associate_params *params);
/**
* add_pmkid - Add PMKSA cache entry to the driver
* @priv: private driver interface data
* @bssid: BSSID for the PMKSA cache entry
* @pmkid: PMKID for the PMKSA cache entry
*
* Returns: 0 on success, -1 on failure
*
* This function is called when a new PMK is received, as a result of
* either normal authentication or RSN pre-authentication.
*
* If the driver generates RSN IE, i.e., it does not use wpa_ie in
* associate(), add_pmkid() can be used to add new PMKSA cache entries
* in the driver. If the driver uses wpa_ie from wpa_supplicant, this
* driver_ops function does not need to be implemented. Likewise, if
* the driver does not support WPA, this function is not needed.
*/
int (*add_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
/**
* remove_pmkid - Remove PMKSA cache entry to the driver
* @priv: private driver interface data
* @bssid: BSSID for the PMKSA cache entry
* @pmkid: PMKID for the PMKSA cache entry
*
* Returns: 0 on success, -1 on failure
*
* This function is called when the supplicant drops a PMKSA cache
* entry for any reason.
*
* If the driver generates RSN IE, i.e., it does not use wpa_ie in
* associate(), remove_pmkid() can be used to synchronize PMKSA caches
* between the driver and wpa_supplicant. If the driver uses wpa_ie
* from wpa_supplicant, this driver_ops function does not need to be
* implemented. Likewise, if the driver does not support WPA, this
* function is not needed.
*/
int (*remove_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
/**
* flush_pmkid - Flush PMKSA cache
* @priv: private driver interface data
*
* Returns: 0 on success, -1 on failure
*
* This function is called when the supplicant drops all PMKSA cache
* entries for any reason.
*
* If the driver generates RSN IE, i.e., it does not use wpa_ie in
* associate(), remove_pmkid() can be used to synchronize PMKSA caches
* between the driver and wpa_supplicant. If the driver uses wpa_ie
* from wpa_supplicant, this driver_ops function does not need to be
* implemented. Likewise, if the driver does not support WPA, this
* function is not needed.
*/
int (*flush_pmkid)(void *priv);
/**
* get_capa - Get driver capabilities
* @priv: private driver interface data
*
* Returns: 0 on success, -1 on failure
*
* Get driver/firmware/hardware capabilities.
*/
int (*get_capa)(void *priv, struct wpa_driver_capa *capa);
/**
* poll - Poll driver for association information
* @priv: private driver interface data
*
* This is an option callback that can be used when the driver does not
* provide event mechanism for association events. This is called when
* receiving WPA EAPOL-Key messages that require association
* information. The driver interface is supposed to generate associnfo
* event before returning from this callback function. In addition, the
* driver interface should generate an association event after having
* sent out associnfo.
*/
void (*poll)(void *priv);
/**
* get_ifname - Get interface name
* @priv: private driver interface data
*
* Returns: Pointer to the interface name. This can differ from the
* interface name used in init() call. Init() is called first.
*
* This optional function can be used to allow the driver interface to
* replace the interface name with something else, e.g., based on an
* interface mapping from a more descriptive name.
*/
const char * (*get_ifname)(void *priv);
/**
* get_mac_addr - Get own MAC address
* @priv: private driver interface data
*
* Returns: Pointer to own MAC address or %NULL on failure
*
* This optional function can be used to get the own MAC address of the
* device from the driver interface code. This is only needed if the
* l2_packet implementation for the OS does not provide easy access to
* a MAC address. */
const u8 * (*get_mac_addr)(void *priv);
/**
* send_eapol - Optional function for sending EAPOL packets
* @priv: private driver interface data
* @dest: Destination MAC address
* @proto: Ethertype
* @data: EAPOL packet starting with IEEE 802.1X header
* @data_len: Size of the EAPOL packet
*
* Returns: 0 on success, -1 on failure
*
* This optional function can be used to override l2_packet operations
* with driver specific functionality. If this function pointer is set,
* l2_packet module is not used at all and the driver interface code is
* responsible for receiving and sending all EAPOL packets. The
* received EAPOL packets are sent to core code with EVENT_EAPOL_RX
* event. The driver interface is required to implement get_mac_addr()
* handler if send_eapol() is used.
*/
int (*send_eapol)(void *priv, const u8 *dest, u16 proto,
const u8 *data, size_t data_len);
/**
* set_operstate - Sets device operating state to DORMANT or UP
* @priv: private driver interface data
* @state: 0 = dormant, 1 = up
* Returns: 0 on success, -1 on failure
*
* This is an optional function that can be used on operating systems
* that support a concept of controlling network device state from user
* space applications. This function, if set, gets called with
* state = 1 when authentication has been completed and with state = 0
* when connection is lost.
*/
int (*set_operstate)(void *priv, int state);
/**
* mlme_setprotection - MLME-SETPROTECTION.request primitive
* @priv: Private driver interface data
* @addr: Address of the station for which to set protection (may be
* %NULL for group keys)
* @protect_type: MLME_SETPROTECTION_PROTECT_TYPE_*
* @key_type: MLME_SETPROTECTION_KEY_TYPE_*
* Returns: 0 on success, -1 on failure
*
* This is an optional function that can be used to set the driver to
* require protection for Tx and/or Rx frames. This uses the layer
* interface defined in IEEE 802.11i-2004 clause 10.3.22.1
* (MLME-SETPROTECTION.request). Many drivers do not use explicit
* set protection operation; instead, they set protection implicitly
* based on configured keys.
*/
int (*mlme_setprotection)(void *priv, const u8 *addr, int protect_type,
int key_type);
/**
* get_hw_feature_data - Get hardware support data (channels and rates)
* @priv: Private driver interface data
* @num_modes: Variable for returning the number of returned modes
* flags: Variable for returning hardware feature flags
* Returns: Pointer to allocated hardware data on success or %NULL on
* failure. Caller is responsible for freeing this.
*/
struct hostapd_hw_modes * (*get_hw_feature_data)(void *priv,
u16 *num_modes,
u16 *flags);
/**
* send_mlme - Send management frame from MLME
* @priv: Private driver interface data
* @data: IEEE 802.11 management frame with IEEE 802.11 header
* @data_len: Size of the management frame
* @noack: Do not wait for this frame to be acked (disable retries)
* Returns: 0 on success, -1 on failure
*/
int (*send_mlme)(void *priv, const u8 *data, size_t data_len,
int noack);
/**
* update_ft_ies - Update FT (IEEE 802.11r) IEs
* @priv: Private driver interface data
* @md: Mobility domain (2 octets) (also included inside ies)
* @ies: FT IEs (MDIE, FTIE, ...) or %NULL to remove IEs
* @ies_len: Length of FT IEs in bytes
* Returns: 0 on success, -1 on failure
*
* The supplicant uses this callback to let the driver know that keying
* material for FT is available and that the driver can use the
* provided IEs in the next message in FT authentication sequence.
*
* This function is only needed for driver that support IEEE 802.11r
* (Fast BSS Transition).
*/
int (*update_ft_ies)(void *priv, const u8 *md, const u8 *ies,
size_t ies_len);
/**
* send_ft_action - Send FT Action frame (IEEE 802.11r)
* @priv: Private driver interface data
* @action: Action field value
* @target_ap: Target AP address
* @ies: FT IEs (MDIE, FTIE, ...) (FT Request action frame body)
* @ies_len: Length of FT IEs in bytes
* Returns: 0 on success, -1 on failure
*
* The supplicant uses this callback to request the driver to transmit
* an FT Action frame (action category 6) for over-the-DS fast BSS
* transition.
*/
int (*send_ft_action)(void *priv, u8 action, const u8 *target_ap,
const u8 *ies, size_t ies_len);
/**
* get_scan_results2 - Fetch the latest scan results
* @priv: private driver interface data
*
* Returns: Allocated buffer of scan results (caller is responsible for
* freeing the data structure) on success, NULL on failure
*/
struct wpa_scan_results * (*get_scan_results2)(void *priv);
/**
* set_country - Set country
* @priv: Private driver interface data
* @alpha2: country to which to switch to
* Returns: 0 on success, -1 on failure
*
* This function is for drivers which support some form
* of setting a regulatory domain.
*/
int (*set_country)(void *priv, const char *alpha2);
/**
* global_init - Global driver initialization
* Returns: Pointer to private data (global), %NULL on failure
*
* This optional function is called to initialize the driver wrapper
* for global data, i.e., data that applies to all interfaces. If this
* function is implemented, global_deinit() will also need to be
* implemented to free the private data. The driver will also likely
* use init2() function instead of init() to get the pointer to global
* data available to per-interface initializer.
*/
void * (*global_init)(void);
/**
* global_deinit - Global driver deinitialization
* @priv: private driver global data from global_init()
*
* Terminate any global driver related functionality and free the
* global data structure.
*/
void (*global_deinit)(void *priv);
/**
* init2 - Initialize driver interface (with global data)
* @ctx: context to be used when calling wpa_supplicant functions,
* e.g., wpa_supplicant_event()
* @ifname: interface name, e.g., wlan0
* @global_priv: private driver global data from global_init()
* Returns: Pointer to private data, %NULL on failure
*
* This function can be used instead of init() if the driver wrapper
* uses global data.
*/
void * (*init2)(void *ctx, const char *ifname, void *global_priv);
/**
* get_interfaces - Get information about available interfaces
* @global_priv: private driver global data from global_init()
* Returns: Allocated buffer of interface information (caller is
* responsible for freeing the data structure) on success, NULL on
* failure
*/
struct wpa_interface_info * (*get_interfaces)(void *global_priv);
/**
* scan2 - Request the driver to initiate scan
* @priv: private driver interface data
* @params: Scan parameters
*
* Returns: 0 on success, -1 on failure
*
* Once the scan results are ready, the driver should report scan
* results event for wpa_supplicant which will eventually request the
* results with wpa_driver_get_scan_results2().
*/
int (*scan2)(void *priv, struct wpa_driver_scan_params *params);
/**
* sched_scan - Request the driver to initiate scheduled scan
* @priv: private driver interface data
* @params: Scan parameters
* @long_interval: interval between cycles after short intervals end
* @short_interval: interval between initial short scan cycles
* @num_short_intervals: number of interval short scan intervals
*
* Returns: 0 on success, -1 on failure
*
* This operation should be used for scheduled scan offload to
* the hardware. Every time scan results are available, the
* driver should report scan results event for wpa_supplicant
* which will eventually request the results with
* wpa_driver_get_scan_results2(). This operation is optional
* and if not provided or if it returns -1, we fall back to
* normal host-scheduled scans.
*/
int (*sched_scan)(void *priv, struct wpa_driver_scan_params *params,
u32 long_interval, u32 short_interval,
u8 num_short_intervals);
/**
* stop_sched_scan - Request the driver to stop a scheduled scan
* @priv: private driver interface data
*
* Returns: 0 on success, -1 on failure
*
* This should cause the scheduled scan to be stopped and
* results should stop being sent. Must be supported if
* sched_scan is supported.
*/
int (*stop_sched_scan)(void *priv);
/**
* authenticate - Request driver to authenticate
* @priv: private driver interface data
* @params: authentication parameters
* Returns: 0 on success, -1 on failure
*
* This is an optional function that can be used with drivers that
* support separate authentication and association steps, i.e., when
* wpa_supplicant can act as the SME. If not implemented, associate()
* function is expected to take care of IEEE 802.11 authentication,
* too.
*/
int (*authenticate)(void *priv,
struct wpa_driver_auth_params *params);
/**
* set_ap - Set Beacon and Probe Response information for AP mode
* @priv: Private driver interface data
* @params: Parameters to use in AP mode
*
* This function is used to configure Beacon template and/or extra IEs
* to add for Beacon and Probe Response frames for the driver in
* AP mode. The driver is responsible for building the full Beacon
* frame by concatenating the head part with TIM IE generated by the
* driver/firmware and finishing with the tail part. Depending on the
* driver architectue, this can be done either by using the full
* template or the set of additional IEs (e.g., WPS and P2P IE).
* Similarly, Probe Response processing depends on the driver design.
* If the driver (or firmware) takes care of replying to Probe Request
* frames, the extra IEs provided here needs to be added to the Probe
* Response frames.
*
* Returns: 0 on success, -1 on failure
*/
int (*set_ap)(void *priv, struct wpa_driver_ap_params *params);
/**
* hapd_init - Initialize driver interface (hostapd only)
* @hapd: Pointer to hostapd context
* @params: Configuration for the driver wrapper
* Returns: Pointer to private data, %NULL on failure
*
* This function is used instead of init() or init2() when the driver
* wrapper is used with hostapd.
*/
void * (*hapd_init)(struct hostapd_data *hapd,
struct wpa_init_params *params);
/**
* hapd_deinit - Deinitialize driver interface (hostapd only)
* @priv: Private driver interface data from hapd_init()
*/
void (*hapd_deinit)(void *priv);
/**
* set_ieee8021x - Enable/disable IEEE 802.1X support (AP only)
* @priv: Private driver interface data
* @params: BSS parameters
* Returns: 0 on success, -1 on failure
*
* This is an optional function to configure the kernel driver to
* enable/disable IEEE 802.1X support and set WPA/WPA2 parameters. This
* can be left undefined (set to %NULL) if IEEE 802.1X support is
* always enabled and the driver uses set_ap() to set WPA/RSN IE
* for Beacon frames.
*
* DEPRECATED - use set_ap() instead
*/
int (*set_ieee8021x)(void *priv, struct wpa_bss_params *params);
/**
* set_privacy - Enable/disable privacy (AP only)
* @priv: Private driver interface data
* @enabled: 1 = privacy enabled, 0 = disabled
* Returns: 0 on success, -1 on failure
*
* This is an optional function to configure privacy field in the
* kernel driver for Beacon frames. This can be left undefined (set to
* %NULL) if the driver uses the Beacon template from set_ap().
*
* DEPRECATED - use set_ap() instead
*/
int (*set_privacy)(void *priv, int enabled);
/**
* get_seqnum - Fetch the current TSC/packet number (AP only)
* @ifname: The interface name (main or virtual)
* @priv: Private driver interface data
* @addr: MAC address of the station or %NULL for group keys
* @idx: Key index
* @seq: Buffer for returning the latest used TSC/packet number
* Returns: 0 on success, -1 on failure
*
* This function is used to fetch the last used TSC/packet number for
* a TKIP, CCMP, or BIP/IGTK key. It is mainly used with group keys, so
* there is no strict requirement on implementing support for unicast
* keys (i.e., addr != %NULL).
*/
int (*get_seqnum)(const char *ifname, void *priv, const u8 *addr,
int idx, u8 *seq);
/**
* flush - Flush all association stations (AP only)
* @priv: Private driver interface data
* Returns: 0 on success, -1 on failure
*
* This function requests the driver to disassociate all associated
* stations. This function does not need to be implemented if the
* driver does not process association frames internally.
*/
int (*flush)(void *priv);
/**
* set_generic_elem - Add IEs into Beacon/Probe Response frames (AP)
* @priv: Private driver interface data
* @elem: Information elements
* @elem_len: Length of the elem buffer in octets
* Returns: 0 on success, -1 on failure
*
* This is an optional function to add information elements in the
* kernel driver for Beacon and Probe Response frames. This can be left
* undefined (set to %NULL) if the driver uses the Beacon template from
* set_ap().
*
* DEPRECATED - use set_ap() instead
*/
int (*set_generic_elem)(void *priv, const u8 *elem, size_t elem_len);
/**
* read_sta_data - Fetch station data (AP only)
* @priv: Private driver interface data
* @data: Buffer for returning station information
* @addr: MAC address of the station
* Returns: 0 on success, -1 on failure
*/
int (*read_sta_data)(void *priv, struct hostap_sta_driver_data *data,
const u8 *addr);
/**
* hapd_send_eapol - Send an EAPOL packet (AP only)
* @priv: private driver interface data
* @addr: Destination MAC address
* @data: EAPOL packet starting with IEEE 802.1X header
* @data_len: Length of the EAPOL packet in octets
* @encrypt: Whether the frame should be encrypted
* @own_addr: Source MAC address
* @flags: WPA_STA_* flags for the destination station
*
* Returns: 0 on success, -1 on failure
*/
int (*hapd_send_eapol)(void *priv, const u8 *addr, const u8 *data,
size_t data_len, int encrypt,
const u8 *own_addr, u32 flags);
/**
* sta_deauth - Deauthenticate a station (AP only)
* @priv: Private driver interface data
* @own_addr: Source address and BSSID for the Deauthentication frame
* @addr: MAC address of the station to deauthenticate
* @reason: Reason code for the Deauthentiation frame
* Returns: 0 on success, -1 on failure
*
* This function requests a specific station to be deauthenticated and
* a Deauthentication frame to be sent to it.
*/
int (*sta_deauth)(void *priv, const u8 *own_addr, const u8 *addr,
int reason);
/**
* sta_disassoc - Disassociate a station (AP only)
* @priv: Private driver interface data
* @own_addr: Source address and BSSID for the Disassociation frame
* @addr: MAC address of the station to disassociate
* @reason: Reason code for the Disassociation frame
* Returns: 0 on success, -1 on failure
*
* This function requests a specific station to be disassociated and
* a Disassociation frame to be sent to it.
*/
int (*sta_disassoc)(void *priv, const u8 *own_addr, const u8 *addr,
int reason);
/**
* sta_remove - Remove a station entry (AP only)
* @priv: Private driver interface data
* @addr: MAC address of the station to be removed
* Returns: 0 on success, -1 on failure
*/
int (*sta_remove)(void *priv, const u8 *addr);
/**
* hapd_get_ssid - Get the current SSID (AP only)
* @priv: Private driver interface data
* @buf: Buffer for returning the SSID
* @len: Maximum length of the buffer
* Returns: Length of the SSID on success, -1 on failure
*
* This function need not be implemented if the driver uses Beacon
* template from set_ap() and does not reply to Probe Request frames.
*/
int (*hapd_get_ssid)(void *priv, u8 *buf, int len);
/**
* hapd_set_ssid - Set SSID (AP only)
* @priv: Private driver interface data
* @buf: SSID
* @len: Length of the SSID in octets
* Returns: 0 on success, -1 on failure
*
* DEPRECATED - use set_ap() instead
*/
int (*hapd_set_ssid)(void *priv, const u8 *buf, int len);
/**
* hapd_set_countermeasures - Enable/disable TKIP countermeasures (AP)
* @priv: Private driver interface data
* @enabled: 1 = countermeasures enabled, 0 = disabled
* Returns: 0 on success, -1 on failure
*
* This need not be implemented if the driver does not take care of
* association processing.
*/
int (*hapd_set_countermeasures)(void *priv, int enabled);
/**
* sta_add - Add a station entry
* @priv: Private driver interface data
* @params: Station parameters
* Returns: 0 on success, -1 on failure
*
* This function is used to add a station entry to the driver once the
* station has completed association. This is only used if the driver
* does not take care of association processing.
*
* With TDLS, this function is also used to add or set (params->set 1)
* TDLS peer entries.
*/
int (*sta_add)(void *priv, struct hostapd_sta_add_params *params);
/**
* get_inact_sec - Get station inactivity duration (AP only)
* @priv: Private driver interface data
* @addr: Station address
* Returns: Number of seconds station has been inactive, -1 on failure
*/
int (*get_inact_sec)(void *priv, const u8 *addr);
/**
* sta_clear_stats - Clear station statistics (AP only)
* @priv: Private driver interface data
* @addr: Station address
* Returns: 0 on success, -1 on failure
*/
int (*sta_clear_stats)(void *priv, const u8 *addr);
/**
* set_freq - Set channel/frequency (AP only)
* @priv: Private driver interface data
* @freq: Channel parameters
* Returns: 0 on success, -1 on failure
*/
int (*set_freq)(void *priv, struct hostapd_freq_params *freq);
/**
* set_rts - Set RTS threshold
* @priv: Private driver interface data
* @rts: RTS threshold in octets
* Returns: 0 on success, -1 on failure
*/
int (*set_rts)(void *priv, int rts);
/**
* set_frag - Set fragmentation threshold
* @priv: Private driver interface data
* @frag: Fragmentation threshold in octets
* Returns: 0 on success, -1 on failure
*/
int (*set_frag)(void *priv, int frag);
/**
* sta_set_flags - Set station flags (AP only)
* @priv: Private driver interface data
* @addr: Station address
* @total_flags: Bitmap of all WPA_STA_* flags currently set
* @flags_or: Bitmap of WPA_STA_* flags to add
* @flags_and: Bitmap of WPA_STA_* flags to us as a mask
* Returns: 0 on success, -1 on failure
*/
int (*sta_set_flags)(void *priv, const u8 *addr,
int total_flags, int flags_or, int flags_and);
/**
* set_tx_queue_params - Set TX queue parameters
* @priv: Private driver interface data
* @queue: Queue number (0 = VO, 1 = VI, 2 = BE, 3 = BK)
* @aifs: AIFS
* @cw_min: cwMin
* @cw_max: cwMax
* @burst_time: Maximum length for bursting in 0.1 msec units
*/
int (*set_tx_queue_params)(void *priv, int queue, int aifs, int cw_min,
int cw_max, int burst_time);
/**
* if_add - Add a virtual interface
* @priv: Private driver interface data
* @type: Interface type
* @ifname: Interface name for the new virtual interface
* @addr: Local address to use for the interface or %NULL to use the
* parent interface address
* @bss_ctx: BSS context for %WPA_IF_AP_BSS interfaces
* @drv_priv: Pointer for overwriting the driver context or %NULL if
* not allowed (applies only to %WPA_IF_AP_BSS type)
* @force_ifname: Buffer for returning an interface name that the
* driver ended up using if it differs from the requested ifname
* @if_addr: Buffer for returning the allocated interface address
* (this may differ from the requested addr if the driver cannot
* change interface address)
* @bridge: Bridge interface to use or %NULL if no bridge configured
* Returns: 0 on success, -1 on failure
*/
int (*if_add)(void *priv, enum wpa_driver_if_type type,
const char *ifname, const u8 *addr, void *bss_ctx,
void **drv_priv, char *force_ifname, u8 *if_addr,
const char *bridge);
/**
* if_remove - Remove a virtual interface
* @priv: Private driver interface data
* @type: Interface type
* @ifname: Interface name of the virtual interface to be removed
* Returns: 0 on success, -1 on failure
*/
int (*if_remove)(void *priv, enum wpa_driver_if_type type,
const char *ifname);
/**
* set_sta_vlan - Bind a station into a specific interface (AP only)
* @priv: Private driver interface data
* @ifname: Interface (main or virtual BSS or VLAN)
* @addr: MAC address of the associated station
* @vlan_id: VLAN ID
* Returns: 0 on success, -1 on failure
*
* This function is used to bind a station to a specific virtual
* interface. It is only used if when virtual interfaces are supported,
* e.g., to assign stations to different VLAN interfaces based on
* information from a RADIUS server. This allows separate broadcast
* domains to be used with a single BSS.
*/
int (*set_sta_vlan)(void *priv, const u8 *addr, const char *ifname,
int vlan_id);
/**
* commit - Optional commit changes handler (AP only)
* @priv: driver private data
* Returns: 0 on success, -1 on failure
*
* This optional handler function can be registered if the driver
* interface implementation needs to commit changes (e.g., by setting
* network interface up) at the end of initial configuration. If set,
* this handler will be called after initial setup has been completed.
*/
int (*commit)(void *priv);
/**
* send_ether - Send an ethernet packet (AP only)
* @priv: private driver interface data
* @dst: Destination MAC address
* @src: Source MAC address
* @proto: Ethertype
* @data: EAPOL packet starting with IEEE 802.1X header
* @data_len: Length of the EAPOL packet in octets
* Returns: 0 on success, -1 on failure
*/
int (*send_ether)(void *priv, const u8 *dst, const u8 *src, u16 proto,
const u8 *data, size_t data_len);
/**
* set_radius_acl_auth - Notification of RADIUS ACL change
* @priv: Private driver interface data
* @mac: MAC address of the station
* @accepted: Whether the station was accepted
* @session_timeout: Session timeout for the station
* Returns: 0 on success, -1 on failure
*/
int (*set_radius_acl_auth)(void *priv, const u8 *mac, int accepted,
u32 session_timeout);
/**
* set_radius_acl_expire - Notification of RADIUS ACL expiration
* @priv: Private driver interface data
* @mac: MAC address of the station
* Returns: 0 on success, -1 on failure
*/
int (*set_radius_acl_expire)(void *priv, const u8 *mac);
/**
* set_ap_wps_ie - Add WPS IE(s) into Beacon/Probe Response frames (AP)
* @priv: Private driver interface data
* @beacon: WPS IE(s) for Beacon frames or %NULL to remove extra IE(s)
* @proberesp: WPS IE(s) for Probe Response frames or %NULL to remove
* extra IE(s)
* @assocresp: WPS IE(s) for (Re)Association Response frames or %NULL
* to remove extra IE(s)
* Returns: 0 on success, -1 on failure
*
* This is an optional function to add WPS IE in the kernel driver for
* Beacon and Probe Response frames. This can be left undefined (set
* to %NULL) if the driver uses the Beacon template from set_ap()
* and does not process Probe Request frames. If the driver takes care
* of (Re)Association frame processing, the assocresp buffer includes
* WPS IE(s) that need to be added to (Re)Association Response frames
* whenever a (Re)Association Request frame indicated use of WPS.
*
* This will also be used to add P2P IE(s) into Beacon/Probe Response
* frames when operating as a GO. The driver is responsible for adding
* timing related attributes (e.g., NoA) in addition to the IEs
* included here by appending them after these buffers. This call is
* also used to provide Probe Response IEs for P2P Listen state
* operations for drivers that generate the Probe Response frames
* internally.
*
* DEPRECATED - use set_ap() instead
*/
int (*set_ap_wps_ie)(void *priv, const struct wpabuf *beacon,
const struct wpabuf *proberesp,
const struct wpabuf *assocresp);
/**
* set_supp_port - Set IEEE 802.1X Supplicant Port status
* @priv: Private driver interface data
* @authorized: Whether the port is authorized
* Returns: 0 on success, -1 on failure
*/
int (*set_supp_port)(void *priv, int authorized);
/**
* set_wds_sta - Bind a station into a 4-address WDS (AP only)
* @priv: Private driver interface data
* @addr: MAC address of the associated station
* @aid: Association ID
* @val: 1 = bind to 4-address WDS; 0 = unbind
* @bridge_ifname: Bridge interface to use for the WDS station or %NULL
* to indicate that bridge is not to be used
* Returns: 0 on success, -1 on failure
*/
int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val,
const char *bridge_ifname);
/**
* send_action - Transmit an Action frame
* @priv: Private driver interface data
* @freq: Frequency (in MHz) of the channel
* @wait: Time to wait off-channel for a response (in ms), or zero
* @dst: Destination MAC address (Address 1)
* @src: Source MAC address (Address 2)
* @bssid: BSSID (Address 3)
* @data: Frame body
* @data_len: data length in octets
@ @no_cck: Whether CCK rates must not be used to transmit this frame
* Returns: 0 on success, -1 on failure
*
* This command can be used to request the driver to transmit an action
* frame to the specified destination.
*
* If the %WPA_DRIVER_FLAGS_OFFCHANNEL_TX flag is set, the frame will
* be transmitted on the given channel and the device will wait for a
* response on that channel for the given wait time.
*
* If the flag is not set, the wait time will be ignored. In this case,
* if a remain-on-channel duration is in progress, the frame must be
* transmitted on that channel; alternatively the frame may be sent on
* the current operational channel (if in associated state in station
* mode or while operating as an AP.)
*/
int (*send_action)(void *priv, unsigned int freq, unsigned int wait,
const u8 *dst, const u8 *src, const u8 *bssid,
const u8 *data, size_t data_len, int no_cck);
/**
* send_action_cancel_wait - Cancel action frame TX wait
* @priv: Private driver interface data
*
* This command cancels the wait time associated with sending an action
* frame. It is only available when %WPA_DRIVER_FLAGS_OFFCHANNEL_TX is
* set in the driver flags.
*/
void (*send_action_cancel_wait)(void *priv);
/**
* remain_on_channel - Remain awake on a channel
* @priv: Private driver interface data
* @freq: Frequency (in MHz) of the channel
* @duration: Duration in milliseconds
* Returns: 0 on success, -1 on failure
*
* This command is used to request the driver to remain awake on the
* specified channel for the specified duration and report received
* Action frames with EVENT_RX_ACTION events. Optionally, received
* Probe Request frames may also be requested to be reported by calling
* probe_req_report(). These will be reported with EVENT_RX_PROBE_REQ.
*
* The driver may not be at the requested channel when this function
* returns, i.e., the return code is only indicating whether the
* request was accepted. The caller will need to wait until the
* EVENT_REMAIN_ON_CHANNEL event indicates that the driver has
* completed the channel change. This may take some time due to other
* need for the radio and the caller should be prepared to timing out
* its wait since there are no guarantees on when this request can be
* executed.
*/
int (*remain_on_channel)(void *priv, unsigned int freq,
unsigned int duration);
/**
* cancel_remain_on_channel - Cancel remain-on-channel operation
* @priv: Private driver interface data
*
* This command can be used to cancel a remain-on-channel operation
* before its originally requested duration has passed. This could be
* used, e.g., when remain_on_channel() is used to request extra time
* to receive a response to an Action frame and the response is
* received when there is still unneeded time remaining on the
* remain-on-channel operation.
*/
int (*cancel_remain_on_channel)(void *priv);
int (*set_priority)(void *priv);
int (*cancel_priority)(void *priv);
/**
* probe_req_report - Request Probe Request frames to be indicated
* @priv: Private driver interface data
* @report: Whether to report received Probe Request frames
* Returns: 0 on success, -1 on failure (or if not supported)
*
* This command can be used to request the driver to indicate when
* Probe Request frames are received with EVENT_RX_PROBE_REQ events.
* Since this operation may require extra resources, e.g., due to less
* optimal hardware/firmware RX filtering, many drivers may disable
* Probe Request reporting at least in station mode. This command is
* used to notify the driver when the Probe Request frames need to be
* reported, e.g., during remain-on-channel operations.
*/
int (*probe_req_report)(void *priv, int report);
/**
* deinit_ap - Deinitialize AP mode
* @priv: Private driver interface data
* Returns: 0 on success, -1 on failure (or if not supported)
*
* This optional function can be used to disable AP mode related
* configuration and change the driver mode to station mode to allow
* normal station operations like scanning to be completed.
*/
int (*deinit_ap)(void *priv);
/**
* deinit_p2p_cli - Deinitialize P2P client mode
* @priv: Private driver interface data
* Returns: 0 on success, -1 on failure (or if not supported)
*
* This optional function can be used to disable P2P client mode. It
* can be used to change the interface type back to station mode.
*/
int (*deinit_p2p_cli)(void *priv);
/**
* suspend - Notification on system suspend/hibernate event
* @priv: Private driver interface data
*/
void (*suspend)(void *priv);
/**
* resume - Notification on system resume/thaw event
* @priv: Private driver interface data
*/
void (*resume)(void *priv);
/**
* signal_monitor - Set signal monitoring parameters
* @priv: Private driver interface data
* @threshold: Threshold value for signal change events; 0 = disabled
* @hysteresis: Minimum change in signal strength before indicating a
* new event
* Returns: 0 on success, -1 on failure (or if not supported)
*
* This function can be used to configure monitoring of signal strength
* with the current AP. Whenever signal strength drops below the
* %threshold value or increases above it, EVENT_SIGNAL_CHANGE event
* should be generated assuming the signal strength has changed at
* least %hysteresis from the previously indicated signal change event.
*/
int (*signal_monitor)(void *priv, int threshold, int hysteresis);
/**
* send_frame - Send IEEE 802.11 frame (testing use only)
* @priv: Private driver interface data
* @data: IEEE 802.11 frame with IEEE 802.11 header
* @data_len: Size of the frame
* @encrypt: Whether to encrypt the frame (if keys are set)
* Returns: 0 on success, -1 on failure
*
* This function is only used for debugging purposes and is not
* required to be implemented for normal operations.
*/
int (*send_frame)(void *priv, const u8 *data, size_t data_len,
int encrypt);
/**
* shared_freq - Get operating frequency of shared interface(s)
* @priv: Private driver interface data
* Returns: Operating frequency in MHz, 0 if no shared operation in
* use, or -1 on failure
*
* This command can be used to request the current operating frequency
* of any virtual interface that shares the same radio to provide
* information for channel selection for other virtual interfaces.
*/
int (*shared_freq)(void *priv);
/**
* get_noa - Get current Notice of Absence attribute payload
* @priv: Private driver interface data
* @buf: Buffer for returning NoA
* @buf_len: Buffer length in octets
* Returns: Number of octets used in buf, 0 to indicate no NoA is being
* advertized, or -1 on failure
*
* This function is used to fetch the current Notice of Absence
* attribute value from GO.
*/
int (*get_noa)(void *priv, u8 *buf, size_t buf_len);
/**
* set_noa - Set Notice of Absence parameters for GO (testing)
* @priv: Private driver interface data
* @count: Count
* @start: Start time in ms from next TBTT
* @duration: Duration in ms
* Returns: 0 on success or -1 on failure
*
* This function is used to set Notice of Absence parameters for GO. It
* is used only for testing. To disable NoA, all parameters are set to
* 0.
*/
int (*set_noa)(void *priv, u8 count, int start, int duration);
/**
* set_p2p_powersave - Set P2P power save options
* @priv: Private driver interface data
* @legacy_ps: 0 = disable, 1 = enable, 2 = maximum PS, -1 = no change
* @opp_ps: 0 = disable, 1 = enable, -1 = no change
* @ctwindow: 0.. = change (msec), -1 = no change
* Returns: 0 on success or -1 on failure
*/
int (*set_p2p_powersave)(void *priv, int legacy_ps, int opp_ps,
int ctwindow);
/**
* ampdu - Enable/disable aggregation
* @priv: Private driver interface data
* @ampdu: 1/0 = enable/disable A-MPDU aggregation
* Returns: 0 on success or -1 on failure
*/
int (*ampdu)(void *priv, int ampdu);
/**
* get_radio_name - Get physical radio name for the device
* @priv: Private driver interface data
* Returns: Radio name or %NULL if not known
*
* The returned data must not be modified by the caller. It is assumed
* that any interface that has the same radio name as another is
* sharing the same physical radio. This information can be used to
* share scan results etc. information between the virtual interfaces
* to speed up various operations.
*/
const char * (*get_radio_name)(void *priv);
/**
* p2p_find - Start P2P Device Discovery
* @priv: Private driver interface data
* @timeout: Timeout for find operation in seconds or 0 for no timeout
* @type: Device Discovery type (enum p2p_discovery_type)
* Returns: 0 on success, -1 on failure
*
* This function is only used if the driver implements P2P management,
* i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
* struct wpa_driver_capa.
*/
int (*p2p_find)(void *priv, unsigned int timeout, int type);
/**
* p2p_stop_find - Stop P2P Device Discovery
* @priv: Private driver interface data
* Returns: 0 on success, -1 on failure
*
* This function is only used if the driver implements P2P management,
* i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
* struct wpa_driver_capa.
*/
int (*p2p_stop_find)(void *priv);
/**
* p2p_listen - Start P2P Listen state for specified duration
* @priv: Private driver interface data
* @timeout: Listen state duration in milliseconds
* Returns: 0 on success, -1 on failure
*
* This function can be used to request the P2P module to keep the
* device discoverable on the listen channel for an extended set of
* time. At least in its current form, this is mainly used for testing
* purposes and may not be of much use for normal P2P operations.
*
* This function is only used if the driver implements P2P management,
* i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
* struct wpa_driver_capa.
*/
int (*p2p_listen)(void *priv, unsigned int timeout);
/**
* p2p_connect - Start P2P group formation (GO negotiation)
* @priv: Private driver interface data
* @peer_addr: MAC address of the peer P2P client
* @wps_method: enum p2p_wps_method value indicating config method
* @go_intent: Local GO intent value (1..15)
* @own_interface_addr: Intended interface address to use with the
* group
* @force_freq: The only allowed channel frequency in MHz or 0
* @persistent_group: Whether to create persistent group
* Returns: 0 on success, -1 on failure
*
* This function is only used if the driver implements P2P management,
* i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
* struct wpa_driver_capa.
*/
int (*p2p_connect)(void *priv, const u8 *peer_addr, int wps_method,
int go_intent, const u8 *own_interface_addr,
unsigned int force_freq, int persistent_group);
/**
* wps_success_cb - Report successfully completed WPS provisioning
* @priv: Private driver interface data
* @peer_addr: Peer address
* Returns: 0 on success, -1 on failure
*
* This function is used to report successfully completed WPS
* provisioning during group formation in both GO/Registrar and
* client/Enrollee roles.
*
* This function is only used if the driver implements P2P management,
* i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
* struct wpa_driver_capa.
*/
int (*wps_success_cb)(void *priv, const u8 *peer_addr);
/**
* p2p_group_formation_failed - Report failed WPS provisioning
* @priv: Private driver interface data
* Returns: 0 on success, -1 on failure
*
* This function is used to report failed group formation. This can
* happen either due to failed WPS provisioning or due to 15 second
* timeout during the provisioning phase.
*
* This function is only used if the driver implements P2P management,
* i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
* struct wpa_driver_capa.
*/
int (*p2p_group_formation_failed)(void *priv);
/**
* p2p_set_params - Set P2P parameters
* @priv: Private driver interface data
* @params: P2P parameters
* Returns: 0 on success, -1 on failure
*
* This function is only used if the driver implements P2P management,
* i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
* struct wpa_driver_capa.
*/
int (*p2p_set_params)(void *priv, const struct p2p_params *params);
/**
* p2p_prov_disc_req - Send Provision Discovery Request
* @priv: Private driver interface data
* @peer_addr: MAC address of the peer P2P client
* @config_methods: WPS Config Methods value (only one bit set)
* Returns: 0 on success, -1 on failure
*
* This function can be used to request a discovered P2P peer to
* display a PIN (config_methods = WPS_CONFIG_DISPLAY) or be prepared
* to enter a PIN from us (config_methods = WPS_CONFIG_KEYPAD). The
* Provision Discovery Request frame is transmitted once immediately
* and if no response is received, the frame will be sent again
* whenever the target device is discovered during device dsicovery
* (start with a p2p_find() call). Response from the peer is indicated
* with the EVENT_P2P_PROV_DISC_RESPONSE event.
*
* This function is only used if the driver implements P2P management,
* i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
* struct wpa_driver_capa.
*/
int (*p2p_prov_disc_req)(void *priv, const u8 *peer_addr,
u16 config_methods, int join);
/**
* p2p_sd_request - Schedule a service discovery query
* @priv: Private driver interface data
* @dst: Destination peer or %NULL to apply for all peers
* @tlvs: P2P Service Query TLV(s)
* Returns: Reference to the query or 0 on failure
*
* Response to the query is indicated with the
* EVENT_P2P_SD_RESPONSE driver event.
*
* This function is only used if the driver implements P2P management,
* i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
* struct wpa_driver_capa.
*/
u64 (*p2p_sd_request)(void *priv, const u8 *dst,
const struct wpabuf *tlvs);
/**
* p2p_sd_cancel_request - Cancel a pending service discovery query
* @priv: Private driver interface data
* @req: Query reference from p2p_sd_request()
* Returns: 0 on success, -1 on failure
*
* This function is only used if the driver implements P2P management,
* i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
* struct wpa_driver_capa.
*/
int (*p2p_sd_cancel_request)(void *priv, u64 req);
/**
* p2p_sd_response - Send response to a service discovery query
* @priv: Private driver interface data
* @freq: Frequency from EVENT_P2P_SD_REQUEST event
* @dst: Destination address from EVENT_P2P_SD_REQUEST event
* @dialog_token: Dialog token from EVENT_P2P_SD_REQUEST event
* @resp_tlvs: P2P Service Response TLV(s)
* Returns: 0 on success, -1 on failure
*
* This function is called as a response to the request indicated with
* the EVENT_P2P_SD_REQUEST driver event.
*
* This function is only used if the driver implements P2P management,
* i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
* struct wpa_driver_capa.
*/
int (*p2p_sd_response)(void *priv, int freq, const u8 *dst,
u8 dialog_token,
const struct wpabuf *resp_tlvs);
/**
* p2p_service_update - Indicate a change in local services
* @priv: Private driver interface data
* Returns: 0 on success, -1 on failure
*
* This function needs to be called whenever there is a change in
* availability of the local services. This will increment the
* Service Update Indicator value which will be used in SD Request and
* Response frames.
*
* This function is only used if the driver implements P2P management,
* i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
* struct wpa_driver_capa.
*/
int (*p2p_service_update)(void *priv);
/**
* p2p_reject - Reject peer device (explicitly block connections)
* @priv: Private driver interface data
* @addr: MAC address of the peer
* Returns: 0 on success, -1 on failure
*/
int (*p2p_reject)(void *priv, const u8 *addr);
/**
* p2p_invite - Invite a P2P Device into a group
* @priv: Private driver interface data
* @peer: Device Address of the peer P2P Device
* @role: Local role in the group
* @bssid: Group BSSID or %NULL if not known
* @ssid: Group SSID
* @ssid_len: Length of ssid in octets
* @go_dev_addr: Forced GO Device Address or %NULL if none
* @persistent_group: Whether this is to reinvoke a persistent group
* Returns: 0 on success, -1 on failure
*/
int (*p2p_invite)(void *priv, const u8 *peer, int role,
const u8 *bssid, const u8 *ssid, size_t ssid_len,
const u8 *go_dev_addr, int persistent_group);
/**
* send_tdls_mgmt - for sending TDLS management packets
* @priv: private driver interface data
* @dst: Destination (peer) MAC address
* @action_code: TDLS action code for the mssage
* @dialog_token: Dialog Token to use in the message (if needed)
* @status_code: Status Code or Reason Code to use (if needed)
* @buf: TDLS IEs to add to the message
* @len: Length of buf in octets
* Returns: 0 on success, negative (<0) on failure
*
* This optional function can be used to send packet to driver which is
* responsible for receiving and sending all TDLS packets.
*/
int (*send_tdls_mgmt)(void *priv, const u8 *dst, u8 action_code,
u8 dialog_token, u16 status_code,
const u8 *buf, size_t len);
/**
* tdls_oper - Ask the driver to perform high-level TDLS operations
* @priv: Private driver interface data
* @oper: TDLS high-level operation. See %enum tdls_oper
* @peer: Destination (peer) MAC address
* Returns: 0 on success, negative (<0) on failure
*
* This optional function can be used to send high-level TDLS commands
* to the driver.
*/
int (*tdls_oper)(void *priv, enum tdls_oper oper, const u8 *peer);
/**
* signal_poll - Get current connection information
* @priv: Private driver interface data
* @signal_info: Connection info structure
*/
int (*signal_poll)(void *priv, struct wpa_signal_info *signal_info);
/**
* set_authmode - Set authentication algorithm(s) for static WEP
* @priv: Private driver interface data
* @authmode: 1=Open System, 2=Shared Key, 3=both
* Returns: 0 on success, -1 on failure
*
* This function can be used to set authentication algorithms for AP
* mode when static WEP is used. If the driver uses user space MLME/SME
* implementation, there is no need to implement this function.
*
* DEPRECATED - use set_ap() instead
*/
int (*set_authmode)(void *priv, int authmode);
/**
* set_rekey_info - Set rekey information
* @priv: Private driver interface data
* @kek: Current KEK
* @kck: Current KCK
* @replay_ctr: Current EAPOL-Key Replay Counter
*
* This optional function can be used to provide information for the
* driver/firmware to process EAPOL-Key frames in Group Key Handshake
* while the host (including wpa_supplicant) is sleeping.
*/
void (*set_rekey_info)(void *priv, const u8 *kek, const u8 *kck,
const u8 *replay_ctr);
/**
* sta_assoc - Station association indication
* @priv: Private driver interface data
* @own_addr: Source address and BSSID for association frame
* @addr: MAC address of the station to associate
* @reassoc: flag to indicate re-association
* @status: association response status code
* @ie: assoc response ie buffer
* @len: ie buffer length
* Returns: 0 on success, -1 on failure
*
* This function indicates the driver to send (Re)Association
* Response frame to the station.
*/
int (*sta_assoc)(void *priv, const u8 *own_addr, const u8 *addr,
int reassoc, u16 status, const u8 *ie, size_t len);
/**
* sta_auth - Station authentication indication
* @priv: Private driver interface data
* @own_addr: Source address and BSSID for authentication frame
* @addr: MAC address of the station to associate
* @seq: authentication sequence number
* @status: authentication response status code
* @ie: authentication frame ie buffer
* @len: ie buffer length
*
* This function indicates the driver to send Authentication frame
* to the station.
*/
int (*sta_auth)(void *priv, const u8 *own_addr, const u8 *addr,
u16 seq, u16 status, const u8 *ie, size_t len);
/**
* add_tspec - Add traffic stream
* @priv: Private driver interface data
* @addr: MAC address of the station to associate
* @tspec_ie: tspec ie buffer
* @tspec_ielen: tspec ie length
* Returns: 0 on success, -1 on failure
*
* This function adds the traffic steam for the station
* and fills the medium_time in tspec_ie.
*/
int (*add_tspec)(void *priv, const u8 *addr, u8 *tspec_ie,
size_t tspec_ielen);
/**
* add_sta_node - Add a station node in the driver
* @priv: Private driver interface data
* @addr: MAC address of the station to add
* @auth_alg: authentication algorithm used by the station
* Returns: 0 on success, -1 on failure
*
* This function adds the station node in the driver, when
* the station gets added by FT-over-DS.
*/
int (*add_sta_node)(void *priv, const u8 *addr, u16 auth_alg);
/**
* poll_client - Probe (null data or such) the given station
* @priv: Private driver interface data
* @own_addr: MAC address of sending interface
* @addr: MAC address of the station to probe
* @qos: Indicates whether station is QoS station
*
* This function is used to verify whether an associated station is
* still present. This function does not need to be implemented if the
* driver provides such inactivity polling mechanism.
*/
void (*poll_client)(void *priv, const u8 *own_addr,
const u8 *addr, int qos);
/**
* radio_disable - Disable/enable radio
* @priv: Private driver interface data
* @disabled: 1=disable 0=enable radio
* Returns: 0 on success, -1 on failure
*
* This optional command is for testing purposes. It can be used to
* disable the radio on a testbed device to simulate out-of-radio-range
* conditions.
*/
int (*radio_disable)(void *priv, int disabled);
/**
* switch_channel - Announce channel switch and migrate the GO to the
* given frequency
* @priv: Private driver interface data
* @freq: Frequency in MHz
* Returns: 0 on success, -1 on failure
*
* This function is used to move the GO to the legacy STA channel to
* avoid frequency conflict in single channel concurrency.
*/
int (*switch_channel)(void *priv, unsigned int freq);
/**
* driver_cmd - execute driver-specific command
* @priv: private driver interface data
* @cmd: command to execute
* @buf: return buffer
* @buf_len: buffer length
*
* Returns: 0 on success, -1 on failure
*/
int (*driver_cmd)(void *priv, char *cmd, char *buf, size_t buf_len);
/**
* hapd_channel_switch - Perform an AP channel switch
* @priv: Private driver interface data
* @params: Channels switch parameters
* Returns: 0 on success, -1 on failure
*/
int (*hapd_channel_switch)(void *priv,
struct hostapd_channel_switch *params);
};
/**
* enum wpa_event_type - Event type for wpa_supplicant_event() calls
*/
enum wpa_event_type {
/**
* EVENT_ASSOC - Association completed
*
* This event needs to be delivered when the driver completes IEEE
* 802.11 association or reassociation successfully.
* wpa_driver_ops::get_bssid() is expected to provide the current BSSID
* after this event has been generated. In addition, optional
* EVENT_ASSOCINFO may be generated just before EVENT_ASSOC to provide
* more information about the association. If the driver interface gets
* both of these events at the same time, it can also include the
* assoc_info data in EVENT_ASSOC call.
*/
EVENT_ASSOC,
/**
* EVENT_DISASSOC - Association lost
*
* This event should be called when association is lost either due to
* receiving deauthenticate or disassociate frame from the AP or when
* sending either of these frames to the current AP. If the driver
* supports separate deauthentication event, EVENT_DISASSOC should only
* be used for disassociation and EVENT_DEAUTH for deauthentication.
* In AP mode, union wpa_event_data::disassoc_info is required.
*/
EVENT_DISASSOC,
/**
* EVENT_MICHAEL_MIC_FAILURE - Michael MIC (TKIP) detected
*
* This event must be delivered when a Michael MIC error is detected by
* the local driver. Additional data for event processing is
* provided with union wpa_event_data::michael_mic_failure. This
* information is used to request new encyption key and to initiate
* TKIP countermeasures if needed.
*/
EVENT_MICHAEL_MIC_FAILURE,
/**
* EVENT_SCAN_RESULTS - Scan results available
*
* This event must be called whenever scan results are available to be
* fetched with struct wpa_driver_ops::get_scan_results(). This event
* is expected to be used some time after struct wpa_driver_ops::scan()
* is called. If the driver provides an unsolicited event when the scan
* has been completed, this event can be used to trigger
* EVENT_SCAN_RESULTS call. If such event is not available from the
* driver, the driver wrapper code is expected to use a registered
* timeout to generate EVENT_SCAN_RESULTS call after the time that the
* scan is expected to be completed. Optional information about
* completed scan can be provided with union wpa_event_data::scan_info.
*/
EVENT_SCAN_RESULTS,
/**
* EVENT_ASSOCINFO - Report optional extra information for association
*
* This event can be used to report extra association information for
* EVENT_ASSOC processing. This extra information includes IEs from
* association frames and Beacon/Probe Response frames in union
* wpa_event_data::assoc_info. EVENT_ASSOCINFO must be send just before
* EVENT_ASSOC. Alternatively, the driver interface can include
* assoc_info data in the EVENT_ASSOC call if it has all the
* information available at the same point.
*/
EVENT_ASSOCINFO,
/**
* EVENT_INTERFACE_STATUS - Report interface status changes
*
* This optional event can be used to report changes in interface
* status (interface added/removed) using union
* wpa_event_data::interface_status. This can be used to trigger
* wpa_supplicant to stop and re-start processing for the interface,
* e.g., when a cardbus card is ejected/inserted.
*/
EVENT_INTERFACE_STATUS,
/**
* EVENT_PMKID_CANDIDATE - Report a candidate AP for pre-authentication
*
* This event can be used to inform wpa_supplicant about candidates for
* RSN (WPA2) pre-authentication. If wpa_supplicant is not responsible
* for scan request (ap_scan=2 mode), this event is required for
* pre-authentication. If wpa_supplicant is performing scan request
* (ap_scan=1), this event is optional since scan results can be used
* to add pre-authentication candidates. union
* wpa_event_data::pmkid_candidate is used to report the BSSID of the
* candidate and priority of the candidate, e.g., based on the signal
* strength, in order to try to pre-authenticate first with candidates
* that are most likely targets for re-association.
*
* EVENT_PMKID_CANDIDATE can be called whenever the driver has updates
* on the candidate list. In addition, it can be called for the current
* AP and APs that have existing PMKSA cache entries. wpa_supplicant
* will automatically skip pre-authentication in cases where a valid
* PMKSA exists. When more than one candidate exists, this event should
* be generated once for each candidate.
*
* Driver will be notified about successful pre-authentication with
* struct wpa_driver_ops::add_pmkid() calls.
*/
EVENT_PMKID_CANDIDATE,
/**
* EVENT_STKSTART - Request STK handshake (MLME-STKSTART.request)
*
* This event can be used to inform wpa_supplicant about desire to set
* up secure direct link connection between two stations as defined in
* IEEE 802.11e with a new PeerKey mechanism that replaced the original
* STAKey negotiation. The caller will need to set peer address for the
* event.
*/
EVENT_STKSTART,
/**
* EVENT_TDLS - Request TDLS operation
*
* This event can be used to request a TDLS operation to be performed.
*/
EVENT_TDLS,
/**
* EVENT_FT_RESPONSE - Report FT (IEEE 802.11r) response IEs
*
* The driver is expected to report the received FT IEs from
* FT authentication sequence from the AP. The FT IEs are included in
* the extra information in union wpa_event_data::ft_ies.
*/
EVENT_FT_RESPONSE,
/**
* EVENT_IBSS_RSN_START - Request RSN authentication in IBSS
*
* The driver can use this event to inform wpa_supplicant about a STA
* in an IBSS with which protected frames could be exchanged. This
* event starts RSN authentication with the other STA to authenticate
* the STA and set up encryption keys with it.
*/
EVENT_IBSS_RSN_START,
/**
* EVENT_AUTH - Authentication result
*
* This event should be called when authentication attempt has been
* completed. This is only used if the driver supports separate
* authentication step (struct wpa_driver_ops::authenticate).
* Information about authentication result is included in
* union wpa_event_data::auth.
*/
EVENT_AUTH,
/**
* EVENT_DEAUTH - Authentication lost
*
* This event should be called when authentication is lost either due
* to receiving deauthenticate frame from the AP or when sending that
* frame to the current AP.
* In AP mode, union wpa_event_data::deauth_info is required.
*/
EVENT_DEAUTH,
/**
* EVENT_ASSOC_REJECT - Association rejected
*
* This event should be called when (re)association attempt has been
* rejected by the AP. Information about the association response is
* included in union wpa_event_data::assoc_reject.
*/
EVENT_ASSOC_REJECT,
/**
* EVENT_AUTH_TIMED_OUT - Authentication timed out
*/
EVENT_AUTH_TIMED_OUT,
/**
* EVENT_ASSOC_TIMED_OUT - Association timed out
*/
EVENT_ASSOC_TIMED_OUT,
/**
* EVENT_FT_RRB_RX - FT (IEEE 802.11r) RRB frame received
*/
EVENT_FT_RRB_RX,
/**
* EVENT_WPS_BUTTON_PUSHED - Report hardware push button press for WPS
*/
EVENT_WPS_BUTTON_PUSHED,
/**
* EVENT_TX_STATUS - Report TX status
*/
EVENT_TX_STATUS,
/**
* EVENT_RX_FROM_UNKNOWN - Report RX from unknown STA
*/
EVENT_RX_FROM_UNKNOWN,
/**
* EVENT_RX_MGMT - Report RX of a management frame
*/
EVENT_RX_MGMT,
/**
* EVENT_RX_ACTION - Action frame received
*
* This event is used to indicate when an Action frame has been
* received. Information about the received frame is included in
* union wpa_event_data::rx_action.
*/
EVENT_RX_ACTION,
/**
* EVENT_REMAIN_ON_CHANNEL - Remain-on-channel duration started
*
* This event is used to indicate when the driver has started the
* requested remain-on-channel duration. Information about the
* operation is included in union wpa_event_data::remain_on_channel.
*/
EVENT_REMAIN_ON_CHANNEL,
/**
* EVENT_CANCEL_REMAIN_ON_CHANNEL - Remain-on-channel timed out
*
* This event is used to indicate when the driver has completed
* remain-on-channel duration, i.e., may noot be available on the
* requested channel anymore. Information about the
* operation is included in union wpa_event_data::remain_on_channel.
*/
EVENT_CANCEL_REMAIN_ON_CHANNEL,
/**
* EVENT_MLME_RX - Report reception of frame for MLME (test use only)
*
* This event is used only by driver_test.c and userspace MLME.
*/
EVENT_MLME_RX,
/**
* EVENT_RX_PROBE_REQ - Indicate received Probe Request frame
*
* This event is used to indicate when a Probe Request frame has been
* received. Information about the received frame is included in
* union wpa_event_data::rx_probe_req. The driver is required to report
* these events only after successfully completed probe_req_report()
* commands to request the events (i.e., report parameter is non-zero)
* in station mode. In AP mode, Probe Request frames should always be
* reported.
*/
EVENT_RX_PROBE_REQ,
/**
* EVENT_NEW_STA - New wired device noticed
*
* This event is used to indicate that a new device has been detected
* in a network that does not use association-like functionality (i.e.,
* mainly wired Ethernet). This can be used to start EAPOL
* authenticator when receiving a frame from a device. The address of
* the device is included in union wpa_event_data::new_sta.
*/
EVENT_NEW_STA,
/**
* EVENT_EAPOL_RX - Report received EAPOL frame
*
* When in AP mode with hostapd, this event is required to be used to
* deliver the receive EAPOL frames from the driver. With
* %wpa_supplicant, this event is used only if the send_eapol() handler
* is used to override the use of l2_packet for EAPOL frame TX.
*/
EVENT_EAPOL_RX,
/**
* EVENT_SIGNAL_CHANGE - Indicate change in signal strength
*
* This event is used to indicate changes in the signal strength
* observed in frames received from the current AP if signal strength
* monitoring has been enabled with signal_monitor().
*/
EVENT_SIGNAL_CHANGE,
/**
* EVENT_ROAMING_ENABLED - Notify that the driver can do roaming again
*
* This event is used to indicate that the driver can do roaming
* and bgscan after it was previosly disabled
*/
EVENT_ROAMING_ENABLED,
/**
* EVENT_ROAMING_DISABLED - Notify that the driver can't do roaming
*
* This event is used to indicate that the driver can't do roaming
* and bgscan and roaming attempts should be disabled
*/
EVENT_ROAMING_DISABLED,
EVENT_START_ROAMING,
/**
* EVENT_INTERFACE_ENABLED - Notify that interface was enabled
*
* This event is used to indicate that the interface was enabled after
* having been previously disabled, e.g., due to rfkill.
*/
EVENT_INTERFACE_ENABLED,
/**
* EVENT_INTERFACE_DISABLED - Notify that interface was disabled
*
* This event is used to indicate that the interface was disabled,
* e.g., due to rfkill.
*/
EVENT_INTERFACE_DISABLED,
/**
* EVENT_CHANNEL_LIST_CHANGED - Channel list changed
*
* This event is used to indicate that the channel list has changed,
* e.g., because of a regulatory domain change triggered by scan
* results including an AP advertising a country code.
*/
EVENT_CHANNEL_LIST_CHANGED,
/**
* EVENT_INTERFACE_UNAVAILABLE - Notify that interface is unavailable
*
* This event is used to indicate that the driver cannot maintain this
* interface in its operation mode anymore. The most likely use for
* this is to indicate that AP mode operation is not available due to
* operating channel would need to be changed to a DFS channel when
* the driver does not support radar detection and another virtual
* interfaces caused the operating channel to change. Other similar
* resource conflicts could also trigger this for station mode
* interfaces.
*/
EVENT_INTERFACE_UNAVAILABLE,
/**
* EVENT_BEST_CHANNEL
*
* Driver generates this event whenever it detects a better channel
* (e.g., based on RSSI or channel use). This information can be used
* to improve channel selection for a new AP/P2P group.
*/
EVENT_BEST_CHANNEL,
/**
* EVENT_UNPROT_DEAUTH - Unprotected Deauthentication frame received
*
* This event should be called when a Deauthentication frame is dropped
* due to it not being protected (MFP/IEEE 802.11w).
* union wpa_event_data::unprot_deauth is required to provide more
* details of the frame.
*/
EVENT_UNPROT_DEAUTH,
/**
* EVENT_UNPROT_DISASSOC - Unprotected Disassociation frame received
*
* This event should be called when a Disassociation frame is dropped
* due to it not being protected (MFP/IEEE 802.11w).
* union wpa_event_data::unprot_disassoc is required to provide more
* details of the frame.
*/
EVENT_UNPROT_DISASSOC,
/**
* EVENT_STATION_LOW_ACK
*
* Driver generates this event whenever it detected that a particular
* station was lost. Detection can be through massive transmission
* failures for example.
*/
EVENT_STATION_LOW_ACK,
/**
* EVENT_P2P_DEV_FOUND - Report a discovered P2P device
*
* This event is used only if the driver implements P2P management
* internally. Event data is stored in
* union wpa_event_data::p2p_dev_found.
*/
EVENT_P2P_DEV_FOUND,
/**
* EVENT_P2P_GO_NEG_REQ_RX - Report reception of GO Negotiation Request
*
* This event is used only if the driver implements P2P management
* internally. Event data is stored in
* union wpa_event_data::p2p_go_neg_req_rx.
*/
EVENT_P2P_GO_NEG_REQ_RX,
/**
* EVENT_P2P_GO_NEG_COMPLETED - Report completion of GO Negotiation
*
* This event is used only if the driver implements P2P management
* internally. Event data is stored in
* union wpa_event_data::p2p_go_neg_completed.
*/
EVENT_P2P_GO_NEG_COMPLETED,
EVENT_P2P_PROV_DISC_REQUEST,
EVENT_P2P_PROV_DISC_RESPONSE,
EVENT_P2P_SD_REQUEST,
EVENT_P2P_SD_RESPONSE,
/**
* EVENT_IBSS_PEER_LOST - IBSS peer not reachable anymore
*/
EVENT_IBSS_PEER_LOST,
/**
* EVENT_DRIVER_GTK_REKEY - Device/driver did GTK rekey
*
* This event carries the new replay counter to notify wpa_supplicant
* of the current EAPOL-Key Replay Counter in case the driver/firmware
* completed Group Key Handshake while the host (including
* wpa_supplicant was sleeping).
*/
EVENT_DRIVER_GTK_REKEY,
/**
* EVENT_SCHED_SCAN_STOPPED - Scheduled scan was stopped
*/
EVENT_SCHED_SCAN_STOPPED,
/**
* EVENT_DRIVER_CLIENT_POLL_OK - Station responded to poll
*
* This event indicates that the station responded to the poll
* initiated with @poll_client.
*/
EVENT_DRIVER_CLIENT_POLL_OK,
/**
* EVENT_EAPOL_TX_STATUS - notify of EAPOL TX status
*/
EVENT_EAPOL_TX_STATUS,
/**
* EVENT_CH_SWITCH - AP or GO decided to switch channels
*
* Described in wpa_event_data.ch_switch
* */
EVENT_CH_SWITCH
};
/**
* union wpa_event_data - Additional data for wpa_supplicant_event() calls
*/
union wpa_event_data {
/**
* struct assoc_info - Data for EVENT_ASSOC and EVENT_ASSOCINFO events
*
* This structure is optional for EVENT_ASSOC calls and required for
* EVENT_ASSOCINFO calls. By using EVENT_ASSOC with this data, the
* driver interface does not need to generate separate EVENT_ASSOCINFO
* calls.
*/
struct assoc_info {
/**
* reassoc - Flag to indicate association or reassociation
*/
int reassoc;
/**
* req_ies - (Re)Association Request IEs
*
* If the driver generates WPA/RSN IE, this event data must be
* returned for WPA handshake to have needed information. If
* wpa_supplicant-generated WPA/RSN IE is used, this
* information event is optional.
*
* This should start with the first IE (fixed fields before IEs
* are not included).
*/
const u8 *req_ies;
/**
* req_ies_len - Length of req_ies in bytes
*/
size_t req_ies_len;
/**
* resp_ies - (Re)Association Response IEs
*
* Optional association data from the driver. This data is not
* required WPA, but may be useful for some protocols and as
* such, should be reported if this is available to the driver
* interface.
*
* This should start with the first IE (fixed fields before IEs
* are not included).
*/
const u8 *resp_ies;
/**
* resp_ies_len - Length of resp_ies in bytes
*/
size_t resp_ies_len;
/**
* beacon_ies - Beacon or Probe Response IEs
*
* Optional Beacon/ProbeResp data: IEs included in Beacon or
* Probe Response frames from the current AP (i.e., the one
* that the client just associated with). This information is
* used to update WPA/RSN IE for the AP. If this field is not
* set, the results from previous scan will be used. If no
* data for the new AP is found, scan results will be requested
* again (without scan request). At this point, the driver is
* expected to provide WPA/RSN IE for the AP (if WPA/WPA2 is
* used).
*
* This should start with the first IE (fixed fields before IEs
* are not included).
*/
const u8 *beacon_ies;
/**
* beacon_ies_len - Length of beacon_ies */
size_t beacon_ies_len;
/**
* freq - Frequency of the operational channel in MHz
*/
unsigned int freq;
/**
* addr - Station address (for AP mode)
*/
const u8 *addr;
} assoc_info;
/**
* struct disassoc_info - Data for EVENT_DISASSOC events
*/
struct disassoc_info {
/**
* addr - Station address (for AP mode)
*/
const u8 *addr;
/**
* reason_code - Reason Code (host byte order) used in
* Deauthentication frame
*/
u16 reason_code;
/**
* ie - Optional IE(s) in Disassociation frame
*/
const u8 *ie;
/**
* ie_len - Length of ie buffer in octets
*/
size_t ie_len;
/**
* locally_generated - Whether the frame was locally generated
*/
int locally_generated;
} disassoc_info;
/**
* struct deauth_info - Data for EVENT_DEAUTH events
*/
struct deauth_info {
/**
* addr - Station address (for AP mode)
*/
const u8 *addr;
/**
* reason_code - Reason Code (host byte order) used in
* Deauthentication frame
*/
u16 reason_code;
/**
* ie - Optional IE(s) in Deauthentication frame
*/
const u8 *ie;
/**
* ie_len - Length of ie buffer in octets
*/
size_t ie_len;
/**
* locally_generated - Whether the frame was locally generated
*/
int locally_generated;
} deauth_info;
/**
* struct michael_mic_failure - Data for EVENT_MICHAEL_MIC_FAILURE
*/
struct michael_mic_failure {
int unicast;
const u8 *src;
} michael_mic_failure;
/**
* struct interface_status - Data for EVENT_INTERFACE_STATUS
*/
struct interface_status {
char ifname[100];
enum {
EVENT_INTERFACE_ADDED, EVENT_INTERFACE_REMOVED
} ievent;
} interface_status;
/**
* struct pmkid_candidate - Data for EVENT_PMKID_CANDIDATE
*/
struct pmkid_candidate {
/** BSSID of the PMKID candidate */
u8 bssid[ETH_ALEN];
/** Smaller the index, higher the priority */
int index;
/** Whether RSN IE includes pre-authenticate flag */
int preauth;
} pmkid_candidate;
/**
* struct stkstart - Data for EVENT_STKSTART
*/
struct stkstart {
u8 peer[ETH_ALEN];
} stkstart;
/**
* struct tdls - Data for EVENT_TDLS
*/
struct tdls {
u8 peer[ETH_ALEN];
enum {
TDLS_REQUEST_SETUP,
TDLS_REQUEST_TEARDOWN
} oper;
u16 reason_code; /* for teardown */
} tdls;
/**
* struct ft_ies - FT information elements (EVENT_FT_RESPONSE)
*
* During FT (IEEE 802.11r) authentication sequence, the driver is
* expected to use this event to report received FT IEs (MDIE, FTIE,
* RSN IE, TIE, possible resource request) to the supplicant. The FT
* IEs for the next message will be delivered through the
* struct wpa_driver_ops::update_ft_ies() callback.
*/
struct ft_ies {
const u8 *ies;
size_t ies_len;
int ft_action;
u8 target_ap[ETH_ALEN];
/** Optional IE(s), e.g., WMM TSPEC(s), for RIC-Request */
const u8 *ric_ies;
/** Length of ric_ies buffer in octets */
size_t ric_ies_len;
} ft_ies;
/**
* struct ibss_rsn_start - Data for EVENT_IBSS_RSN_START
*/
struct ibss_rsn_start {
u8 peer[ETH_ALEN];
} ibss_rsn_start;
/**
* struct auth_info - Data for EVENT_AUTH events
*/
struct auth_info {
u8 peer[ETH_ALEN];
u8 bssid[ETH_ALEN];
u16 auth_type;
u16 auth_transaction;
u16 status_code;
const u8 *ies;
size_t ies_len;
} auth;
/**
* struct assoc_reject - Data for EVENT_ASSOC_REJECT events
*/
struct assoc_reject {
/**
* bssid - BSSID of the AP that rejected association
*/
const u8 *bssid;
/**
* resp_ies - (Re)Association Response IEs
*
* Optional association data from the driver. This data is not
* required WPA, but may be useful for some protocols and as
* such, should be reported if this is available to the driver
* interface.
*
* This should start with the first IE (fixed fields before IEs
* are not included).
*/
const u8 *resp_ies;
/**
* resp_ies_len - Length of resp_ies in bytes
*/
size_t resp_ies_len;
/**
* status_code - Status Code from (Re)association Response
*/
u16 status_code;
} assoc_reject;
struct timeout_event {
u8 addr[ETH_ALEN];
} timeout_event;
/**
* struct ft_rrb_rx - Data for EVENT_FT_RRB_RX events
*/
struct ft_rrb_rx {
const u8 *src;
const u8 *data;
size_t data_len;
} ft_rrb_rx;
/**
* struct tx_status - Data for EVENT_TX_STATUS events
*/
struct tx_status {
u16 type;
u16 stype;
const u8 *dst;
const u8 *data;
size_t data_len;
int ack;
} tx_status;
/**
* struct rx_from_unknown - Data for EVENT_RX_FROM_UNKNOWN events
*/
struct rx_from_unknown {
const u8 *bssid;
const u8 *addr;
int wds;
} rx_from_unknown;
/**
* struct rx_mgmt - Data for EVENT_RX_MGMT events
*/
struct rx_mgmt {
const u8 *frame;
size_t frame_len;
u32 datarate;
int ssi_signal; /* dBm */
} rx_mgmt;
/**
* struct rx_action - Data for EVENT_RX_ACTION events
*/
struct rx_action {
/**
* da - Destination address of the received Action frame
*/
const u8 *da;
/**
* sa - Source address of the received Action frame
*/
const u8 *sa;
/**
* bssid - Address 3 of the received Action frame
*/
const u8 *bssid;
/**
* category - Action frame category
*/
u8 category;
/**
* data - Action frame body after category field
*/
const u8 *data;
/**
* len - Length of data in octets
*/
size_t len;
/**
* freq - Frequency (in MHz) on which the frame was received
*/
int freq;
} rx_action;
/**
* struct remain_on_channel - Data for EVENT_REMAIN_ON_CHANNEL events
*
* This is also used with EVENT_CANCEL_REMAIN_ON_CHANNEL events.
*/
struct remain_on_channel {
/**
* freq - Channel frequency in MHz
*/
unsigned int freq;
/**
* duration - Duration to remain on the channel in milliseconds
*/
unsigned int duration;
} remain_on_channel;
/**
* struct scan_info - Optional data for EVENT_SCAN_RESULTS events
* @aborted: Whether the scan was aborted
* @is_sched_scan_res: Whether the scan results are from the sched scan
* @freqs: Scanned frequencies in MHz (%NULL = all channels scanned)
* @num_freqs: Number of entries in freqs array
* @ssids: Scanned SSIDs (%NULL or zero-length SSID indicates wildcard
* SSID)
* @num_ssids: Number of entries in ssids array
*/
struct scan_info {
int aborted;
int is_sched_scan_res;
const int *freqs;
size_t num_freqs;
struct wpa_driver_scan_ssid ssids[WPAS_MAX_SCAN_SSIDS];
size_t num_ssids;
} scan_info;
/**
* struct mlme_rx - Data for EVENT_MLME_RX events
*/
struct mlme_rx {
const u8 *buf;
size_t len;
int freq;
int channel;
int ssi;
} mlme_rx;
/**
* struct rx_probe_req - Data for EVENT_RX_PROBE_REQ events
*/
struct rx_probe_req {
/**
* sa - Source address of the received Probe Request frame
*/
const u8 *sa;
/**
* da - Destination address of the received Probe Request frame
* or %NULL if not available
*/
const u8 *da;
/**
* bssid - BSSID of the received Probe Request frame or %NULL
* if not available
*/
const u8 *bssid;
/**
* ie - IEs from the Probe Request body
*/
const u8 *ie;
/**
* ie_len - Length of ie buffer in octets
*/
size_t ie_len;
/**
* signal - signal strength in dBm (or 0 if not available)
*/
int ssi_signal;
} rx_probe_req;
/**
* struct new_sta - Data for EVENT_NEW_STA events
*/
struct new_sta {
const u8 *addr;
} new_sta;
/**
* struct eapol_rx - Data for EVENT_EAPOL_RX events
*/
struct eapol_rx {
const u8 *src;
const u8 *data;
size_t data_len;
} eapol_rx;
/**
* signal_change - Data for EVENT_SIGNAL_CHANGE events
*/
struct wpa_signal_info signal_change;
/**
* struct best_channel - Data for EVENT_BEST_CHANNEL events
* @freq_24: Best 2.4 GHz band channel frequency in MHz
* @freq_5: Best 5 GHz band channel frequency in MHz
* @freq_overall: Best channel frequency in MHz
*
* 0 can be used to indicate no preference in either band.
*/
struct best_channel {
int freq_24;
int freq_5;
int freq_overall;
} best_chan;
struct unprot_deauth {
const u8 *sa;
const u8 *da;
u16 reason_code;
} unprot_deauth;
struct unprot_disassoc {
const u8 *sa;
const u8 *da;
u16 reason_code;
} unprot_disassoc;
/**
* struct low_ack - Data for EVENT_STATION_LOW_ACK events
* @addr: station address
*/
struct low_ack {
u8 addr[ETH_ALEN];
} low_ack;
/**
* struct p2p_dev_found - Data for EVENT_P2P_DEV_FOUND
*/
struct p2p_dev_found {
const u8 *addr;
const u8 *dev_addr;
const u8 *pri_dev_type;
const char *dev_name;
u16 config_methods;
u8 dev_capab;
u8 group_capab;
} p2p_dev_found;
/**
* struct p2p_go_neg_req_rx - Data for EVENT_P2P_GO_NEG_REQ_RX
*/
struct p2p_go_neg_req_rx {
const u8 *src;
u16 dev_passwd_id;
} p2p_go_neg_req_rx;
/**
* struct p2p_go_neg_completed - Data for EVENT_P2P_GO_NEG_COMPLETED
*/
struct p2p_go_neg_completed {
struct p2p_go_neg_results *res;
} p2p_go_neg_completed;
struct p2p_prov_disc_req {
const u8 *peer;
u16 config_methods;
const u8 *dev_addr;
const u8 *pri_dev_type;
const char *dev_name;
u16 supp_config_methods;
u8 dev_capab;
u8 group_capab;
} p2p_prov_disc_req;
struct p2p_prov_disc_resp {
const u8 *peer;
u16 config_methods;
} p2p_prov_disc_resp;
struct p2p_sd_req {
int freq;
const u8 *sa;
u8 dialog_token;
u16 update_indic;
const u8 *tlvs;
size_t tlvs_len;
} p2p_sd_req;
struct p2p_sd_resp {
const u8 *sa;
u16 update_indic;
const u8 *tlvs;
size_t tlvs_len;
} p2p_sd_resp;
/**
* struct ibss_peer_lost - Data for EVENT_IBSS_PEER_LOST
*/
struct ibss_peer_lost {
u8 peer[ETH_ALEN];
} ibss_peer_lost;
/**
* struct driver_gtk_rekey - Data for EVENT_DRIVER_GTK_REKEY
*/
struct driver_gtk_rekey {
const u8 *bssid;
const u8 *replay_ctr;
} driver_gtk_rekey;
/**
* struct client_poll - Data for EVENT_DRIVER_CLIENT_POLL_OK events
* @addr: station address
*/
struct client_poll {
u8 addr[ETH_ALEN];
} client_poll;
/**
* struct eapol_tx_status
* @dst: Original destination
* @data: Data starting with IEEE 802.1X header (!)
* @data_len: Length of data
* @ack: Indicates ack or lost frame
*
* This corresponds to hapd_send_eapol if the frame sent
* there isn't just reported as EVENT_TX_STATUS.
*/
struct eapol_tx_status {
const u8 *dst;
const u8 *data;
int data_len;
int ack;
} eapol_tx_status;
/**
* struct ch_switch
* @freq: Frequency of new channel in MHz
* @ht_enabled: Whether this is an HT channel
* @ch_offset: Secondary channel offset
*/
struct ch_switch {
int freq;
int ht_enabled;
int ch_offset;
} ch_switch;
};
/**
* wpa_supplicant_event - Report a driver event for wpa_supplicant
* @ctx: Context pointer (wpa_s); this is the ctx variable registered
* with struct wpa_driver_ops::init()
* @event: event type (defined above)
* @data: possible extra data for the event
*
* Driver wrapper code should call this function whenever an event is received
* from the driver.
*/
void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
union wpa_event_data *data);
/*
* The following inline functions are provided for convenience to simplify
* event indication for some of the common events.
*/
static inline void drv_event_assoc(void *ctx, const u8 *addr, const u8 *ie,
size_t ielen, int reassoc)
{
union wpa_event_data event;
os_memset(&event, 0, sizeof(event));
event.assoc_info.reassoc = reassoc;
event.assoc_info.req_ies = ie;
event.assoc_info.req_ies_len = ielen;
event.assoc_info.addr = addr;
wpa_supplicant_event(ctx, EVENT_ASSOC, &event);
}
static inline void drv_event_disassoc(void *ctx, const u8 *addr)
{
union wpa_event_data event;
os_memset(&event, 0, sizeof(event));
event.disassoc_info.addr = addr;
wpa_supplicant_event(ctx, EVENT_DISASSOC, &event);
}
static inline void drv_event_eapol_rx(void *ctx, const u8 *src, const u8 *data,
size_t data_len)
{
union wpa_event_data event;
os_memset(&event, 0, sizeof(event));
event.eapol_rx.src = src;
event.eapol_rx.data = data;
event.eapol_rx.data_len = data_len;
wpa_supplicant_event(ctx, EVENT_EAPOL_RX, &event);
}
/* driver_common.c */
void wpa_scan_results_free(struct wpa_scan_results *res);
/* Convert wpa_event_type to a string for logging */
const char * event_to_string(enum wpa_event_type event);
#endif /* DRIVER_H */
|