DtcntSrvWlanOtap.c
131 KB
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
/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2005
*
* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
/*****************************************************************************
*
* Filename:
* ---------
* DtcntSrvWlanOtap.c
*
* Project:
* --------
* MAUI
*
* Description:
* ------------
* This file is intended to provide the WLAN profile OTA
* provisioning handling services.
*
* Author:
* -------
* -------
*
*============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
*
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*============================================================================
****************************************************************************/
#ifdef __TCPIP__
#include "MMI_features.h"
//#ifdef __CCA_SUPPORT__
#ifdef __MMI_CCA_SUPPORT__
#include "DtcntSrv.h"
#include "cbm_consts.h"
#ifdef __MMI_WLAN_FEATURES__
#if defined(__MMI_WLAN_OTAP_OMAEXT__) || defined(__MMI_WLAN_OTAP_DMP__)
#include "Conversions.h" /* Conversion between different Unicode encodings. */
#include "MMI_features.h"
#include "DtcntSrvWlanOtap.h"
#include "DtcntSrvIprot.h"
#include "MMIDataType.h"
#include "kal_general_types.h"
#include "DtcntSrvIntStruct.h"
#include "Unicodexdcl.h"
#include "string.h"
#include "DtcntSrvGprot.h"
#include "mmi_frm_mem_gprot.h"
#include "kal_public_api.h"
#include "DtcntSrvIntDef.h"
#include "DtcntSrvProv.h"
#include "DebugInitDef_Int.h"
#include "supc_abm_msgs.h"
#include "MMI_conn_app_trc.h"
#include "kal_trace.h"
#include "mmi_frm_events_gprot.h"
#include "mmi_cb_mgr_gprot.h"
#include "DtcntSrvIntEnum.h"
#include "DtcntSrvWlan.h"
#include "nvram_common_defs.h"
#include "mmi_frm_nvram_gprot.h"
#include "stdlib.h"
#include "CcaSrvGprot.h"
/*****************************************************************************
* Define
*****************************************************************************/
/* Default profile's name. */
#define SRV_DTCNT_DEFAULT_PROF_NAME (L"New Profile")
/* Constants for auto renaming. */
#define SRV_DTCNT_DUP_NAME_SUFFIX_PATTERN (L"(00)") /* Appended pattern */
#define SRV_DTCNT_DUP_NAME_SUFFIX_LEN (4) /* Length of pattern */
#define SRV_DTCNT_DUP_NAME_SUFFIX_NUM (100) /* Num of values in pattern */
/*****************************************************************************
* Local Variable
*****************************************************************************/
/* Since the application has the property that it is only triggered when a
configuration document is arrived, we dynamically allocate the control
block to save memory. */
static srv_dtcnt_wlan_otap_struct *g_srv_dtcnt_wlan_otap = NULL;
static srv_dtcnt_prof_wlan_struct *g_srv_dtcnt_wlan_otap_active_prof_p = NULL;
/*****************************************************************************
* Local Function
*****************************************************************************/
static S32 srv_dtcnt_wlan_hex_to_dec(U8 input);
static MMI_BOOL srv_dtcnt_wlan_hex_to_psk(U8 *dst, const U8 *src, S32 len);
static MMI_BOOL srv_dtcnt_wlan_is_ascii_string(const U8 *utf8_str);
static MMI_BOOL srv_dtcnt_wlan_is_appended_pattern(const U8 *name, U8 *value);
static void srv_dtcnt_wlan_update_appended_pattern(U8 *dup_name, const U8 **name, U8 num_names);
static void srv_dtcnt_wlan_resolve_duplicate_name(U8 *dup_name, const U8 **name, U8 num_names);
static srv_dtcnt_wlan_otap_struct *srv_dtcnt_wlan_new_otap_cntx(U16 conf_id, S32 doc_hdl);
static void srv_dtcnt_wlan_free_otap_cntx(void);
static U8 srv_dtcnt_wlan_abort_otap_app(void *dummy);
static void srv_dtcnt_wlan_init_slim_profile(srv_dtcnt_wlan_slim_profile_struct *prof);
static S16 srv_dtcnt_wlan_new_otap_profile(srv_dtcnt_wlan_otap_struct *cntx);
static void srv_dtcnt_wlan_free_otap_profile(srv_dtcnt_wlan_otap_struct *cntx, S16 index);
static MMI_BOOL srv_dtcnt_wlan_validate_eap(const srv_dtcnt_wlan_slim_profile_struct *prof);
static MMI_BOOL srv_dtcnt_wlan_validate_wep_key(const srv_dtcnt_wlan_slim_profile_struct * prof);
static MMI_BOOL srv_dtcnt_wlan_validate_profile(const srv_dtcnt_wlan_slim_profile_struct *prof);
static void srv_dtcnt_wlan_provision_profile(srv_dtcnt_prof_wlan_struct *dst, const srv_dtcnt_wlan_slim_profile_struct *src);
static U8 srv_dtcnt_wlan_find_empty_profile(void);
static MMI_BOOL srv_dtcnt_wlan_is_empty_profile(U8 i);
static void srv_dtcnt_wlan_otap_install_start(void);
static void srv_dtcnt_wlan_otap_install_notify(MMI_BOOL replace_flag);
static void srv_dtcnt_wlan_otap_prof_name_list(void);
static MMI_BOOL srv_dtcnt_wlan_is_duplicate_name(S16 src_idx);
static void srv_dtcnt_wlan_auto_rename_profile(S16 src_idx);
static void srv_dtcnt_wlan_otap_install(void);
static void srv_dtcnt_wlan_otap_replace(U8 replace_idx);
static void srv_dtcnt_wlan_otap_skip(void);
static void srv_stcnt_wlan_otap_install_next(void);
static U8 srv_dtcnt_wlan_install_profiles(void);
static void srv_dtcnt_wlan_otap_done_notify(U8 num_installed);
/* Use OMA extension OTAP spec. */
#if defined(__MMI_WLAN_OTAP_OMAEXT__)
static U32 srv_dtcnt_wlan_base64_decoder(S8 *dst, U32 dst_size, const S8 *src, U32 src_size);
static MMI_BOOL srv_dtcnt_wlan_has_otap_profile(cca_iterator_struct *param_list);
static cca_status_enum srv_dtcnt_wlan_proc_cca_param_wepkey(
const cca_core_data_struct *param,
srv_dtcnt_wlan_slim_profile_struct *prof);
static cca_status_enum srv_dtcnt_wlan_proc_cca_param_eap(
const cca_core_data_struct *param,
srv_dtcnt_wlan_slim_profile_struct *prof);
static cca_status_enum srv_dtcnt_wlan_proc_cca_param_wlan(
const cca_core_data_struct *param,
srv_dtcnt_wlan_slim_profile_struct *prof);
static cca_status_enum srv_dtcnt_wlan_proc_cca_param_napdef(
const cca_core_data_struct *param,
srv_dtcnt_wlan_otap_struct *cntx);
static cca_status_enum srv_dtcnt_wlan_proc_cca_nodes(
S32 doc_hdl,
S32 node_hdl,
U16 symbol,
cca_iterator_struct *param_list,
void *user_data);
/* Use the proprietary OTAP spec. */
#elif defined(__MMI_WLAN_OTAP_DMP__)
static cca_status_enum srv_dtcnt_wlan_proc_cca_node_profile(
cca_iterator_struct *param_list,
srv_dtcnt_wlan_slim_profile_struct *prof);
static cca_status_enum srv_dtcnt_wlan_proc_cca_param_profile(
const cca_core_data_struct *param,
srv_dtcnt_wlan_slim_profile_struct *prof);
static cca_status_enum srv_dtcnt_wlan_proc_cca_nodes(
S32 doc_hdl,
S32 node_hdl,
U16 symbol,
cca_iterator_struct *param_list,
void *user_data);
#endif /* ! (defined(__MMI_WLAN_OTAP_OMAEXT__) || defined(__MMI_WLAN_OTAP_DMP__)) */
/*****************************************************************************
* Global Variable
*****************************************************************************/
extern srv_dtcnt_prof_wlan_struct g_srv_dtcnt_wlan_prof_list[SRV_DTCNT_MAX_WLAN_ACCOUNT_NUM];
extern srv_dtcnt_prof_wlan_struct *g_srv_dtcnt_wlan_prof_list_p[SRV_DTCNT_MAX_WLAN_ACCOUNT_NUM];
extern srv_dtcnt_wlan_setting_struct g_srv_dtcnt_wlan_setting_ctx;
extern void pbkdf2_sha1(
const char *passphrase,
const char *ssid,
kal_uint16 ssid_len,
int iterations,
kal_uint8 *buf,
kal_uint16 buflen);
#define WLAN_OTAP_STATIC_APIs
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_hex_to_dec
* DESCRIPTION
* This function converts a hexadecimal character to its decimal value.
* PARAMETERS
* input [IN] Input hexadecimal character
* RETURNS
* If input is a hexadecimal character, return its decimal value. Otherwise,
* return -1.
*****************************************************************************/
S32 srv_dtcnt_wlan_hex_to_dec(U8 input)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (input >= '0' && input <= '9')
{
return input - '0';
}
else if (input >= 'a' && input <= 'f')
{
return input - 'a' + 10;
}
else if (input >= 'A' && input <= 'F')
{
return input - 'A' + 10;
}
else
{
return -1;
}
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_hex_to_psk
* DESCRIPTION
* This function converts a hexadecimal character string to the pre-shared
* key, where each hexadecimal character represents 4-bits in the destination.
* PARAMETERS
* dst [OUT] Output raw data
* src [IN] Input hexadecimal character string
* len [IN] Length of the string
* RETURNS
* On success, return TRUE. On error, return FALSE.
*****************************************************************************/
MMI_BOOL srv_dtcnt_wlan_hex_to_psk(U8 *dst, const U8 *src, S32 len)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 msb, lsb;
S32 ret;
S32 i;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (len % 2 != 0)
{
return MMI_FALSE;
}
for (i = 0; i < len; i += 2)
{
if ((ret = srv_dtcnt_wlan_hex_to_dec(src[i])) < 0)
{
return MMI_FALSE;
}
msb= (U8)ret;
if ((ret = srv_dtcnt_wlan_hex_to_dec(src[i + 1])) < 0)
{
return MMI_FALSE;
}
lsb = (U8)ret;
dst[i / 2] = (msb << 4) + lsb;
}
return MMI_TRUE;
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_is_ascii_string
* DESCRIPTION
* This function checks whether the input UTF-8 encoded string is an ASCII
* string.
* PARAMETERS
* utf8_str [IN] Input UTF-8 encoded string
* RETURNS
* If input string is ASCII string, return TRUE. Otherwise, return FALSE.
*****************************************************************************/
MMI_BOOL srv_dtcnt_wlan_is_ascii_string(const U8 *utf8_str)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* If this is an ASCII string, each octet should be an ASCII character. */
for ( ; *utf8_str != '\0'; ++utf8_str)
{
if (*utf8_str > 0x7F)
{
return MMI_FALSE;
}
}
return MMI_TRUE;
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_is_appended_pattern
* DESCRIPTION
* This function examines whether the name has an appended pattern (\d\d).
* If the name has the pattern and value is not NULL, set value to \d\d.
* PARAMETERS
* name [IN] Name to be examined
* value [OUT] Return the value of \d\d
* RETURNS
* If name has an appended pattern, return TRUE. Otherwise, return FALSE.
*****************************************************************************/
MMI_BOOL srv_dtcnt_wlan_is_appended_pattern(const U8 *name, U8 *value)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
const U8 *start, *end, *iter;
S32 str_len;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
str_len = mmi_ucs2strlen((S8 *)name);
/* Examine whether the name has the appended pattern. */
if (str_len < SRV_DTCNT_DUP_NAME_SUFFIX_LEN)
{
return MMI_FALSE;
}
else
{
start = name + (str_len - SRV_DTCNT_DUP_NAME_SUFFIX_LEN) * ENCODING_LENGTH;
end = name + (str_len - 1) * ENCODING_LENGTH;
if (*start != '(' || *(start + 1) != '\0')
{
return MMI_FALSE;
}
if (*end != ')' || *(end + 1) != '\0')
{
return MMI_FALSE;
}
for (iter = start + ENCODING_LENGTH; iter != end; iter += ENCODING_LENGTH)
{
if (*iter < '0' || *iter > '9' || *(iter + 1) != '\0')
{
return MMI_FALSE;
}
}
}
/* Save the value in the pattern. */
if (value != NULL)
{
start = name + (str_len - 3) * ENCODING_LENGTH; /* decimal */
end = name + (str_len - 2) * ENCODING_LENGTH; /* unit */
*value = (*start - '0') * 10 + (*end - '0');
}
return MMI_TRUE;
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_update_appended_pattern
* DESCRIPTION
* The function updates the values of the pattern (\d\d) in the duplicate
* name.
* PARAMETERS
* dup_name [IN/OUT] The name to be updated
* name [IN] The other names
* num_names [IN] Number of the other names
* RETURNS
* void
*****************************************************************************/
void srv_dtcnt_wlan_update_appended_pattern(U8 *dup_name, const U8 **name, U8 num_names)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 map[SRV_DTCNT_DUP_NAME_SUFFIX_NUM];
U8 value, min;
S32 str_len;
U8 i;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* Initialize the map. All numbers are not used. */
memset(map, 0, SRV_DTCNT_DUP_NAME_SUFFIX_NUM);
str_len = mmi_ucs2strlen((S8 *)dup_name);
/* Mark used values as one. */
for (i = 0; i < num_names; ++i)
{
/* String length must be identical. */
if (str_len != mmi_ucs2strlen((S8 *)name[i]))
{
continue;
}
/* Prefix of names must be the same as the prefix of duplicate name. */
if (mmi_ucs2ncmp((S8 *)dup_name, (S8 *)name[i], str_len - SRV_DTCNT_DUP_NAME_SUFFIX_LEN) != 0)
{
continue;
}
if (srv_dtcnt_wlan_is_appended_pattern(name[i], &value) == MMI_TRUE)
{
map[value] = 1;
}
}
/* Find the minimum unused position. If all values are used, still produce
a pattern with a duplicate value 99. */
min = SRV_DTCNT_DUP_NAME_SUFFIX_NUM - 1;
for (i = 1; i < SRV_DTCNT_DUP_NAME_SUFFIX_NUM; ++i)
{
if (map[i] == 0)
{
min = i;
break;
}
}
/* Update the value in the pattern. */
*(dup_name + (str_len - 2) * ENCODING_LENGTH) = (min % 10) + '0';
*(dup_name + (str_len - 3) * ENCODING_LENGTH) = (min / 10) + '0';
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_resolve_duplicate_name
* DESCRIPTION
* This function updates the duplicate name according to the circumstance of
* the name array.
* PARAMETERS
* dup_name [IN/OUT] The duplicate name to be updated
* name [IN] The other names
* num_names [IN] Number of the other names
* RETURNS
* void
*****************************************************************************/
void srv_dtcnt_wlan_resolve_duplicate_name(U8 *dup_name, const U8 **name, U8 num_names)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S32 str_len;
U8 *ptr;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* If tail does not have an appended pattern (\d\d), append a pattern. */
if (srv_dtcnt_wlan_is_appended_pattern(dup_name, NULL) == MMI_FALSE)
{
str_len = mmi_ucs2strlen((S8 *)dup_name);
/* Whether spaces are enough for appending the pattern (\d\d). */
if (str_len + SRV_DTCNT_DUP_NAME_SUFFIX_LEN > SRV_DTCNT_PROF_MAX_WLAN_PROF_NAME_LEN)
{
/* Spaces are not enough. Truncate the tail. */
ptr = dup_name + (SRV_DTCNT_PROF_MAX_WLAN_PROF_NAME_LEN - SRV_DTCNT_DUP_NAME_SUFFIX_LEN) * ENCODING_LENGTH;
*(ptr) = '\0';
*(ptr + 1) = '\0';
}
mmi_ucs2cat((S8 *)dup_name, (S8 *)SRV_DTCNT_DUP_NAME_SUFFIX_PATTERN);
}
/* Update the values in the pattern. */
srv_dtcnt_wlan_update_appended_pattern(dup_name, name, num_names);
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_new_otap_cntx
* DESCRIPTION
* This function allocates and initializes the control block of WLAN OTA
* provisioning application.
* PARAMETERS
* conf_id [IN] CCA configuration ID
* doc_hdl [IN] Configuration document handle
* RETURNS
* On success, return the address of control block. On error, return NULL.
*****************************************************************************/
srv_dtcnt_wlan_otap_struct *srv_dtcnt_wlan_new_otap_cntx(U16 conf_id, S32 doc_hdl)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
srv_dtcnt_wlan_otap_struct *cntx;
U8 i;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* Allocate the control block. Must be successful. */
cntx = (srv_dtcnt_wlan_otap_struct *)OslMalloc(sizeof(srv_dtcnt_wlan_otap_struct));
if (cntx == NULL)
{
return NULL;
}
/* Clear the entire structure. */
memset(cntx, 0, sizeof(srv_dtcnt_wlan_otap_struct));
/* Save the identifier for this configuration process. */
cntx->conf_id = conf_id;
cntx->doc_hdl = doc_hdl;
/* Allow to process nodes and parameters until a NAPDEF node comes. */
cntx->is_active = MMI_FALSE;
/* Initialize the index for replacement to an invalid index. */
for (i = 0; i < SRV_DTCNT_MAX_WLAN_OTA_PROF_NUM; ++i)
{
cntx->dst_idx[i] = -1;
}
/* Initialize the index for replacement to an invalid index. */
for (i = 0; i < SRV_DTCNT_MAX_WLAN_ACCOUNT_NUM; ++i)
{
cntx->src_idx[i] = -1;
cntx->sel_dst_idx[i] = -1;
}
return cntx;
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_free_otap_cntx
* DESCRIPTION
* The function frees memory of the control block, and clears the global ptr.
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void srv_dtcnt_wlan_free_otap_cntx(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 i;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* Nothing to do. Return. */
if (g_srv_dtcnt_wlan_otap == NULL)
{
return;
}
/* Free all profiles. */
for (i = 0; i < g_srv_dtcnt_wlan_otap->num_profiles; ++i)
{
OslMfree(g_srv_dtcnt_wlan_otap->profile[i]);
}
/* Free the control block. */
OslMfree(g_srv_dtcnt_wlan_otap);
g_srv_dtcnt_wlan_otap = NULL;
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_abort_otap_app
* DESCRIPTION
* This function should be called to exit the WLAN OTAP application. It is
* registered as a delete screen callback such that it can be called when END
* key is pressed to return to idle screen.
* PARAMETERS
* dummy [IN] Dummy parameter. Always be zero.
* RETURNS
* When END key is pressed to return to idle screen, return TRUE to stop
* delete other nodes in history stack. Here, always return FALSE.
*****************************************************************************/
U8 srv_dtcnt_wlan_abort_otap_app(void *dummy)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* Terminated. Send a response back to CCA and free memory. */
switch (g_srv_dtcnt_wlan_otap->cur_status)
{
case 0:
case 5:
srv_dtcnt_send_cca_app_configure_rsp(g_srv_dtcnt_wlan_otap->conf_id, g_srv_dtcnt_wlan_otap->doc_hdl, CCA_STATUS_ENDKEY_PRESSED);
break;
case 2:
srv_dtcnt_send_cca_app_configure_rsp(g_srv_dtcnt_wlan_otap->conf_id, g_srv_dtcnt_wlan_otap->doc_hdl, CCA_STATUS_ENDKEY_SETTING_INSTALLED);
break;
case 3:
srv_dtcnt_send_cca_app_configure_rsp(g_srv_dtcnt_wlan_otap->conf_id, g_srv_dtcnt_wlan_otap->doc_hdl, CCA_STATUS_ENDKEY_SETTING_SKIPPED);
break;
case 4:
srv_dtcnt_send_cca_app_configure_rsp(g_srv_dtcnt_wlan_otap->conf_id, g_srv_dtcnt_wlan_otap->doc_hdl, CCA_STATUS_ENDKEY_INVALID_SETTING);
break;
}
srv_dtcnt_wlan_free_otap_cntx();
return MMI_FALSE;
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_init_slim_profile
* DESCRIPTION
* This function initializes a slim WLAN profile.
* PARAMETERS
* prof [OUT] Profile to be initialized
* RETURNS
* void
*****************************************************************************/
void srv_dtcnt_wlan_init_slim_profile(srv_dtcnt_wlan_slim_profile_struct *prof)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
memset(prof, 0, sizeof(srv_dtcnt_wlan_slim_profile_struct));
mmi_ucs2cpy((S8 *)prof->name, (S8 *)SRV_DTCNT_DEFAULT_PROF_NAME);
prof->network_type = SRV_DTCNT_WLAN_NETWORK_TYPE_INFRA;
prof->encrypt_mode = SRV_DTCNT_WLAN_ENCRYPT_MODE_NONE;
prof->auth_mode = SRV_DTCNT_WLAN_AUTH_MODE_OPEN;
prof->wep_key_index = SRV_DTCNT_MAX_WEP_KEY_NUM; /* Invalid index */
prof->wep_key_len = SRV_DTCNT_WLAN_WEP_KEY_ENCRYPT_TOTAL; /* Invalid key len */
prof->wep_key_format = SRV_DTCNT_WLAN_WEP_KEY_FORMAT_ASCII;
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_new_otap_profile
* DESCRIPTION
* This function allocates a temporary storage for WLAN profile. And it will
* turn on the flag such that we can process subsequent nodes/parameters
* again.
* PARAMETERS
* cntx [IN] control block for WLAN OTA provisioning
* RETURNS
* On success, return the index of the newly allocated profile. Otherwise,
* return -1, i.e., an invalid index.
*****************************************************************************/
S16 srv_dtcnt_wlan_new_otap_profile(srv_dtcnt_wlan_otap_struct *cntx)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S16 index;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* No more temporary profile storage. */
if (cntx->num_profiles == SRV_DTCNT_MAX_WLAN_OTA_PROF_NUM)
{
return -1;
}
/* Obtain the index. */
index = cntx->num_profiles;
/* Allocate memory for the profile. */
cntx->profile[index] = (srv_dtcnt_wlan_slim_profile_struct *)OslMalloc(sizeof(srv_dtcnt_wlan_slim_profile_struct));
if (cntx->profile[index] == NULL)
{
return -1;
}
/* Initialize the allocated slim WLAN profile. */
srv_dtcnt_wlan_init_slim_profile(cntx->profile[index]);
/* Now, we can update the number of profiles. */
++cntx->num_profiles;
return index;
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_free_otap_profile
* DESCRIPTION
* This function frees the specified profile in the control block.
* PARAMETERS
* cntx [IN] Control block of WLAN OTA provisioning
* index [IN] Index of the profile to be freed
* RETURNS
* void
*****************************************************************************/
void srv_dtcnt_wlan_free_otap_profile(srv_dtcnt_wlan_otap_struct *cntx, S16 index)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S16 i;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* Whether the index is legal. */
if (index >= cntx->num_profiles)
{
MMI_ASSERT(0);
}
/* Release the specified profile. */
OslMfree(cntx->profile[index]);
/* Shift the other profiles. */
for (i = index + 1; i < cntx->num_profiles; ++i)
{
cntx->profile[i - 1] = cntx->profile[i];
}
cntx->profile[cntx->num_profiles - 1] = NULL;
/* Now, we can update the number of profiles. */
--cntx->num_profiles;
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_validate_eap
* DESCRIPTION
* The function validates whether a correct EAP setting is presented.
* PARAMETERS
* prof [IN] A provisioned profile
* RETURNS
* On success, return TRUE. Otherwise, return FALSE.
*****************************************************************************/
MMI_BOOL srv_dtcnt_wlan_validate_eap(const srv_dtcnt_wlan_slim_profile_struct *prof)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* Currently, only EAP-SIM is supported. */
if (prof->eap_auth_type != WLAN_EAP_SIM)
{
return MMI_FALSE;
}
/* Whether the username/password have been provided. */
if (strlen((S8 *)prof->username) == 0 || strlen((S8 *)prof->password) == 0)
{
return MMI_FALSE;
}
return MMI_TRUE;
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_validate_wep_key
* DESCRIPTION
* The function validates whether a correct WEP key is presented.
* PARAMETERS
* prof [IN] A provisioned profile
* RETURNS
* On success, return TRUE. Otherwise, return FALSE.
*****************************************************************************/
MMI_BOOL srv_dtcnt_wlan_validate_wep_key(const srv_dtcnt_wlan_slim_profile_struct *prof)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S32 str_len;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* Whether the wep key index is legal. */
if (prof->wep_key_index >= SRV_DTCNT_MAX_WEP_KEY_NUM)
{
return MMI_FALSE;
}
/* Return TRUE if WEP setting are meaningful. */
str_len = strlen((S8 *)prof->wep_key);
if (prof->wep_key_len == SRV_DTCNT_WLAN_WEP_KEY_ENCRYPT_64 &&
prof->wep_key_format == SRV_DTCNT_WLAN_WEP_KEY_FORMAT_ASCII)
{
return str_len == 5? MMI_TRUE: MMI_FALSE; /* WEP64, ASCII */
}
else if (prof->wep_key_len == SRV_DTCNT_WLAN_WEP_KEY_ENCRYPT_64 &&
prof->wep_key_format == SRV_DTCNT_WLAN_WEP_KEY_FORMAT_HEX)
{
return str_len == 10? MMI_TRUE: MMI_FALSE; /* WEP64, HEX */
}
else if (prof->wep_key_len == SRV_DTCNT_WLAN_WEP_KEY_ENCRYPT_128 &&
prof->wep_key_format == SRV_DTCNT_WLAN_WEP_KEY_FORMAT_ASCII)
{
return str_len == 13? MMI_TRUE: MMI_FALSE; /* WEP128, ASCII */
}
else if (prof->wep_key_len == SRV_DTCNT_WLAN_WEP_KEY_ENCRYPT_128 &&
prof->wep_key_format == SRV_DTCNT_WLAN_WEP_KEY_FORMAT_HEX)
{
return str_len == 26? MMI_TRUE: MMI_FALSE; /* WEP128, HEX */
}
/* All other situations are illegal. Return FALSE. */
return MMI_FALSE;
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_validate_profile
* DESCRIPTION
* The function validates a provisioned profile.
* PARAMETERS
* prof [IN] A provisioned profile
* RETURNS
* On success, return TRUE. Otherwise, return FALSE.
*****************************************************************************/
MMI_BOOL srv_dtcnt_wlan_validate_profile(const srv_dtcnt_wlan_slim_profile_struct *prof)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* NAPDEF node's node ID */
if (mmi_chset_utf8_strlen((kal_uint8 *)prof->node_id) == 0)
{
return MMI_FALSE;
}
/* Name */
if (mmi_ucs2strlen((S8 *)prof->name) == 0)
{
return MMI_FALSE;
}
/* SSID */
if (prof->ssid_len == 0)
{
return MMI_FALSE;
}
/* Network type. Ad-hoc network does not has authentication server.
IEEE802.1X and WPA need authentication server and can't be used. */
if (prof->network_type == SRV_DTCNT_WLAN_NETWORK_TYPE_ADHOC &&
(prof->auth_mode == SRV_DTCNT_WLAN_AUTH_MODE_IEEE8021X ||
prof->auth_mode == SRV_DTCNT_WLAN_AUTH_MODE_WPA_WPA2_MIX))
{
return MMI_FALSE;
}
/*
* Authentication mode
*/
switch (prof->auth_mode)
{
case SRV_DTCNT_WLAN_AUTH_MODE_OPEN:
/* OPEN must turn on NONE or WEP encryption. */
if (prof->encrypt_mode != SRV_DTCNT_WLAN_ENCRYPT_MODE_NONE &&
prof->encrypt_mode != SRV_DTCNT_WLAN_ENCRYPT_MODE_WEP)
{
return MMI_FALSE;
}
break;
case SRV_DTCNT_WLAN_AUTH_MODE_WEP:
/* SHARED must turn on NONE or WEP encryption. */
if (prof->encrypt_mode != SRV_DTCNT_WLAN_ENCRYPT_MODE_NONE &&
prof->encrypt_mode != SRV_DTCNT_WLAN_ENCRYPT_MODE_WEP)
{
return MMI_FALSE;
}
/* SHARED alwalys needs a correct WEP key. */
if (srv_dtcnt_wlan_validate_wep_key(prof) == MMI_FALSE) {
return MMI_FALSE;
}
break;
case SRV_DTCNT_WLAN_AUTH_MODE_IEEE8021X:
/* IEEE802.1X must turn on WEP encryption. */
if (prof->encrypt_mode != SRV_DTCNT_WLAN_ENCRYPT_MODE_WEP)
{
return MMI_FALSE;
}
if (srv_dtcnt_wlan_validate_eap(prof) == MMI_FALSE)
{
return MMI_FALSE;
}
break;
case SRV_DTCNT_WLAN_AUTH_MODE_WPA_WPA2_MIX:
/* WPA must turn on TKIP or AES encryption. */
if (prof->encrypt_mode != SRV_DTCNT_WLAN_ENCRYPT_MODE_TKIP &&
prof->encrypt_mode != SRV_DTCNT_WLAN_ENCRYPT_MODE_AES)
{
return MMI_FALSE;
}
if (srv_dtcnt_wlan_validate_eap(prof) == MMI_FALSE)
{
return MMI_FALSE;
}
break;
case SRV_DTCNT_WLAN_AUTH_MODE_WPA_WPA2_MIX_PSK:
/* WPA-PSK must turn on TKIP or AES. */
if (prof->encrypt_mode != SRV_DTCNT_WLAN_ENCRYPT_MODE_TKIP &&
prof->encrypt_mode != SRV_DTCNT_WLAN_ENCRYPT_MODE_AES)
{
return MMI_FALSE;
}
break;
default:
return MMI_FALSE; /* Discard profile */
}
/*
* Encryption mode
*/
switch (prof->encrypt_mode)
{
case SRV_DTCNT_WLAN_ENCRYPT_MODE_NONE:
break;
case SRV_DTCNT_WLAN_ENCRYPT_MODE_WEP:
/* Whether WEP key is correctly presented except under IEEE802.1X,
which provides the key automatically. */
if (prof->auth_mode != SRV_DTCNT_WLAN_AUTH_MODE_IEEE8021X &&
srv_dtcnt_wlan_validate_wep_key(prof) == MMI_FALSE)
{
return MMI_FALSE;
}
break;
case SRV_DTCNT_WLAN_ENCRYPT_MODE_TKIP:
case SRV_DTCNT_WLAN_ENCRYPT_MODE_AES:
/* Whether psk or passphrase is presented. Note that WPA don't
need to provide key here. It uses dynamic key. */
if (prof->auth_mode != SRV_DTCNT_WLAN_AUTH_MODE_WPA_WPA2_MIX &&
prof->psk[32] == 0 && prof->passphrase[0] == '\0')
{
return MMI_FALSE;
}
break;
default:
return MMI_FALSE; /* Discard profile */
}
return MMI_TRUE;
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_provision_profile
* DESCRIPTION
* This function setups a WLAN profile from a slim profile.
* PARAMETERS
* dst [OUT] Destination profile
* src [IN] Source slim profile
* RETURNS
* void
*****************************************************************************/
void srv_dtcnt_wlan_provision_profile(srv_dtcnt_prof_wlan_struct *dst, const srv_dtcnt_wlan_slim_profile_struct *src)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* Clear the profile. */
srv_dtcnt_wlan_init_profile(dst);
mmi_ucs2cpy((S8 *)dst->ProfName, (S8 *)src->name); /* Name */
dst->ssid_len = src->ssid_len; /* SSID length */
memcpy(dst->ssid, src->ssid, dst->ssid_len); /* SSID */
dst->network_type = (srv_dtcnt_wlan_network_type_enum)src->network_type; /* Network type */
dst->encrypt_mode = (srv_dtcnt_wlan_encrypt_mode_enum)src->encrypt_mode; /* Encryption */
dst->auth_mode = (srv_dtcnt_wlan_auth_mode_enum)src->auth_mode; /* Authentication */
/* WEP settings */
if (dst->auth_mode == SRV_DTCNT_WLAN_AUTH_MODE_WEP ||
dst->encrypt_mode == SRV_DTCNT_WLAN_ENCRYPT_MODE_WEP)
{
dst->wep_key_index = src->wep_key_index;
dst->wep_key_len = src->wep_key_len;
dst->wep_key_format = (srv_dtcnt_wlan_wep_key_format_enum)src->wep_key_format;
strcpy((S8 *)dst->wep_key, (S8 *)src->wep_key);
}
/* Pre-shared key settings. */
if (dst->auth_mode == SRV_DTCNT_WLAN_AUTH_MODE_WPA_WPA2_MIX_PSK)
{
/* Default uses psk; otherwise, compute psk from passphrase. */
if (src->psk[32] != 0)
{
memcpy(dst->psk, src->psk, 32);
}
else
{
strcpy((S8 *)dst->passphrase, (S8 *)src->passphrase);
#ifdef __MTK_TARGET__
pbkdf2_sha1(
(S8 *)dst->passphrase,
(S8 *)dst->ssid,
dst->ssid_len,
4096,
dst->psk,
32);
#else
memcpy(dst->psk, src->passphrase, 32);
#endif
}
/* PSK is always provided. Turn on the flag. */
dst->psk[32] = 1;
}
/* EAP settings. */
if (dst->auth_mode == SRV_DTCNT_WLAN_AUTH_MODE_IEEE8021X ||
dst->auth_mode == SRV_DTCNT_WLAN_AUTH_MODE_WPA_WPA2_MIX)
{
dst->eap_auth_type= src->eap_auth_type;
strcpy((S8 *)dst->username, (S8 *)src->username);
strcpy((S8 *)dst->password, (S8 *)src->password);
}
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_find_empty_profile
* DESCRIPTION
* This function finds and remembers an empty profile. If there is no empty
* profile, entry replacement process.
* PARAMETERS
* void
* RETURNS
* profile slot index < SRV_DTCNT_MAX_WLAN_ACCOUNT_NUM : empty slot id
* profile slot index = SRV_DTCNT_MAX_WLAN_ACCOUNT_NUM : no empty slot
*****************************************************************************/
U8 srv_dtcnt_wlan_find_empty_profile(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 i;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* Find an empty profile. */
for (i = 0; i < SRV_DTCNT_MAX_WLAN_ACCOUNT_NUM; ++i)
{
/* Whether the profile is empty. */
if (srv_dtcnt_wlan_is_empty_profile(i) == MMI_TRUE)
{
return i;
}
}
return SRV_DTCNT_MAX_WLAN_ACCOUNT_NUM;
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_is_empty_profile
* DESCRIPTION
* This function examines whether the i-th slot in the profile list is used.
* PARAMETERS
* i [IN] Used to specify i-th profile
* RETURNS
* Return TRUE when profile is empty. Otherwise, return FALSE.
*****************************************************************************/
MMI_BOOL srv_dtcnt_wlan_is_empty_profile(U8 i)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* The profile is used originally. */
if (g_srv_dtcnt_wlan_prof_list[i].ssid_len != 0)
{
return MMI_FALSE;
}
/* The profile is selected during the OTA provisioning. */
if (g_srv_dtcnt_wlan_otap->src_idx[i] >= 0)
{
return MMI_FALSE;
}
return MMI_TRUE;
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_otap_install_start
* DESCRIPTION
* This function sends the processing wlan ota profile information to APP.
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void srv_dtcnt_wlan_otap_install_start(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_TRACE(MMI_CONN_TRC_G6_DTCNT, SRV_DTCNT_WLAN_OTAP_INSTALL_START);
/* notify DA APP for installation */
if (srv_dtcnt_wlan_find_empty_profile() == SRV_DTCNT_MAX_WLAN_ACCOUNT_NUM)
{
srv_dtcnt_wlan_otap_install_notify(MMI_TRUE);
}
else
{
srv_dtcnt_wlan_otap_install_notify(MMI_FALSE);
}
}
void srv_dtcnt_wlan_otap_install_notify(MMI_BOOL replace_flag)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
srv_dtcnt_wlan_slim_profile_struct *prof;
srv_dtcnt_prov_ind_evt_struct evt;
srv_dtcnt_prov_wlan_ind_struct *tmp_ind;
srv_dtcnt_prov_ind_cb_func_ptr callback;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_FRM_INIT_EVENT(&evt, EVT_ID_SRV_DTCNT_PROV_IND);
/* Obtain the current interesting profile. */
prof = (srv_dtcnt_wlan_slim_profile_struct *)g_srv_dtcnt_wlan_otap->profile[g_srv_dtcnt_wlan_otap->iter];
/* construct prov wlan ind for DA APP */
tmp_ind = OslMalloc(sizeof(srv_dtcnt_prov_wlan_ind_struct));
tmp_ind->AccountName = prof->name;
tmp_ind->SSID = prof->ssid;
tmp_ind->network_type = (srv_dtcnt_wlan_network_type_enum)prof->network_type;
tmp_ind->auth_mode = (srv_dtcnt_wlan_auth_mode_enum)prof->auth_mode;
tmp_ind->encrypt_mode = (srv_dtcnt_wlan_encrypt_mode_enum)prof->encrypt_mode;
evt.prof_data = tmp_ind;
if (replace_flag)
{
srv_dtcnt_wlan_otap_prof_name_list();
kal_mem_cpy(evt.prof_name_list, g_srv_dtcnt_wlan_otap->prof_name_list, SRV_DTCNT_MAX_WLAN_ACCOUNT_NUM * sizeof(PU8));
}
/* construct event struct */
evt.num_profs = g_srv_dtcnt_wlan_otap->num_profiles;
evt.prov_ind = SRV_DTCNT_PROV_IND_WLAN;
evt.prov_type = (replace_flag)? SRV_DTCNT_PROV_TYPE_REPLACE : SRV_DTCNT_PROV_TYPE_ADD;
evt.cur_prof_idx = g_srv_dtcnt_wlan_otap->iter;
callback = (srv_dtcnt_prov_ind_cb_func_ptr)srv_dtcnt_wlan_prov_ind_callback;
evt.cnf_callback = callback;
MMI_FRM_CB_EMIT_POST_EVENT_EX((mmi_event_struct *)&evt, srv_dtcnt_wlan_event_callback, (void *)evt.prof_data);
}
void srv_dtcnt_wlan_otap_prof_name_list(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S16 sel_idx, i_src_idx;
U8 i, count = 0;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
kal_mem_set(g_srv_dtcnt_wlan_otap->prof_name_list, 0, SRV_DTCNT_MAX_WLAN_ACCOUNT_NUM * sizeof(PU8));
for (i = 0; i < SRV_DTCNT_MAX_WLAN_ACCOUNT_NUM; ++i)
{
if (g_srv_dtcnt_wlan_prof_list[i].ssid_len == 0)
{
/* The slot is originally empty, but has been chosen to install
incoming profile during OTA provisioning. */
i_src_idx = g_srv_dtcnt_wlan_otap->src_idx[i];
sel_idx = g_srv_dtcnt_wlan_setting_ctx.profile_id_count + (count++);
g_srv_dtcnt_wlan_otap->prof_name_list[sel_idx - CBM_DEFAULT_ACCT_ID - 1] = g_srv_dtcnt_wlan_otap->profile[i_src_idx]->name;
g_srv_dtcnt_wlan_otap->sel_dst_idx[sel_idx - CBM_DEFAULT_ACCT_ID - 1] = i;
}
else
{
/* The profile is originally used. */
i_src_idx = g_srv_dtcnt_wlan_otap->src_idx[i];
sel_idx = g_srv_dtcnt_wlan_prof_list[i].priority - 1;
/* Whether the slot has been chosen to install incoming profiles. */
if (i_src_idx >= 0)
{
g_srv_dtcnt_wlan_otap->prof_name_list[sel_idx] = g_srv_dtcnt_wlan_otap->profile[i_src_idx]->name;
}
else
{
g_srv_dtcnt_wlan_otap->prof_name_list[sel_idx] = (U8 *)g_srv_dtcnt_wlan_prof_list[i].ProfName;
}
g_srv_dtcnt_wlan_otap->sel_dst_idx[sel_idx] = i;
}
}
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_is_duplicate_name
* DESCRIPTION
* This function examines whether the specified provisioning profile has a
* duplicate name.
* PARAMETERS
* src_idx [IN] Used to specify the profile
* RETURNS
* When there is a duplication, return TRUE. Otherwise, return FALSE.
*****************************************************************************/
MMI_BOOL srv_dtcnt_wlan_is_duplicate_name(S16 src_idx)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 *name;
S16 dst_idx, i_src_idx;
U8 i;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* Obtain info about this specified provisioned profile. */
name = g_srv_dtcnt_wlan_otap->profile[src_idx]->name;
dst_idx = g_srv_dtcnt_wlan_otap->dst_idx[src_idx];
/* Check duplication by scanning all profiles. */
for (i = 0; i < SRV_DTCNT_MAX_WLAN_ACCOUNT_NUM; ++i)
{
/* Skip itself. */
if (dst_idx == i)
{
continue;
}
/* Obtain the name of the profile in the i-th slot at present. */
i_src_idx = g_srv_dtcnt_wlan_otap->src_idx[i];
if (i_src_idx >= 0)
{
/* i-th slot has been selected to install a incoming profile. */
if (mmi_ucs2cmp((S8 *)name, (S8 *)g_srv_dtcnt_wlan_otap->profile[i_src_idx]->name) == 0)
{
return MMI_TRUE;
}
}
else if (g_srv_dtcnt_wlan_prof_list[i].ssid_len != 0)
{
/* A profile exists in i-th slot before OTA provisioning. */
if (mmi_ucs2cmp((S8 *)name, (S8 *)g_srv_dtcnt_wlan_prof_list[i].ProfName) == 0)
{
return MMI_TRUE;
}
}
}
return MMI_FALSE;
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_auto_rename_profile
* DESCRIPTION
* This function renames the specified provisioned profile that has duplicate
* name.
* PARAMETERS
* src_idx [IN] Used to specified the profile
* RETURNS
* void
*****************************************************************************/
void srv_dtcnt_wlan_auto_rename_profile(S16 src_idx)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
const U16 *name[SRV_DTCNT_MAX_WLAN_ACCOUNT_NUM];
U8 num_names;
S16 dst_idx, i_src_idx;
U8 i;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* Collect the other profiles' names. */
num_names = 0;
dst_idx = g_srv_dtcnt_wlan_otap->dst_idx[src_idx];
for (i = 0; i < SRV_DTCNT_MAX_WLAN_ACCOUNT_NUM; ++i)
{
/* Skip itself. */
if (dst_idx == i)
{
continue;
}
/* Obtain the name of the profile in the i-th slot at present. */
i_src_idx = g_srv_dtcnt_wlan_otap->src_idx[i];
if (i_src_idx >= 0)
{
/* i-th slot has been selected to install an incoming profile. */
name[num_names++] = (U16 *)g_srv_dtcnt_wlan_otap->profile[i_src_idx]->name;
}
else if (g_srv_dtcnt_wlan_prof_list[i].ssid_len != 0)
{
/* A profile exists in i-th slot before OTA provisioning. */
name[num_names++] = (U16 *)(g_srv_dtcnt_wlan_prof_list[i].ProfName);
}
}
/* Auto renaming. */
srv_dtcnt_wlan_resolve_duplicate_name(g_srv_dtcnt_wlan_otap->profile[src_idx]->name, (const U8 **)name, num_names);
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_otap_install
* DESCRIPTION
* This function handles the install command from APP.
* PARAMETERS
* void
* RETURNS
* ret < 0 : install failed
* ret > 0 : the installed profile id
*****************************************************************************/
void srv_dtcnt_wlan_otap_install(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 i;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_TRACE(MMI_CONN_TRC_G6_DTCNT, SRV_DTCNT_WLAN_OTAP_INSTALL);
/* Find an empty profile. */
i = srv_dtcnt_wlan_find_empty_profile();
MMI_ASSERT(i < SRV_DTCNT_MAX_WLAN_ACCOUNT_NUM);
/* Remember the index of the empty profile. */
g_srv_dtcnt_wlan_otap->dst_idx[g_srv_dtcnt_wlan_otap->iter] = i;
g_srv_dtcnt_wlan_otap->src_idx[i] = g_srv_dtcnt_wlan_otap->iter;
/* Whether the profile's name is duplicate. */
if (srv_dtcnt_wlan_is_duplicate_name(g_srv_dtcnt_wlan_otap->iter) == MMI_TRUE)
{
srv_dtcnt_wlan_auto_rename_profile(g_srv_dtcnt_wlan_otap->iter);
}
g_srv_dtcnt_wlan_otap->cur_status = 2;
/* Go to the next profile if it is presented. */
srv_stcnt_wlan_otap_install_next();
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_otap_replace
* DESCRIPTION
* This function handles the install command from APP.
* PARAMETERS
* replace_idx : [IN] replace idx of profie name list
* RETURNS
* void
*****************************************************************************/
void srv_dtcnt_wlan_otap_replace(U8 replace_idx)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S16 src_idx, dst_idx;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_TRACE(MMI_CONN_TRC_G6_DTCNT, SRV_DTCNT_WLAN_OTAP_REPLACE, replace_idx);
/* The index of profile in profile list that plans to be replaced. */
dst_idx = g_srv_dtcnt_wlan_otap->sel_dst_idx[replace_idx];
/* Whether the profile has been selected to be replaced during OTA
provisioning. If yes, the previously provisioned profile is replaced
here and will not be install consequently. */
src_idx = g_srv_dtcnt_wlan_otap->src_idx[dst_idx];
if (src_idx >= 0)
{
g_srv_dtcnt_wlan_otap->dst_idx[src_idx] = -1;
}
/* Save the replacement result. */
g_srv_dtcnt_wlan_otap->src_idx[dst_idx] = g_srv_dtcnt_wlan_otap->iter;
g_srv_dtcnt_wlan_otap->dst_idx[g_srv_dtcnt_wlan_otap->iter] = dst_idx;
/* Whether the profile's name is duplicate. */
if (srv_dtcnt_wlan_is_duplicate_name(g_srv_dtcnt_wlan_otap->iter) == MMI_TRUE)
{
srv_dtcnt_wlan_auto_rename_profile(g_srv_dtcnt_wlan_otap->iter);
}
g_srv_dtcnt_wlan_otap->cur_status = 2;
/* Go to the next profile if it is presented. */
srv_stcnt_wlan_otap_install_next();
}
static void srv_dtcnt_wlan_otap_skip(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_TRACE(MMI_CONN_TRC_G6_DTCNT, SRV_DTCNT_WLAN_OTAP_SKIP);
if (g_srv_dtcnt_wlan_otap->cur_status != 2)
{
g_srv_dtcnt_wlan_otap->cur_status = 3;
}
srv_stcnt_wlan_otap_install_next();
}
/*****************************************************************************
* FUNCTION
* srv_stcnt_wlan_otap_install_next
* DESCRIPTION
* This function leads us to process next incoming profile.
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void srv_stcnt_wlan_otap_install_next(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 num_installed;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_TRACE(MMI_CONN_TRC_G6_DTCNT, SRV_DTCNT_WLAN_OTAP_INSTALL_NEXT);
/* Increase the index of the iterator to process next profile. */
++g_srv_dtcnt_wlan_otap->iter;
/* Whether there is another profile needed to be installed. */
if (g_srv_dtcnt_wlan_otap->iter < g_srv_dtcnt_wlan_otap->num_profiles)
{
/* Try to install next profile. */
srv_dtcnt_wlan_otap_install_start();
}
else
{
/* Now, save the profiles into the NVRAM. */
num_installed = srv_dtcnt_wlan_install_profiles();
/* Send a response back to CCA and free memory. */
if (num_installed == 0)
{
srv_dtcnt_send_cca_app_configure_rsp(g_srv_dtcnt_wlan_otap->conf_id, g_srv_dtcnt_wlan_otap->doc_hdl, CCA_STATUS_SETTING_SKIPPED);
}
else
{
srv_dtcnt_send_cca_app_configure_rsp(g_srv_dtcnt_wlan_otap->conf_id, g_srv_dtcnt_wlan_otap->doc_hdl, CCA_STATUS_OK);
/* notify DA APP */
srv_dtcnt_wlan_otap_done_notify(num_installed);
}
/* Free all allocated memory. */
srv_dtcnt_wlan_free_otap_cntx();
}
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_install_profiles
* DESCRIPTION
* This function installs each incoming profile that has been chosen to
* install.
* PARAMETERS
* void
* RETURNS
* Number of installed profiles.
*****************************************************************************/
U8 srv_dtcnt_wlan_install_profiles(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 i, k, num_installed = 0, replace, total_num = 0;
srv_dtcnt_wlan_network_type_enum old_network;
srv_dtcnt_wlan_slim_profile_struct *src_prof;
srv_dtcnt_prof_wlan_struct dst_prof;
srv_dtcnt_prov_install_res_ind_evt_struct evt;
S16 src_idx, error;
U32 size = 0;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
for (i = 0; i < SRV_DTCNT_MAX_WLAN_ACCOUNT_NUM; ++i)
{
/* Continue when no incoming profile plans to install in this slot. */
if ((src_idx = g_srv_dtcnt_wlan_otap->src_idx[i]) < 0)
{
continue;
}
else
{
total_num++;
}
}
/* Install each profile. To make sure the order of installed profiles are
correct, scan the slots, rather than profiles in the control block. */
for (i = 0; i < SRV_DTCNT_MAX_WLAN_ACCOUNT_NUM; ++i)
{
/* Continue when no incoming profile plans to install in this slot. */
if ((src_idx = g_srv_dtcnt_wlan_otap->src_idx[i]) < 0)
{
continue;
}
src_prof = g_srv_dtcnt_wlan_otap->profile[src_idx];
kal_mem_cpy(&dst_prof, &g_srv_dtcnt_wlan_prof_list[i], sizeof(srv_dtcnt_prof_wlan_struct));
old_network = g_srv_dtcnt_wlan_prof_list[i].network_type;
replace = (g_srv_dtcnt_wlan_prof_list[i].priority > 0)? 1 : 0;
/* Setup profile. Note that all context of dst_prof will be reset. */
srv_dtcnt_wlan_provision_profile(&dst_prof, src_prof);
/* Setup new priority, profile_id and update pointer. */
switch (g_srv_dtcnt_wlan_setting_ctx.pri_criteria)
{
case SRV_DTCNT_WLAN_PROF_PRI_INFRA_NEW:
srv_dtcnt_wlan_save_profiles(i, replace, old_network, &dst_prof);
break;
/* not support now, should not happened */
default:
MMI_ASSERT(0);
}
/* Notify CCA the success of installing each WLAN profile. */
mmi_cca_oma_add_dataacctid(g_srv_dtcnt_wlan_otap->doc_hdl, (S8 *)src_prof->node_id, CBM_WIFI_ACCT_ID);
/* Install successfully. Update counter. */
++num_installed;
MMI_FRM_INIT_EVENT(&evt, EVT_ID_SRV_DTCNT_PROV_INSTALL_RES_IND);
mmi_ucs2ncpy((char *)(evt.name), (char *) (dst_prof.ProfName), SRV_DTCNT_PROF_MAX_WLAN_PROF_NAME_LEN+1);
evt.prof_idx = (num_installed);
evt.num_profs = total_num;
evt.acct_id = CBM_WIFI_ACCT_ID;
evt.prov_ind = SRV_DTCNT_PROV_IND_WLAN;
evt.prof_type = SRV_DTCNT_PROF_TYPE_OTA_CONF;
evt.install_result = 1;
MMI_FRM_CB_EMIT_POST_EVENT((mmi_event_struct *)&evt);
}
MMI_TRACE(MMI_CONN_TRC_G6_DTCNT, SRV_DTCNT_WLAN_OTAP_INSTALL_PROFILES, num_installed);
if (num_installed)
{
for (k = 0; k < SRV_DTCNT_MAX_WLAN_ACCOUNT_NUM; k++)
{
if (g_srv_dtcnt_wlan_prof_list[k].priority > 0)
{
size = WriteRecord(NVRAM_EF_WLAN_PROFILE_LID, k + 1, &g_srv_dtcnt_wlan_prof_list[k], NVRAM_MAX_WLAN_PROFILE_SIZE, &error);
if (size < NVRAM_MAX_WLAN_PROFILE_SIZE)
{
MMI_ASSERT(0);
}
}
else /* memset the removed accounts */
{
memset(&(g_srv_dtcnt_wlan_prof_list[k]), 0, sizeof(srv_dtcnt_prof_wlan_struct));
}
}
/* profile_id_count has been updated. Save the context in the NVRAM. */
WriteRecord(NVRAM_EF_WLAN_SETTING_LID, 1, &g_srv_dtcnt_wlan_setting_ctx, NVRAM_MAX_WLAN_SETTING_SIZE, &error);
if (error != NVRAM_WRITE_SUCCESS)
{
MMI_ASSERT(0);
}
}
return num_installed;
}
void srv_dtcnt_wlan_otap_done_notify(U8 num_installed)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
srv_dtcnt_prov_done_ind_evt_struct evt;
srv_dtcnt_prov_wlan_done_ind_struct *tmp_ind;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_TRACE(MMI_CONN_TRC_G6_DTCNT, SRV_DTCNT_WLAN_OTAP_DONE, num_installed);
MMI_FRM_INIT_EVENT(&evt, EVT_ID_SRV_DTCNT_PROV_DONE_IND);
/* construct prov wlan done ind for DA APP */
tmp_ind = OslMalloc(sizeof(srv_dtcnt_prov_wlan_done_ind_struct));
tmp_ind->num_adhoc_profs = g_srv_dtcnt_wlan_setting_ctx.adhoc_prof_num;
tmp_ind->num_infra_profs = g_srv_dtcnt_wlan_setting_ctx.infra_prof_num;
if (g_srv_dtcnt_wlan_otap_active_prof_p)
{
tmp_ind->active_prof_id_valid = MMI_TRUE;
tmp_ind->active_prof_id = g_srv_dtcnt_wlan_otap_active_prof_p->profile_id;
g_srv_dtcnt_wlan_otap_active_prof_p = NULL;
}
else
{
tmp_ind->active_prof_id_valid = MMI_FALSE;
}
/* construct event struct */
evt.prov_ind = SRV_DTCNT_PROV_IND_WLAN;
evt.prof_data = tmp_ind;
MMI_FRM_CB_EMIT_POST_EVENT_EX((mmi_event_struct *)&evt, srv_dtcnt_wlan_event_callback, (void *)evt.prof_data);
}
/*****************************************************************************
* Use OMA extension OTAP spec.
*****************************************************************************/
#if defined(__MMI_WLAN_OTAP_OMAEXT__)
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_base64_decoder
* DESCRIPTION
* This function decodes the Base64 encoded data according to the RFC 1341.
* PARAMETERS
* dst [OUT] Buffer for storing the decoded data
* dst_size [IN] Size of the dst buffer
* src [IN] Buffer of the input Base64 encoded data
* src_size [IN] #characters of the Base64 encoded data
* RETURNS
* On success, it returns the number of decoded octets that are stored in the
* dst buffer. On error, 0 is returned, e.g., when the size of dst buffer is
* too small.
*****************************************************************************/
U32 srv_dtcnt_wlan_base64_decoder(S8 *dst, U32 dst_size, const S8 *src, U32 src_size)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*
* Codebook used to decode Base64 data. Please refer to RFC 1341 and ASCII
* encoding for more details.
*/
const U8 codebook[] =
{
62, 0xFF, 0xFF, 0xFF, 63, /* +, / */
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, /* 0-9 */
0xFF, 0xFF, 0xFF, 0, 0xFF, 0xFF, 0xFF, /* = */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* A-Z */
10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* garbage */
26, 27, 28, 29, 30, 31, 32, 33, 34, 35, /* a-z */
36, 37, 38, 39, 40, 41, 42, 43,
44, 45, 46, 47, 48, 49, 50, 51
};
U8 in[4], out[3]; /* buffers to decode a quantum */
S8 count; /* #octet decoded for a quantum */
U32 num_octets; /* #octet decoded from source */
U32 i, j;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* Initialize the number of octets decoded from the Base64 data. */
num_octets = 0;
/* Start the Base64 decoding process. */
for (i = 0; i < src_size;)
{
/* Initialize #octet decoded for a quantum without padding. */
count = 3;
/* Obtain a quantum to be decoded. */
for (j = 0; j < 4; ++j)
{
/* Ignore line breaks and other characters not found in the
table of Base64 specification. */
do
{
/* Read one character from the Base64 data. If the data steam
is empty, assign the padding character '='. */
if (i < src_size)
{
in[j] = src[i++];
}
else
{
in[j] = '=';
}
/* Padding happened. Decrease count for the decoded result.
Note that count might be negative when there is nothing to
commit to the destination buffer. */
if (in[j] == '=')
{
--count;
}
/* decode the character by table look-up. */
if (in[j] >= '+' && in[j] <= 'z')
{
in[j] = codebook[in[j] - '+'];
}
else
{
in[j] = 0xFF;
}
} while (in[j] == 0xFF);
}
/* decode the quantum. */
out[0] = (U8)(in[0] << 2 | in[1] >> 4);
out[1] = (U8)(in[1] << 4 | in[2] >> 2);
out[2] = (U8)(in[2] << 6 | in[3]);
/* commit the result when we have decoded octets actually. */
if (count > 0)
{
/* check whether the size of the dst buffer is enough. */
if (num_octets + count > dst_size || UINT_MAX - count < num_octets)
{
return 0;
}
/* commit the result to the destination buffer. */
memcpy(dst + num_octets, out, count);
num_octets += count;
}
}
return num_octets;
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_has_otap_profile
* DESCRIPTION
* This function checks whether there is a new WLAN profile in the document.
* The input data list contains the parameters and their values of a NAPDEF
* node. Care should be take that the input iterator is reset after calling
* the function.
* PARAMETERS
* param_list [IN] Parameter list for a NAPDEF node
* RETURNS
* If there is a new WLAN profile, return TRUE. Otherwise, return FALSE.
*****************************************************************************/
MMI_BOOL srv_dtcnt_wlan_has_otap_profile(cca_iterator_struct *param_list)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S32 *bearer;
S32 num_bearers;
cca_status_enum status;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* Extract the value of the parameter BEARER. */
status = mmi_cca_doc_get_nodedata_ints(param_list, CCA_NS_OMA_BEARER, &bearer, &num_bearers);
mmi_cca_iterator_restart(param_list);
if (status != CCA_STATUS_OK)
{
return MMI_FALSE;
}
/* Whether there is a WLAN bearer. */
while (--num_bearers >= 0)
{
if (bearer[num_bearers] == CCA_NS_VAL_WLAN)
{
return MMI_TRUE;
}
}
return MMI_FALSE;
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_proc_cca_param_wepkey
* DESCRIPTION
* This function processes the parameter of WEPKEY node.
* PARAMETERS
* param [IN] A parameter with its values
* prof [IN/OUT] The current provisioned profile
* RETURNS
* On success, return OK; otherwise, return FAIL.
*****************************************************************************/
cca_status_enum srv_dtcnt_wlan_proc_cca_param_wepkey(
const cca_core_data_struct *param,
srv_dtcnt_wlan_slim_profile_struct *prof)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U32 num_octets;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/*
* Dispatching according to the parameter symbol
*/
switch (param->id)
{
case CCA_NS_OMA_LENGTH:
/* Whether the value is presented and the type is legal. */
if (param->size <= 0 || param->type != CCA_DT_STR)
{
return CCA_STATUS_FAIL;
}
switch (atoi(param->values.s[0]))
{
case 40:
/* 40-bits WEP key + 24-bits IV = 64 bits */
prof->wep_key_len = SRV_DTCNT_WLAN_WEP_KEY_ENCRYPT_64;
break;
case 104:
/* 104-bits WEP key + 24-bits IV = 128 bits */
prof->wep_key_len = SRV_DTCNT_WLAN_WEP_KEY_ENCRYPT_128;
break;
default:
return CCA_STATUS_FAIL;
}
break;
case CCA_NS_OMA_DATA:
/* Whether the value is presented and the type is legal. */
if (param->size <= 0 || param->type != CCA_DT_STR)
{
return CCA_STATUS_FAIL;
}
/* Whether this is a ASCII string. */
if (srv_dtcnt_wlan_is_ascii_string((U8 *)param->values.s[0]) == MMI_FALSE)
{
return CCA_STATUS_FAIL;
}
/* Compute the WEP key. */
num_octets = srv_dtcnt_wlan_base64_decoder(
(S8 *)prof->wep_key,
SRV_DTCNT_PROF_MAX_WEP_KEY_LEN,
param->values.s[0],
strlen(param->values.s[0]));
/* Fail when wep_key buffer is too small, or length is illegal. */
if (num_octets != 5 && num_octets != 13)
{
return CCA_STATUS_FAIL;
}
prof->wep_key[num_octets] = '\0';
/* Set WEP key length when this entry is not set yet. */
if (prof->wep_key_len == SRV_DTCNT_WLAN_WEP_KEY_ENCRYPT_TOTAL)
{
if (num_octets == 5)
{
prof->wep_key_len = SRV_DTCNT_WLAN_WEP_KEY_ENCRYPT_64;
}
else
{
prof->wep_key_len = SRV_DTCNT_WLAN_WEP_KEY_ENCRYPT_128;
}
}
break;
case CCA_NS_OMA_INDEX:
default:
break;
}
return CCA_STATUS_OK;
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_proc_cca_param_eap
* DESCRIPTION
* The function processes the parameter of EAP node.
* PARAMETERS
* param [IN] A parameter with its values
* prof [IN/OUT] The current provisioned profile
* RETURNS
* On success, return OK; otherwise, return FAIL.
*****************************************************************************/
cca_status_enum srv_dtcnt_wlan_proc_cca_param_eap(
const cca_core_data_struct *param,
srv_dtcnt_wlan_slim_profile_struct *prof)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S32 str_len;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/*
* Dispatching according to the parameter symbol
*/
switch (param->id)
{
case CCA_NS_OMA_EAPTYPE:
/* Whether the value is presented and the type is legal. */
if (param->size <= 0 || param->type != CCA_DT_INT)
{
return CCA_STATUS_FAIL;
}
/* Only support EAP SIM currently. */
switch (param->values.i[0])
{
case CCA_NS_VAL_EAP_SIM:
prof->eap_auth_type |= WLAN_EAP_SIM;
break;
default:
return CCA_STATUS_FAIL;
}
break;
case CCA_NS_OMA_USERNAME:
/* Whether the value is presented and the type is legal. */
if (param->size <= 0 || param->type != CCA_DT_STR)
{
return CCA_STATUS_FAIL;
}
/* Check whether the length of the username is legal. */
str_len = mmi_chset_utf8_strlen((kal_uint8 *)param->values.s[0]);
if (str_len > SRV_DTCNT_PROF_MAX_USER_LEN)
{
return CCA_STATUS_FAIL;
}
/* Whether this is a ASCII string. */
if (srv_dtcnt_wlan_is_ascii_string((U8 *)param->values.s[0]) == MMI_FALSE)
{
return CCA_STATUS_FAIL;
}
/* Obtain the username. Zero-terminate username. */
strcpy((S8 *)prof->username, param->values.s[0]);
break;
case CCA_NS_OMA_PASSWORD:
/* Whether the value is presented and the type is legal. */
if (param->size <= 0 || param->type != CCA_DT_STR)
{
return CCA_STATUS_FAIL;
}
/* Check whether the length of the password is legal. */
str_len = mmi_chset_utf8_strlen((kal_uint8 *)param->values.s[0]);
if (str_len > SRV_DTCNT_PROF_MAX_PW_LEN)
{
return CCA_STATUS_FAIL;
}
/* Whether this is a ASCII string. */
if (srv_dtcnt_wlan_is_ascii_string((U8 *)param->values.s[0]) == MMI_FALSE)
{
return CCA_STATUS_FAIL;
}
/* Obtain the password. Zero-terminate password. */
strcpy((S8 *)prof->password, param->values.s[0]);
break;
default:
break;
}
return CCA_STATUS_OK;
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_proc_cca_param_wlan
* DESCRIPTION
* This function processes the parameter of WLAN node.
* PARAMETERS
* param [IN] A parameter with its values
* prof [IN/OUT] The current provisioned profile
* RETURNS
* On success, return OK; otherwise, return FAIL.
*****************************************************************************/
cca_status_enum srv_dtcnt_wlan_proc_cca_param_wlan(
const cca_core_data_struct *param,
srv_dtcnt_wlan_slim_profile_struct *prof)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S32 str_len;
U8 base64_buf[64];
S32 value;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/*
* Dispatching according to the parameter symbol
*/
switch (param->id)
{
case CCA_NS_OMA_PRI_SSID:
/* Whether the value is presented and the type is legal. */
if (param->size <= 0 || param->type != CCA_DT_STR)
{
return CCA_STATUS_FAIL;
}
/* Whether the length of the SSID is legal. */
str_len = mmi_chset_utf8_strlen((kal_uint8 *)param->values.s[0]);
if (str_len > SRV_DTCNT_PROF_MAX_SSID_LEN)
{
return CCA_STATUS_FAIL;
}
/* Whether this is a ASCII string. */
if (srv_dtcnt_wlan_is_ascii_string((U8 *)param->values.s[0]) == MMI_FALSE)
{
return CCA_STATUS_FAIL;
}
/* Get SSID in ASCII format. Zero-terminate SSID. */
prof->ssid_len = str_len;
strcpy((S8 *)prof->ssid, param->values.s[0]);
break;
case CCA_NS_OMA_NETMODE:
/* Whether the value is presented and the type is legal. */
if (param->size <= 0 || param->type != CCA_DT_INT)
{
return CCA_STATUS_FAIL;
}
/* Extract setting. */
switch (param->values.i[0])
{
case CCA_NS_VAL_INFRA:
prof->network_type = SRV_DTCNT_WLAN_NETWORK_TYPE_INFRA;
break;
case CCA_NS_VAL_ADHOC:
prof->network_type = SRV_DTCNT_WLAN_NETWORK_TYPE_ADHOC;
break;
default:
return CCA_STATUS_FAIL;
}
break;
case CCA_NS_OMA_WPA_PRES_KEY_ASC:
/* Whether the value is presented and the type is legal. */
if (param->size <= 0 || param->type != CCA_DT_STR)
{
return CCA_STATUS_FAIL;
}
/* Check whether the length of the passphrase is legal. */
str_len = mmi_chset_utf8_strlen((kal_uint8 *)param->values.s[0]);
if (str_len < SRV_DTCNT_MIN_PASSPHRASE_LEN || str_len > SRV_DTCNT_PROF_MAX_PASSPHRASE_LEN)
{
return CCA_STATUS_FAIL;
}
/* Whether this is a ASCII string. */
if (srv_dtcnt_wlan_is_ascii_string((U8 *)param->values.s[0]) == MMI_FALSE)
{
return CCA_STATUS_FAIL;
}
/* Get passphrase in ASCII format. Zero-terminate passphrase. */
strcpy((S8 *)prof->passphrase, param->values.s[0]);
break;
case CCA_NS_OMA_WPA_PRES_KEY_HEX:
/* Whether the value is presented and the type is legal. */
if (param->size <= 0 || param->type != CCA_DT_STR)
{
return CCA_STATUS_FAIL;
}
/* Length of the Base64 data should be 88 bytes for 64 HEX chars
(256 bits). Please refer to Base64 encoding method. */
str_len = mmi_chset_utf8_strlen((kal_uint8 *)param->values.s[0]);
if (str_len != 88)
{
return CCA_STATUS_FAIL;
}
/* Whether this is a ASCII string. */
if (srv_dtcnt_wlan_is_ascii_string((U8 *)param->values.s[0]) == MMI_FALSE)
{
return CCA_STATUS_FAIL;
}
/* Obtain the HEX format pre-shared key. It should be 64 bytes. */
if (srv_dtcnt_wlan_base64_decoder(
(S8 *)base64_buf,
sizeof(base64_buf) / sizeof(U8),
param->values.s[0],
str_len) != 64)
{
return CCA_STATUS_FAIL;
}
/* Convert 64 bytes HEX data to 256 bits raw data. */
if (srv_dtcnt_wlan_hex_to_psk(prof->psk, base64_buf, 64) == MMI_FALSE)
{
return CCA_STATUS_FAIL;
}
/* Turn on the 33-bytes when PSK is set. */
prof->psk[32] = 1;
break;
case CCA_NS_OMA_WEPKEYIND:
/* Whether the value is presented and the type is legal. */
if (param->size <= 0 || param->type != CCA_DT_STR)
{
return CCA_STATUS_FAIL;
}
/* Check whether the index is legal. */
value = atoi(param->values.s[0]);
if (value < 0 || value >= SRV_DTCNT_MAX_WEP_KEY_NUM)
{
return CCA_STATUS_FAIL;
}
prof->wep_key_index = value;
break;
case CCA_NS_OMA_WEPAUTHMODE:
/* Whether the value is presented and the type is legal. */
if (param->size <= 0 || param->type != CCA_DT_INT)
{
return CCA_STATUS_FAIL;
}
/* Extract the setting. */
switch (param->values.i[0])
{
case CCA_NS_VAL_OPEN:
prof->auth_mode = SRV_DTCNT_WLAN_AUTH_MODE_OPEN;
break;
case CCA_NS_VAL_SHARED:
prof->auth_mode = SRV_DTCNT_WLAN_AUTH_MODE_WEP;
break;
default:
return CCA_STATUS_FAIL;
}
break;
case CCA_NS_OMA_SECMODE:
default:
break;
}
return CCA_STATUS_OK;
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_proc_cca_param_napdef
* DESCRIPTION
* This function processes the parameter of WLAN node.
* PARAMETERS
* param [IN] A parameter with its values
* cntx [IN/OUT] The WLAN OTAP control block
* RETURNS
* On success, return OK; otherwise, return FAIL.
*****************************************************************************/
cca_status_enum srv_dtcnt_wlan_proc_cca_param_napdef(
const cca_core_data_struct *param,
srv_dtcnt_wlan_otap_struct *cntx)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S32 str_len;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/*
* Dispatching according to the parameter symbol
*/
switch (param->id)
{
case CCA_NS_NODEID:
/* Whether the value is presented and the type is legal. */
if (param->size <= 0 || param->type != CCA_DT_STR)
{
return CCA_STATUS_FAIL;
}
/* Whether the string's raw length is legal. */
str_len = strlen(param->values.s[0]);
if (str_len > SRV_DTCNT_MAX_NODE_ID_LEN)
{
return CCA_STATUS_FAIL;
}
/* Extract the node id. Store it as UTF-8 string. */
strcpy((S8 *)cntx->node_id, param->values.s[0]);
break;
case CCA_NS_OMA_NAME:
/* Whether the value is presented and the type is legal. If it's
illegal, default name will be used. Still return OK. */
if (param->size <= 0 || param->type != CCA_DT_STR)
{
return CCA_STATUS_OK; /* Error-tolerant for profile's name */
}
/* Extract the profile's name. If the name is too long, it will be
truncated by the function. */
mmi_chset_utf8_to_ucs2_string(
cntx->name,
(SRV_DTCNT_PROF_MAX_WLAN_PROF_NAME_LEN+1)* ENCODING_LENGTH,
(U8 *)param->values.s[0]);
break;
case CCA_NS_OMA_NAPID:
case CCA_NS_OMA_BEARER:
default:
/* All other parameters are skipped. And the status is OK. */
break;
}
return CCA_STATUS_OK;
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_proc_cca_nodes
* DESCRIPTION
* The node callback function used when processing a CCA document.
* PARAMETERS
* doc_hdl [IN] Configuration document handle
* node_hdl [IN] The node handle
* symbol [IN] The converted node symbol
* param_list [IN] List of parameters in the node
* user_data [IN] User data
* RETURNS
* On success, return OK; otherwise, return FAIL.
*****************************************************************************/
cca_status_enum srv_dtcnt_wlan_proc_cca_nodes(
S32 doc_hdl,
S32 node_hdl,
U16 symbol,
cca_iterator_struct *param_list,
void *user_data)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
srv_dtcnt_wlan_otap_struct *cntx;
cca_core_data_struct *param;
S8 *value_s;
S32 value_i;
S32 wep_key_index;
cca_status_enum status;
S16 index;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* Obtain the control block. */
cntx = (srv_dtcnt_wlan_otap_struct *)user_data;
/* We always process NAPDEF nodes to obtain node_id. We always process
WLAN nodes to obtain profiles. For other nodes, the behavior is
controlled by is_active parameter. */
if (symbol != WLAN_OTAP_NS_NAPDEF && symbol != WLAN_OTAP_NS_WLAN &&
cntx->is_active != MMI_TRUE)
{
return CCA_STATUS_OK;
}
/*
* Dispatch the node according to the node symbol.
*/
status = CCA_STATUS_OK; /* Initialize the status variable */
index = cntx->num_profiles - 1; /* Obtain the last profile */
switch (symbol)
{
case WLAN_OTAP_NS_NAPDEF:
/* Clear node_id and name for previous NAPDEF node. */
memset(cntx->node_id, 0, SRV_DTCNT_MAX_NODE_ID_LEN+1);
memset(cntx->name, 0, (SRV_DTCNT_PROF_MAX_WLAN_PROF_NAME_LEN+1) * ENCODING_LENGTH);
/* Traverse each parameter in NAPDEF node. */
while (mmi_cca_doc_nodedata_next(param_list, ¶m) == CCA_STATUS_OK && status == CCA_STATUS_OK)
{
status = srv_dtcnt_wlan_proc_cca_param_napdef(param, cntx);
}
/* NAPDEF doesn't know the correctness of a WLAN profile. Always
return OK. */
return CCA_STATUS_OK;
case WLAN_OTAP_NS_WLAN:
/* Whether we have node_id */
if (strlen((S8 *)cntx->node_id) == 0)
{
cntx->is_active = MMI_FALSE;
return CCA_STATUS_FAIL;
}
/* Prepare a storage for the new profile. And get the new index. */
if ((index = srv_dtcnt_wlan_new_otap_profile(cntx)) < 0)
{
cntx->is_active = MMI_FALSE;
return CCA_STATUS_FAIL;
}
/* Enable to process parameters/nodes in the WLAN node. */
cntx->is_active = MMI_TRUE;
/* Remember the name, and node_id which this profile belongs to. */
if (mmi_ucs2strlen((S8 *)cntx->name) != 0)
{
mmi_ucs2cpy((S8 *)cntx->profile[index]->name, (S8 *)cntx->name);
}
strcpy((S8 *)cntx->profile[index]->node_id, (S8 *)cntx->node_id);
/* Before processing other parameters, obtain the security mode. */
if (mmi_cca_doc_get_nodedata_int_first(param_list, CCA_NS_OMA_SECMODE, &value_i) == CCA_STATUS_OK)
{
switch (value_i)
{
case CCA_NS_VAL_WEP:
cntx->profile[index]->auth_mode = SRV_DTCNT_WLAN_AUTH_MODE_WEP;
cntx->profile[index]->encrypt_mode = SRV_DTCNT_WLAN_ENCRYPT_MODE_WEP;
break;
case CCA_NS_VAL_8021X:
cntx->profile[index]->auth_mode = SRV_DTCNT_WLAN_AUTH_MODE_IEEE8021X;
cntx->profile[index]->encrypt_mode = SRV_DTCNT_WLAN_ENCRYPT_MODE_WEP;
break;
case CCA_NS_VAL_WPA:
cntx->profile[index]->auth_mode = SRV_DTCNT_WLAN_AUTH_MODE_WPA_WPA2_MIX;
cntx->profile[index]->encrypt_mode = SRV_DTCNT_WLAN_ENCRYPT_MODE_TKIP;
break;
case CCA_NS_VAL_WPA_PRESHARED_KEY:
cntx->profile[index]->auth_mode = SRV_DTCNT_WLAN_AUTH_MODE_WPA_WPA2_MIX_PSK;
cntx->profile[index]->encrypt_mode = SRV_DTCNT_WLAN_ENCRYPT_MODE_TKIP;
break;
case CCA_NS_VAL_WPA2:
cntx->profile[index]->auth_mode = SRV_DTCNT_WLAN_AUTH_MODE_WPA_WPA2_MIX;
cntx->profile[index]->encrypt_mode = SRV_DTCNT_WLAN_ENCRYPT_MODE_AES;
break;
case CCA_NS_VAL_WPA2_PRESHARED_KEY:
cntx->profile[index]->auth_mode = SRV_DTCNT_WLAN_AUTH_MODE_WPA_WPA2_MIX_PSK;
cntx->profile[index]->encrypt_mode = SRV_DTCNT_WLAN_ENCRYPT_MODE_AES;
break;
/* to-do: need add new auth-types which were added from W11.41*/
default:
return CCA_STATUS_FAIL;
}
}
/* Traverse other parameter in WLAN node */
mmi_cca_iterator_restart(param_list);
while (mmi_cca_doc_nodedata_next(param_list, ¶m) == CCA_STATUS_OK && status == CCA_STATUS_OK)
{
status = srv_dtcnt_wlan_proc_cca_param_wlan(param, cntx->profile[index]);
}
break;
case WLAN_OTAP_NS_EAP:
/* Traverse each parameter in EAP node */
while (mmi_cca_doc_nodedata_next(param_list, ¶m) == CCA_STATUS_OK && status == CCA_STATUS_OK)
{
status = srv_dtcnt_wlan_proc_cca_param_eap(param, cntx->profile[index]);
}
break;
case WLAN_OTAP_NS_WEPKEY:
/* Return if WEP key has been set. */
if (strlen((S8 *)cntx->profile[index]->wep_key) != 0)
{
return CCA_STATUS_OK;
}
/* Pre-determine the key index if it's presented. */
if (mmi_cca_doc_get_nodedata_str_first(param_list, CCA_NS_OMA_INDEX, &value_s) != CCA_STATUS_OK)
{
wep_key_index = SRV_DTCNT_MAX_WEP_KEY_NUM; /* Init an invalid index */
}
else
{
/* If it's presented, the range must be correct. */
wep_key_index = atoi(value_s);
if (wep_key_index < 0 || wep_key_index >= SRV_DTCNT_MAX_WEP_KEY_NUM)
{
return CCA_STATUS_OK;
}
}
/* If WEP key index is specified in WLAN node, it must match the
index in this WEPKEY node. */
if (cntx->profile[index]->wep_key_index < SRV_DTCNT_MAX_WEP_KEY_NUM)
{
if (wep_key_index != cntx->profile[index]->wep_key_index)
{
return CCA_STATUS_OK;
}
}
/* Traverse each parameter in WEPKEY node */
mmi_cca_iterator_restart(param_list);
while (mmi_cca_doc_nodedata_next(param_list, ¶m) == CCA_STATUS_OK && status == CCA_STATUS_OK)
{
status = srv_dtcnt_wlan_proc_cca_param_wepkey(param, cntx->profile[index]);
}
/* If successfully get the WEP key, update the key index. */
if (strlen((S8 *)cntx->profile[index]->wep_key) != 0)
{
cntx->profile[index]->wep_key_index = (wep_key_index < SRV_DTCNT_MAX_WEP_KEY_NUM ? wep_key_index: 0);
}
break;
case WLAN_OTAP_NS_SEC_SSID:
case WLAN_OTAP_NS_CERT:
/* Useless characteristic type. Still return OK since the profile
might work well even without these settings. And this will be
checked in the validation phase. */
return CCA_STATUS_OK;
default:
/* A traversing not matched to the namespace definition. */
MMI_ASSERT(0);
}
/* If the node or any parameters of the node can not be processed, update
the context to stop processing the current profile. And release the
memory of the current profile. */
if (status == CCA_STATUS_FAIL)
{
cntx->is_active = MMI_FALSE;
srv_dtcnt_wlan_free_otap_profile(cntx, index);
}
return status;
}
/*****************************************************************************
* Use the proprietary OTAP spec.
*****************************************************************************/
#elif defined(__MMI_WLAN_OTAP_DMP__)
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_proc_cca_node_profile
* DESCRIPTION
* This function pre-processes the parameters in the profile node.
* PARAMETERS
* param_list [IN] The parameter list in the node
* prof [IN/OUT] The current provisioned profile
* RETURNS
* On success, return OK; otherwise, return FAIL.
*****************************************************************************/
cca_status_enum srv_dtcnt_wlan_proc_cca_node_profile(
cca_iterator_struct *param_list,
srv_dtcnt_wlan_slim_profile_struct *prof)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S8 *encrypt, *auth;
cca_status_enum en_status, au_status;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* Obtain the encryption and authentication method. */
en_status = mmi_cca_doc_get_nodedata_str_first(
param_list,
CCA_NS_OMADMP_ENCRYPTION,
&encrypt);
mmi_cca_iterator_restart(param_list);
au_status = mmi_cca_doc_get_nodedata_str_first(
param_list,
CCA_NS_OMADMP_AUTHENTICATION,
&auth);
mmi_cca_iterator_restart(param_list);
/* Output traces if encryption or authentication method is specified. */
if (en_status == CCA_STATUS_OK && encrypt != NULL)
{
MMI_TRACE(MMI_CONN_TRC_G6_DTCNT, SRV_DTCNT_WLAN_OTAP_ENCRYPTION, atoi(encrypt));
}
if (au_status == CCA_STATUS_OK && auth != NULL)
{
MMI_TRACE(MMI_CONN_TRC_G6_DTCNT, SRV_DTCNT_WLAN_OTAP_AUTHENTICATION, atoi(auth));
}
/*
* Determine the encryption method.
*/
if (en_status != CCA_STATUS_OK)
{
/* Use default encryption if parameter is not present. */
prof->encrypt_mode = SRV_DTCNT_WLAN_ENCRYPT_MODE_WEP;
}
else
{
/* Discard profile if parameter value is not present. */
if (encrypt == NULL)
{
MMI_TRACE(MMI_CONN_TRC_G6_DTCNT, SRV_DTCNT_WLAN_OTAP_FAIL_ENCRYPT);
return CCA_STATUS_FAIL;
}
/* Determine encryption method according to the value. */
switch (atoi(encrypt))
{
case 0:
/* WEP */
prof->encrypt_mode = SRV_DTCNT_WLAN_ENCRYPT_MODE_WEP;
break;
case 1:
/* No encryption */
prof->encrypt_mode = SRV_DTCNT_WLAN_ENCRYPT_MODE_NONE;
break;
case 4:
/* TKIP */
prof->encrypt_mode = SRV_DTCNT_WLAN_ENCRYPT_MODE_TKIP;
break;
case 6:
/* AES */
prof->encrypt_mode = SRV_DTCNT_WLAN_ENCRYPT_MODE_AES;
break;
default:
MMI_TRACE(MMI_CONN_TRC_G6_DTCNT, SRV_DTCNT_WLAN_OTAP_FAIL_ENCRYPT_SWITCH);
return CCA_STATUS_FAIL; /* Discard profile */
}
}
/*
* Determine the authentication method.
*/
if (au_status != CCA_STATUS_OK)
{
/* Use default authentication if parameter is not present. */
prof->auth_mode = SRV_DTCNT_WLAN_AUTH_MODE_OPEN;
}
else
{
/* Discard profile if parameter value is not present. */
if (auth == NULL)
{
MMI_TRACE(MMI_CONN_TRC_G6_DTCNT, SRV_DTCNT_WLAN_OTAP_FAIL_AUTH);
return CCA_STATUS_FAIL;
}
/* Determine authentication method according to the value. */
switch (atoi(auth))
{
case 0:
/* Open */
prof->auth_mode = SRV_DTCNT_WLAN_AUTH_MODE_OPEN;
break;
case 1:
/* SHARED */
prof->auth_mode = SRV_DTCNT_WLAN_AUTH_MODE_WEP;
break;
case 3:
/* WPA: unsupported */
return CCA_STATUS_FAIL;
case 4:
/* 4 is for WPA-PSK, while 7 is for WPA2-PSK. And both are
valid for infrastructure network only. */
if (prof->network_type != SRV_DTCNT_WLAN_NETWORK_TYPE_INFRA)
{
return CCA_STATUS_FAIL;
}
prof->auth_mode = SRV_DTCNT_WLAN_AUTH_MODE_WPA_ONLY_PSK;
break;
case 7:
/* 4 is for WPA-PSK, while 7 is for WPA2-PSK. And both are
valid for infrastructure network only. */
if (prof->network_type != SRV_DTCNT_WLAN_NETWORK_TYPE_INFRA)
{
return CCA_STATUS_FAIL;
}
prof->auth_mode = SRV_DTCNT_WLAN_AUTH_MODE_WPA2_ONLY_PSK;
break;
case 5:
/* WPA-NONE. This is valid for ad-hoc network only. */
if (prof->network_type != SRV_DTCNT_WLAN_NETWORK_TYPE_ADHOC)
{
return CCA_STATUS_FAIL;
}
prof->auth_mode = SRV_DTCNT_WLAN_AUTH_MODE_WPA_WPA2_MIX_PSK;
break;
default:
MMI_TRACE(MMI_CONN_TRC_G6_DTCNT, SRV_DTCNT_WLAN_OTAP_FAIL_AUTH_SWITCH);
return CCA_STATUS_FAIL; /* Discard profile */
}
}
return CCA_STATUS_OK;
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_proc_cca_param_infra
* DESCRIPTION
* This function processes the parameter of access-ponit/profile node.
* PARAMETERS
* param [IN] A parameter with its values
* prof [IN/OUT] The current provisioned profile
* RETURNS
* On success, return OK; otherwise, return FAIL.
*****************************************************************************/
cca_status_enum srv_dtcnt_wlan_proc_cca_param_profile(
const cca_core_data_struct *param,
srv_dtcnt_wlan_slim_profile_struct *prof)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S32 str_len;
S32 value;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
switch (param->id)
{
case CCA_NS_NODEID:
/* Whether the type is legal and the value is present. */
if (param->type != CCA_DT_STR || param->values.s[0] == NULL)
{
return CCA_STATUS_FAIL;
}
/* Whether the string's raw length is legal. */
if (strlen(param->values.s[0]) > SRV_DTCNT_MAX_NODE_ID_LEN)
{
return CCA_STATUS_FAIL;
}
/* Extract the node id. Store it as UTF-8 string. */
strcpy((S8 *)prof->node_id, param->values.s[0]);
break;
case CCA_NS_OMADMP_SSID:
/* Whether the type is legal and the value is present. */
if (param->type != CCA_DT_STR || param->values.s[0] == NULL)
{
MMI_TRACE(MMI_CONN_TRC_G6_DTCNT, SRV_DTCNT_WLAN_OTAP_FAIL_SSID);
return CCA_STATUS_FAIL;
}
/* Whether this is a ASCII string. */
if (srv_dtcnt_wlan_is_ascii_string((U8 *)param->values.s[0]) == MMI_FALSE)
{
MMI_TRACE(MMI_CONN_TRC_G6_DTCNT, SRV_DTCNT_WLAN_OTAP_FAIL_SSID_FORMAT);
return CCA_STATUS_FAIL;
}
/* Whether the length of the SSID is legal. */
if ((str_len = strlen(param->values.s[0])) > SRV_DTCNT_PROF_MAX_SSID_LEN)
{
MMI_TRACE(MMI_CONN_TRC_G6_DTCNT, SRV_DTCNT_WLAN_OTAP_FAIL_SSID_FORMAT);
return CCA_STATUS_FAIL;
}
/* Get SSID in ASCII and zero-terminated format. */
prof->ssid_len = str_len;
strcpy((S8 *)prof->ssid, param->values.s[0]);
/* SSID is also the profile name. */
memset(prof->name, 0, (SRV_DTCNT_PROF_MAX_WLAN_PROF_NAME_LEN+1) * ENCODING_LENGTH);
mmi_asc_n_to_ucs2((S8 *)prof->name, param->values.s[0], SRV_DTCNT_PROF_MAX_WLAN_PROF_NAME_LEN+1);
break;
case CCA_NS_OMADMP_NETWORKKEY:
/* Network key is meaningless for OPEN network. */
if (prof->auth_mode == SRV_DTCNT_WLAN_AUTH_MODE_OPEN &&
prof->encrypt_mode == SRV_DTCNT_WLAN_ENCRYPT_MODE_NONE)
{
return CCA_STATUS_OK;
}
/* Whether the type is legal and the value is present. */
if (param->type != CCA_DT_STR || param->values.s[0] == NULL)
{
MMI_TRACE(MMI_CONN_TRC_G6_DTCNT, SRV_DTCNT_WLAN_OTAP_FAIL_NW_KEY);
return CCA_STATUS_FAIL;
}
/* Whether this is a ASCII string. */
if (srv_dtcnt_wlan_is_ascii_string((U8 *)param->values.s[0]) == MMI_FALSE)
{
MMI_TRACE(MMI_CONN_TRC_G6_DTCNT, SRV_DTCNT_WLAN_OTAP_FAIL_NW_KEY_FORMAT);
return CCA_STATUS_FAIL;
}
/*
* The usage of the key has four different cases. Using the auth,
* encryption, and key string length can determine the cases. If
* security solution does not need any key, ignore this parameter.
*
* 1) WEP key in ASCII format
* 2) WEP key in HEX format
* 3) WPA-PSK key in ASCII format
* 4) WPA-PSK key in HEX format
*/
str_len = strlen(param->values.s[0]);
if (prof->encrypt_mode == SRV_DTCNT_WLAN_ENCRYPT_MODE_TKIP ||
prof->encrypt_mode == SRV_DTCNT_WLAN_ENCRYPT_MODE_AES)
{
/*
* For TKIP or AES encryption methods.
*/
if (str_len >= SRV_DTCNT_MIN_PASSPHRASE_LEN && str_len <= SRV_DTCNT_PROF_MAX_PASSPHRASE_LEN)
{
strcpy((S8 *)prof->passphrase, param->values.s[0]);
}
else if (str_len == 64)
{
/* Obtain 256-bits PSK from 64-bytes HEX. */
if (srv_dtcnt_wlan_hex_to_psk(
prof->psk,
(U8 *)param->values.s[0],
64) == MMI_FALSE)
{
return CCA_STATUS_FAIL;
}
/* Turn on the 33-bytes when PSK is set. */
prof->psk[32] = 1;
}
else
{
return CCA_STATUS_FAIL;
}
}
else if (prof->auth_mode == SRV_DTCNT_WLAN_AUTH_MODE_WEP ||
prof->encrypt_mode == SRV_DTCNT_WLAN_ENCRYPT_MODE_WEP)
{
/*
* For WEP security.
*/
switch (str_len)
{
case 5:
prof->wep_key_len = SRV_DTCNT_WLAN_WEP_KEY_ENCRYPT_64;
prof->wep_key_format = SRV_DTCNT_WLAN_WEP_KEY_FORMAT_ASCII;
break;
case 10:
/* Examine whether input is a valid HEX string. */
if (!srv_dtcnt_is_valid_hexstring((U8 *)param->values.s[0], (U8)str_len))
{
return CCA_STATUS_FAIL;
}
prof->wep_key_len = SRV_DTCNT_WLAN_WEP_KEY_ENCRYPT_64;
prof->wep_key_format = SRV_DTCNT_WLAN_WEP_KEY_FORMAT_HEX;
break;
case 13:
prof->wep_key_len = SRV_DTCNT_WLAN_WEP_KEY_ENCRYPT_128;
prof->wep_key_format = SRV_DTCNT_WLAN_WEP_KEY_FORMAT_ASCII;
break;
case 26:
/* Examine whether input is a valid HEX string. */
if (!srv_dtcnt_is_valid_hexstring((U8 *)param->values.s[0], (U8)str_len))
{
return CCA_STATUS_FAIL;
}
prof->wep_key_len = SRV_DTCNT_WLAN_WEP_KEY_ENCRYPT_128;
prof->wep_key_format = SRV_DTCNT_WLAN_WEP_KEY_FORMAT_HEX;
break;
default:
MMI_TRACE(MMI_CONN_TRC_G6_DTCNT, SRV_DTCNT_WLAN_OTAP_FAIL_WEP_KEY_LEN);
return CCA_STATUS_FAIL;
}
/* Obtain the key. */
strcpy((S8 *)prof->wep_key, param->values.s[0]);
/* Setup a default key index value if it is not set yet. */
if (prof->wep_key_index == SRV_DTCNT_MAX_WEP_KEY_NUM)
{
prof->wep_key_index = 0;
}
}
break;
case CCA_NS_OMADMP_KEYINDEX:
/* This parameter is only valid when WEP security is used. */
if (prof->auth_mode == SRV_DTCNT_WLAN_AUTH_MODE_WEP ||
prof->encrypt_mode == SRV_DTCNT_WLAN_ENCRYPT_MODE_WEP)
{
/* Whether the type is legal and the value is present. */
if (param->type != CCA_DT_STR || param->values.s[0] == NULL)
{
return CCA_STATUS_FAIL;
}
/* Check whether the index is legal. */
value = atoi(param->values.s[0]);
if (value >= 1 && value <= SRV_DTCNT_MAX_WEP_KEY_NUM)
{
prof->wep_key_index = value - 1;
}
else
{
return CCA_STATUS_FAIL; /* Discard profile */
}
}
break;
case CCA_NS_OMADMP_AUTHENTICATION: /* Already processed */
case CCA_NS_OMADMP_ENCRYPTION: /* Already processed */
case CCA_NS_OMADMP_ADHOC: /* Useless */
case CCA_NS_OMADMP_KEYPROVIDED: /* Useless */
case CCA_NS_OMADMP_USE8021X: /* Unsupported */
case CCA_NS_OMADMP_EAPTYPE: /* Unsupported */
break;
default:
MMI_ASSERT(0); /* Impossible to reach here */
}
return CCA_STATUS_OK;
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_proc_cca_nodes
* DESCRIPTION
* The node callback function used when processing a CCA document.
* PARAMETERS
* doc_hdl [IN] Configuration document handle
* node_hdl [IN] The node handle
* symbol [IN] The converted node symbol
* param_list [IN] List of parameters in the node
* user_data [IN] User data
* RETURNS
* On success, return OK; otherwise, return FAIL.
*****************************************************************************/
cca_status_enum srv_dtcnt_wlan_proc_cca_nodes(
S32 doc_hdl,
S32 node_hdl,
U16 symbol,
cca_iterator_struct *param_list,
void *user_data)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
srv_dtcnt_wlan_otap_struct *cntx;
cca_core_data_struct *param;
cca_status_enum status;
S16 index;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* Obtain the OTAP control block. */
cntx = (srv_dtcnt_wlan_otap_struct *)user_data;
/* Prepare a storage for the new profile. And get the new index. */
if ((index = srv_dtcnt_wlan_new_otap_profile(cntx)) < 0)
{
MMI_TRACE(MMI_CONN_TRC_G6_DTCNT, SRV_DTCNT_WLAN_OTAP_FAIL_INDEX_INSTALL);
return CCA_STATUS_FAIL;
}
/* Dispatch the node according to the node symbol. */
status = CCA_STATUS_OK;
switch (symbol)
{
case WLAN_OTAP_NS_INFRA:
cntx->profile[index]->network_type = SRV_DTCNT_WLAN_NETWORK_TYPE_INFRA;
break;
case WLAN_OTAP_NS_ADHOC:
cntx->profile[index]->network_type = SRV_DTCNT_WLAN_NETWORK_TYPE_ADHOC;
break;
default:
MMI_ASSERT(0); /* Impossible to reach here */
}
/* Pre-process the profile node. */
status = srv_dtcnt_wlan_proc_cca_node_profile(param_list, cntx->profile[index]);
/* Traverse other parameters in the profile node. */
while (mmi_cca_doc_nodedata_next(param_list, ¶m) == CCA_STATUS_OK && status == CCA_STATUS_OK)
{
status = srv_dtcnt_wlan_proc_cca_param_profile(param, cntx->profile[index]);
}
/* If we fail to process the profile, release the memory. */
if (status == CCA_STATUS_FAIL)
{
MMI_TRACE(MMI_CONN_TRC_G6_DTCNT, SRV_DTCNT_WLAN_OTAP_PRE_DISCARD_PROF);
srv_dtcnt_wlan_free_otap_profile(cntx, index);
}
return status;
}
#endif /* ! (defined(__MMI_WLAN_OTAP_OMAEXT__) || defined(__MMI_WLAN_OTAP_DMP__)) */
#define WLAN_OTAP_EXTERN_APIs
#if defined(__MMI_WLAN_OTAP_OMAEXT__)
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_proc_cca_doc
* DESCRIPTION
* This function is responsible for processing a CCA document relevant to WLAN
* data account.
* PARAMETERS
* conf_id [IN] CCA configuration ID
* doc_hdl [IN] Configuration document handle
* RETURNS
* void
*****************************************************************************/
void srv_dtcnt_wlan_proc_cca_doc(U16 conf_id, S32 doc_hdl)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*
* Mapping table used to extract the WLAN settings for each profile. All
* characteristics are included such that unsupported fields can also be
* found out.
*/
const U16 proc_tbl[] =
{
CCA_NS_TRIGNODE, CCA_NS_OMA_NAPDEF,
WLAN_OTAP_NS_NAPDEF, 0xFFFF,
CCA_NS_TRIGNODE, CCA_NS_OMA_NAPDEF, CCA_NS_OMA_WLAN,
WLAN_OTAP_NS_WLAN, 0xFFFF,
CCA_NS_TRIGNODE, CCA_NS_OMA_NAPDEF, CCA_NS_OMA_WLAN, CCA_NS_OMA_SEC_SSID,
WLAN_OTAP_NS_SEC_SSID, 0xFFFF,
CCA_NS_TRIGNODE, CCA_NS_OMA_NAPDEF, CCA_NS_OMA_WLAN, CCA_NS_OMA_EAP,
WLAN_OTAP_NS_EAP, 0xFFFF,
CCA_NS_TRIGNODE, CCA_NS_OMA_NAPDEF, CCA_NS_OMA_WLAN, CCA_NS_OMA_EAP, CCA_NS_OMA_CERT,
WLAN_OTAP_NS_CERT, 0xFFFF,
CCA_NS_TRIGNODE, CCA_NS_OMA_NAPDEF, CCA_NS_OMA_WLAN, CCA_NS_OMA_WEPKEY,
WLAN_OTAP_NS_WEPKEY, 0xFFFF
};
cca_status_enum status;
U8 i;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_TRACE(MMI_CONN_TRC_G6_DTCNT, SRV_DTCNT_WLAN_OTAP_RECV_DOC);
/* Whether any other OTA provisioning process is still running. */
if (g_srv_dtcnt_wlan_otap != NULL)
{
MMI_ASSERT(0); /* Guaranteed by CCA that this should not happen */
}
/* Init control block and save the ID/handle for the response msg. */
g_srv_dtcnt_wlan_otap = srv_dtcnt_wlan_new_otap_cntx(conf_id, doc_hdl);
if (g_srv_dtcnt_wlan_otap == NULL)
{
srv_dtcnt_send_cca_app_configure_rsp(conf_id, doc_hdl, CCA_STATUS_FAIL);
return;
}
/* Extract WLAN settings from CCA configuration document, and store
settings in the temporary storage. */
status = mmi_cca_doc_process(
doc_hdl,
proc_tbl,
sizeof(proc_tbl) / sizeof(U16),
NULL,
srv_dtcnt_wlan_proc_cca_nodes,
g_srv_dtcnt_wlan_otap);
/* Whether each profile contains all mandatory fields. */
for (i = 0; i < g_srv_dtcnt_wlan_otap->num_profiles; )
{
/* If valid, examine next profile. If invalid, free the profile. */
if (srv_dtcnt_wlan_validate_profile(g_srv_dtcnt_wlan_otap->profile[i]) == MMI_TRUE)
{
++i;
}
else
{
/* Profiles are shifted. No need to increase the index. */
srv_dtcnt_wlan_free_otap_profile(g_srv_dtcnt_wlan_otap, i);
status = CCA_STATUS_FAIL;
}
}
/* If there is no correct WLAN profile, send a FAIL response message back
to CCA. Popup a notification screen to inform the user. */
if (g_srv_dtcnt_wlan_otap->num_profiles == 0)
{
/* Now, terminate the WLAN OTA provisioning application. */
srv_dtcnt_send_cca_app_configure_rsp(conf_id, doc_hdl, CCA_STATUS_INVALID_SETTING);
srv_dtcnt_wlan_free_otap_cntx();
return;
}
/* Start the WLAN OTA provisioning application to interact with user. */
srv_dtcnt_wlan_otap_install_start();
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_is_cca_target
* DESCRIPTION
* This function examines whether the configuration document has any settings
* relevant to WLAN data account.
* PARAMETERS
* conf_id [IN] CCA configuration ID
* doc_hdl [IN] Configuration document handle
* data_list [IN] Level one node IDs and application IDs
* RETURNS
* Return CCA_STATUS_OK if the document is relevant to WLAN data account;
* otherwise, return CCA_STATUS_NOT_FOUND.
*****************************************************************************/
cca_status_enum srv_dtcnt_wlan_is_cca_target(
U16 conf_id,
S32 doc_hdl,
cca_iterator_struct *data_list)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
cca_iterator_struct *node_list, *param_list;
S32 num_nodes, num_params;
cca_status_enum status;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* Check whether NAPDEF nodes are presented in the document. */
status = mmi_cca_doc_get_nodes(doc_hdl, CCA_NS_OMA_NAPDEF, &node_list, &num_nodes);
if (status != CCA_STATUS_OK)
{
return CCA_STATUS_NOT_FOUND;
}
/* Check whether there are NAPDEF nodes that have a BEARER parameter with
the value of WLAN. */
while (mmi_cca_iterator_next(node_list) != NULL)
{
/* Extract all parameters and their values in the current node. */
status = mmi_cca_doc_get_nodedata(node_list, ¶m_list, &num_params);
if (status != CCA_STATUS_OK)
{
continue; /* No need to release param iterator here */
}
/* Whether there is a WLAN bearer in the NAPDEF node */
if (srv_dtcnt_wlan_has_otap_profile(param_list) == MMI_TRUE)
{
/* Release memory and return OK */
mmi_cca_iterator_release(node_list);
mmi_cca_iterator_release(param_list);
return CCA_STATUS_OK;
}
/* Release memory for the current node. */
mmi_cca_iterator_release(param_list);
}
/* Release memory and return NOT_FOUND */
mmi_cca_iterator_release(node_list);
return CCA_STATUS_NOT_FOUND;
}
#elif defined(__MMI_WLAN_OTAP_DMP__)
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_proc_cca_doc
* DESCRIPTION
* This function is responsible for processing a CCA document relevant to WLAN
* data account.
* PARAMETERS
* conf_id [IN] CCA configuration ID
* doc_hdl [IN] Configuration document handle
* RETURNS
* void
*****************************************************************************/
void srv_dtcnt_wlan_proc_cca_doc(U16 conf_id, S32 doc_hdl)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*
* Mapping table used to extract the WLAN settings for each profile. All
* characteristics are included such that unsupported fields can also be
* found out.
*/
const U16 proc_tbl[] =
{
CCA_NS_TRIGNODE, CCA_NS_OMADMP_WIFI, CCA_NS_OMADMP_ACCESS_POINT, CCA_NS_OMADMP_PROFILE,
WLAN_OTAP_NS_INFRA, 0xFFFF,
CCA_NS_TRIGNODE, CCA_NS_OMADMP_WIFI, CCA_NS_OMADMP_AD_HOC, CCA_NS_OMADMP_PROFILE,
WLAN_OTAP_NS_ADHOC, 0xFFFF
};
//cca_status_enum status;
U8 i;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_TRACE(MMI_CONN_TRC_G6_DTCNT, SRV_DTCNT_WLAN_OTAP_RECV_DOC);
/* Whether any other OTA provisioning process is still running. */
if (g_srv_dtcnt_wlan_otap != NULL)
{
MMI_ASSERT(0); /* Guaranteed by CCA that this should not happen */
}
/* Init control block and save the ID/handle for the response msg. */
g_srv_dtcnt_wlan_otap = srv_dtcnt_wlan_new_otap_cntx(conf_id, doc_hdl);
if (g_srv_dtcnt_wlan_otap == NULL)
{
srv_dtcnt_send_cca_app_configure_rsp(conf_id, doc_hdl, CCA_STATUS_FAIL);
return;
}
/* Extract WLAN settings from CCA configuration document, and store
settings in the temporary storage. */
mmi_cca_doc_process(
doc_hdl,
proc_tbl,
sizeof(proc_tbl) / sizeof(U16),
NULL,
srv_dtcnt_wlan_proc_cca_nodes,
g_srv_dtcnt_wlan_otap);
/* Whether each profile contains all mandatory fields. */
for (i = 0; i < g_srv_dtcnt_wlan_otap->num_profiles; )
{
/* If valid, examine next profile. If invalid, free the profile. */
if (srv_dtcnt_wlan_validate_profile(g_srv_dtcnt_wlan_otap->profile[i]) == MMI_TRUE)
{
++i;
}
else
{
/* Profiles are shifted. No need to increase the index. */
MMI_TRACE(MMI_CONN_TRC_G6_DTCNT, SRV_DTCNT_WLAN_OTAP_POST_DISCARD_PROF);
srv_dtcnt_wlan_free_otap_profile(g_srv_dtcnt_wlan_otap, i);
//status = CCA_STATUS_FAIL;
}
}
/* If there is no correct WLAN profile, send a error response message back
to CCA. Popup a notification screen to inform the user. */
if (g_srv_dtcnt_wlan_otap->num_profiles == 0)
{
/* Now, terminate the WLAN OTA provisioning application. */
g_srv_dtcnt_wlan_otap->cur_status = 4;
srv_dtcnt_send_cca_app_configure_rsp(conf_id, doc_hdl, CCA_STATUS_INVALID_SETTING);
srv_dtcnt_wlan_free_otap_cntx();
return;
}
/* Ready to install profiles. */
g_srv_dtcnt_wlan_otap->cur_status = 5;
/* Start the WLAN OTA provisioning application to interact with user. */
srv_dtcnt_wlan_otap_install_start();
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_is_cca_target
* DESCRIPTION
* This function examines whether the configuration document has any settings
* relevant to WLAN data account.
* PARAMETERS
* conf_id [IN] CCA configuration ID
* doc_hdl [IN] Configuration document handle
* data_list [IN] Level one node IDs and application IDs
* RETURNS
* Return CCA_STATUS_OK if the document is relevant to WLAN data account;
* otherwise, return CCA_STATUS_NOT_FOUND.
*****************************************************************************/
cca_status_enum srv_dtcnt_wlan_is_cca_target(
U16 conf_id,
S32 doc_hdl,
cca_iterator_struct *data_list)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S32 *node_id, num_nodes;
cca_status_enum status;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
status = mmi_cca_doc_get_nodedata_ints(data_list, CCA_NS_L1NODEID, &node_id, &num_nodes);
/* Must be OK. It is guaranteed by CCA. */
if (status != CCA_STATUS_OK)
{
MMI_ASSERT(0);
}
/* Return OK if there is a WIFI node in level one. */
while (--num_nodes >= 0)
{
if (node_id[num_nodes] == CCA_NS_OMADMP_WIFI)
{
return CCA_STATUS_OK;
}
}
return CCA_STATUS_NOT_FOUND;
}
#endif /* ! (defined(__MMI_WLAN_OTAP_OMAEXT__) || defined(__MMI_WLAN_OTAP_DMP__)) */
void srv_dtcnt_wlan_prov_ind_callback(srv_dtcnt_prov_cnf_enum cnf, U8 replace_idx)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_TRACE(MMI_CONN_TRC_G6_DTCNT, SRV_DTCNT_WLAN_OTAP_RROV_IND_CALLBACK, cnf, replace_idx);
switch (cnf)
{
case SRV_DTCNT_PROV_CNF_INSTALL:
srv_dtcnt_wlan_otap_install();
break;
case SRV_DTCNT_PROV_CNF_REPLACE:
srv_dtcnt_wlan_otap_replace(replace_idx);
break;
case SRV_DTCNT_PROV_CNF_SKIP:
srv_dtcnt_wlan_otap_skip();
break;
case SRV_DTCNT_PROV_CNF_ABORT:
srv_dtcnt_wlan_abort_otap_app(NULL);
break;
default:
break;
}
}
/*****************************************************************************
* FUNCTION
* srv_dtcnt_wlan_event_callback
* DESCRIPTION
* The callback function after post event is done
* Including action response, action notify and confirm indication
* PARAMETERS
* result_evt: [IN] result structure
* RETURNS
* mmi_ret
*****************************************************************************/
mmi_ret srv_dtcnt_wlan_event_callback(mmi_post_result_event_struct *result_evt)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_TRACE(MMI_CONN_TRC_G6_DTCNT, SRV_DTCNT_WLAN_OTAP_EVENT_CALLBACK, result_evt, result_evt->user_data);
if (result_evt->user_data != NULL)
{
OslMfree(result_evt->user_data);
}
return MMI_RET_OK;
}
#endif /* defined(__MMI_WLAN_OTAP_OMAEXT__) || defined(__MMI_WLAN_OTAP_DMP__) */
#endif /* __MMI_WLAN_FEATURES__ */
#endif /* __CCA_SUPPORT__ */
#endif /* __TCPIP__ */