openthread-sys 0.1.4

Rust bindings for OpenThread
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
/*
 *    Copyright (c) 2016, The OpenThread Authors.
 *    All rights reserved.
 *
 *    Redistribution and use in source and binary forms, with or without
 *    modification, are permitted provided that the following conditions are met:
 *    1. Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *    2. Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *    3. Neither the name of the copyright holder nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 *
 *    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 *    ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 *    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 *    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
 *    DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 *    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 *    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 *    ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 *    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 *    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

/**
 * @file
 *   This file contains definitions of spinel.
 */

#ifndef SPINEL_HEADER_INCLUDED
#define SPINEL_HEADER_INCLUDED 1

/*
 *   Spinel is a host-controller protocol designed to enable
 *   inter-operation over simple serial connections between general purpose
 *   device operating systems (OS) host and network co-processors (NCP) for
 *   the purpose of controlling and managing the NCP.
 *
 * ---------------------------------------------------------------------------
 *
 *   Frame Format
 *
 *   A frame is defined simply as the concatenation of
 *
 *   -  A header byte
 *   -  A command (up to three bytes)
 *   -  An optional command payload
 *
 *              +---------+--------+-----+-------------+
 *              | Octets: |   1    | 1-3 |      n      |
 *              +---------+--------+-----+-------------+
 *              | Fields: | HEADER | CMD | CMD_PAYLOAD |
 *              +---------+--------+-----+-------------+
 *
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 *
 *   Header Format
 *
 *   The header byte is broken down as follows:
 *
 *                    0   1   2   3   4   5   6   7
 *                  +---+---+---+---+---+---+---+---+
 *                  |  FLG  |  IID  |      TID      |
 *                  +---+---+---+---+---+---+---+---+
 *
 *
 *   The flag field of the header byte ("FLG") is always set to the value
 *   two (or "10" in binary).  Any frame received with these bits set to
 *   any other value else MUST NOT be considered a Spinel frame.
 *
 *   This convention allows Spinel to be line compatible with BTLE HCI.
 *   By defining the first two bit in this way we can disambiguate between
 *   Spinel frames and HCI frames (which always start with either "0x01"
 *   or "0x04") without any additional framing overhead.
 *
 *   The Interface Identifier (IID) is a number between 0 and 3, which
 *   is associated by the OS with a specific NCP. This allows the protocol
 *   to support up to 4 NCPs under same connection.
 *
 *   The least significant bits of the header represent the Transaction
 *   Identifier (TID). The TID is used for correlating responses to the
 *   commands which generated them.
 *
 *   When a command is sent from the host, any reply to that command sent
 *   by the NCP will use the same value for the TID.  When the host
 *   receives a frame that matches the TID of the command it sent, it can
 *   easily recognize that frame as the actual response to that command.
 *
 *   The TID value of zero (0) is used for commands to which a correlated
 *   response is not expected or needed, such as for unsolicited update
 *   commands sent to the host from the NCP.
 *
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 *
 *   The command identifier is a 21-bit unsigned integer encoded in up to
 *   three bytes using the packed unsigned integer format described below.
 *   Depending on the semantics of the command in question, a payload MAY
 *   be included in the frame.  The exact composition and length of the
 *   payload is defined by the command identifier.
 *
 * ---------------------------------------------------------------------------
 *
 *   Data Packing
 *
 *   Data serialization for properties is performed using a light-weight
 *   data packing format which was loosely inspired by D-Bus.  The format
 *   of a serialization is defined by a specially formatted string.
 *
 *   This packing format is used for notational convenience.  While this
 *   string-based data-type format has been designed so that the strings
 *   may be directly used by a structured data parser, such a thing is not
 *   required to implement Spinel.
 *
 *   Goals:
 *
 *   -  Be lightweight and favor direct representation of values.
 *   -  Use an easily readable and memorable format string.
 *   -  Support lists and structures.
 *   -  Allow properties to be appended to structures while maintaining
 *      backward compatibility.
 *
 *   Each primitive data-type has an ASCII character associated with it.
 *   Structures can be represented as strings of these characters.  For
 *   example:
 *
 *   -  "C": A single unsigned byte.
 *   -  "C6U": A single unsigned byte, followed by a 128-bit IPv6 address,
 *      followed by a zero-terminated UTF8 string.
 *   -  "A(6)": An array of concatenated IPv6 addresses
 *
 *   In each case, the data is represented exactly as described.  For
 *   example, an array of 10 IPv6 address is stored as 160 bytes.
 *
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 *
 *   Primitive Types
 *
 *   +----------+----------------------+---------------------------------+
 *   |   Char   | Name                 | Description                     |
 *   +----------+----------------------+---------------------------------+
 *   |   "."    | DATATYPE_VOID        | Empty data type. Used           |
 *   |          |                      | internally.                     |
 *   |   "b"    | DATATYPE_BOOL        | Boolean value. Encoded in       |
 *   |          |                      | 8-bits as either 0x00 or 0x01.  |
 *   |          |                      | All other values are illegal.   |
 *   |   "C"    | DATATYPE_UINT8       | Unsigned 8-bit integer.         |
 *   |   "c"    | DATATYPE_INT8        | Signed 8-bit integer.           |
 *   |   "S"    | DATATYPE_UINT16      | Unsigned 16-bit integer.        |
 *   |   "s"    | DATATYPE_INT16       | Signed 16-bit integer.          |
 *   |   "L"    | DATATYPE_UINT32      | Unsigned 32-bit integer.        |
 *   |   "l"    | DATATYPE_INT32       | Signed 32-bit integer.          |
 *   |   "i"    | DATATYPE_UINT_PACKED | Packed Unsigned Integer. See    |
 *   |          |                      | description below               |
 *   |   "6"    | DATATYPE_IPv6ADDR    | IPv6 Address. (Big-endian)      |
 *   |   "E"    | DATATYPE_EUI64       | EUI-64 Address. (Big-endian)    |
 *   |   "e"    | DATATYPE_EUI48       | EUI-48 Address. (Big-endian)    |
 *   |   "D"    | DATATYPE_DATA        | Arbitrary data. See related     |
 *   |          |                      | section below for details.      |
 *   |   "d"    | DATATYPE_DATA_WLEN   | Arbitrary data with prepended   |
 *   |          |                      | length. See below for details   |
 *   |   "U"    | DATATYPE_UTF8        | Zero-terminated UTF8-encoded    |
 *   |          |                      | string.                         |
 *   | "t(...)" | DATATYPE_STRUCT      | Structured datatype with        |
 *   |          |                      | prepended length.               |
 *   | "A(...)" | DATATYPE_ARRAY       | Array of datatypes. Compound    |
 *   |          |                      | type.                           |
 *   +----------+----------------------+---------------------------------+
 *
 *   All multi-byte values are little-endian unless explicitly stated
 *   otherwise.
 *
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 *
 *   Packed Unsigned Integer
 *
 *   For certain types of integers, such command or property identifiers,
 *   usually have a value on the wire that is less than 127.  However, in
 *   order to not preclude the use of values larger than 255, we would
 *   need to add an extra byte.  Doing this would add an extra byte to the
 *   majority of instances, which can add up in terms of bandwidth.
 *
 *   The packed unsigned integer format is based on the unsigned integer
 *   format in EXI, except that we limit the maximum value to the
 *   largest value that can be encoded into three bytes (2,097,151).
 *
 *   For all values less than 127, the packed form of the number is simply
 *   a single byte which directly represents the number.  For values
 *   larger than 127, the following process is used to encode the value:
 *
 *   1.  The unsigned integer is broken up into _n_ 7-bit chunks and
 *       placed into _n_ octets, leaving the most significant bit of each
 *       octet unused.
 *   2.  Order the octets from least-significant to most-significant.
 *       (Little-endian)
 *   3.  Clear the most significant bit of the most significant octet.
 *       Set the least significant bit on all other octets.
 *
 *   Where `n` is the smallest number of 7-bit chunks you can use to
 *   represent the given value.
 *
 *   Take the value 1337, for example:
 *
 *                              1337 => 0x0539
 *                                   => [39 0A]
 *                                   => [B9 0A]
 *
 *   To decode the value, you collect the 7-bit chunks until you find an
 *   octet with the most significant bit clear.
 *
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 *
 *   Data Blobs
 *
 *   There are two types for data blobs: "d" and "D".
 *
 *   -  "d" has the length of the data (in bytes) prepended to the data
 *      (with the length encoded as type "S").  The size of the length
 *      field is not included in the length.
 *   -  "D" does not have a prepended length: the length of the data is
 *      implied by the bytes remaining to be parsed.  It is an error for
 *      "D" to not be the last type in a type in a type signature.
 *
 *   This dichotomy allows for more efficient encoding by eliminating
 *   redundancy.  If the rest of the buffer is a data blob, encoding the
 *   length would be redundant because we already know how many bytes are
 *   in the rest of the buffer.
 *
 *   In some cases we use "d" even if it is the last field in a type
 *   signature.  We do this to allow for us to be able to append
 *   additional fields to the type signature if necessary in the future.
 *   This is usually the case with embedded structs, like in the scan
 *   results.
 *
 *   For example, let's say we have a buffer that is encoded with the
 *   datatype signature of "CLLD".  In this case, it is pretty easy to
 *   tell where the start and end of the data blob is: the start is 9
 *   bytes from the start of the buffer, and its length is the length of
 *   the buffer minus 9. (9 is the number of bytes taken up by a byte and
 *   two longs)
 *
 *   The datatype signature "CLLDU" is illegal because we can't determine
 *   where the last field (a zero-terminated UTF8 string) starts.  But the
 *   datatype "CLLdU" is legal, because the parser can determine the
 *   exact length of the data blob-- allowing it to know where the start
 *   of the next field would be.
 *
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 *
 *   Structured Data
 *
 *   The structure data type ("t(...)") is a way of bundling together
 *   several fields into a single structure.  It can be thought of as a
 *   "d" type except that instead of being opaque, the fields in the
 *   content are known.  This is useful for things like scan results where
 *   you have substructures which are defined by different layers.
 *
 *   For example, consider the type signature "Lt(ES)t(6C)".  In this
 *   hypothetical case, the first struct is defined by the MAC layer, and
 *   the second struct is defined by the PHY layer.  Because of the use of
 *   structures, we know exactly what part comes from that layer.
 *   Additionally, we can add fields to each structure without introducing
 *   backward compatability problems: Data encoded as "Lt(ESU)t(6C)"
 *   (Notice the extra "U") will decode just fine as "Lt(ES)t(6C)".
 *   Additionally, if we don't care about the MAC layer and only care
 *   about the network layer, we could parse as "Lt()t(6C)".
 *
 *   Note that data encoded as "Lt(ES)t(6C)" will also parse as "Ldd",
 *   with the structures from both layers now being opaque data blobs.
 *
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 *
 *   Arrays
 *
 *   An array is simply a concatenated set of _n_ data encodings.  For
 *   example, the type "A(6)" is simply a list of IPv6 addresses---one
 *   after the other.  The type "A(6E)" likewise a concatenation of IPv6-
 *   address/EUI-64 pairs.
 *
 *   If an array contains many fields, the fields will often be surrounded
 *   by a structure ("t(...)").  This effectively prepends each item in
 *   the array with its length.  This is useful for improving parsing
 *   performance or to allow additional fields to be added in the future
 *   in a backward compatible way.  If there is a high certainty that
 *   additional fields will never be added, the struct may be omitted
 *   (saving two bytes per item).
 *
 *   This specification does not define a way to embed an array as a field
 *   alongside other fields.
 *
 * ---------------------------------------------------------------------------
 *
 *   Spinel definition guideline:
 *
 *   New NCP firmware should work with an older host driver, i.e., NCP
 *   implementation should remain backward compatible.
 *
 *    - Existing fields in the format of an already implemented spinel
 *      property or command cannot change.
 *
 *    - New fields may be appended at the end of the format (or the end of
 *      a struct) as long as the NCP implementation treats the new fields as
 *      optional (i.e., a driver not aware of and therefore not using the
 *      new fields should continue to function as before).
 *
 * ---------------------------------------------------------------------------
 */

#ifdef SPINEL_PLATFORM_HEADER
#include SPINEL_PLATFORM_HEADER
#else // ifdef SPINEL_PLATFORM_HEADER
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#endif // else SPINEL_PLATFORM_HEADER

// ----------------------------------------------------------------------------

#ifndef DOXYGEN_SHOULD_SKIP_THIS

#if defined(__GNUC__)
#define SPINEL_API_EXTERN extern __attribute__((visibility("default")))
#define SPINEL_API_NONNULL_ALL __attribute__((nonnull))
#define SPINEL_API_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#endif // ifdef __GNUC__

#endif // ifndef DOXYGEN_SHOULD_SKIP_THIS

#ifndef SPINEL_API_EXTERN
#define SPINEL_API_EXTERN extern
#endif

#ifndef SPINEL_API_NONNULL_ALL
#define SPINEL_API_NONNULL_ALL
#endif

#ifndef SPINEL_API_WARN_UNUSED_RESULT
#define SPINEL_API_WARN_UNUSED_RESULT
#endif

// ----------------------------------------------------------------------------

#define SPINEL_PROTOCOL_VERSION_THREAD_MAJOR 4
#define SPINEL_PROTOCOL_VERSION_THREAD_MINOR 3

/**
 * @def SPINEL_FRAME_MAX_SIZE
 *
 *  The maximum size of SPINEL frame.
 *
 */
#define SPINEL_FRAME_MAX_SIZE 1300

/**
 * @def SPINEL_FRAME_MAX_COMMAND_HEADER_SIZE
 *
 *  The maximum size of SPINEL command header.
 *
 */
#define SPINEL_FRAME_MAX_COMMAND_HEADER_SIZE 4

/**
 * @def SPINEL_FRAME_MAX_PAYLOAD_SIZE
 *
 *  The maximum size of SPINEL command payload.
 *
 */
#define SPINEL_FRAME_MAX_COMMAND_PAYLOAD_SIZE (SPINEL_FRAME_MAX_SIZE - SPINEL_FRAME_MAX_COMMAND_HEADER_SIZE)

/**
 * @def SPINEL_ENCRYPTER_EXTRA_DATA_SIZE
 *
 *  The size of extra data to be allocated for spinel frame buffer,
 *  needed by Spinel Encrypter.
 *
 */
#define SPINEL_ENCRYPTER_EXTRA_DATA_SIZE 0

/**
 * @def SPINEL_FRAME_BUFFER_SIZE
 *
 *  The size of buffer large enough to fit one whole spinel frame with extra data
 *  needed by Spinel Encrypter.
 *
 */
#define SPINEL_FRAME_BUFFER_SIZE (SPINEL_FRAME_MAX_SIZE + SPINEL_ENCRYPTER_EXTRA_DATA_SIZE)

/// Macro for generating bit masks using bit index from the spec
#define SPINEL_BIT_MASK(bit_index, field_bit_count) ((1 << ((field_bit_count)-1)) >> (bit_index))

// ----------------------------------------------------------------------------

#if defined(__cplusplus)
extern "C" {
#endif

enum
{
    SPINEL_STATUS_OK                       = 0,  ///< Operation has completed successfully.
    SPINEL_STATUS_FAILURE                  = 1,  ///< Operation has failed for some undefined reason.
    SPINEL_STATUS_UNIMPLEMENTED            = 2,  ///< Given operation has not been implemented.
    SPINEL_STATUS_INVALID_ARGUMENT         = 3,  ///< An argument to the operation is invalid.
    SPINEL_STATUS_INVALID_STATE            = 4,  ///< This operation is invalid for the current device state.
    SPINEL_STATUS_INVALID_COMMAND          = 5,  ///< This command is not recognized.
    SPINEL_STATUS_INVALID_INTERFACE        = 6,  ///< This interface is not supported.
    SPINEL_STATUS_INTERNAL_ERROR           = 7,  ///< An internal runtime error has occurred.
    SPINEL_STATUS_SECURITY_ERROR           = 8,  ///< A security/authentication error has occurred.
    SPINEL_STATUS_PARSE_ERROR              = 9,  ///< A error has occurred while parsing the command.
    SPINEL_STATUS_IN_PROGRESS              = 10, ///< This operation is in progress.
    SPINEL_STATUS_NOMEM                    = 11, ///< Operation prevented due to memory pressure.
    SPINEL_STATUS_BUSY                     = 12, ///< The device is currently performing a mutually exclusive operation
    SPINEL_STATUS_PROP_NOT_FOUND           = 13, ///< The given property is not recognized.
    SPINEL_STATUS_DROPPED                  = 14, ///< A/The packet was dropped.
    SPINEL_STATUS_EMPTY                    = 15, ///< The result of the operation is empty.
    SPINEL_STATUS_CMD_TOO_BIG              = 16, ///< The command was too large to fit in the internal buffer.
    SPINEL_STATUS_NO_ACK                   = 17, ///< The packet was not acknowledged.
    SPINEL_STATUS_CCA_FAILURE              = 18, ///< The packet was not sent due to a CCA failure.
    SPINEL_STATUS_ALREADY                  = 19, ///< The operation is already in progress.
    SPINEL_STATUS_ITEM_NOT_FOUND           = 20, ///< The given item could not be found.
    SPINEL_STATUS_INVALID_COMMAND_FOR_PROP = 21, ///< The given command cannot be performed on this property.

    SPINEL_STATUS_JOIN__BEGIN = 104,

    /// Generic failure to associate with other peers.
    /**
     *  This status error should not be used by implementors if
     *  enough information is available to determine that one of the
     *  later join failure status codes would be more accurate.
     *
     *  \sa SPINEL_PROP_NET_REQUIRE_JOIN_EXISTING
     *  \sa SPINEL_PROP_MESHCOP_JOINER_COMMISSIONING
     */
    SPINEL_STATUS_JOIN_FAILURE = SPINEL_STATUS_JOIN__BEGIN + 0,

    /// The node found other peers but was unable to decode their packets.
    /**
     *  Typically this error code indicates that the network
     *  key has been set incorrectly.
     *
     *  \sa SPINEL_PROP_NET_REQUIRE_JOIN_EXISTING
     *  \sa SPINEL_PROP_MESHCOP_JOINER_COMMISSIONING
     */
    SPINEL_STATUS_JOIN_SECURITY = SPINEL_STATUS_JOIN__BEGIN + 1,

    /// The node was unable to find any other peers on the network.
    /**
     *  \sa SPINEL_PROP_NET_REQUIRE_JOIN_EXISTING
     *  \sa SPINEL_PROP_MESHCOP_JOINER_COMMISSIONING
     */
    SPINEL_STATUS_JOIN_NO_PEERS = SPINEL_STATUS_JOIN__BEGIN + 2,

    /// The only potential peer nodes found are incompatible.
    /**
     *  \sa SPINEL_PROP_NET_REQUIRE_JOIN_EXISTING
     */
    SPINEL_STATUS_JOIN_INCOMPATIBLE = SPINEL_STATUS_JOIN__BEGIN + 3,

    /// No response in expecting time.
    /**
     *  \sa SPINEL_PROP_MESHCOP_JOINER_COMMISSIONING
     */
    SPINEL_STATUS_JOIN_RSP_TIMEOUT = SPINEL_STATUS_JOIN__BEGIN + 4,

    /// The node succeeds in commissioning and get the network credentials.
    /**
     *  \sa SPINEL_PROP_MESHCOP_JOINER_COMMISSIONING
     */
    SPINEL_STATUS_JOIN_SUCCESS = SPINEL_STATUS_JOIN__BEGIN + 5,

    SPINEL_STATUS_JOIN__END = 112,

    SPINEL_STATUS_RESET__BEGIN   = 112,
    SPINEL_STATUS_RESET_POWER_ON = SPINEL_STATUS_RESET__BEGIN + 0,
    SPINEL_STATUS_RESET_EXTERNAL = SPINEL_STATUS_RESET__BEGIN + 1,
    SPINEL_STATUS_RESET_SOFTWARE = SPINEL_STATUS_RESET__BEGIN + 2,
    SPINEL_STATUS_RESET_FAULT    = SPINEL_STATUS_RESET__BEGIN + 3,
    SPINEL_STATUS_RESET_CRASH    = SPINEL_STATUS_RESET__BEGIN + 4,
    SPINEL_STATUS_RESET_ASSERT   = SPINEL_STATUS_RESET__BEGIN + 5,
    SPINEL_STATUS_RESET_OTHER    = SPINEL_STATUS_RESET__BEGIN + 6,
    SPINEL_STATUS_RESET_UNKNOWN  = SPINEL_STATUS_RESET__BEGIN + 7,
    SPINEL_STATUS_RESET_WATCHDOG = SPINEL_STATUS_RESET__BEGIN + 8,
    SPINEL_STATUS_RESET__END     = 128,

    SPINEL_STATUS_VENDOR__BEGIN = 15360,
    SPINEL_STATUS_VENDOR__END   = 16384,

    SPINEL_STATUS_STACK_NATIVE__BEGIN = 16384,
    SPINEL_STATUS_STACK_NATIVE__END   = 81920,

    SPINEL_STATUS_EXPERIMENTAL__BEGIN = 2000000,
    SPINEL_STATUS_EXPERIMENTAL__END   = 2097152,
};

typedef uint32_t spinel_status_t;

typedef enum
{
    SPINEL_NET_ROLE_DETACHED = 0,
    SPINEL_NET_ROLE_CHILD    = 1,
    SPINEL_NET_ROLE_ROUTER   = 2,
    SPINEL_NET_ROLE_LEADER   = 3,
} spinel_net_role_t;

typedef enum
{
    SPINEL_IPV6_ICMP_PING_OFFLOAD_DISABLED       = 0,
    SPINEL_IPV6_ICMP_PING_OFFLOAD_UNICAST_ONLY   = 1,
    SPINEL_IPV6_ICMP_PING_OFFLOAD_MULTICAST_ONLY = 2,
    SPINEL_IPV6_ICMP_PING_OFFLOAD_ALL            = 3,
} spinel_ipv6_icmp_ping_offload_mode_t;

typedef enum
{
    SPINEL_SCAN_STATE_IDLE     = 0,
    SPINEL_SCAN_STATE_BEACON   = 1,
    SPINEL_SCAN_STATE_ENERGY   = 2,
    SPINEL_SCAN_STATE_DISCOVER = 3,
} spinel_scan_state_t;

typedef enum
{
    SPINEL_MCU_POWER_STATE_ON        = 0,
    SPINEL_MCU_POWER_STATE_LOW_POWER = 1,
    SPINEL_MCU_POWER_STATE_OFF       = 2,
} spinel_mcu_power_state_t;

// The `spinel_power_state_t` enumeration and `POWER_STATE`
// property are deprecated. Please use `MCU_POWER_STATE`
// instead.
typedef enum
{
    SPINEL_POWER_STATE_OFFLINE    = 0,
    SPINEL_POWER_STATE_DEEP_SLEEP = 1,
    SPINEL_POWER_STATE_STANDBY    = 2,
    SPINEL_POWER_STATE_LOW_POWER  = 3,
    SPINEL_POWER_STATE_ONLINE     = 4,
} spinel_power_state_t;

typedef enum
{
    SPINEL_HOST_POWER_STATE_OFFLINE    = 0,
    SPINEL_HOST_POWER_STATE_DEEP_SLEEP = 1,
    SPINEL_HOST_POWER_STATE_RESERVED   = 2,
    SPINEL_HOST_POWER_STATE_LOW_POWER  = 3,
    SPINEL_HOST_POWER_STATE_ONLINE     = 4,
} spinel_host_power_state_t;

typedef enum
{
    SPINEL_MESHCOP_JOINER_STATE_IDLE       = 0,
    SPINEL_MESHCOP_JOINER_STATE_DISCOVER   = 1,
    SPINEL_MESHCOP_JOINER_STATE_CONNECTING = 2,
    SPINEL_MESHCOP_JOINER_STATE_CONNECTED  = 3,
    SPINEL_MESHCOP_JOINER_STATE_ENTRUST    = 4,
    SPINEL_MESHCOP_JOINER_STATE_JOINED     = 5,
} spinel_meshcop_joiner_state_t;

enum
{
    SPINEL_NET_FLAG_ON_MESH       = (1 << 0),
    SPINEL_NET_FLAG_DEFAULT_ROUTE = (1 << 1),
    SPINEL_NET_FLAG_CONFIGURE     = (1 << 2),
    SPINEL_NET_FLAG_DHCP          = (1 << 3),
    SPINEL_NET_FLAG_SLAAC         = (1 << 4),
    SPINEL_NET_FLAG_PREFERRED     = (1 << 5),

    SPINEL_NET_FLAG_PREFERENCE_OFFSET = 6,
    SPINEL_NET_FLAG_PREFERENCE_MASK   = (3 << SPINEL_NET_FLAG_PREFERENCE_OFFSET),
};

enum
{
    SPINEL_ROUTE_PREFERENCE_HIGH   = (1 << SPINEL_NET_FLAG_PREFERENCE_OFFSET),
    SPINEL_ROUTE_PREFERENCE_MEDIUM = (0 << SPINEL_NET_FLAG_PREFERENCE_OFFSET),
    SPINEL_ROUTE_PREFERENCE_LOW    = (3 << SPINEL_NET_FLAG_PREFERENCE_OFFSET),
};

enum
{
    SPINEL_THREAD_MODE_FULL_NETWORK_DATA   = (1 << 0),
    SPINEL_THREAD_MODE_FULL_THREAD_DEV     = (1 << 1),
    SPINEL_THREAD_MODE_SECURE_DATA_REQUEST = (1 << 2),
    SPINEL_THREAD_MODE_RX_ON_WHEN_IDLE     = (1 << 3),
};

enum
{
    SPINEL_GPIO_FLAG_DIR_INPUT       = 0,
    SPINEL_GPIO_FLAG_DIR_OUTPUT      = SPINEL_BIT_MASK(0, 8),
    SPINEL_GPIO_FLAG_PULL_UP         = SPINEL_BIT_MASK(1, 8),
    SPINEL_GPIO_FLAG_PULL_DOWN       = SPINEL_BIT_MASK(2, 8),
    SPINEL_GPIO_FLAG_OPEN_DRAIN      = SPINEL_BIT_MASK(2, 8),
    SPINEL_GPIO_FLAG_TRIGGER_NONE    = 0,
    SPINEL_GPIO_FLAG_TRIGGER_RISING  = SPINEL_BIT_MASK(3, 8),
    SPINEL_GPIO_FLAG_TRIGGER_FALLING = SPINEL_BIT_MASK(4, 8),
    SPINEL_GPIO_FLAG_TRIGGER_ANY     = SPINEL_GPIO_FLAG_TRIGGER_RISING | SPINEL_GPIO_FLAG_TRIGGER_FALLING,
};

enum
{
    SPINEL_PROTOCOL_TYPE_BOOTLOADER = 0,
    SPINEL_PROTOCOL_TYPE_ZIGBEE_IP  = 2,
    SPINEL_PROTOCOL_TYPE_THREAD     = 3,
};

enum
{
    SPINEL_MAC_PROMISCUOUS_MODE_OFF     = 0, ///< Normal MAC filtering is in place.
    SPINEL_MAC_PROMISCUOUS_MODE_NETWORK = 1, ///< All MAC packets matching network are passed up the stack.
    SPINEL_MAC_PROMISCUOUS_MODE_FULL    = 2, ///< All decoded MAC packets are passed up the stack.
};

enum
{
    SPINEL_NCP_LOG_LEVEL_EMERG  = 0,
    SPINEL_NCP_LOG_LEVEL_ALERT  = 1,
    SPINEL_NCP_LOG_LEVEL_CRIT   = 2,
    SPINEL_NCP_LOG_LEVEL_ERR    = 3,
    SPINEL_NCP_LOG_LEVEL_WARN   = 4,
    SPINEL_NCP_LOG_LEVEL_NOTICE = 5,
    SPINEL_NCP_LOG_LEVEL_INFO   = 6,
    SPINEL_NCP_LOG_LEVEL_DEBUG  = 7,
};

enum
{
    SPINEL_NCP_LOG_REGION_NONE        = 0,
    SPINEL_NCP_LOG_REGION_OT_API      = 1,
    SPINEL_NCP_LOG_REGION_OT_MLE      = 2,
    SPINEL_NCP_LOG_REGION_OT_ARP      = 3,
    SPINEL_NCP_LOG_REGION_OT_NET_DATA = 4,
    SPINEL_NCP_LOG_REGION_OT_ICMP     = 5,
    SPINEL_NCP_LOG_REGION_OT_IP6      = 6,
    SPINEL_NCP_LOG_REGION_OT_MAC      = 7,
    SPINEL_NCP_LOG_REGION_OT_MEM      = 8,
    SPINEL_NCP_LOG_REGION_OT_NCP      = 9,
    SPINEL_NCP_LOG_REGION_OT_MESH_COP = 10,
    SPINEL_NCP_LOG_REGION_OT_NET_DIAG = 11,
    SPINEL_NCP_LOG_REGION_OT_PLATFORM = 12,
    SPINEL_NCP_LOG_REGION_OT_COAP     = 13,
    SPINEL_NCP_LOG_REGION_OT_CLI      = 14,
    SPINEL_NCP_LOG_REGION_OT_CORE     = 15,
    SPINEL_NCP_LOG_REGION_OT_UTIL     = 16,
    SPINEL_NCP_LOG_REGION_OT_BBR      = 17,
};

enum
{
    SPINEL_MESHCOP_COMMISSIONER_STATE_DISABLED = 0,
    SPINEL_MESHCOP_COMMISSIONER_STATE_PETITION = 1,
    SPINEL_MESHCOP_COMMISSIONER_STATE_ACTIVE   = 2,
};

enum
{
    SPINEL_ADDRESS_CACHE_ENTRY_STATE_CACHED      = 0, // Entry is cached and in-use.
    SPINEL_ADDRESS_CACHE_ENTRY_STATE_SNOOPED     = 1, // Entry is created by snoop optimization.
    SPINEL_ADDRESS_CACHE_ENTRY_STATE_QUERY       = 2, // Entry represents an ongoing query for the EID.
    SPINEL_ADDRESS_CACHE_ENTRY_STATE_RETRY_QUERY = 3, // Entry is in retry mode (a prior query did not  a response).
};

typedef struct
{
    uint8_t bytes[8];
} spinel_eui64_t;

typedef struct
{
    uint8_t bytes[8];
} spinel_net_xpanid_t;

typedef struct
{
    uint8_t bytes[16];
} spinel_net_pskc_t;

typedef struct
{
    uint8_t bytes[6];
} spinel_eui48_t;

typedef struct
{
    uint8_t bytes[16];
} spinel_ipv6addr_t;

typedef int          spinel_ssize_t;
typedef unsigned int spinel_size_t;
typedef uint8_t      spinel_tid_t;

enum
{
    SPINEL_MD_FLAG_TX       = 0x0001, //!< Packet was transmitted, not received.
    SPINEL_MD_FLAG_BAD_FCS  = 0x0004, //!< Packet was received with bad FCS
    SPINEL_MD_FLAG_DUPE     = 0x0008, //!< Packet seems to be a duplicate
    SPINEL_MD_FLAG_ACKED_FP = 0x0010, //!< Packet was acknowledged with frame pending set
    SPINEL_MD_FLAG_RESERVED = 0xFFE2, //!< Flags reserved for future use.
};

enum
{
    /**
     * No-Operation command (Host -> NCP)
     *
     * Encoding: Empty
     *
     * Induces the NCP to send a success status back to the host. This is
     * primarily used for liveliness checks. The command payload for this
     * command SHOULD be empty.
     *
     * There is no error condition for this command.
     *
     */
    SPINEL_CMD_NOOP = 0,

    /**
     * Reset NCP command (Host -> NCP)
     *
     * Encoding: Empty
     *
     * Causes the NCP to perform a software reset. Due to the nature of
     * this command, the TID is ignored. The host should instead wait
     * for a `CMD_PROP_VALUE_IS` command from the NCP indicating
     * `PROP_LAST_STATUS` has been set to `STATUS_RESET_SOFTWARE`.
     *
     * The command payload for this command SHOULD be empty.
     *
     * If an error occurs, the value of `PROP_LAST_STATUS` will be emitted
     * instead with the value set to the generated status code for the error.
     *
     */
    SPINEL_CMD_RESET = 1,

    /**
     * Get property value command (Host -> NCP)
     *
     * Encoding: `i`
     *   `i` : Property Id
     *
     * Causes the NCP to emit a `CMD_PROP_VALUE_IS` command for the
     * given property identifier.
     *
     * The payload for this command is the property identifier encoded
     * in the packed unsigned integer format `i`.
     *
     * If an error occurs, the value of `PROP_LAST_STATUS` will be emitted
     * instead with the value set to the generated status code for the error.
     *
     */
    SPINEL_CMD_PROP_VALUE_GET = 2,

    /**
     * Set property value command (Host -> NCP)
     *
     * Encoding: `iD`
     *   `i` : Property Id
     *   `D` : Value (encoding depends on the property)
     *
     * Instructs the NCP to set the given property to the specific given
     * value, replacing any previous value.
     *
     * The payload for this command is the property identifier encoded in the
     * packed unsigned integer format, followed by the property value. The
     * exact format of the property value is defined by the property.
     *
     * On success a `CMD_PROP_VALUE_IS` command is emitted either for the
     * given property identifier with the set value, or for `PROP_LAST_STATUS`
     * with value `LAST_STATUS_OK`.
     *
     * If an error occurs, the value of `PROP_LAST_STATUS` will be emitted
     * with the value set to the generated status code for the error.
     *
     */
    SPINEL_CMD_PROP_VALUE_SET = 3,

    /**
     * Insert value into property command (Host -> NCP)
     *
     * Encoding: `iD`
     *   `i` : Property Id
     *   `D` : Value (encoding depends on the property)
     *
     * Instructs the NCP to insert the given value into a list-oriented
     * property without removing other items in the list. The resulting order
     * of items in the list is defined by the individual property being
     * operated on.
     *
     * The payload for this command is the property identifier encoded in the
     * packed unsigned integer format, followed by the value to be inserted.
     * The exact format of the value is defined by the property.
     *
     * If the type signature of the property consists of a single structure
     * enclosed by an array `A(t(...))`, then the contents of value MUST
     * contain the contents of the structure (`...`) rather than the
     * serialization of the whole item (`t(...)`).  Specifically, the length
     * of the structure MUST NOT be prepended to value. This helps to
     * eliminate redundant data.
     *
     * On success, either a `CMD_PROP_VALUE_INSERTED` command is emitted for
     * the given property, or a `CMD_PROP_VALUE_IS` command is emitted of
     * property `PROP_LAST_STATUS` with value `LAST_STATUS_OK`.
     *
     * If an error occurs, the value of `PROP_LAST_STATUS` will be emitted
     * with the value set to the generated status code for the error.
     *
     */
    SPINEL_CMD_PROP_VALUE_INSERT = 4,

    /**
     * Remove value from property command (Host -> NCP)
     *
     * Encoding: `iD`
     *   `i` : Property Id
     *   `D` : Value (encoding depends on the property)

     * Instructs the NCP to remove the given value from a list-oriented property,
     * without affecting other items in the list. The resulting order of items
     * in the list is defined by the individual property being operated on.
     *
     * Note that this command operates by value, not by index!
     *
     * The payload for this command is the property identifier encoded in the
     * packed unsigned integer format, followed by the value to be removed. The
     * exact format of the value is defined by the property.
     *
     * If the type signature of the property consists of a single structure
     * enclosed by an array `A(t(...))`, then the contents of value MUST contain
     * the contents of the structure (`...`) rather than the serialization of the
     * whole item (`t(...)`).  Specifically, the length of the structure MUST NOT
     * be prepended to `VALUE`. This helps to eliminate redundant data.
     *
     * On success, either a `CMD_PROP_VALUE_REMOVED` command is emitted for the
     * given property, or a `CMD_PROP_VALUE_IS` command is emitted of property
     * `PROP_LAST_STATUS` with value `LAST_STATUS_OK`.
     *
     * If an error occurs, the value of `PROP_LAST_STATUS` will be emitted
     * with the value set to the generated status code for the error.
     *
     */
    SPINEL_CMD_PROP_VALUE_REMOVE = 5,

    /**
     * Property value notification command (NCP -> Host)
     *
     * Encoding: `iD`
     *   `i` : Property Id
     *   `D` : Value (encoding depends on the property)
     *
     * This command can be sent by the NCP in response to a previous command
     * from the host, or it can be sent by the NCP in an unsolicited fashion
     * to notify the host of various state changes asynchronously.
     *
     * The payload for this command is the property identifier encoded in the
     * packed unsigned integer format, followed by the current value of the
     * given property.
     *
     */
    SPINEL_CMD_PROP_VALUE_IS = 6,

    /**
     * Property value insertion notification command (NCP -> Host)
     *
     * Encoding:`iD`
     *   `i` : Property Id
     *   `D` : Value (encoding depends on the property)
     *
     * This command can be sent by the NCP in response to the
     * `CMD_PROP_VALUE_INSERT` command, or it can be sent by the NCP in an
     * unsolicited fashion to notify the host of various state changes
     * asynchronously.
     *
     * The payload for this command is the property identifier encoded in the
     * packed unsigned integer format, followed by the value that was inserted
     * into the given property.
     *
     * If the type signature of the property specified by property id consists
     * of a single structure enclosed by an array (`A(t(...))`), then the
     * contents of value MUST contain the contents of the structure (`...`)
     * rather than the serialization of the whole item (`t(...)`). Specifically,
     * the length of the structure MUST NOT be prepended to `VALUE`. This
     * helps to eliminate redundant data.
     *
     * The resulting order of items in the list is defined by the given
     * property.
     *
     */
    SPINEL_CMD_PROP_VALUE_INSERTED = 7,

    /**
     * Property value removal notification command (NCP -> Host)
     *
     * Encoding: `iD`
     *   `i` : Property Id
     *   `D` : Value (encoding depends on the property)
     *
     * This command can be sent by the NCP in response to the
     * `CMD_PROP_VALUE_REMOVE` command, or it can be sent by the NCP in an
     * unsolicited fashion to notify the host of various state changes
     * asynchronously.
     *
     * Note that this command operates by value, not by index!
     *
     * The payload for this command is the property identifier encoded in the
     * packed unsigned integer format described in followed by the value that
     * was removed from the given property.
     *
     * If the type signature of the property specified by property id consists
     * of a single structure enclosed by an array (`A(t(...))`), then the
     * contents of value MUST contain the contents of the structure (`...`)
     * rather than the serialization of the whole item (`t(...)`).  Specifically,
     * the length of the structure MUST NOT be prepended to `VALUE`. This
     * helps to eliminate redundant data.
     *
     * The resulting order of items in the list is defined by the given
     * property.
     *
     */
    SPINEL_CMD_PROP_VALUE_REMOVED = 8,

    SPINEL_CMD_NET_SAVE = 9, // Deprecated

    /**
     * Clear saved network settings command (Host -> NCP)
     *
     * Encoding: Empty
     *
     * Erases all network credentials and state from non-volatile memory.
     *
     * This operation affects non-volatile memory only. The current network
     * information stored in volatile memory is unaffected.
     *
     * The response to this command is always a `CMD_PROP_VALUE_IS` for
     * `PROP_LAST_STATUS`, indicating the result of the operation.
     *
     */
    SPINEL_CMD_NET_CLEAR = 10,

    SPINEL_CMD_NET_RECALL = 11, // Deprecated

    /**
     * Host buffer offload is an optional NCP capability that, when
     * present, allows the NCP to store data buffers on the host processor
     * that can be recalled at a later time.
     *
     * The presence of this feature can be detected by the host by
     * checking for the presence of the `CAP_HBO`
     * capability in `PROP_CAPS`.
     *
     * This feature is not currently supported on OpenThread.
     *
     */

    SPINEL_CMD_HBO_OFFLOAD   = 12,
    SPINEL_CMD_HBO_RECLAIM   = 13,
    SPINEL_CMD_HBO_DROP      = 14,
    SPINEL_CMD_HBO_OFFLOADED = 15,
    SPINEL_CMD_HBO_RECLAIMED = 16,
    SPINEL_CMD_HBO_DROPPED   = 17,

    /**
     * Peek command (Host -> NCP)
     *
     * Encoding: `LU`
     *   `L` : The address to peek
     *   `U` : Number of bytes to read
     *
     * This command allows the NCP to fetch values from the RAM of the NCP
     * for debugging purposes. Upon success, `CMD_PEEK_RET` is sent from the
     * NCP to the host. Upon failure, `PROP_LAST_STATUS` is emitted with
     * the appropriate error indication.
     *
     * The NCP MAY prevent certain regions of memory from being accessed.
     *
     * This command requires the capability `CAP_PEEK_POKE` to be present.
     *
     */
    SPINEL_CMD_PEEK = 18,

    /**
     * Peek return command (NCP -> Host)
     *
     * Encoding: `LUD`
     *   `L` : The address peeked
     *   `U` : Number of bytes read
     *   `D` : Memory content
     *
     * This command contains the contents of memory that was requested by
     * a previous call to `CMD_PEEK`.
     *
     * This command requires the capability `CAP_PEEK_POKE` to be present.
     *
     */
    SPINEL_CMD_PEEK_RET = 19,

    /**
     * Poke command (Host -> NCP)
     *
     * Encoding: `LUD`
     *   `L` : The address to be poked
     *   `U` : Number of bytes to write
     *   `D` : Content to write
     *
     * This command writes the bytes to the specified memory address
     * for debugging purposes.
     *
     * This command requires the capability `CAP_PEEK_POKE` to be present.
     *
     */
    SPINEL_CMD_POKE = 20,

    SPINEL_CMD_PROP_VALUE_MULTI_GET = 21,
    SPINEL_CMD_PROP_VALUE_MULTI_SET = 22,
    SPINEL_CMD_PROP_VALUES_ARE      = 23,

    SPINEL_CMD_NEST__BEGIN = 15296,
    SPINEL_CMD_NEST__END   = 15360,

    SPINEL_CMD_VENDOR__BEGIN = 15360,
    SPINEL_CMD_VENDOR__END   = 16384,

    SPINEL_CMD_EXPERIMENTAL__BEGIN = 2000000,
    SPINEL_CMD_EXPERIMENTAL__END   = 2097152,
};

typedef uint32_t spinel_command_t;

enum
{
    SPINEL_CAP_LOCK       = 1,
    SPINEL_CAP_NET_SAVE   = 2,
    SPINEL_CAP_HBO        = 3,
    SPINEL_CAP_POWER_SAVE = 4,

    SPINEL_CAP_COUNTERS   = 5,
    SPINEL_CAP_JAM_DETECT = 6,

    SPINEL_CAP_PEEK_POKE = 7,

    SPINEL_CAP_WRITABLE_RAW_STREAM = 8,
    SPINEL_CAP_GPIO                = 9,
    SPINEL_CAP_TRNG                = 10,
    SPINEL_CAP_CMD_MULTI           = 11,
    SPINEL_CAP_UNSOL_UPDATE_FILTER = 12,
    SPINEL_CAP_MCU_POWER_STATE     = 13,
    SPINEL_CAP_PCAP                = 14,

    SPINEL_CAP_802_15_4__BEGIN        = 16,
    SPINEL_CAP_802_15_4_2003          = (SPINEL_CAP_802_15_4__BEGIN + 0),
    SPINEL_CAP_802_15_4_2006          = (SPINEL_CAP_802_15_4__BEGIN + 1),
    SPINEL_CAP_802_15_4_2011          = (SPINEL_CAP_802_15_4__BEGIN + 2),
    SPINEL_CAP_802_15_4_PIB           = (SPINEL_CAP_802_15_4__BEGIN + 5),
    SPINEL_CAP_802_15_4_2450MHZ_OQPSK = (SPINEL_CAP_802_15_4__BEGIN + 8),
    SPINEL_CAP_802_15_4_915MHZ_OQPSK  = (SPINEL_CAP_802_15_4__BEGIN + 9),
    SPINEL_CAP_802_15_4_868MHZ_OQPSK  = (SPINEL_CAP_802_15_4__BEGIN + 10),
    SPINEL_CAP_802_15_4_915MHZ_BPSK   = (SPINEL_CAP_802_15_4__BEGIN + 11),
    SPINEL_CAP_802_15_4_868MHZ_BPSK   = (SPINEL_CAP_802_15_4__BEGIN + 12),
    SPINEL_CAP_802_15_4_915MHZ_ASK    = (SPINEL_CAP_802_15_4__BEGIN + 13),
    SPINEL_CAP_802_15_4_868MHZ_ASK    = (SPINEL_CAP_802_15_4__BEGIN + 14),
    SPINEL_CAP_802_15_4__END          = 32,

    SPINEL_CAP_CONFIG__BEGIN = 32,
    SPINEL_CAP_CONFIG_FTD    = (SPINEL_CAP_CONFIG__BEGIN + 0),
    SPINEL_CAP_CONFIG_MTD    = (SPINEL_CAP_CONFIG__BEGIN + 1),
    SPINEL_CAP_CONFIG_RADIO  = (SPINEL_CAP_CONFIG__BEGIN + 2),
    SPINEL_CAP_CONFIG__END   = 40,

    SPINEL_CAP_ROLE__BEGIN = 48,
    SPINEL_CAP_ROLE_ROUTER = (SPINEL_CAP_ROLE__BEGIN + 0),
    SPINEL_CAP_ROLE_SLEEPY = (SPINEL_CAP_ROLE__BEGIN + 1),
    SPINEL_CAP_ROLE__END   = 52,

    SPINEL_CAP_NET__BEGIN     = 52,
    SPINEL_CAP_NET_THREAD_1_0 = (SPINEL_CAP_NET__BEGIN + 0),
    SPINEL_CAP_NET_THREAD_1_1 = (SPINEL_CAP_NET__BEGIN + 1),
    SPINEL_CAP_NET__END       = 64,

    SPINEL_CAP_OPENTHREAD__BEGIN       = 512,
    SPINEL_CAP_MAC_WHITELIST           = (SPINEL_CAP_OPENTHREAD__BEGIN + 0),
    SPINEL_CAP_MAC_RAW                 = (SPINEL_CAP_OPENTHREAD__BEGIN + 1),
    SPINEL_CAP_OOB_STEERING_DATA       = (SPINEL_CAP_OPENTHREAD__BEGIN + 2),
    SPINEL_CAP_CHANNEL_MONITOR         = (SPINEL_CAP_OPENTHREAD__BEGIN + 3),
    SPINEL_CAP_ERROR_RATE_TRACKING     = (SPINEL_CAP_OPENTHREAD__BEGIN + 4),
    SPINEL_CAP_CHANNEL_MANAGER         = (SPINEL_CAP_OPENTHREAD__BEGIN + 5),
    SPINEL_CAP_OPENTHREAD_LOG_METADATA = (SPINEL_CAP_OPENTHREAD__BEGIN + 6),
    SPINEL_CAP_TIME_SYNC               = (SPINEL_CAP_OPENTHREAD__BEGIN + 7),
    SPINEL_CAP_CHILD_SUPERVISION       = (SPINEL_CAP_OPENTHREAD__BEGIN + 8),
    SPINEL_CAP_POSIX                   = (SPINEL_CAP_OPENTHREAD__BEGIN + 9),
    SPINEL_CAP_SLAAC                   = (SPINEL_CAP_OPENTHREAD__BEGIN + 10),
    SPINEL_CAP_RADIO_COEX              = (SPINEL_CAP_OPENTHREAD__BEGIN + 11),
    SPINEL_CAP_MAC_RETRY_HISTOGRAM     = (SPINEL_CAP_OPENTHREAD__BEGIN + 12),
    SPINEL_CAP_OPENTHREAD__END         = 640,

    SPINEL_CAP_THREAD__BEGIN        = 1024,
    SPINEL_CAP_THREAD_COMMISSIONER  = (SPINEL_CAP_THREAD__BEGIN + 0),
    SPINEL_CAP_THREAD_TMF_PROXY     = (SPINEL_CAP_THREAD__BEGIN + 1),
    SPINEL_CAP_THREAD_UDP_FORWARD   = (SPINEL_CAP_THREAD__BEGIN + 2),
    SPINEL_CAP_THREAD_JOINER        = (SPINEL_CAP_THREAD__BEGIN + 3),
    SPINEL_CAP_THREAD_BORDER_ROUTER = (SPINEL_CAP_THREAD__BEGIN + 4),
    SPINEL_CAP_THREAD_SERVICE       = (SPINEL_CAP_THREAD__BEGIN + 5),
    SPINEL_CAP_THREAD__END          = 1152,

    SPINEL_CAP_NEST__BEGIN           = 15296,
    SPINEL_CAP_NEST_LEGACY_INTERFACE = (SPINEL_CAP_NEST__BEGIN + 0),
    SPINEL_CAP_NEST_LEGACY_NET_WAKE  = (SPINEL_CAP_NEST__BEGIN + 1),
    SPINEL_CAP_NEST_TRANSMIT_HOOK    = (SPINEL_CAP_NEST__BEGIN + 2),
    SPINEL_CAP_NEST__END             = 15360,

    SPINEL_CAP_VENDOR__BEGIN = 15360,
    SPINEL_CAP_VENDOR__END   = 16384,

    SPINEL_CAP_EXPERIMENTAL__BEGIN = 2000000,
    SPINEL_CAP_EXPERIMENTAL__END   = 2097152,
};

typedef uint32_t spinel_capability_t;

/**
 * Property Keys
 *
 * The properties are broken up into several sections, each with a
 * reserved ranges of property identifiers:
 *
 *    Name         | Range (Inclusive)              | Description
 *    -------------|--------------------------------|------------------------
 *    Core         | 0x000 - 0x01F, 0x1000 - 0x11FF | Spinel core
 *    PHY          | 0x020 - 0x02F, 0x1200 - 0x12FF | Radio PHY layer
 *    MAC          | 0x030 - 0x03F, 0x1300 - 0x13FF | MAC layer
 *    NET          | 0x040 - 0x04F, 0x1400 - 0x14FF | Network
 *    Thread       | 0x050 - 0x05F, 0x1500 - 0x15FF | Thread
 *    IPv6         | 0x060 - 0x06F, 0x1600 - 0x16FF | IPv6
 *    Stream       | 0x070 - 0x07F, 0x1700 - 0x17FF | Stream
 *    MeshCop      | 0x080 - 0x08F, 0x1800 - 0x18FF | Thread Mesh Commissioning
 *    OpenThread   |                0x1900 - 0x19FF | OpenThread specific
 *    Server       | 0x0A0 - 0x0AF                  | ALOC Service Server
 *    Interface    | 0x100 - 0x1FF                  | Interface (e.g., UART)
 *    PIB          | 0x400 - 0x4FF                  | 802.15.4 PIB
 *    Counter      | 0x500 - 0x7FF                  | Counters (MAC, IP, etc).
 *    RCP          | 0x800 - 0x8FF                  | RCP specific property
 *    Nest         |                0x3BC0 - 0x3BFF | Nest (legacy)
 *    Vendor       |                0x3C00 - 0x3FFF | Vendor specific
 *    Debug        |                0x4000 - 0x43FF | Debug related
 *    Experimental |          2,000,000 - 2,097,151 | Experimental use only
 *
 */
enum
{
    /// Last Operation Status
    /** Format: `i` - Read-only
     *
     * Describes the status of the last operation. Encoded as a packed
     * unsigned integer (see `SPINEL_STATUS_*` for list of values).
     *
     * This property is emitted often to indicate the result status of
     * pretty much any Host-to-NCP operation.
     *
     * It is emitted automatically at NCP startup with a value indicating
     * the reset reason. It is also emitted asynchronously on an error (
     * e.g., NCP running out of buffer).
     *
     */
    SPINEL_PROP_LAST_STATUS = 0,

    /// Protocol Version
    /** Format: `ii` - Read-only
     *
     * Describes the protocol version information. This property contains
     * two fields, each encoded as a packed unsigned integer:
     *   `i`: Major Version Number
     *   `i`: Minor Version Number
     *
     * The version number is defined by `SPINEL_PROTOCOL_VERSION_THREAD_MAJOR`
     * and `SPINEL_PROTOCOL_VERSION_THREAD_MINOR`.
     *
     * This specification describes major version 4, minor version 3.
     *
     */
    SPINEL_PROP_PROTOCOL_VERSION = 1,

    /// NCP Version
    /** Format: `U` - Read-only
     *
     * Contains a string which describes the firmware currently running on
     * the NCP. Encoded as a zero-terminated UTF-8 string.
     *
     */
    SPINEL_PROP_NCP_VERSION = 2,

    /// NCP Network Protocol Type
    /** Format: 'i' - Read-only
     *
     * This value identifies what the network protocol for this NCP.
     * The valid protocol type values are defined by enumeration
     * `SPINEL_PROTOCOL_TYPE_*`:
     *
     *   `SPINEL_PROTOCOL_TYPE_BOOTLOADER` = 0
     *   `SPINEL_PROTOCOL_TYPE_ZIGBEE_IP`  = 2,
     *   `SPINEL_PROTOCOL_TYPE_THREAD`     = 3,
     *
     * OpenThread NCP supports only `SPINEL_PROTOCOL_TYPE_THREAD`
     *
     */
    SPINEL_PROP_INTERFACE_TYPE = 3,

    /// NCP Vendor ID
    /** Format: 'i` - Read-only
     *
     * Vendor ID. Zero for unknown.
     *
     */
    SPINEL_PROP_VENDOR_ID = 4,

    /// NCP Capability List
    /** Format: 'A(i)` - Read-only
     *
     * Describes the supported capabilities of this NCP. Encoded as a list of
     * packed unsigned integers.
     *
     * The capability values are specified by SPINEL_CAP_* enumeration.
     *
     */
    SPINEL_PROP_CAPS = 5,

    /// NCP Interface Count
    /** Format: 'C` - Read-only
     *
     * Provides number of interfaces.
     *
     * Currently always reads as 1.
     *
     */
    SPINEL_PROP_INTERFACE_COUNT = 6,

    SPINEL_PROP_POWER_STATE = 7, ///< PowerState [C] (deprecated, use `MCU_POWER_STATE` instead).

    /// NCP Hardware Address
    /** Format: 'E` - Read-only
     *
     * The static EUI64 address of the device, used as a serial number.
     *
     */
    SPINEL_PROP_HWADDR = 8,

    SPINEL_PROP_LOCK          = 9,  ///< PropLock [b] (not supported)
    SPINEL_PROP_HBO_MEM_MAX   = 10, ///< Max offload mem [S] (not supported)
    SPINEL_PROP_HBO_BLOCK_MAX = 11, ///< Max offload block [S] (not supported)

    /// Host Power State
    /** Format: 'C`
     *
     * Describes the current power state of the host. This property is used
     * by the host to inform the NCP when it has changed power states. The
     * NCP can then use this state to determine which properties need
     * asynchronous updates. Enumeration `spinel_host_power_state_t` defines
     * the valid values (`SPINEL_HOST_POWER_STATE_*`):
     *
     *   `HOST_POWER_STATE_OFFLINE`: Host is physically powered off and
     *   cannot be woken by the NCP. All asynchronous commands are
     *   squelched.
     *
     *   `HOST_POWER_STATE_DEEP_SLEEP`: The host is in a low power state
     *   where it can be woken by the NCP but will potentially require more
     *   than two seconds to become fully responsive. The NCP MUST
     *   avoid sending unnecessary property updates, such as child table
     *   updates or non-critical messages on the debug stream. If the NCP
     *   needs to wake the host for traffic, the NCP MUST first take
     *   action to wake the host. Once the NCP signals to the host that it
     *   should wake up, the NCP MUST wait for some activity from the
     *   host (indicating that it is fully awake) before sending frames.
     *
     *   `HOST_POWER_STATE_RESERVED`:  This value MUST NOT be set by the host. If
     *   received by the NCP, the NCP SHOULD consider this as a synonym
     *   of `HOST_POWER_STATE_DEEP_SLEEP`.
     *
     *   `HOST_POWER_STATE_LOW_POWER`: The host is in a low power state
     *   where it can be immediately woken by the NCP. The NCP SHOULD
     *   avoid sending unnecessary property updates, such as child table
     *   updates or non-critical messages on the debug stream.
     *
     *   `HOST_POWER_STATE_ONLINE`: The host is awake and responsive. No
     *   special filtering is performed by the NCP on asynchronous updates.
     *
     *   All other values are RESERVED. They MUST NOT be set by the
     *   host. If received by the NCP, the NCP SHOULD consider the value as
     *   a synonym of `HOST_POWER_STATE_LOW_POWER`.
     *
     * After setting this power state, any further commands from the host to
     * the NCP will cause `HOST_POWER_STATE` to automatically revert to
     * `HOST_POWER_STATE_ONLINE`.
     *
     * When the host is entering a low-power state, it should wait for the
     * response from the NCP acknowledging the command (with `CMD_VALUE_IS`).
     * Once that acknowledgment is received the host may enter the low-power
     * state.
     *
     * If the NCP has the `CAP_UNSOL_UPDATE_FILTER` capability, any unsolicited
     * property updates masked by `PROP_UNSOL_UPDATE_FILTER` should be honored
     * while the host indicates it is in a low-power state. After resuming to the
     * `HOST_POWER_STATE_ONLINE` state, the value of `PROP_UNSOL_UPDATE_FILTER`
     * MUST be unchanged from the value assigned prior to the host indicating
     * it was entering a low-power state.
     *
     */
    SPINEL_PROP_HOST_POWER_STATE = 12,

    /// NCP's MCU Power State
    /** Format: 'C`
     *  Required capability: CAP_MCU_POWER_SAVE
     *
     * This property specifies the desired power state of NCP's micro-controller
     * (MCU) when the underlying platform's operating system enters idle mode (i.e.,
     * all active tasks/events are processed and the MCU can potentially enter a
     * energy-saving power state).
     *
     * The power state primarily determines how the host should interact with the NCP
     * and whether the host needs an external trigger (a "poke") to NCP before it can
     * communicate with the NCP or not. After a reset, the MCU power state MUST be
     * SPINEL_MCU_POWER_STATE_ON.
     *
     * Enumeration `spinel_mcu_power_state_t` defines the valid values
     * (`SPINEL_MCU_POWER_STATE_*` constants):
     *
     *   `SPINEL_MCU_POWER_STATE_ON`: NCP's MCU stays on and active all the time.
     *   When the NCP's desired power state is set to this value, host can send
     *   messages to NCP without requiring any "poke" or external triggers. MCU is
     *   expected to stay on and active. Note that the `ON` power state only
     *   determines the MCU's power mode and is not related to radio's state.
     *
     *   `SPINEL_MCU_POWER_STATE_LOW_POWER`: NCP's MCU can enter low-power
     *   (energy-saving) state. When the NCP's desired power state is set to
     *   `LOW_POWER`, host is expected to "poke" the NCP (e.g., an external trigger
     *   like an interrupt) before it can communicate with the NCP (send a message
     *   to the NCP). The "poke" mechanism is determined by the platform code (based
     *   on NCP's interface to the host).
     *   While power state is set to `LOW_POWER`, NCP can still (at any time) send
     *   messages to host. Note that receiving a message from the NCP does NOT
     *   indicate that the NCP's power state has changed, i.e., host is expected to
     *   continue to "poke" NCP when it wants to talk to the NCP until the power
     *   state is explicitly changed (by setting this property to `ON`).
     *   Note that the `LOW_POWER` power state only determines the MCU's power mode
     *   and is not related to radio's state.
     *
     *   `SPINEL_MCU_POWER_STATE_OFF`: NCP is fully powered off.
     *   An NCP hardware reset (via a RESET pin) is required to bring the NCP back
     *   to `SPINEL_MCU_POWER_STATE_ON`. RAM is not retained after reset.
     *
     */
    SPINEL_PROP_MCU_POWER_STATE = 13,

    SPINEL_PROP_BASE_EXT__BEGIN = 0x1000,

    /// GPIO Configuration
    /** Format: `A(CCU)`
     *  Type: Read-Only (Optionally Read-write using `CMD_PROP_VALUE_INSERT`)
     *
     * An array of structures which contain the following fields:
     *
     * *   `C`: GPIO Number
     * *   `C`: GPIO Configuration Flags
     * *   `U`: Human-readable GPIO name
     *
     * GPIOs which do not have a corresponding entry are not supported.
     *
     * The configuration parameter contains the configuration flags for the
     * GPIO:
     *
     *       0   1   2   3   4   5   6   7
     *     +---+---+---+---+---+---+---+---+
     *     |DIR|PUP|PDN|TRIGGER|  RESERVED |
     *     +---+---+---+---+---+---+---+---+
     *             |O/D|
     *             +---+
     *
     * *   `DIR`: Pin direction. Clear (0) for input, set (1) for output.
     * *   `PUP`: Pull-up enabled flag.
     * *   `PDN`/`O/D`: Flag meaning depends on pin direction:
     *     *   Input: Pull-down enabled.
     *     *   Output: Output is an open-drain.
     * *   `TRIGGER`: Enumeration describing how pin changes generate
     *     asynchronous notification commands (TBD) from the NCP to the host.
     *     *   0: Feature disabled for this pin
     *     *   1: Trigger on falling edge
     *     *   2: Trigger on rising edge
     *     *   3: Trigger on level change
     * *   `RESERVED`: Bits reserved for future use. Always cleared to zero
     *     and ignored when read.
     *
     * As an optional feature, the configuration of individual pins may be
     * modified using the `CMD_PROP_VALUE_INSERT` command. Only the GPIO
     * number and flags fields MUST be present, the GPIO name (if present)
     * would be ignored. This command can only be used to modify the
     * configuration of GPIOs which are already exposed---it cannot be used
     * by the host to add additional GPIOs.
     */
    SPINEL_PROP_GPIO_CONFIG = SPINEL_PROP_BASE_EXT__BEGIN + 0,

    /// GPIO State Bitmask
    /** Format: `D`
     *  Type: Read-Write
     *
     * Contains a bit field identifying the state of the GPIOs. The length of
     * the data associated with these properties depends on the number of
     * GPIOs. If you have 10 GPIOs, you'd have two bytes. GPIOs are numbered
     * from most significant bit to least significant bit, so 0x80 is GPIO 0,
     * 0x40 is GPIO 1, etc.
     *
     * For GPIOs configured as inputs:
     *
     * *   `CMD_PROP_VAUE_GET`: The value of the associated bit describes the
     *     logic level read from the pin.
     * *   `CMD_PROP_VALUE_SET`: The value of the associated bit is ignored
     *     for these pins.
     *
     * For GPIOs configured as outputs:
     *
     * *   `CMD_PROP_VAUE_GET`: The value of the associated bit is
     *     implementation specific.
     * *   `CMD_PROP_VALUE_SET`: The value of the associated bit determines
     *     the new logic level of the output. If this pin is configured as an
     *     open-drain, setting the associated bit to 1 will cause the pin to
     *     enter a Hi-Z state.
     *
     * For GPIOs which are not specified in `PROP_GPIO_CONFIG`:
     *
     * *   `CMD_PROP_VAUE_GET`: The value of the associated bit is
     *     implementation specific.
     * *   `CMD_PROP_VALUE_SET`: The value of the associated bit MUST be
     *     ignored by the NCP.
     *
     * When writing, unspecified bits are assumed to be zero.
     */
    SPINEL_PROP_GPIO_STATE = SPINEL_PROP_BASE_EXT__BEGIN + 2,

    /// GPIO State Set-Only Bitmask
    /** Format: `D`
     *  Type: Write-Only
     *
     * Allows for the state of various output GPIOs to be set without affecting
     * other GPIO states. Contains a bit field identifying the output GPIOs that
     * should have their state set to 1.
     *
     * When writing, unspecified bits are assumed to be zero. The value of
     * any bits for GPIOs which are not specified in `PROP_GPIO_CONFIG` MUST
     * be ignored.
     */
    SPINEL_PROP_GPIO_STATE_SET = SPINEL_PROP_BASE_EXT__BEGIN + 3,

    /// GPIO State Clear-Only Bitmask
    /** Format: `D`
     *  Type: Write-Only
     *
     * Allows for the state of various output GPIOs to be cleared without affecting
     * other GPIO states. Contains a bit field identifying the output GPIOs that
     * should have their state cleared to 0.
     *
     * When writing, unspecified bits are assumed to be zero. The value of
     * any bits for GPIOs which are not specified in `PROP_GPIO_CONFIG` MUST
     * be ignored.
     */
    SPINEL_PROP_GPIO_STATE_CLEAR = SPINEL_PROP_BASE_EXT__BEGIN + 4,

    /// 32-bit random number from TRNG, ready-to-use.
    SPINEL_PROP_TRNG_32 = SPINEL_PROP_BASE_EXT__BEGIN + 5,

    /// 16 random bytes from TRNG, ready-to-use.
    SPINEL_PROP_TRNG_128 = SPINEL_PROP_BASE_EXT__BEGIN + 6,

    /// Raw samples from TRNG entropy source representing 32 bits of entropy.
    SPINEL_PROP_TRNG_RAW_32 = SPINEL_PROP_BASE_EXT__BEGIN + 7,

    /// NCP Unsolicited update filter
    /** Format: `A(I)`
     *  Type: Read-Write (optional Insert-Remove)
     *  Required capability: `CAP_UNSOL_UPDATE_FILTER`
     *
     * Contains a list of properties which are excluded from generating
     * unsolicited value updates. This property is empty after reset.
     * In other words, the host may opt-out of unsolicited property updates
     * for a specific property by adding that property id to this list.
     * Hosts SHOULD NOT add properties to this list which are not
     * present in `PROP_UNSOL_UPDATE_LIST`. If such properties are added,
     * the NCP ignores the unsupported properties.
     *
     */
    SPINEL_PROP_UNSOL_UPDATE_FILTER = SPINEL_PROP_BASE_EXT__BEGIN + 8,

    /// List of properties capable of generating unsolicited value update.
    /** Format: `A(I)`
     *  Type: Read-Only
     *  Required capability: `CAP_UNSOL_UPDATE_FILTER`
     *
     * Contains a list of properties which are capable of generating
     * unsolicited value updates. This list can be used when populating
     * `PROP_UNSOL_UPDATE_FILTER` to disable all unsolicited property
     * updates.
     *
     * This property is intended to effectively behave as a constant
     * for a given NCP firmware.
     */
    SPINEL_PROP_UNSOL_UPDATE_LIST = SPINEL_PROP_BASE_EXT__BEGIN + 9,

    SPINEL_PROP_BASE_EXT__END = 0x1100,

    SPINEL_PROP_PHY__BEGIN         = 0x20,
    SPINEL_PROP_PHY_ENABLED        = SPINEL_PROP_PHY__BEGIN + 0, ///< [b]
    SPINEL_PROP_PHY_CHAN           = SPINEL_PROP_PHY__BEGIN + 1, ///< [C]
    SPINEL_PROP_PHY_CHAN_SUPPORTED = SPINEL_PROP_PHY__BEGIN + 2, ///< [A(C)]
    SPINEL_PROP_PHY_FREQ           = SPINEL_PROP_PHY__BEGIN + 3, ///< kHz [L]
    SPINEL_PROP_PHY_CCA_THRESHOLD  = SPINEL_PROP_PHY__BEGIN + 4, ///< dBm [c]
    SPINEL_PROP_PHY_TX_POWER       = SPINEL_PROP_PHY__BEGIN + 5, ///< [c]
    SPINEL_PROP_PHY_RSSI           = SPINEL_PROP_PHY__BEGIN + 6, ///< dBm [c]
    SPINEL_PROP_PHY_RX_SENSITIVITY = SPINEL_PROP_PHY__BEGIN + 7, ///< dBm [c]
    SPINEL_PROP_PHY_PCAP_ENABLED   = SPINEL_PROP_PHY__BEGIN + 8, ///< [b]
    SPINEL_PROP_PHY_CHAN_PREFERRED = SPINEL_PROP_PHY__BEGIN + 9, ///< [A(C)]
    SPINEL_PROP_PHY__END           = 0x30,

    SPINEL_PROP_PHY_EXT__BEGIN = 0x1200,

    /// Signal Jamming Detection Enable
    /** Format: `b`
     *
     * Indicates if jamming detection is enabled or disabled. Set to true
     * to enable jamming detection.
     */
    SPINEL_PROP_JAM_DETECT_ENABLE = SPINEL_PROP_PHY_EXT__BEGIN + 0,

    /// Signal Jamming Detected Indicator
    /** Format: `b` (Read-Only)
     *
     * Set to true if radio jamming is detected. Set to false otherwise.
     *
     * When jamming detection is enabled, changes to the value of this
     * property are emitted asynchronously via `CMD_PROP_VALUE_IS`.
     */
    SPINEL_PROP_JAM_DETECTED = SPINEL_PROP_PHY_EXT__BEGIN + 1,

    /// Jamming detection RSSI threshold
    /** Format: `c`
     *  Units: dBm
     *
     * This parameter describes the threshold RSSI level (measured in
     * dBm) above which the jamming detection will consider the
     * channel blocked.
     */
    SPINEL_PROP_JAM_DETECT_RSSI_THRESHOLD = SPINEL_PROP_PHY_EXT__BEGIN + 2,

    /// Jamming detection window size
    /** Format: `C`
     *  Units: Seconds (1-63)
     *
     * This parameter describes the window period for signal jamming
     * detection.
     */
    SPINEL_PROP_JAM_DETECT_WINDOW = SPINEL_PROP_PHY_EXT__BEGIN + 3,

    /// Jamming detection busy period
    /** Format: `C`
     *  Units: Seconds (1-63)
     *
     * This parameter describes the number of aggregate seconds within
     * the detection window where the RSSI must be above
     * `PROP_JAM_DETECT_RSSI_THRESHOLD` to trigger detection.
     *
     * The behavior of the jamming detection feature when `PROP_JAM_DETECT_BUSY`
     * is larger than `PROP_JAM_DETECT_WINDOW` is undefined.
     */
    SPINEL_PROP_JAM_DETECT_BUSY = SPINEL_PROP_PHY_EXT__BEGIN + 4,

    /// Jamming detection history bitmap (for debugging)
    /** Format: `X` (read-only)
     *
     * This value provides information about current state of jamming detection
     * module for monitoring/debugging purpose. It returns a 64-bit value where
     * each bit corresponds to one second interval starting with bit 0 for the
     * most recent interval and bit 63 for the oldest intervals (63 sec earlier).
     * The bit is set to 1 if the jamming detection module observed/detected
     * high signal level during the corresponding one second interval.
     *
     */
    SPINEL_PROP_JAM_DETECT_HISTORY_BITMAP = SPINEL_PROP_PHY_EXT__BEGIN + 5,

    /// Channel monitoring sample interval
    /** Format: `L` (read-only)
     *  Units: Milliseconds
     *
     * Required capability: SPINEL_CAP_CHANNEL_MONITOR
     *
     * If channel monitoring is enabled and active, every sample interval, a
     * zero-duration Energy Scan is performed, collecting a single RSSI sample
     * per channel. The RSSI samples are compared with a pre-specified RSSI
     * threshold.
     *
     */
    SPINEL_PROP_CHANNEL_MONITOR_SAMPLE_INTERVAL = SPINEL_PROP_PHY_EXT__BEGIN + 6,

    /// Channel monitoring RSSI threshold
    /** Format: `c` (read-only)
     *  Units: dBm
     *
     * Required capability: SPINEL_CAP_CHANNEL_MONITOR
     *
     * This value specifies the threshold used by channel monitoring module.
     * Channel monitoring maintains the average rate of RSSI samples that
     * are above the threshold within (approximately) a pre-specified number
     * of samples (sample window).
     *
     */
    SPINEL_PROP_CHANNEL_MONITOR_RSSI_THRESHOLD = SPINEL_PROP_PHY_EXT__BEGIN + 7,

    /// Channel monitoring sample window
    /** Format: `L` (read-only)
     *  Units: Number of samples
     *
     * Required capability: SPINEL_CAP_CHANNEL_MONITOR
     *
     * The averaging sample window length (in units of number of channel
     * samples) used by channel monitoring module. Channel monitoring will
     * sample all channels every sample interval. It maintains the average rate
     * of RSSI samples that are above the RSSI threshold within (approximately)
     * the sample window.
     *
     */
    SPINEL_PROP_CHANNEL_MONITOR_SAMPLE_WINDOW = SPINEL_PROP_PHY_EXT__BEGIN + 8,

    /// Channel monitoring sample count
    /** Format: `L` (read-only)
     *  Units: Number of samples
     *
     * Required capability: SPINEL_CAP_CHANNEL_MONITOR
     *
     * Total number of RSSI samples (per channel) taken by the channel
     * monitoring module since its start (since Thread network interface
     * was enabled).
     *
     */
    SPINEL_PROP_CHANNEL_MONITOR_SAMPLE_COUNT = SPINEL_PROP_PHY_EXT__BEGIN + 9,

    /// Channel monitoring channel occupancy
    /** Format: `A(t(CU))` (read-only)
     *
     * Required capability: SPINEL_CAP_CHANNEL_MONITOR
     *
     * Data per item is:
     *
     *  `C`: Channel
     *  `U`: Channel occupancy indicator
     *
     * The channel occupancy value represents the average rate/percentage of
     * RSSI samples that were above RSSI threshold ("bad" RSSI samples) within
     * (approximately) sample window latest RSSI samples.
     *
     * Max value of `0xffff` indicates all RSSI samples were above RSSI
     * threshold (i.e. 100% of samples were "bad").
     *
     */
    SPINEL_PROP_CHANNEL_MONITOR_CHANNEL_OCCUPANCY = SPINEL_PROP_PHY_EXT__BEGIN + 10,

    /// Radio caps
    /** Format: `i` (read-only)
     *
     * Data per item is:
     *
     *  `i`: Radio Capabilities.
     *
     */
    SPINEL_PROP_RADIO_CAPS = SPINEL_PROP_PHY_EXT__BEGIN + 11,

    /// All coex metrics related counters.
    /** Format: t(LLLLLLLL)t(LLLLLLLLL)bL  (Read-only)
     *
     * Required capability: SPINEL_CAP_RADIO_COEX
     *
     * The contents include two structures and two common variables, first structure corresponds to
     * all transmit related coex counters, second structure provides the receive related counters.
     *
     * The transmit structure includes:
     *   'L': NumTxRequest                       (The number of tx requests).
     *   'L': NumTxGrantImmediate                (The number of tx requests while grant was active).
     *   'L': NumTxGrantWait                     (The number of tx requests while grant was inactive).
     *   'L': NumTxGrantWaitActivated            (The number of tx requests while grant was inactive that were
     *                                            ultimately granted).
     *   'L': NumTxGrantWaitTimeout              (The number of tx requests while grant was inactive that timed out).
     *   'L': NumTxGrantDeactivatedDuringRequest (The number of tx requests that were in progress when grant was
     *                                            deactivated).
     *   'L': NumTxDelayedGrant                  (The number of tx requests that were not granted within 50us).
     *   'L': AvgTxRequestToGrantTime            (The average time in usec from tx request to grant).
     *
     * The receive structure includes:
     *   'L': NumRxRequest                       (The number of rx requests).
     *   'L': NumRxGrantImmediate                (The number of rx requests while grant was active).
     *   'L': NumRxGrantWait                     (The number of rx requests while grant was inactive).
     *   'L': NumRxGrantWaitActivated            (The number of rx requests while grant was inactive that were
     *                                            ultimately granted).
     *   'L': NumRxGrantWaitTimeout              (The number of rx requests while grant was inactive that timed out).
     *   'L': NumRxGrantDeactivatedDuringRequest (The number of rx requests that were in progress when grant was
     *                                            deactivated).
     *   'L': NumRxDelayedGrant                  (The number of rx requests that were not granted within 50us).
     *   'L': AvgRxRequestToGrantTime            (The average time in usec from rx request to grant).
     *   'L': NumRxGrantNone                     (The number of rx requests that completed without receiving grant).
     *
     * Two common variables:
     *   'b': Stopped        (Stats collection stopped due to saturation).
     *   'L': NumGrantGlitch (The number of of grant glitches).
     */
    SPINEL_PROP_RADIO_COEX_METRICS = SPINEL_PROP_PHY_EXT__BEGIN + 12,

    /// Radio Coex Enable
    /** Format: `b`
     *
     * Required capability: SPINEL_CAP_RADIO_COEX
     *
     * Indicates if radio coex is enabled or disabled. Set to true to enable radio coex.
     */
    SPINEL_PROP_RADIO_COEX_ENABLE = SPINEL_PROP_PHY_EXT__BEGIN + 13,

    SPINEL_PROP_PHY_EXT__END = 0x1300,

    SPINEL_PROP_MAC__BEGIN = 0x30,

    /// MAC Scan State
    /** Format: `C`
     *
     * Possible values are from enumeration `spinel_scan_state_t`.
     *
     *   SCAN_STATE_IDLE
     *   SCAN_STATE_BEACON
     *   SCAN_STATE_ENERGY
     *   SCAN_STATE_DISCOVER
     *
     * Set to `SCAN_STATE_BEACON` to start an active scan.
     * Beacons will be emitted from `PROP_MAC_SCAN_BEACON`.
     *
     * Set to `SCAN_STATE_ENERGY` to start an energy scan.
     * Channel energy result will be reported by emissions
     * of `PROP_MAC_ENERGY_SCAN_RESULT` (per channel).
     *
     * Set to `SCAN_STATE_DISOVER` to start a Thread MLE discovery
     * scan operation. Discovery scan result will be emitted from
     * `PROP_MAC_SCAN_BEACON`.
     *
     * Value switches to `SCAN_STATE_IDLE` when scan is complete.
     *
     */
    SPINEL_PROP_MAC_SCAN_STATE = SPINEL_PROP_MAC__BEGIN + 0,

    /// MAC Scan Channel Mask
    /** Format: `A(C)`
     *
     * List of channels to scan.
     *
     */
    SPINEL_PROP_MAC_SCAN_MASK = SPINEL_PROP_MAC__BEGIN + 1,

    /// MAC Scan Channel Period
    /** Format: `S`
     *  Unit: milliseconds per channel
     *
     */
    SPINEL_PROP_MAC_SCAN_PERIOD = SPINEL_PROP_MAC__BEGIN + 2,

    /// MAC Scan Beacon
    /** Format `Cct(ESSc)t(iCUdd)` - Asynchronous event only
     *
     * Scan beacons have two embedded structures which contain
     * information about the MAC layer and the NET layer. Their
     * format depends on the MAC and NET layer currently in use.
     * The format below is for an 802.15.4 MAC with Thread:
     *
     *  `C`: Channel
     *  `c`: RSSI of the beacon
     *  `t`: MAC layer properties (802.15.4 layer)
     *    `E`: Long address
     *    `S`: Short address
     *    `S`: PAN-ID
     *    `c`: LQI
     *  NET layer properties
     *    `i`: Protocol Number (SPINEL_PROTOCOL_TYPE_* values)
     *    `C`: Flags (SPINEL_BEACON_THREAD_FLAG_* values)
     *    `U`: Network Name
     *    `d`: XPANID
     *    `d`: Steering data
     *
     * Extra parameters may be added to each of the structures
     * in the future, so care should be taken to read the length
     * that prepends each structure.
     *
     */
    SPINEL_PROP_MAC_SCAN_BEACON = SPINEL_PROP_MAC__BEGIN + 3,

    /// MAC Long Address
    /** Format: `E`
     *
     * The 802.15.4 long address of this node.
     *
     */
    SPINEL_PROP_MAC_15_4_LADDR = SPINEL_PROP_MAC__BEGIN + 4,

    /// MAC Short Address
    /** Format: `S`
     *
     * The 802.15.4 short address of this node.
     *
     */
    SPINEL_PROP_MAC_15_4_SADDR = SPINEL_PROP_MAC__BEGIN + 5,

    /// MAC PAN ID
    /** Format: `S`
     *
     * The 802.15.4 PANID this node is associated with.
     *
     */
    SPINEL_PROP_MAC_15_4_PANID = SPINEL_PROP_MAC__BEGIN + 6,

    /// MAC Stream Raw Enabled
    /** Format: `b`
     *
     * Set to true to enable raw MAC frames to be emitted from
     * `PROP_STREAM_RAW`.
     *
     */
    SPINEL_PROP_MAC_RAW_STREAM_ENABLED = SPINEL_PROP_MAC__BEGIN + 7,

    /// MAC Promiscuous Mode
    /** Format: `C`
     *
     * Possible values are from enumeration
     * `SPINEL_MAC_PROMISCUOUS_MODE_*`:
     *
     *   `SPINEL_MAC_PROMISCUOUS_MODE_OFF`
     *        Normal MAC filtering is in place.
     *
     *   `SPINEL_MAC_PROMISCUOUS_MODE_NETWORK`
     *        All MAC packets matching network are passed up
     *        the stack.
     *
     *   `SPINEL_MAC_PROMISCUOUS_MODE_FULL`
     *        All decoded MAC packets are passed up the stack.
     *
     */
    SPINEL_PROP_MAC_PROMISCUOUS_MODE = SPINEL_PROP_MAC__BEGIN + 8,

    /// MAC Energy Scan Result
    /** Format: `Cc` - Asynchronous event only
     *
     * This property is emitted during energy scan operation
     * per scanned channel with following format:
     *
     *   `C`: Channel
     *   `c`: RSSI (in dBm)
     *
     */
    SPINEL_PROP_MAC_ENERGY_SCAN_RESULT = SPINEL_PROP_MAC__BEGIN + 9,

    /// MAC Data Poll Period
    /** Format: `L`
     *  Unit: millisecond
     * The (user-specified) data poll (802.15.4 MAC Data Request) period
     * in milliseconds. Value zero means there is no user-specified
     * poll period, and the network stack determines the maximum period
     * based on the MLE Child Timeout.
     *
     * If the value is non-zero, it specifies the maximum period between
     * data poll transmissions. Note that the network stack may send data
     * request transmissions more frequently when expecting a control-message
     * (e.g., when waiting for an MLE Child ID Response).
     *
     */
    SPINEL_PROP_MAC_DATA_POLL_PERIOD = SPINEL_PROP_MAC__BEGIN + 10,

    SPINEL_PROP_MAC__END = 0x40,

    SPINEL_PROP_MAC_EXT__BEGIN = 0x1300,

    /// MAC Whitelist
    /** Format: `A(t(Ec))`
     * Required capability: `CAP_MAC_WHITELIST`
     *
     * Structure Parameters:
     *
     *  `E`: EUI64 address of node
     *  `c`: Optional RSSI-override value. The value 127 indicates
     *       that the RSSI-override feature is not enabled for this
     *       address. If this value is omitted when setting or
     *       inserting, it is assumed to be 127. This parameter is
     *       ignored when removing.
     */
    SPINEL_PROP_MAC_WHITELIST = SPINEL_PROP_MAC_EXT__BEGIN + 0,

    /// MAC Whitelist Enabled Flag
    /** Format: `b`
     * Required capability: `CAP_MAC_WHITELIST`
     *
     */
    SPINEL_PROP_MAC_WHITELIST_ENABLED = SPINEL_PROP_MAC_EXT__BEGIN + 1,

    /// MAC Extended Address
    /** Format: `E`
     *
     *  Specified by Thread. Randomly-chosen, but non-volatile EUI-64.
     */
    SPINEL_PROP_MAC_EXTENDED_ADDR = SPINEL_PROP_MAC_EXT__BEGIN + 2,

    /// MAC Source Match Enabled Flag
    /** Format: `b`
     * Required Capability: SPINEL_CAP_MAC_RAW or SPINEL_CAP_CONFIG_RADIO
     *
     * Set to true to enable radio source matching or false to disable it.
     * The source match functionality is used by radios when generating
     * ACKs. The short and extended address lists are used for setting
     * the Frame Pending bit in the ACKs.
     *
     */
    SPINEL_PROP_MAC_SRC_MATCH_ENABLED = SPINEL_PROP_MAC_EXT__BEGIN + 3,

    /// MAC Source Match Short Address List
    /** Format: `A(S)`
     * Required Capability: SPINEL_CAP_MAC_RAW or SPINEL_CAP_CONFIG_RADIO
     *
     */
    SPINEL_PROP_MAC_SRC_MATCH_SHORT_ADDRESSES = SPINEL_PROP_MAC_EXT__BEGIN + 4,

    /// MAC Source Match Extended Address List
    /** Format: `A(E)`
     *  Required Capability: SPINEL_CAP_MAC_RAW or SPINEL_CAP_CONFIG_RADIO
     *
     */
    SPINEL_PROP_MAC_SRC_MATCH_EXTENDED_ADDRESSES = SPINEL_PROP_MAC_EXT__BEGIN + 5,

    /// MAC Blacklist
    /** Format: `A(t(E))`
     * Required capability: `CAP_MAC_WHITELIST`
     *
     * Structure Parameters:
     *
     *  `E`: EUI64 address of node
     *
     */
    SPINEL_PROP_MAC_BLACKLIST = SPINEL_PROP_MAC_EXT__BEGIN + 6,

    /// MAC Blacklist Enabled Flag
    /** Format: `b`
     *  Required capability: `CAP_MAC_WHITELIST`
     */
    SPINEL_PROP_MAC_BLACKLIST_ENABLED = SPINEL_PROP_MAC_EXT__BEGIN + 7,

    /// MAC Received Signal Strength Filter
    /** Format: `A(t(Ec))`
     * Required capability: `CAP_MAC_WHITELIST`
     *
     * Structure Parameters:
     *
     * * `E`: Optional EUI64 address of node. Set default RSS if not included.
     * * `c`: Fixed RSS. 127 means not set.
     */
    SPINEL_PROP_MAC_FIXED_RSS = SPINEL_PROP_MAC_EXT__BEGIN + 8,

    /// The CCA failure rate
    /** Format: `S`
     *
     * This property provides the current CCA (Clear Channel Assessment) failure rate.
     *
     * Maximum value `0xffff` corresponding to 100% failure rate.
     *
     */
    SPINEL_PROP_MAC_CCA_FAILURE_RATE = SPINEL_PROP_MAC_EXT__BEGIN + 9,

    /// MAC Max direct retry number
    /** Format: `C`
     *
     * The maximum (user-specified) number of direct frame transmission retries.
     *
     */
    SPINEL_PROP_MAC_MAX_RETRY_NUMBER_DIRECT = SPINEL_PROP_MAC_EXT__BEGIN + 10,

    /// MAC Max indirect retry number
    /** Format: `C`
     * Required capability: `SPINEL_CAP_CONFIG_FTD`
     *
     * The maximum (user-specified) number of indirect frame transmission retries.
     *
     */
    SPINEL_PROP_MAC_MAX_RETRY_NUMBER_INDIRECT = SPINEL_PROP_MAC_EXT__BEGIN + 11,

    SPINEL_PROP_MAC_EXT__END = 0x1400,

    SPINEL_PROP_NET__BEGIN = 0x40,

    /// Network Is Saved (Is Commissioned)
    /** Format: `b` - Read only
     *
     * Returns true if there is a network state stored/saved.
     *
     */
    SPINEL_PROP_NET_SAVED = SPINEL_PROP_NET__BEGIN + 0,

    /// Network Interface Status
    /** Format `b` - Read-write
     *
     * Network interface up/down status. Write true to bring
     * interface up and false to bring interface down.
     *
     */
    SPINEL_PROP_NET_IF_UP = SPINEL_PROP_NET__BEGIN + 1,

    /// Thread Stack Operational Status
    /** Format `b` - Read-write
     *
     * Thread stack operational status. Write true to start
     * Thread stack and false to stop it.
     *
     */
    SPINEL_PROP_NET_STACK_UP = SPINEL_PROP_NET__BEGIN + 2,

    /// Thread Device Role
    /** Format `C` - Read-write
     *
     * Possible values are from enumeration `spinel_net_role_t`
     *
     *  SPINEL_NET_ROLE_DETACHED = 0,
     *  SPINEL_NET_ROLE_CHILD    = 1,
     *  SPINEL_NET_ROLE_ROUTER   = 2,
     *  SPINEL_NET_ROLE_LEADER   = 3,
     *
     */
    SPINEL_PROP_NET_ROLE = SPINEL_PROP_NET__BEGIN + 3,

    /// Thread Network Name
    /** Format `U` - Read-write
     *
     */
    SPINEL_PROP_NET_NETWORK_NAME = SPINEL_PROP_NET__BEGIN + 4,

    /// Thread Network Extended PAN ID
    /** Format `D` - Read-write
     *
     */
    SPINEL_PROP_NET_XPANID = SPINEL_PROP_NET__BEGIN + 5,

    /// Thread Network Master Key
    /** Format `D` - Read-write
     *
     */
    SPINEL_PROP_NET_MASTER_KEY = SPINEL_PROP_NET__BEGIN + 6,

    /// Thread Network Key Sequence Counter
    /** Format `L` - Read-write
     *
     */
    SPINEL_PROP_NET_KEY_SEQUENCE_COUNTER = SPINEL_PROP_NET__BEGIN + 7,

    /// Thread Network Partition Id
    /** Format `L` - Read-write
     *
     * The partition ID of the partition that this node is a
     * member of.
     *
     */
    SPINEL_PROP_NET_PARTITION_ID = SPINEL_PROP_NET__BEGIN + 8,

    /// Require Join Existing
    /** Format: `b`
     *  Default Value: `false`
     *
     * This flag is typically used for nodes that are associating with an
     * existing network for the first time. If this is set to `true` before
     * `PROP_NET_STACK_UP` is set to `true`, the
     * creation of a new partition at association is prevented. If the node
     * cannot associate with an existing partition, `PROP_LAST_STATUS` will
     * emit a status that indicates why the association failed and
     * `PROP_NET_STACK_UP` will automatically revert to `false`.
     *
     * Once associated with an existing partition, this flag automatically
     * reverts to `false`.
     *
     * The behavior of this property being set to `true` when
     * `PROP_NET_STACK_UP` is already set to `true` is undefined.
     *
     */
    SPINEL_PROP_NET_REQUIRE_JOIN_EXISTING = SPINEL_PROP_NET__BEGIN + 9,

    /// Thread Network Key Switch Guard Time
    /** Format `L` - Read-write
     *
     */
    SPINEL_PROP_NET_KEY_SWITCH_GUARDTIME = SPINEL_PROP_NET__BEGIN + 10,

    /// Thread Network PSKc
    /** Format `D` - Read-write
     *
     */
    SPINEL_PROP_NET_PSKC = SPINEL_PROP_NET__BEGIN + 11,

    SPINEL_PROP_NET__END = 0x50,

    SPINEL_PROP_NET_EXT__BEGIN = 0x1400,
    SPINEL_PROP_NET_EXT__END   = 0x1500,

    SPINEL_PROP_THREAD__BEGIN = 0x50,

    /// Thread Leader IPv6 Address
    /** Format `6` - Read only
     *
     */
    SPINEL_PROP_THREAD_LEADER_ADDR = SPINEL_PROP_THREAD__BEGIN + 0,

    /// Thread Parent Info
    /** Format: `ESLccCC` - Read only
     *
     *  `E`: Extended address
     *  `S`: RLOC16
     *  `L`: Age (seconds since last heard from)
     *  `c`: Average RSS (in dBm)
     *  `c`: Last RSSI (in dBm)
     *  `C`: Link Quality In
     *  `C`: Link Quality Out
     *
     */
    SPINEL_PROP_THREAD_PARENT = SPINEL_PROP_THREAD__BEGIN + 1,

    /// Thread Child Table
    /** Format: [A(t(ESLLCCcCc)] - Read only
     *
     * Data per item is:
     *
     *  `E`: Extended address
     *  `S`: RLOC16
     *  `L`: Timeout (in seconds)
     *  `L`: Age (in seconds)
     *  `L`: Network Data version
     *  `C`: Link Quality In
     *  `c`: Average RSS (in dBm)
     *  `C`: Mode (bit-flags)
     *  `c`: Last RSSI (in dBm)
     *
     */
    SPINEL_PROP_THREAD_CHILD_TABLE = SPINEL_PROP_THREAD__BEGIN + 2,

    /// Thread Leader Router Id
    /** Format `C` - Read only
     *
     * The router-id of the current leader.
     *
     */
    SPINEL_PROP_THREAD_LEADER_RID = SPINEL_PROP_THREAD__BEGIN + 3,

    /// Thread Leader Weight
    /** Format `C` - Read only
     *
     * The leader weight of the current leader.
     *
     */
    SPINEL_PROP_THREAD_LEADER_WEIGHT = SPINEL_PROP_THREAD__BEGIN + 4,

    /// Thread Local Leader Weight
    /** Format `C` - Read only
     *
     * The leader weight of this node.
     *
     */
    SPINEL_PROP_THREAD_LOCAL_LEADER_WEIGHT = SPINEL_PROP_THREAD__BEGIN + 5,

    /// Thread Local Network Data
    /** Format `D` - Read only
     *
     */
    SPINEL_PROP_THREAD_NETWORK_DATA = SPINEL_PROP_THREAD__BEGIN + 6,

    /// Thread Local Network Data Version
    /** Format `C` - Read only
     *
     */
    SPINEL_PROP_THREAD_NETWORK_DATA_VERSION = SPINEL_PROP_THREAD__BEGIN + 7,

    /// Thread Local Stable Network Data
    /** Format `D` - Read only
     *
     */
    SPINEL_PROP_THREAD_STABLE_NETWORK_DATA = SPINEL_PROP_THREAD__BEGIN + 8,

    /// Thread Local Stable Network Data Version
    /** Format `C` - Read only
     *
     */
    SPINEL_PROP_THREAD_STABLE_NETWORK_DATA_VERSION = SPINEL_PROP_THREAD__BEGIN + 9,

    /// On-Mesh Prefixes
    /** Format: `A(t(6CbCbS))`
     *
     * Data per item is:
     *
     *  `6`: IPv6 Prefix
     *  `C`: Prefix length in bits
     *  `b`: Stable flag
     *  `C`: TLV flags
     *  `b`: "Is defined locally" flag. Set if this network was locally
     *       defined. Assumed to be true for set, insert and replace. Clear if
     *       the on mesh network was defined by another node.
     *  `S`: The RLOC16 of the device that registered this on-mesh prefix entry.
     *       This value is not used and ignored when adding an on-mesh prefix.
     *
     */
    SPINEL_PROP_THREAD_ON_MESH_NETS = SPINEL_PROP_THREAD__BEGIN + 10,

    /// Off-mesh routes
    /** Format: [A(t(6CbCbb))]
     *
     * Data per item is:
     *
     *  `6`: Route Prefix
     *  `C`: Prefix length in bits
     *  `b`: Stable flag
     *  `C`: Route preference flags
     *  `b`: "Is defined locally" flag. Set if this route info was locally
     *       defined as part of local network data. Assumed to be true for set,
     *       insert and replace. Clear if the route is part of partition's network
     *       data.
     *  `b`: "Next hop is this device" flag. Set if the next hop for the
     *       route is this device itself (i.e., route was added by this device)
     *       This value is ignored when adding an external route. For any added
     *       route the next hop is this device.
     *  `S`: The RLOC16 of the device that registered this route entry.
     *       This value is not used and ignored when adding a route.
     *
     */
    SPINEL_PROP_THREAD_OFF_MESH_ROUTES = SPINEL_PROP_THREAD__BEGIN + 11,

    /// Thread Assisting Ports
    /** Format `A(S)`
     *
     * Array of port numbers.
     */
    SPINEL_PROP_THREAD_ASSISTING_PORTS = SPINEL_PROP_THREAD__BEGIN + 12,

    /// Thread Allow Local Network Data Change
    /** Format `b` - Read-write
     *
     * Set to true before changing local net data. Set to false when finished.
     * This allows changes to be aggregated into a single event.
     *
     */
    SPINEL_PROP_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE = SPINEL_PROP_THREAD__BEGIN + 13,

    /// Thread Mode
    /** Format: `C`
     *
     *  This property contains the value of the mode
     *  TLV for this node. The meaning of the bits in this
     *  bit-field are defined by section 4.5.2 of the Thread
     *  specification.
     *
     * The values `SPINEL_THREAD_MODE_*` defines the bit-fields
     *
     */
    SPINEL_PROP_THREAD_MODE = SPINEL_PROP_THREAD__BEGIN + 14,

    SPINEL_PROP_THREAD__END = 0x60,

    SPINEL_PROP_THREAD_EXT__BEGIN = 0x1500,

    /// Thread Child Timeout
    /** Format: `L`
     *  Unit: Seconds
     *
     *  Used when operating in the Child role.
     */
    SPINEL_PROP_THREAD_CHILD_TIMEOUT = SPINEL_PROP_THREAD_EXT__BEGIN + 0,

    /// Thread RLOC16
    /** Format: `S`
     *
     */
    SPINEL_PROP_THREAD_RLOC16 = SPINEL_PROP_THREAD_EXT__BEGIN + 1,

    /// Thread Router Upgrade Threshold
    /** Format: `C`
     *
     */
    SPINEL_PROP_THREAD_ROUTER_UPGRADE_THRESHOLD = SPINEL_PROP_THREAD_EXT__BEGIN + 2,

    /// Thread Context Reuse Delay
    /** Format: `L`
     *
     */
    SPINEL_PROP_THREAD_CONTEXT_REUSE_DELAY = SPINEL_PROP_THREAD_EXT__BEGIN + 3,

    /// Thread Network ID Timeout
    /** Format: `C`
     *
     */
    SPINEL_PROP_THREAD_NETWORK_ID_TIMEOUT = SPINEL_PROP_THREAD_EXT__BEGIN + 4,

    /// List of active thread router ids
    /** Format: `A(C)`
     *
     * Note that some implementations may not support CMD_GET_VALUE
     * router ids, but may support CMD_REMOVE_VALUE when the node is
     * a leader.
     *
     */
    SPINEL_PROP_THREAD_ACTIVE_ROUTER_IDS = SPINEL_PROP_THREAD_EXT__BEGIN + 5,

    /// Forward IPv6 packets that use RLOC16 addresses to HOST.
    /** Format: `b`
     *
     * Allow host to directly observe all IPv6 packets received by the NCP,
     * including ones sent to the RLOC16 address.
     *
     * Default is false.
     *
     */
    SPINEL_PROP_THREAD_RLOC16_DEBUG_PASSTHRU = SPINEL_PROP_THREAD_EXT__BEGIN + 6,

    /// Router Role Enabled
    /** Format `b`
     *
     * Allows host to indicate whether or not the router role is enabled.
     * If current role is a router, setting this property to `false` starts
     * a re-attach process as an end-device.
     *
     */
    SPINEL_PROP_THREAD_ROUTER_ROLE_ENABLED = SPINEL_PROP_THREAD_EXT__BEGIN + 7,

    /// Thread Router Downgrade Threshold
    /** Format: `C`
     *
     */
    SPINEL_PROP_THREAD_ROUTER_DOWNGRADE_THRESHOLD = SPINEL_PROP_THREAD_EXT__BEGIN + 8,

    /// Thread Router Selection Jitter
    /** Format: `C`
     *
     */
    SPINEL_PROP_THREAD_ROUTER_SELECTION_JITTER = SPINEL_PROP_THREAD_EXT__BEGIN + 9,

    /// Thread Preferred Router Id
    /** Format: `C` - Write only
     *
     * Specifies the preferred Router Id. Upon becoming a router/leader the node
     * attempts to use this Router Id. If the preferred Router Id is not set or
     * if it can not be used, a randomly generated router id is picked. This
     * property can be set only when the device role is either detached or
     * disabled.
     *
     */
    SPINEL_PROP_THREAD_PREFERRED_ROUTER_ID = SPINEL_PROP_THREAD_EXT__BEGIN + 10,

    /// Thread Neighbor Table
    /** Format: `A(t(ESLCcCbLLc))` - Read only
     *
     * Data per item is:
     *
     *  `E`: Extended address
     *  `S`: RLOC16
     *  `L`: Age (in seconds)
     *  `C`: Link Quality In
     *  `c`: Average RSS (in dBm)
     *  `C`: Mode (bit-flags)
     *  `b`: `true` if neighbor is a child, `false` otherwise.
     *  `L`: Link Frame Counter
     *  `L`: MLE Frame Counter
     *  `c`: The last RSSI (in dBm)
     *
     */
    SPINEL_PROP_THREAD_NEIGHBOR_TABLE = SPINEL_PROP_THREAD_EXT__BEGIN + 11,

    /// Thread Max Child Count
    /** Format: `C`
     *
     * Specifies the maximum number of children currently allowed.
     * This parameter can only be set when Thread protocol operation
     * has been stopped.
     *
     */
    SPINEL_PROP_THREAD_CHILD_COUNT_MAX = SPINEL_PROP_THREAD_EXT__BEGIN + 12,

    /// Leader Network Data
    /** Format: `D` - Read only
     *
     */
    SPINEL_PROP_THREAD_LEADER_NETWORK_DATA = SPINEL_PROP_THREAD_EXT__BEGIN + 13,

    /// Stable Leader Network Data
    /** Format: `D` - Read only
     *
     */
    SPINEL_PROP_THREAD_STABLE_LEADER_NETWORK_DATA = SPINEL_PROP_THREAD_EXT__BEGIN + 14,

    /// Thread Joiner Data
    /** Format `A(T(ULE))`
     *  PSKd, joiner timeout, eui64 (optional)
     *
     * This property is being deprecated by SPINEL_PROP_MESHCOP_COMMISSIONER_JOINERS.
     *
     */
    SPINEL_PROP_THREAD_JOINERS = SPINEL_PROP_THREAD_EXT__BEGIN + 15,

    /// Thread Commissioner Enable
    /** Format `b`
     *
     * Default value is `false`.
     *
     * This property is being deprecated by SPINEL_PROP_MESHCOP_COMMISSIONER_STATE.
     *
     */
    SPINEL_PROP_THREAD_COMMISSIONER_ENABLED = SPINEL_PROP_THREAD_EXT__BEGIN + 16,

    /// Thread TMF proxy enable
    /** Format `b`
     * Required capability: `SPINEL_CAP_THREAD_TMF_PROXY`
     *
     * This property is deprecated.
     *
     */
    SPINEL_PROP_THREAD_TMF_PROXY_ENABLED = SPINEL_PROP_THREAD_EXT__BEGIN + 17,

    /// Thread TMF proxy stream
    /** Format `dSS`
     * Required capability: `SPINEL_CAP_THREAD_TMF_PROXY`
     *
     * This property is deprecated. Please see `SPINEL_PROP_THREAD_UDP_FORWARD_STREAM`.
     *
     */
    SPINEL_PROP_THREAD_TMF_PROXY_STREAM = SPINEL_PROP_THREAD_EXT__BEGIN + 18,

    /// Thread "joiner" flag used during discovery scan operation
    /** Format `b`
     *
     * This property defines the Joiner Flag value in the Discovery Request TLV.
     *
     * Default value is `false`.
     *
     */
    SPINEL_PROP_THREAD_DISCOVERY_SCAN_JOINER_FLAG = SPINEL_PROP_THREAD_EXT__BEGIN + 19,

    /// Enable EUI64 filtering for discovery scan operation.
    /** Format `b`
     *
     * Default value is `false`
     *
     */
    SPINEL_PROP_THREAD_DISCOVERY_SCAN_ENABLE_FILTERING = SPINEL_PROP_THREAD_EXT__BEGIN + 20,

    /// PANID used for Discovery scan operation (used for PANID filtering).
    /** Format: `S`
     *
     * Default value is 0xffff (Broadcast PAN) to disable PANID filtering
     *
     */
    SPINEL_PROP_THREAD_DISCOVERY_SCAN_PANID = SPINEL_PROP_THREAD_EXT__BEGIN + 21,

    /// Thread (out of band) steering data for MLE Discovery Response.
    /** Format `E` - Write only
     *
     * Required capability: SPINEL_CAP_OOB_STEERING_DATA.
     *
     * Writing to this property allows to set/update the MLE
     * Discovery Response steering data out of band.
     *
     *  - All zeros to clear the steering data (indicating that
     *    there is no steering data).
     *  - All 0xFFs to set steering data/bloom filter to
     *    accept/allow all.
     *  - A specific EUI64 which is then added to current steering
     *    data/bloom filter.
     *
     */
    SPINEL_PROP_THREAD_STEERING_DATA = SPINEL_PROP_THREAD_EXT__BEGIN + 22,

    /// Thread Router Table.
    /** Format: `A(t(ESCCCCCCb)` - Read only
     *
     * Data per item is:
     *
     *  `E`: IEEE 802.15.4 Extended Address
     *  `S`: RLOC16
     *  `C`: Router ID
     *  `C`: Next hop to router
     *  `C`: Path cost to router
     *  `C`: Link Quality In
     *  `C`: Link Quality Out
     *  `C`: Age (seconds since last heard)
     *  `b`: Link established with Router ID or not.
     *
     */
    SPINEL_PROP_THREAD_ROUTER_TABLE = SPINEL_PROP_THREAD_EXT__BEGIN + 23,

    /// Thread Active Operational Dataset
    /** Format: `A(t(iD))` - Read-Write
     *
     * This property provides access to current Thread Active Operational Dataset. A Thread device maintains the
     * Operational Dataset that it has stored locally and the one currently in use by the partition to which it is
     * attached. This property corresponds to the locally stored Dataset on the device.
     *
     * Operational Dataset consists of a set of supported properties (e.g., channel, master key, network name, PAN id,
     * etc). Note that not all supported properties may be present (have a value) in a Dataset.
     *
     * The Dataset value is encoded as an array of structs containing pairs of property key (as `i`) followed by the
     * property value (as `D`). The property value must follow the format associated with the corresponding property.
     *
     * On write, any unknown/unsupported property keys must be ignored.
     *
     * The following properties can be included in a Dataset list:
     *
     *   SPINEL_PROP_DATASET_ACTIVE_TIMESTAMP
     *   SPINEL_PROP_PHY_CHAN
     *   SPINEL_PROP_PHY_CHAN_SUPPORTED (Channel Mask Page 0)
     *   SPINEL_PROP_NET_MASTER_KEY
     *   SPINEL_PROP_NET_NETWORK_NAME
     *   SPINEL_PROP_NET_XPANID
     *   SPINEL_PROP_MAC_15_4_PANID
     *   SPINEL_PROP_IPV6_ML_PREFIX
     *   SPINEL_PROP_NET_PSKC
     *   SPINEL_PROP_DATASET_SECURITY_POLICY
     *
     */
    SPINEL_PROP_THREAD_ACTIVE_DATASET = SPINEL_PROP_THREAD_EXT__BEGIN + 24,

    /// Thread Pending Operational Dataset
    /** Format: `A(t(iD))` - Read-Write
     *
     * This property provide access to current locally stored Pending Operational Dataset.
     *
     * The formatting of this property follows the same rules as in SPINEL_PROP_THREAD_ACTIVE_DATASET.
     *
     * In addition supported properties in SPINEL_PROP_THREAD_ACTIVE_DATASET, the following properties can also
     * be included in the Pending Dataset:
     *
     *   SPINEL_PROP_DATASET_PENDING_TIMESTAMP
     *   SPINEL_PROP_DATASET_DELAY_TIMER
     *
     */
    SPINEL_PROP_THREAD_PENDING_DATASET = SPINEL_PROP_THREAD_EXT__BEGIN + 25,

    /// Send MGMT_SET Thread Active Operational Dataset
    /** Format: `A(t(iD))` - Write only
     *
     * The formatting of this property follows the same rules as in SPINEL_PROP_THREAD_ACTIVE_DATASET.
     *
     * This is write-only property. When written, it triggers a MGMT_ACTIVE_SET meshcop command to be sent to leader
     * with the given Dataset. The spinel frame response should be a `LAST_STATUS` with the status of the transmission
     * of MGMT_ACTIVE_SET command.
     *
     * In addition to supported properties in SPINEL_PROP_THREAD_ACTIVE_DATASET, the following property can be
     * included in the Dataset (to allow for custom raw TLVs):
     *
     *    SPINEL_PROP_DATASET_RAW_TLVS
     *
     */
    SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET = SPINEL_PROP_THREAD_EXT__BEGIN + 26,

    /// Send MGMT_SET Thread Pending Operational Dataset
    /** Format: `A(t(iD))` - Write only
     *
     * This property is similar to SPINEL_PROP_THREAD_PENDING_DATASET and follows the same format and rules.
     *
     * In addition to supported properties in SPINEL_PROP_THREAD_PENDING_DATASET, the following property can be
     * included the Dataset (to allow for custom raw TLVs to be provided).
     *
     *    SPINEL_PROP_DATASET_RAW_TLVS
     *
     */
    SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET = SPINEL_PROP_THREAD_EXT__BEGIN + 27,

    /// Operational Dataset Active Timestamp
    /** Format: `X` - No direct read or write
     *
     * It can only be included in one of the Dataset related properties below:
     *
     *   SPINEL_PROP_THREAD_ACTIVE_DATASET
     *   SPINEL_PROP_THREAD_PENDING_DATASET
     *   SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET
     *   SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET
     *   SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET
     *   SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET
     *
     */
    SPINEL_PROP_DATASET_ACTIVE_TIMESTAMP = SPINEL_PROP_THREAD_EXT__BEGIN + 28,

    /// Operational Dataset Pending Timestamp
    /** Format: `X` - No direct read or write
     *
     * It can only be included in one of the Pending Dataset properties:
     *
     *   SPINEL_PROP_THREAD_PENDING_DATASET
     *   SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET
     *   SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET
     *
     */
    SPINEL_PROP_DATASET_PENDING_TIMESTAMP = SPINEL_PROP_THREAD_EXT__BEGIN + 29,

    /// Operational Dataset Delay Timer
    /** Format: `L` - No direct read or write
     *
     * Delay timer (in ms) specifies the time renaming until Thread devices overwrite the value in the Active
     * Operational Dataset with the corresponding values in the Pending Operational Dataset.
     *
     * It can only be included in one of the Pending Dataset properties:
     *
     *   SPINEL_PROP_THREAD_PENDING_DATASET
     *   SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET
     *   SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET
     *
     */
    SPINEL_PROP_DATASET_DELAY_TIMER = SPINEL_PROP_THREAD_EXT__BEGIN + 30,

    /// Operational Dataset Security Policy
    /** Format: `SC` - No direct read or write
     *
     * It can only be included in one of the Dataset related properties below:
     *
     *   SPINEL_PROP_THREAD_ACTIVE_DATASET
     *   SPINEL_PROP_THREAD_PENDING_DATASET
     *   SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET
     *   SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET
     *   SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET
     *   SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET
     *
     * Content is
     *   `S` : Key Rotation Time (in units of hour)
     *   `C` : Security Policy Flags (as specified in Thread 1.1 Section 8.10.1.15)
     *
     */
    SPINEL_PROP_DATASET_SECURITY_POLICY = SPINEL_PROP_THREAD_EXT__BEGIN + 31,

    /// Operational Dataset Additional Raw TLVs
    /** Format: `D` - No direct read or write
     *
     * This property defines extra raw TLVs that can be added to an Operational DataSet.
     *
     * It can only be included in one of the following Dataset properties:
     *
     *   SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET
     *   SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET
     *   SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET
     *   SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET
     *
     */
    SPINEL_PROP_DATASET_RAW_TLVS = SPINEL_PROP_THREAD_EXT__BEGIN + 32,

    /// Child table addresses
    /** Format: `A(t(ESA(6)))` - Read only
     *
     * This property provides the list of all addresses associated with every child
     * including any registered IPv6 addresses.
     *
     * Data per item is:
     *
     *  `E`: Extended address of the child
     *  `S`: RLOC16 of the child
     *  `A(6)`: List of IPv6 addresses registered by the child (if any)
     *
     */
    SPINEL_PROP_THREAD_CHILD_TABLE_ADDRESSES = SPINEL_PROP_THREAD_EXT__BEGIN + 33,

    /// Neighbor Table Frame and Message Error Rates
    /** Format: `A(t(ESSScc))`
     *  Required capability: `CAP_ERROR_RATE_TRACKING`
     *
     * This property provides link quality related info including
     * frame and (IPv6) message error rates for all neighbors.
     *
     * With regards to message error rate, note that a larger (IPv6)
     * message can be fragmented and sent as multiple MAC frames. The
     * message transmission is considered a failure, if any of its
     * fragments fail after all MAC retry attempts.
     *
     * Data per item is:
     *
     *  `E`: Extended address of the neighbor
     *  `S`: RLOC16 of the neighbor
     *  `S`: Frame error rate (0 -> 0%, 0xffff -> 100%)
     *  `S`: Message error rate (0 -> 0%, 0xffff -> 100%)
     *  `c`: Average RSSI (in dBm)
     *  `c`: Last RSSI (in dBm)
     *
     */
    SPINEL_PROP_THREAD_NEIGHBOR_TABLE_ERROR_RATES = SPINEL_PROP_THREAD_EXT__BEGIN + 34,

    /// EID (Endpoint Identifier) IPv6 Address Cache Table
    /** Format `A(t(6SCCt(bL6)t(bSS)))
     *
     * This property provides Thread EID address cache table.
     *
     * Data per item is:
     *
     *  `6` : Target IPv6 address
     *  `S` : RLOC16 of target
     *  `C` : Age (order of use, 0 indicates most recently used entry)
     *  `C` : Entry state (values are defined by enumeration `SPINEL_ADDRESS_CACHE_ENTRY_STATE_*`).
     *
     *  `t` : Info when state is `SPINEL_ADDRESS_CACHE_ENTRY_STATE_CACHED`
     *    `b` : Indicates whether last transaction time and ML-EID are valid.
     *    `L` : Last transaction time
     *    `6` : Mesh-local EID
     *
     *  `t` : Info when state is other than `SPINEL_ADDRESS_CACHE_ENTRY_STATE_CACHED`
     *    `b` : Indicates whether the entry can be evicted.
     *    `S` : Timeout in seconds
     *    `S` : Retry delay (applicable if in query-retry state).
     *
     */
    SPINEL_PROP_THREAD_ADDRESS_CACHE_TABLE = SPINEL_PROP_THREAD_EXT__BEGIN + 35,

    /// Thread UDP forward stream
    /** Format `dS6S`
     * Required capability: `SPINEL_CAP_THREAD_UDP_FORWARD`
     *
     * This property helps exchange UDP packets with host.
     *
     *  `d`: UDP payload
     *  `S`: Remote UDP port
     *  `6`: Remote IPv6 address
     *  `S`: Local UDP port
     *
     */
    SPINEL_PROP_THREAD_UDP_FORWARD_STREAM = SPINEL_PROP_THREAD_EXT__BEGIN + 36,

    /// Send MGMT_GET Thread Active Operational Dataset
    /** Format: `A(t(iD))` - Write only
     *
     * The formatting of this property follows the same rules as in SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET. This
     * property further allows the sender to not include a value associated with properties in formating of `t(iD)`,
     * i.e., it should accept either a `t(iD)` or a `t(i)` encoding (in both cases indicating that the associated
     * Dataset property should be requested as part of MGMT_GET command).
     *
     * This is write-only property. When written, it triggers a MGMT_ACTIVE_GET meshcop command to be sent to leader
     * requesting the Dataset related properties from the format. The spinel frame response should be a `LAST_STATUS`
     * with the status of the transmission of MGMT_ACTIVE_GET command.
     *
     * In addition to supported properties in SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET, the following property can be
     * optionally included in the Dataset:
     *
     *    SPINEL_PROP_DATASET_DEST_ADDRESS
     *
     */
    SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET = SPINEL_PROP_THREAD_EXT__BEGIN + 37,

    /// Send MGMT_GET Thread Pending Operational Dataset
    /** Format: `A(t(iD))` - Write only
     *
     * The formatting of this property follows the same rules as in SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET.
     *
     * This is write-only property. When written, it triggers a MGMT_PENDING_GET meshcop command to be sent to leader
     * with the given Dataset. The spinel frame response should be a `LAST_STATUS` with the status of the transmission
     * of MGMT_PENDING_GET command.
     *
     */
    SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET = SPINEL_PROP_THREAD_EXT__BEGIN + 38,

    /// Operational Dataset (MGMT_GET) Destination IPv6 Address
    /** Format: `6` - No direct read or write
     *
     * This property specifies the IPv6 destination when sending MGMT_GET command for either Active or Pending Dataset
     * if not provided, Leader ALOC address is used as default.
     *
     * It can only be included in one of the MGMT_GET Dataset properties:
     *
     *   SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET
     *   SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET
     *
     */
    SPINEL_PROP_DATASET_DEST_ADDRESS = SPINEL_PROP_THREAD_EXT__BEGIN + 39,

    /// Thread New Operational Dataset
    /** Format: `A(t(iD))` - Read only - FTD build only
     *
     * This property allows host to request NCP to create and return a new Operation Dataset to use when forming a new
     * network.
     *
     * Operational Dataset consists of a set of supported properties (e.g., channel, master key, network name, PAN id,
     * etc). Note that not all supported properties may be present (have a value) in a Dataset.
     *
     * The Dataset value is encoded as an array of structs containing pairs of property key (as `i`) followed by the
     * property value (as `D`). The property value must follow the format associated with the corresponding property.
     *
     * The following properties can be included in a Dataset list:
     *
     *   SPINEL_PROP_DATASET_ACTIVE_TIMESTAMP
     *   SPINEL_PROP_PHY_CHAN
     *   SPINEL_PROP_PHY_CHAN_SUPPORTED (Channel Mask Page 0)
     *   SPINEL_PROP_NET_MASTER_KEY
     *   SPINEL_PROP_NET_NETWORK_NAME
     *   SPINEL_PROP_NET_XPANID
     *   SPINEL_PROP_MAC_15_4_PANID
     *   SPINEL_PROP_IPV6_ML_PREFIX
     *   SPINEL_PROP_NET_PSKC
     *   SPINEL_PROP_DATASET_SECURITY_POLICY
     *
     */
    SPINEL_PROP_THREAD_NEW_DATASET = SPINEL_PROP_THREAD_EXT__BEGIN + 40,

    SPINEL_PROP_THREAD_EXT__END = 0x1600,

    SPINEL_PROP_IPV6__BEGIN = 0x60,

    /// Link-Local IPv6 Address
    /** Format: `6` - Read only
     *
     */
    SPINEL_PROP_IPV6_LL_ADDR = SPINEL_PROP_IPV6__BEGIN + 0, ///< [6]

    /// Mesh Local IPv6 Address
    /** Format: `6` - Read only
     *
     */
    SPINEL_PROP_IPV6_ML_ADDR = SPINEL_PROP_IPV6__BEGIN + 1,

    /// Mesh Local Prefix
    /** Format: `6C` - Read-write
     *
     * Provides Mesh Local Prefix
     *
     *   `6`: Mesh local prefix
     *   `C` : Prefix length (64 bit for Thread).
     *
     */
    SPINEL_PROP_IPV6_ML_PREFIX = SPINEL_PROP_IPV6__BEGIN + 2,

    /// IPv6 (Unicast) Address Table
    /** Format: `A(t(6CLLC))`
     *
     * This property provides all unicast addresses.
     *
     * Array of structures containing:
     *
     *  `6`: IPv6 Address
     *  `C`: Network Prefix Length (in bits)
     *  `L`: Valid Lifetime
     *  `L`: Preferred Lifetime
     *
     */
    SPINEL_PROP_IPV6_ADDRESS_TABLE = SPINEL_PROP_IPV6__BEGIN + 3,

    /// IPv6 Route Table - Deprecated
    SPINEL_PROP_IPV6_ROUTE_TABLE = SPINEL_PROP_IPV6__BEGIN + 4,

    /// IPv6 ICMP Ping Offload
    /** Format: `b`
     *
     * Allow the NCP to directly respond to ICMP ping requests. If this is
     * turned on, ping request ICMP packets will not be passed to the host.
     *
     * Default value is `false`.
     */
    SPINEL_PROP_IPV6_ICMP_PING_OFFLOAD = SPINEL_PROP_IPV6__BEGIN + 5,

    /// IPv6 Multicast Address Table
    /** Format: `A(t(6))`
     *
     * This property provides all multicast addresses.
     *
     */
    SPINEL_PROP_IPV6_MULTICAST_ADDRESS_TABLE = SPINEL_PROP_IPV6__BEGIN + 6,

    /// IPv6 ICMP Ping Offload
    /** Format: `C`
     *
     * Allow the NCP to directly respond to ICMP ping requests. If this is
     * turned on, ping request ICMP packets will not be passed to the host.
     *
     * This property allows enabling responses sent to unicast only, multicast
     * only, or both. The valid value are defined by enumeration
     * `spinel_ipv6_icmp_ping_offload_mode_t`.
     *
     *   SPINEL_IPV6_ICMP_PING_OFFLOAD_DISABLED       = 0
     *   SPINEL_IPV6_ICMP_PING_OFFLOAD_UNICAST_ONLY   = 1
     *   SPINEL_IPV6_ICMP_PING_OFFLOAD_MULTICAST_ONLY = 2
     *   SPINEL_IPV6_ICMP_PING_OFFLOAD_ALL            = 3
     *
     * Default value is `NET_IPV6_ICMP_PING_OFFLOAD_DISABLED`.
     *
     */
    SPINEL_PROP_IPV6_ICMP_PING_OFFLOAD_MODE = SPINEL_PROP_IPV6__BEGIN + 7, ///< [b]

    SPINEL_PROP_IPV6__END = 0x70,

    SPINEL_PROP_IPV6_EXT__BEGIN = 0x1600,
    SPINEL_PROP_IPV6_EXT__END   = 0x1700,

    SPINEL_PROP_STREAM__BEGIN = 0x70,

    /// Debug Stream
    /** Format: `U` (stream, read only)
     *
     * This property is a streaming property, meaning that you cannot explicitly
     * fetch the value of this property. The stream provides human-readable debugging
     * output which may be displayed in the host logs.
     *
     * The location of newline characters is not assumed by the host: it is
     * the NCP's responsibility to insert newline characters where needed,
     * just like with any other text stream.
     *
     * To receive the debugging stream, you wait for `CMD_PROP_VALUE_IS`
     * commands for this property from the NCP.
     *
     */
    SPINEL_PROP_STREAM_DEBUG = SPINEL_PROP_STREAM__BEGIN + 0,

    /// Raw Stream
    /** Format: `dD` (stream, read only)
     *  Required Capability: SPINEL_CAP_MAC_RAW or SPINEL_CAP_CONFIG_RADIO
     *
     * This stream provides the capability of sending and receiving raw 15.4 frames
     * to and from the radio. The exact format of the frame metadata and data is
     * dependent on the MAC and PHY being used.
     *
     * This property is a streaming property, meaning that you cannot explicitly
     * fetch the value of this property. To receive traffic, you wait for
     * `CMD_PROP_VALUE_IS` commands with this property id from the NCP.
     *
     * The general format of this property is:
     *
     *    `d` : frame data
     *    `D` : frame meta data
     *
     * The frame meta data is optional. Frame metadata MAY be empty or partially
     * specified. Partially specified metadata MUST be accepted. Default values
     * are used for all unspecified fields.
     *
     * The frame metadata field consists of the following fields:
     *
     *   `c` : Received Signal Strength (RSSI) in dBm - default is -128
     *   `c` : Noise floor in dBm - default is -128
     *   `S` : Flags (see below).
     *   `d` : PHY-specific data/struct
     *   `d` : Vendor-specific data/struct
     *
     * Flags fields are defined by the following enumeration bitfields:
     *
     *   SPINEL_MD_FLAG_TX       = 0x0001 :  Packet was transmitted, not received.
     *   SPINEL_MD_FLAG_BAD_FCS  = 0x0004 :  Packet was received with bad FCS
     *   SPINEL_MD_FLAG_DUPE     = 0x0008 :  Packet seems to be a duplicate
     *   SPINEL_MD_FLAG_RESERVED = 0xFFF2 :  Flags reserved for future use.
     *
     * The format of PHY-specific data for a Thread device contains the following
     * optional fields:

     *   `C` : 802.15.4 channel (Receive channel)
     *   `C` : IEEE 802.15.4 LQI
     *   `L` : The timestamp milliseconds
     *   `S` : The timestamp microseconds, offset to mMsec
     *
     * Frames written to this stream with `CMD_PROP_VALUE_SET` will be sent out
     * over the radio. This allows the caller to use the radio directly.
     *
     * The frame meta data for the `CMD_PROP_VALUE_SET` contains the following
     * optional fields.  Default values are used for all unspecified fields.
     *
     *  `C` : Channel (for frame tx)
     *  `C` : Maximum number of backoffs attempts before declaring CCA failure
     *        (use Thread stack default if not specified)
     *  `C` : Maximum number of retries allowed after a transmission failure
     *        (use Thread stack default if not specified)
     *  `b` : Set to true to enable CSMA-CA for this packet, false otherwise.
     *        (default true).
     *  `b` : Set to true to indicate it is a retransmission packet, false otherwise.
     *        (default false).
     *  `b` : Set to true to indicate that SubMac should skip AES processing, false otherwise.
     *        (default false).
     *
     */
    SPINEL_PROP_STREAM_RAW = SPINEL_PROP_STREAM__BEGIN + 1,

    /// (IPv6) Network Stream
    /** Format: `dD` (stream, read only)
     *
     * This stream provides the capability of sending and receiving (IPv6)
     * data packets to and from the currently attached network. The packets
     * are sent or received securely (encryption and authentication).
     *
     * This property is a streaming property, meaning that you cannot explicitly
     * fetch the value of this property. To receive traffic, you wait for
     * `CMD_PROP_VALUE_IS` commands with this property id from the NCP.
     *
     * To send network packets, you call `CMD_PROP_VALUE_SET` on this property with
     * the value of the packet.
     *
     * The general format of this property is:
     *
     *    `d` : packet data
     *    `D` : packet meta data
     *
     * The packet metadata is optional. Packet meta data MAY be empty or partially
     * specified. Partially specified metadata MUST be accepted. Default values
     * are used for all unspecified fields.
     *
     * For OpenThread the meta data is currently empty.
     *
     */
    SPINEL_PROP_STREAM_NET = SPINEL_PROP_STREAM__BEGIN + 2,

    /// (IPv6) Network Stream Insecure
    /** Format: `dD` (stream, read only)
     *
     * This stream provides the capability of sending and receiving unencrypted
     * and unauthenticated data packets to and from nearby devices for the
     * purposes of device commissioning.
     *
     * This property is a streaming property, meaning that you cannot explicitly
     * fetch the value of this property. To receive traffic, you wait for
     * `CMD_PROP_VALUE_IS` commands with this property id from the NCP.
     *
     * To send network packets, you call `CMD_PROP_VALUE_SET` on this property with
     * the value of the packet.
     *
     * The general format of this property is:
     *
     *    `d` : packet data
     *    `D` : packet meta data
     *
     * The packet metadata is optional. Packet meta data MAY be empty or partially
     * specified. Partially specified metadata MUST be accepted. Default values
     * are used for all unspecified fields.
     *
     * For OpenThread the meta data is currently empty.
     *
     */
    SPINEL_PROP_STREAM_NET_INSECURE = SPINEL_PROP_STREAM__BEGIN + 3,

    /// Log Stream
    /** Format: `UD` (stream, read only)
     *
     * This property is a read-only streaming property which provides
     * formatted log string from NCP. This property provides asynchronous
     * `CMD_PROP_VALUE_IS` updates with a new log string and includes
     * optional meta data.
     *
     *   `U`: The log string
     *   `D`: Log metadata (optional).
     *
     * Any data after the log string is considered metadata and is OPTIONAL.
     * Presence of `SPINEL_CAP_OPENTHREAD_LOG_METADATA` capability
     * indicates that OpenThread log metadata format is used as defined
     * below:
     *
     *    `C`: Log level (as per definition in enumeration
     *         `SPINEL_NCP_LOG_LEVEL_<level>`)
     *    `i`: OpenThread Log region (as per definition in enumeration
     *         `SPINEL_NCP_LOG_REGION_<region>).
     *    `X`: Log timestamp = <timestamp_base> + <current_time_ms>
     *
     */
    SPINEL_PROP_STREAM_LOG = SPINEL_PROP_STREAM__BEGIN + 4,

    SPINEL_PROP_STREAM__END = 0x80,

    SPINEL_PROP_STREAM_EXT__BEGIN = 0x1700,
    SPINEL_PROP_STREAM_EXT__END   = 0x1800,

    SPINEL_PROP_MESHCOP__BEGIN = 0x80,

    // Thread Joiner State
    /** Format `C` - Read Only
     *
     * Required capability: SPINEL_CAP_THREAD_JOINER
     *
     * The valid values are specified by `spinel_meshcop_joiner_state_t` (`SPINEL_MESHCOP_JOINER_STATE_<state>`)
     * enumeration.
     *
     */
    SPINEL_PROP_MESHCOP_JOINER_STATE = SPINEL_PROP_MESHCOP__BEGIN + 0, ///<[C]

    /// Thread Joiner Commissioning command and the parameters
    /** Format `b` or `bU(UUUUU)` (fields in parenthesis are optional) - Write Only
     *
     * This property starts or stops Joiner's commissioning process
     *
     * Required capability: SPINEL_CAP_THREAD_JOINER
     *
     * Writing to this property starts/stops the Joiner commissioning process.
     * The immediate `VALUE_IS` response indicates success/failure of the starting/stopping
     * the Joiner commissioning process.
     *
     * After a successful start operation, the join process outcome is reported through an
     * asynchronous `VALUE_IS(LAST_STATUS)` update with one of the following error status values:
     *
     *     - SPINEL_STATUS_JOIN_SUCCESS     the join process succeeded.
     *     - SPINEL_STATUS_JOIN_SECURITY    the join process failed due to security credentials.
     *     - SPINEL_STATUS_JOIN_NO_PEERS    no joinable network was discovered.
     *     - SPINEL_STATUS_JOIN_RSP_TIMEOUT if a response timed out.
     *     - SPINEL_STATUS_JOIN_FAILURE     join failure.
     *
     * Frame format:
     *
     *  `b` : Start or stop commissioning process (true to start).
     *
     * Only if the start commissioning.
     *
     *  `U` : Joiner's PSKd.
     *
     * The next fields are all optional. If not provided, OpenThread default values would be used.
     *
     *  `U` : Provisioning URL (use empty string if not required).
     *  `U` : Vendor Name. If not specified or empty string, use OpenThread default (PACKAGE_NAME).
     *  `U` : Vendor Model. If not specified or empty string, use OpenThread default (OPENTHREAD_CONFIG_PLATFORM_INFO).
     *  `U` : Vendor Sw Version. If not specified or empty string, use OpenThread default (PACKAGE_VERSION).
     *  `U` : Vendor Data String. Will not be appended if not specified.
     *
     */
    SPINEL_PROP_MESHCOP_JOINER_COMMISSIONING = SPINEL_PROP_MESHCOP__BEGIN + 1,

    // Thread Commissioner State
    /** Format `C`
     *
     * Required capability: SPINEL_CAP_THREAD_COMMISSIONER
     *
     * The valid values are specified by SPINEL_MESHCOP_COMMISSIONER_STATE_<state> enumeration.
     *
     */
    SPINEL_PROP_MESHCOP_COMMISSIONER_STATE = SPINEL_PROP_MESHCOP__BEGIN + 2,

    // Thread Commissioner Joiners
    /** Format `A(t(E)UL)` - insert or remove only
     *
     * Required capability: SPINEL_CAP_THREAD_COMMISSIONER
     *
     * Data per item is:
     *
     *  `t(E)` | `t()`: Joiner EUI64. Empty struct indicates any Joiner
     *  `L`           : Timeout (in seconds) after which the Joiner is automatically removed
     *  `U`           : PSKd
     *
     * For CMD_PROP_VALUE_REMOVE the timeout and PSKd are optional.
     *
     */
    SPINEL_PROP_MESHCOP_COMMISSIONER_JOINERS = SPINEL_PROP_MESHCOP__BEGIN + 3,

    // Thread Commissioner Provisioning URL
    /** Format `U`
     *
     * Required capability: SPINEL_CAP_THREAD_COMMISSIONER
     *
     */
    SPINEL_PROP_MESHCOP_COMMISSIONER_PROVISIONING_URL = SPINEL_PROP_MESHCOP__BEGIN + 4,

    // Thread Commissioner Session ID
    /** Format `S` - Read only
     *
     * Required capability: SPINEL_CAP_THREAD_COMMISSIONER
     *
     */
    SPINEL_PROP_MESHCOP_COMMISSIONER_SESSION_ID = SPINEL_PROP_MESHCOP__BEGIN + 5,

    SPINEL_PROP_MESHCOP__END = 0x90,

    SPINEL_PROP_MESHCOP_EXT__BEGIN = 0x1800,

    // Thread Commissioner Announce Begin
    /** Format `LCS6` - Write only
     *
     * Required capability: SPINEL_CAP_THREAD_COMMISSIONER
     *
     * Writing to this property sends an Announce Begin message with the specified parameters. Response is a
     * `LAST_STATUS` update with status of operation.
     *
     *   `L` : Channel mask
     *   `C` : Number of messages per channel
     *   `S` : The time between two successive MLE Announce transmissions (milliseconds)
     *   `6` : IPv6 destination
     *
     */
    SPINEL_PROP_MESHCOP_COMMISSIONER_ANNOUNCE_BEGIN = SPINEL_PROP_MESHCOP_EXT__BEGIN + 0,

    // Thread Commissioner Energy Scan Query
    /** Format `LCSS6` - Write only
     *
     * Required capability: SPINEL_CAP_THREAD_COMMISSIONER
     *
     * Writing to this property sends an Energy Scan Query message with the specified parameters. Response is a
     * `LAST_STATUS` with status of operation. The energy scan results are emitted asynchronously through
     * `SPINEL_PROP_MESHCOP_COMMISSIONER_ENERGY_SCAN_RESULT` updates.
     *
     * Format is:
     *
     *   `L` : Channel mask
     *   `C` : The number of energy measurements per channel
     *   `S` : The time between energy measurements (milliseconds)
     *   `S` : The scan duration for each energy measurement (milliseconds)
     *   `6` : IPv6 destination.
     *
     */
    SPINEL_PROP_MESHCOP_COMMISSIONER_ENERGY_SCAN = SPINEL_PROP_MESHCOP_EXT__BEGIN + 1,

    // Thread Commissioner Energy Scan Result
    /** Format `Ld` - Asynchronous event only
     *
     * Required capability: SPINEL_CAP_THREAD_COMMISSIONER
     *
     * This property provides asynchronous `CMD_PROP_VALUE_INSERTED` updates to report energy scan results for a
     * previously sent Energy Scan Query message (please see `SPINEL_PROP_MESHCOP_COMMISSIONER_ENERGY_SCAN`).
     *
     * Format is:
     *
     *   `L` : Channel mask
     *   `d` : Energy measurement data (note that `d` encoding includes the length)
     *
     */
    SPINEL_PROP_MESHCOP_COMMISSIONER_ENERGY_SCAN_RESULT = SPINEL_PROP_MESHCOP_EXT__BEGIN + 2,

    // Thread Commissioner PAN ID Query
    /** Format `SL6` - Write only
     *
     * Required capability: SPINEL_CAP_THREAD_COMMISSIONER
     *
     * Writing to this property sends a PAN ID Query message with the specified parameters. Response is a
     * `LAST_STATUS` with status of operation. The PAN ID Conflict results are emitted asynchronously through
     * `SPINEL_PROP_MESHCOP_COMMISSIONER_PAN_ID_CONFLICT_RESULT` updates.
     *
     * Format is:
     *
     *   `S` : PAN ID to query
     *   `L` : Channel mask
     *   `6` : IPv6 destination
     *
     */
    SPINEL_PROP_MESHCOP_COMMISSIONER_PAN_ID_QUERY = SPINEL_PROP_MESHCOP_EXT__BEGIN + 3,

    // Thread Commissioner PAN ID Conflict Result
    /** Format `SL` - Asynchronous event only
     *
     * Required capability: SPINEL_CAP_THREAD_COMMISSIONER
     *
     * This property provides asynchronous `CMD_PROP_VALUE_INSERTED` updates to report PAN ID conflict results for a
     * previously sent PAN ID Query message (please see `SPINEL_PROP_MESHCOP_COMMISSIONER_PAN_ID_QUERY`).
     *
     * Format is:
     *
     *   `S` : The PAN ID
     *   `L` : Channel mask
     *
     */
    SPINEL_PROP_MESHCOP_COMMISSIONER_PAN_ID_CONFLICT_RESULT = SPINEL_PROP_MESHCOP_EXT__BEGIN + 4,

    // Thread Commissioner Send MGMT_COMMISSIONER_GET
    /** Format `d` - Write only
     *
     * Required capability: SPINEL_CAP_THREAD_COMMISSIONER
     *
     * Writing to this property sends a MGMT_COMMISSIONER_GET message with the specified parameters. Response is a
     * `LAST_STATUS` with status of operation.
     *
     * Format is:
     *
     *   `d` : List of TLV types to get
     *
     */
    SPINEL_PROP_MESHCOP_COMMISSIONER_MGMT_GET = SPINEL_PROP_MESHCOP_EXT__BEGIN + 5,

    // Thread Commissioner Send MGMT_COMMISSIONER_SET
    /** Format `d` - Write only
     *
     * Required capability: SPINEL_CAP_THREAD_COMMISSIONER
     *
     * Writing to this property sends a MGMT_COMMISSIONER_SET message with the specified parameters. Response is a
     * `LAST_STATUS` with status of operation.
     *
     * Format is:
     *
     *   `d` : TLV encoded data
     *
     */
    SPINEL_PROP_MESHCOP_COMMISSIONER_MGMT_SET = SPINEL_PROP_MESHCOP_EXT__BEGIN + 6,

    // Thread Commissioner Generate PSKc
    /** Format: `UUd` - Write only
     *
     * Required capability: SPINEL_CAP_THREAD_COMMISSIONER
     *
     * Writing to this property allows user to generate PSKc from a given commissioning pass-phrase, network name,
     * extended PAN Id.
     *
     * Written value format is:
     *
     *   `U` : The commissioning pass-phrase.
     *   `U` : Network Name.
     *   `d` : Extended PAN ID.
     *
     * The response on success would be a `VALUE_IS` command with the PSKc with format below:
     *
     *   `D` : The PSKc
     *
     * On a failure a `LAST_STATUS` is emitted with the error status.
     *
     */
    SPINEL_PROP_MESHCOP_COMMISSIONER_GENERATE_PSKC = SPINEL_PROP_MESHCOP_EXT__BEGIN + 7,

    SPINEL_PROP_MESHCOP_EXT__END = 0x1900,

    SPINEL_PROP_OPENTHREAD__BEGIN = 0x1900,

    /// Channel Manager - Channel Change New Channel
    /** Format: `C` (read-write)
     *
     * Required capability: SPINEL_CAP_CHANNEL_MANAGER
     *
     * Setting this property triggers the Channel Manager to start
     * a channel change process. The network switches to the given
     * channel after the specified delay (see `CHANNEL_MANAGER_DELAY`).
     *
     * A subsequent write to this property will cancel an ongoing
     * (previously requested) channel change.
     *
     */
    SPINEL_PROP_CHANNEL_MANAGER_NEW_CHANNEL = SPINEL_PROP_OPENTHREAD__BEGIN + 0,

    /// Channel Manager - Channel Change Delay
    /** Format 'S'
     *  Units: seconds
     *
     * Required capability: SPINEL_CAP_CHANNEL_MANAGER
     *
     * This property specifies the delay (in seconds) to be used for
     * a channel change request.
     *
     * The delay should preferably be longer than maximum data poll
     * interval used by all sleepy-end-devices within the Thread
     * network.
     *
     */
    SPINEL_PROP_CHANNEL_MANAGER_DELAY = SPINEL_PROP_OPENTHREAD__BEGIN + 1,

    /// Channel Manager Supported Channels
    /** Format 'A(C)'
     *
     * Required capability: SPINEL_CAP_CHANNEL_MANAGER
     *
     * This property specifies the list of supported channels.
     *
     */
    SPINEL_PROP_CHANNEL_MANAGER_SUPPORTED_CHANNELS = SPINEL_PROP_OPENTHREAD__BEGIN + 2,

    /// Channel Manager Favored Channels
    /** Format 'A(C)'
     *
     * Required capability: SPINEL_CAP_CHANNEL_MANAGER
     *
     * This property specifies the list of favored channels (when `ChannelManager` is asked to select channel)
     *
     */
    SPINEL_PROP_CHANNEL_MANAGER_FAVORED_CHANNELS = SPINEL_PROP_OPENTHREAD__BEGIN + 3,

    /// Channel Manager Channel Select Trigger
    /** Format 'b'
     *
     * Required capability: SPINEL_CAP_CHANNEL_MANAGER
     *
     * Writing to this property triggers a request on `ChannelManager` to select a new channel.
     *
     * Once a Channel Select is triggered, the Channel Manager will perform the following 3 steps:
     *
     * 1) `ChannelManager` decides if the channel change would be helpful. This check can be skipped if in the input
     *    boolean to this property is set to `true` (skipping the quality check).
     *    This step uses the collected link quality metrics on the device such as CCA failure rate, frame and message
     *    error rates per neighbor, etc. to determine if the current channel quality is at the level that justifies
     *    a channel change.
     *
     * 2) If first step passes, then `ChannelManager` selects a potentially better channel. It uses the collected
     *    channel quality data by `ChannelMonitor` module. The supported and favored channels are used at this step.
     *
     * 3) If the newly selected channel is different from the current channel, `ChannelManager` requests/starts the
     *    channel change process.
     *
     * Reading this property always yields `false`.
     *
     */
    SPINEL_PROP_CHANNEL_MANAGER_CHANNEL_SELECT = SPINEL_PROP_OPENTHREAD__BEGIN + 4,

    /// Channel Manager Auto Channel Selection Enabled
    /** Format 'b'
     *
     * Required capability: SPINEL_CAP_CHANNEL_MANAGER
     *
     * This property indicates if auto-channel-selection functionality is enabled/disabled on `ChannelManager`.
     *
     * When enabled, `ChannelManager` will periodically checks and attempts to select a new channel. The period interval
     * is specified by `SPINEL_PROP_CHANNEL_MANAGER_AUTO_SELECT_INTERVAL`.
     *
     */
    SPINEL_PROP_CHANNEL_MANAGER_AUTO_SELECT_ENABLED = SPINEL_PROP_OPENTHREAD__BEGIN + 5,

    /// Channel Manager Auto Channel Selection Interval
    /** Format 'L'
     *  units: seconds
     *
     * Required capability: SPINEL_CAP_CHANNEL_MANAGER
     *
     * This property specifies the auto-channel-selection check interval (in seconds).
     *
     */
    SPINEL_PROP_CHANNEL_MANAGER_AUTO_SELECT_INTERVAL = SPINEL_PROP_OPENTHREAD__BEGIN + 6,

    /// Thread network time.
    /** Format: `Xc` - Read only
     *
     * Data per item is:
     *
     *  `X`: The Thread network time, in microseconds.
     *  `c`: Time synchronization status.
     *
     */
    SPINEL_PROP_THREAD_NETWORK_TIME = SPINEL_PROP_OPENTHREAD__BEGIN + 7,

    /// Thread time synchronization period
    /** Format: `S` - Read-Write
     *
     * Data per item is:
     *
     *  `S`: Time synchronization period, in seconds.
     *
     */
    SPINEL_PROP_TIME_SYNC_PERIOD = SPINEL_PROP_OPENTHREAD__BEGIN + 8,

    /// Thread Time synchronization XTAL accuracy threshold for Router
    /** Format: `S` - Read-Write
     *
     * Data per item is:
     *
     *  `S`: The XTAL accuracy threshold for Router, in PPM.
     *
     */
    SPINEL_PROP_TIME_SYNC_XTAL_THRESHOLD = SPINEL_PROP_OPENTHREAD__BEGIN + 9,

    /// Child Supervision Interval
    /** Format: `S` - Read-Write
     *  Units: Seconds
     *
     * Required capability: `SPINEL_CAP_CHILD_SUPERVISION`
     *
     * The child supervision interval (in seconds). Zero indicates that child supervision is disabled.
     *
     * When enabled, Child supervision feature ensures that at least one message is sent to every sleepy child within
     * the given supervision interval. If there is no other message, a supervision message (a data message with empty
     * payload) is enqueued and sent to the child.
     *
     * This property is available for FTD build only.
     *
     */
    SPINEL_PROP_CHILD_SUPERVISION_INTERVAL = SPINEL_PROP_OPENTHREAD__BEGIN + 10,

    /// Child Supervision Check Timeout
    /** Format: `S` - Read-Write
     *  Units: Seconds
     *
     * Required capability: `SPINEL_CAP_CHILD_SUPERVISION`
     *
     * The child supervision check timeout interval (in seconds). Zero indicates supervision check on the child is
     * disabled.
     *
     * Supervision check is only applicable on a sleepy child. When enabled, if the child does not hear from its parent
     * within the specified check timeout, it initiates a re-attach process by starting an MLE Child Update
     * Request/Response exchange with the parent.
     *
     * This property is available for FTD and MTD builds.
     *
     */
    SPINEL_PROP_CHILD_SUPERVISION_CHECK_TIMEOUT = SPINEL_PROP_OPENTHREAD__BEGIN + 11,

    // RCP (NCP in radio only mode) version
    /** Format `U` - Read only
     *
     * Required capability: SPINEL_CAP_POSIX
     *
     * This property gives the version string of RCP (NCP in radio mode) which is being controlled by a POSIX
     * application. It is available only in "POSIX" platform (i.e., `OPENTHREAD_PLATFORM_POSIX` is enabled).
     *
     */
    SPINEL_PROP_RCP_VERSION = SPINEL_PROP_OPENTHREAD__BEGIN + 12,

    /// Thread Parent Response info
    /** Format: `ESccCCCb` - Asynchronous event only
     *
     *  `E`: Extended address
     *  `S`: RLOC16
     *  `c`: Instant RSSI
     *  'c': Parent Priority
     *  `C`: Link Quality3
     *  `C`: Link Quality2
     *  `C`: Link Quality1
     *  'b': Is the node receiving parent response frame attached
     *
     * This property sends Parent Response frame information to the Host.
     * This property is available for FTD build only.
     *
     */
    SPINEL_PROP_PARENT_RESPONSE_INFO = SPINEL_PROP_OPENTHREAD__BEGIN + 13,

    /// SLAAC enabled
    /** Format `b` - Read-Write
     *  Required capability: `SPINEL_CAP_SLAAC`
     *
     * This property allows the host to enable/disable SLAAC module on NCP at run-time. When SLAAC module is enabled,
     * SLAAC addresses (based on on-mesh prefixes in Network Data) are added to the interface. When SLAAC module is
     * disabled any previously added SLAAC address is removed.
     *
     */
    SPINEL_PROP_SLAAC_ENABLED = SPINEL_PROP_OPENTHREAD__BEGIN + 14,

    SPINEL_PROP_OPENTHREAD__END = 0x2000,

    SPINEL_PROP_SERVER__BEGIN = 0xA0,

    /// Server Allow Local Network Data Change
    /** Format `b` - Read-write
     *
     * Required capability: SPINEL_CAP_THREAD_SERVICE
     *
     * Set to true before changing local server net data. Set to false when finished.
     * This allows changes to be aggregated into a single event.
     *
     */
    SPINEL_PROP_SERVER_ALLOW_LOCAL_DATA_CHANGE = SPINEL_PROP_SERVER__BEGIN + 0,

    // Server Services
    /** Format: `A(t(LdbdS))`
     *
     * This property provides all services registered on the device
     *
     * Required capability: SPINEL_CAP_THREAD_SERVICE
     *
     * Array of structures containing:
     *
     *  `L`: Enterprise Number
     *  `d`: Service Data
     *  `b`: Stable
     *  `d`: Server Data
     *  `S`: RLOC
     *
     */
    SPINEL_PROP_SERVER_SERVICES = SPINEL_PROP_SERVER__BEGIN + 1,

    // Server Leader Services
    /** Format: `A(t(CLdbdS))`
     *
     * This property provides all services registered on the leader
     *
     * Array of structures containing:
     *
     *  `C`: Service ID
     *  `L`: Enterprise Number
     *  `d`: Service Data
     *  `b`: Stable
     *  `d`: Server Data
     *  `S`: RLOC
     *
     */
    SPINEL_PROP_SERVER_LEADER_SERVICES = SPINEL_PROP_SERVER__BEGIN + 2,

    SPINEL_PROP_SERVER__END = 0xB0,

    SPINEL_PROP_INTERFACE__BEGIN = 0x100,

    /// UART Bitrate
    /** Format: `L`
     *
     *  If the NCP is using a UART to communicate with the host,
     *  this property allows the host to change the bitrate
     *  of the serial connection. The value encoding is `L`,
     *  which is a little-endian 32-bit unsigned integer.
     *  The host should not assume that all possible numeric values
     *  are supported.
     *
     *  If implemented by the NCP, this property should be persistent
     *  across software resets and forgotten upon hardware resets.
     *
     *  This property is only implemented when a UART is being
     *  used for Spinel. This property is optional.
     *
     *  When changing the bitrate, all frames will be received
     *  at the previous bitrate until the response frame to this command
     *  is received. Once a successful response frame is received by
     *  the host, all further frames will be transmitted at the new
     *  bitrate.
     */
    SPINEL_PROP_UART_BITRATE = SPINEL_PROP_INTERFACE__BEGIN + 0,

    /// UART Software Flow Control
    /** Format: `b`
     *
     *  If the NCP is using a UART to communicate with the host,
     *  this property allows the host to determine if software flow
     *  control (XON/XOFF style) should be used and (optionally) to
     *  turn it on or off.
     *
     *  This property is only implemented when a UART is being
     *  used for Spinel. This property is optional.
     */
    SPINEL_PROP_UART_XON_XOFF = SPINEL_PROP_INTERFACE__BEGIN + 1,

    SPINEL_PROP_INTERFACE__END = 0x200,

    SPINEL_PROP_15_4_PIB__BEGIN = 0x400,
    // For direct access to the 802.15.4 PID.
    // Individual registers are fetched using
    // `SPINEL_PROP_15_4_PIB__BEGIN+[PIB_IDENTIFIER]`
    // Only supported if SPINEL_CAP_15_4_PIB is set.
    //
    // For brevity, the entire 802.15.4 PIB space is
    // not defined here, but a few choice attributes
    // are defined for illustration and convenience.
    SPINEL_PROP_15_4_PIB_PHY_CHANNELS_SUPPORTED = SPINEL_PROP_15_4_PIB__BEGIN + 0x01, ///< [A(L)]
    SPINEL_PROP_15_4_PIB_MAC_PROMISCUOUS_MODE   = SPINEL_PROP_15_4_PIB__BEGIN + 0x51, ///< [b]
    SPINEL_PROP_15_4_PIB_MAC_SECURITY_ENABLED   = SPINEL_PROP_15_4_PIB__BEGIN + 0x5d, ///< [b]
    SPINEL_PROP_15_4_PIB__END                   = 0x500,

    SPINEL_PROP_CNTR__BEGIN = 0x500,

    /// Counter reset
    /** Format: Empty (Write only).
     *
     * Writing to this property (with any value) will reset all MAC, MLE, IP, and NCP counters to zero.
     *
     */
    SPINEL_PROP_CNTR_RESET = SPINEL_PROP_CNTR__BEGIN + 0,

    /// The total number of transmissions.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_TX_PKT_TOTAL = SPINEL_PROP_CNTR__BEGIN + 1,

    /// The number of transmissions with ack request.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_TX_PKT_ACK_REQ = SPINEL_PROP_CNTR__BEGIN + 2,

    /// The number of transmissions that were acked.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_TX_PKT_ACKED = SPINEL_PROP_CNTR__BEGIN + 3,

    /// The number of transmissions without ack request.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_TX_PKT_NO_ACK_REQ = SPINEL_PROP_CNTR__BEGIN + 4,

    /// The number of transmitted data.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_TX_PKT_DATA = SPINEL_PROP_CNTR__BEGIN + 5,

    /// The number of transmitted data poll.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_TX_PKT_DATA_POLL = SPINEL_PROP_CNTR__BEGIN + 6,

    /// The number of transmitted beacon.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_TX_PKT_BEACON = SPINEL_PROP_CNTR__BEGIN + 7,

    /// The number of transmitted beacon request.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_TX_PKT_BEACON_REQ = SPINEL_PROP_CNTR__BEGIN + 8,

    /// The number of transmitted other types of frames.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_TX_PKT_OTHER = SPINEL_PROP_CNTR__BEGIN + 9,

    /// The number of retransmission times.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_TX_PKT_RETRY = SPINEL_PROP_CNTR__BEGIN + 10,

    /// The number of CCA failure times.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_TX_ERR_CCA = SPINEL_PROP_CNTR__BEGIN + 11,

    /// The number of unicast packets transmitted.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_TX_PKT_UNICAST = SPINEL_PROP_CNTR__BEGIN + 12,

    /// The number of broadcast packets transmitted.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_TX_PKT_BROADCAST = SPINEL_PROP_CNTR__BEGIN + 13,

    /// The number of frame transmission failures due to abort error.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_TX_ERR_ABORT = SPINEL_PROP_CNTR__BEGIN + 14,

    /// The total number of received packets.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_RX_PKT_TOTAL = SPINEL_PROP_CNTR__BEGIN + 100,

    /// The number of received data.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_RX_PKT_DATA = SPINEL_PROP_CNTR__BEGIN + 101,

    /// The number of received data poll.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_RX_PKT_DATA_POLL = SPINEL_PROP_CNTR__BEGIN + 102,

    /// The number of received beacon.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_RX_PKT_BEACON = SPINEL_PROP_CNTR__BEGIN + 103,

    /// The number of received beacon request.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_RX_PKT_BEACON_REQ = SPINEL_PROP_CNTR__BEGIN + 104,

    /// The number of received other types of frames.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_RX_PKT_OTHER = SPINEL_PROP_CNTR__BEGIN + 105,

    /// The number of received packets filtered by whitelist.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_RX_PKT_FILT_WL = SPINEL_PROP_CNTR__BEGIN + 106,

    /// The number of received packets filtered by destination check.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_RX_PKT_FILT_DA = SPINEL_PROP_CNTR__BEGIN + 107,

    /// The number of received packets that are empty.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_RX_ERR_EMPTY = SPINEL_PROP_CNTR__BEGIN + 108,

    /// The number of received packets from an unknown neighbor.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_RX_ERR_UKWN_NBR = SPINEL_PROP_CNTR__BEGIN + 109,

    /// The number of received packets whose source address is invalid.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_RX_ERR_NVLD_SADDR = SPINEL_PROP_CNTR__BEGIN + 110,

    /// The number of received packets with a security error.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_RX_ERR_SECURITY = SPINEL_PROP_CNTR__BEGIN + 111,

    /// The number of received packets with a checksum error.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_RX_ERR_BAD_FCS = SPINEL_PROP_CNTR__BEGIN + 112,

    /// The number of received packets with other errors.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_RX_ERR_OTHER = SPINEL_PROP_CNTR__BEGIN + 113,

    /// The number of received duplicated.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_RX_PKT_DUP = SPINEL_PROP_CNTR__BEGIN + 114,

    /// The number of unicast packets received.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_RX_PKT_UNICAST = SPINEL_PROP_CNTR__BEGIN + 115,

    /// The number of broadcast packets received.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_RX_PKT_BROADCAST = SPINEL_PROP_CNTR__BEGIN + 116,

    /// The total number of secure transmitted IP messages.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_TX_IP_SEC_TOTAL = SPINEL_PROP_CNTR__BEGIN + 200,

    /// The total number of insecure transmitted IP messages.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_TX_IP_INSEC_TOTAL = SPINEL_PROP_CNTR__BEGIN + 201,

    /// The number of dropped (not transmitted) IP messages.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_TX_IP_DROPPED = SPINEL_PROP_CNTR__BEGIN + 202,

    /// The total number of secure received IP message.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_RX_IP_SEC_TOTAL = SPINEL_PROP_CNTR__BEGIN + 203,

    /// The total number of insecure received IP message.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_RX_IP_INSEC_TOTAL = SPINEL_PROP_CNTR__BEGIN + 204,

    /// The number of dropped received IP messages.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_RX_IP_DROPPED = SPINEL_PROP_CNTR__BEGIN + 205,

    /// The number of transmitted spinel frames.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_TX_SPINEL_TOTAL = SPINEL_PROP_CNTR__BEGIN + 300,

    /// The number of received spinel frames.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_RX_SPINEL_TOTAL = SPINEL_PROP_CNTR__BEGIN + 301,

    /// The number of received spinel frames with error.
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_RX_SPINEL_ERR = SPINEL_PROP_CNTR__BEGIN + 302,

    /// Number of out of order received spinel frames (tid increase by more than 1).
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_RX_SPINEL_OUT_OF_ORDER_TID = SPINEL_PROP_CNTR__BEGIN + 303,

    /// The number of successful Tx IP packets
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_IP_TX_SUCCESS = SPINEL_PROP_CNTR__BEGIN + 304,

    /// The number of successful Rx IP packets
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_IP_RX_SUCCESS = SPINEL_PROP_CNTR__BEGIN + 305,

    /// The number of failed Tx IP packets
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_IP_TX_FAILURE = SPINEL_PROP_CNTR__BEGIN + 306,

    /// The number of failed Rx IP packets
    /** Format: `L` (Read-only) */
    SPINEL_PROP_CNTR_IP_RX_FAILURE = SPINEL_PROP_CNTR__BEGIN + 307,

    /// The message buffer counter info
    /** Format: `SSSSSSSSSSSSSSSS` (Read-only)
     *      `S`, (TotalBuffers)           The number of buffers in the pool.
     *      `S`, (FreeBuffers)            The number of free message buffers.
     *      `S`, (6loSendMessages)        The number of messages in the 6lo send queue.
     *      `S`, (6loSendBuffers)         The number of buffers in the 6lo send queue.
     *      `S`, (6loReassemblyMessages)  The number of messages in the 6LoWPAN reassembly queue.
     *      `S`, (6loReassemblyBuffers)   The number of buffers in the 6LoWPAN reassembly queue.
     *      `S`, (Ip6Messages)            The number of messages in the IPv6 send queue.
     *      `S`, (Ip6Buffers)             The number of buffers in the IPv6 send queue.
     *      `S`, (MplMessages)            The number of messages in the MPL send queue.
     *      `S`, (MplBuffers)             The number of buffers in the MPL send queue.
     *      `S`, (MleMessages)            The number of messages in the MLE send queue.
     *      `S`, (MleBuffers)             The number of buffers in the MLE send queue.
     *      `S`, (ArpMessages)            The number of messages in the ARP send queue.
     *      `S`, (ArpBuffers)             The number of buffers in the ARP send queue.
     *      `S`, (CoapMessages)           The number of messages in the CoAP send queue.
     *      `S`, (CoapBuffers)            The number of buffers in the CoAP send queue.
     */
    SPINEL_PROP_MSG_BUFFER_COUNTERS = SPINEL_PROP_CNTR__BEGIN + 400,

    /// All MAC related counters.
    /** Format: t(A(L))t(A(L))
     *
     * The contents include two structs, first one corresponds to
     * all transmit related MAC counters, second one provides the
     * receive related counters.
     *
     * The transmit structure includes:
     *
     *   'L': TxTotal                  (The total number of transmissions).
     *   'L': TxUnicast                (The total number of unicast transmissions).
     *   'L': TxBroadcast              (The total number of broadcast transmissions).
     *   'L': TxAckRequested           (The number of transmissions with ack request).
     *   'L': TxAcked                  (The number of transmissions that were acked).
     *   'L': TxNoAckRequested         (The number of transmissions without ack request).
     *   'L': TxData                   (The number of transmitted data).
     *   'L': TxDataPoll               (The number of transmitted data poll).
     *   'L': TxBeacon                 (The number of transmitted beacon).
     *   'L': TxBeaconRequest          (The number of transmitted beacon request).
     *   'L': TxOther                  (The number of transmitted other types of frames).
     *   'L': TxRetry                  (The number of retransmission times).
     *   'L': TxErrCca                 (The number of CCA failure times).
     *   'L': TxErrAbort               (The number of frame transmission failures due to abort error).
     *   'L': TxErrBusyChannel         (The number of frames that were dropped due to a busy channel).
     *   'L': TxDirectMaxRetryExpiry   (The number of expired retransmission retries for direct message).
     *   'L': TxIndirectMaxRetryExpiry (The number of expired retransmission retries for indirect message).
     *
     * The receive structure includes:
     *
     *   'L': RxTotal                  (The total number of received packets).
     *   'L': RxUnicast                (The total number of unicast packets received).
     *   'L': RxBroadcast              (The total number of broadcast packets received).
     *   'L': RxData                   (The number of received data).
     *   'L': RxDataPoll               (The number of received data poll).
     *   'L': RxBeacon                 (The number of received beacon).
     *   'L': RxBeaconRequest          (The number of received beacon request).
     *   'L': RxOther                  (The number of received other types of frames).
     *   'L': RxAddressFiltered        (The number of received packets filtered by address filter
     *                                  (whitelist or blacklist)).
     *   'L': RxDestAddrFiltered       (The number of received packets filtered by destination check).
     *   'L': RxDuplicated             (The number of received duplicated packets).
     *   'L': RxErrNoFrame             (The number of received packets with no or malformed content).
     *   'L': RxErrUnknownNeighbor     (The number of received packets from unknown neighbor).
     *   'L': RxErrInvalidSrcAddr      (The number of received packets whose source address is invalid).
     *   'L': RxErrSec                 (The number of received packets with security error).
     *   'L': RxErrFcs                 (The number of received packets with FCS error).
     *   'L': RxErrOther               (The number of received packets with other error).
     *
     * Writing to this property with any value would reset all MAC counters to zero.
     *
     */
    SPINEL_PROP_CNTR_ALL_MAC_COUNTERS = SPINEL_PROP_CNTR__BEGIN + 401,

    /// Thread MLE counters.
    /** Format: `SSSSSSSSS`
     *
     *   'S': DisabledRole                  (The number of times device entered OT_DEVICE_ROLE_DISABLED role).
     *   'S': DetachedRole                  (The number of times device entered OT_DEVICE_ROLE_DETACHED role).
     *   'S': ChildRole                     (The number of times device entered OT_DEVICE_ROLE_CHILD role).
     *   'S': RouterRole                    (The number of times device entered OT_DEVICE_ROLE_ROUTER role).
     *   'S': LeaderRole                    (The number of times device entered OT_DEVICE_ROLE_LEADER role).
     *   'S': AttachAttempts                (The number of attach attempts while device was detached).
     *   'S': PartitionIdChanges            (The number of changes to partition ID).
     *   'S': BetterPartitionAttachAttempts (The number of attempts to attach to a better partition).
     *   'S': ParentChanges                 (The number of times device changed its parents).
     *
     * Writing to this property with any value would reset all MLE counters to zero.
     *
     */
    SPINEL_PROP_CNTR_MLE_COUNTERS = SPINEL_PROP_CNTR__BEGIN + 402,

    /// Thread IPv6 counters.
    /** Format: `t(LL)t(LL)`
     *
     * The contents include two structs, first one corresponds to
     * all transmit related MAC counters, second one provides the
     * receive related counters.
     *
     * The transmit structure includes:
     *   'L': TxSuccess (The number of IPv6 packets successfully transmitted).
     *   'L': TxFailure (The number of IPv6 packets failed to transmit).
     *
     * The receive structure includes:
     *   'L': RxSuccess (The number of IPv6 packets successfully received).
     *   'L': RxFailure (The number of IPv6 packets failed to receive).
     *
     * Writing to this property with any value would reset all IPv6 counters to zero.
     *
     */
    SPINEL_PROP_CNTR_ALL_IP_COUNTERS = SPINEL_PROP_CNTR__BEGIN + 403,

    /// MAC retry histogram.
    /** Format: t(A(L))t(A(L))
     *
     * Required capability: SPINEL_CAP_MAC_RETRY_HISTOGRAM
     *
     * The contents include two structs, first one is histogram which corresponds to retransmissions number of direct
     * messages, second one provides the histogram of retransmissions for indirect messages.
     *
     * The first structure includes:
     *   'L': DirectRetry[0]                   (The number of packets after 0 retry).
     *   'L': DirectRetry[1]                   (The number of packets after 1 retry).
     *    ...
     *   'L': DirectRetry[n]                   (The number of packets after n retry).
     *
     * The size of the array is OPENTHREAD_CONFIG_MAC_RETRY_SUCCESS_HISTOGRAM_MAX_SIZE_COUNT_DIRECT.
     *
     * The second structure includes:
     *   'L': IndirectRetry[0]                   (The number of packets after 0 retry).
     *   'L': IndirectRetry[1]                   (The number of packets after 1 retry).
     *    ...
     *   'L': IndirectRetry[m]                   (The number of packets after m retry).
     *
     * The size of the array is OPENTHREAD_CONFIG_MAC_RETRY_SUCCESS_HISTOGRAM_MAX_SIZE_COUNT_INDIRECT.
     *
     * Writing to this property with any value would reset MAC retry histogram.
     *
     */
    SPINEL_PROP_CNTR_MAC_RETRY_HISTOGRAM = SPINEL_PROP_CNTR__BEGIN + 404,

    SPINEL_PROP_CNTR__END = 0x800,

    SPINEL_PROP_RCP__BEGIN = 0x800,

    /// MAC Key
    /** Format: `CCddd`.
     *
     *  `C`: MAC key ID mode
     *  `C`: MAC key ID
     *  `d`: previous MAC key material data
     *  `d`: current MAC key material data
     *  `d`: next MAC key material data
     *
     * The Spinel property is used to set/get MAC key materials to and from RCP.
     *
     */
    SPINEL_PROP_RCP_MAC_KEY = SPINEL_PROP_RCP__BEGIN + 0,

    SPINEL_PROP_RCP__END = 0x900,

    SPINEL_PROP_NEST__BEGIN = 0x3BC0,

    SPINEL_PROP_NEST_STREAM_MFG = SPINEL_PROP_NEST__BEGIN + 0,

    /// The legacy network ULA prefix (8 bytes)
    /** Format: 'D' */
    SPINEL_PROP_NEST_LEGACY_ULA_PREFIX = SPINEL_PROP_NEST__BEGIN + 1,

    /// The EUI64 of last node joined using legacy protocol (if none, all zero EUI64 is returned).
    /** Format: 'E' */
    SPINEL_PROP_NEST_LEGACY_LAST_NODE_JOINED = SPINEL_PROP_NEST__BEGIN + 2,

    SPINEL_PROP_NEST__END = 0x3C00,

    SPINEL_PROP_VENDOR__BEGIN = 0x3C00,
    SPINEL_PROP_VENDOR__END   = 0x4000,

    SPINEL_PROP_DEBUG__BEGIN = 0x4000,

    /// Testing platform assert
    /** Format: 'b' (read-only)
     *
     * Reading this property will cause an assert on the NCP. This is intended for testing the assert functionality of
     * underlying platform/NCP. Assert should ideally cause the NCP to reset, but if this is not supported a `false`
     * boolean is returned in response.
     *
     */
    SPINEL_PROP_DEBUG_TEST_ASSERT = SPINEL_PROP_DEBUG__BEGIN + 0,

    /// The NCP log level.
    /** Format: `C` */
    SPINEL_PROP_DEBUG_NCP_LOG_LEVEL = SPINEL_PROP_DEBUG__BEGIN + 1,

    /// Testing platform watchdog
    /** Format: Empty  (read-only)
     *
     * Reading this property will causes NCP to start a `while(true) ;` loop and thus triggering a watchdog.
     *
     * This is intended for testing the watchdog functionality on the underlying platform/NCP.
     *
     */
    SPINEL_PROP_DEBUG_TEST_WATCHDOG = SPINEL_PROP_DEBUG__BEGIN + 2,

    /// The NCP timestamp base
    /** Format: X (write-only)
     *
     * This property controls the time base value that is used for logs timestamp field calculation.
     *
     */
    SPINEL_PROP_DEBUG_LOG_TIMESTAMP_BASE = SPINEL_PROP_DEBUG__BEGIN + 3,

    SPINEL_PROP_DEBUG__END = 0x4400,

    SPINEL_PROP_EXPERIMENTAL__BEGIN = 2000000,
    SPINEL_PROP_EXPERIMENTAL__END   = 2097152,
};

typedef uint32_t spinel_prop_key_t;

// ----------------------------------------------------------------------------

#define SPINEL_HEADER_FLAG 0x80

#define SPINEL_HEADER_TID_SHIFT 0
#define SPINEL_HEADER_TID_MASK (15 << SPINEL_HEADER_TID_SHIFT)

#define SPINEL_HEADER_IID_SHIFT 4
#define SPINEL_HEADER_IID_MASK (3 << SPINEL_HEADER_IID_SHIFT)

#define SPINEL_HEADER_IID_0 (0 << SPINEL_HEADER_IID_SHIFT)
#define SPINEL_HEADER_IID_1 (1 << SPINEL_HEADER_IID_SHIFT)
#define SPINEL_HEADER_IID_2 (2 << SPINEL_HEADER_IID_SHIFT)
#define SPINEL_HEADER_IID_3 (3 << SPINEL_HEADER_IID_SHIFT)

#define SPINEL_HEADER_GET_IID(x) (((x)&SPINEL_HEADER_IID_MASK) >> SPINEL_HEADER_IID_SHIFT)
#define SPINEL_HEADER_GET_TID(x) (spinel_tid_t)(((x)&SPINEL_HEADER_TID_MASK) >> SPINEL_HEADER_TID_SHIFT)

#define SPINEL_GET_NEXT_TID(x) (spinel_tid_t)((x) >= 0xF ? 1 : (x) + 1)

#define SPINEL_BEACON_THREAD_FLAG_VERSION_SHIFT 4

#define SPINEL_BEACON_THREAD_FLAG_VERSION_MASK (0xf << SPINEL_BEACON_THREAD_FLAG_VERSION_SHIFT)

#define SPINEL_BEACON_THREAD_FLAG_JOINABLE (1 << 0)

#define SPINEL_BEACON_THREAD_FLAG_NATIVE (1 << 3)

// ----------------------------------------------------------------------------

enum
{
    SPINEL_DATATYPE_NULL_C        = 0,
    SPINEL_DATATYPE_VOID_C        = '.',
    SPINEL_DATATYPE_BOOL_C        = 'b',
    SPINEL_DATATYPE_UINT8_C       = 'C',
    SPINEL_DATATYPE_INT8_C        = 'c',
    SPINEL_DATATYPE_UINT16_C      = 'S',
    SPINEL_DATATYPE_INT16_C       = 's',
    SPINEL_DATATYPE_UINT32_C      = 'L',
    SPINEL_DATATYPE_INT32_C       = 'l',
    SPINEL_DATATYPE_UINT64_C      = 'X',
    SPINEL_DATATYPE_INT64_C       = 'x',
    SPINEL_DATATYPE_UINT_PACKED_C = 'i',
    SPINEL_DATATYPE_IPv6ADDR_C    = '6',
    SPINEL_DATATYPE_EUI64_C       = 'E',
    SPINEL_DATATYPE_EUI48_C       = 'e',
    SPINEL_DATATYPE_DATA_WLEN_C   = 'd',
    SPINEL_DATATYPE_DATA_C        = 'D',
    SPINEL_DATATYPE_UTF8_C        = 'U', //!< Zero-Terminated UTF8-Encoded String
    SPINEL_DATATYPE_STRUCT_C      = 't',
    SPINEL_DATATYPE_ARRAY_C       = 'A',
};

typedef char spinel_datatype_t;

#define SPINEL_DATATYPE_NULL_S ""
#define SPINEL_DATATYPE_VOID_S "."
#define SPINEL_DATATYPE_BOOL_S "b"
#define SPINEL_DATATYPE_UINT8_S "C"
#define SPINEL_DATATYPE_INT8_S "c"
#define SPINEL_DATATYPE_UINT16_S "S"
#define SPINEL_DATATYPE_INT16_S "s"
#define SPINEL_DATATYPE_UINT32_S "L"
#define SPINEL_DATATYPE_INT32_S "l"
#define SPINEL_DATATYPE_UINT64_S "X"
#define SPINEL_DATATYPE_INT64_S "x"
#define SPINEL_DATATYPE_UINT_PACKED_S "i"
#define SPINEL_DATATYPE_IPv6ADDR_S "6"
#define SPINEL_DATATYPE_EUI64_S "E"
#define SPINEL_DATATYPE_EUI48_S "e"
#define SPINEL_DATATYPE_DATA_WLEN_S "d"
#define SPINEL_DATATYPE_DATA_S "D"
#define SPINEL_DATATYPE_UTF8_S "U" //!< Zero-Terminated UTF8-Encoded String

#define SPINEL_DATATYPE_ARRAY_S(x) "A(" x ")"
#define SPINEL_DATATYPE_STRUCT_S(x) "t(" x ")"

#define SPINEL_DATATYPE_ARRAY_STRUCT_S(x) SPINEL_DATATYPE_ARRAY_S(SPINEL_DATATYPE_STRUCT_WLEN_S(x))

#define SPINEL_DATATYPE_COMMAND_S                   \
    SPINEL_DATATYPE_UINT8_S           /* header  */ \
        SPINEL_DATATYPE_UINT_PACKED_S /* command */

#define SPINEL_DATATYPE_COMMAND_PROP_S                    \
    SPINEL_DATATYPE_COMMAND_S         /* prop command  */ \
        SPINEL_DATATYPE_UINT_PACKED_S /* property id */

#define SPINEL_MAX_UINT_PACKED 2097151

SPINEL_API_EXTERN spinel_ssize_t spinel_datatype_pack(uint8_t *     data_out,
                                                      spinel_size_t data_len_max,
                                                      const char *  pack_format,
                                                      ...);
SPINEL_API_EXTERN spinel_ssize_t spinel_datatype_vpack(uint8_t *     data_out,
                                                       spinel_size_t data_len_max,
                                                       const char *  pack_format,
                                                       va_list       args);
SPINEL_API_EXTERN spinel_ssize_t spinel_datatype_unpack(const uint8_t *data_in,
                                                        spinel_size_t  data_len,
                                                        const char *   pack_format,
                                                        ...);
/**
 * This function parses spinel data similar to sscanf().
 *
 * This function actually calls spinel_datatype_vunpack_in_place() to parse data.
 *
 * @param[in]   data_in     A pointer to the data to parse.
 * @param[in]   data_len    The length of @p data_in in bytes.
 * @param[in]   pack_format C string that contains a format string follows the same specification of spinel.
 * @param[in]   ...         Additional arguments depending on the format string @p pack_format.
 *
 * @returns The parsed length in bytes.
 *
 * @note This function behaves different from `spinel_datatype_unpack()`:
 *       - This function expects composite data arguments of pointer to data type, while `spinel_datatype_unpack()`
 *         expects them of pointer to data type pointer. For example, if `SPINEL_DATATYPE_EUI64_C` is present in
 *         @p pack_format, this function expects a `spinel_eui64_t *` is included in variable arguments, while
 *         `spinel_datatype_unpack()` expects a `spinel_eui64_t **` is included.
 *       - For `SPINEL_DATATYPE_UTF8_C`, this function expects two arguments, the first of type `char *` and the
 *         second is of type `size_t` to indicate length of the provided buffer in the first argument just like
 *         `strncpy()`, while `spinel_datatype_unpack()` only expects a `const char **`.
 *
 * @sa spinel_datatype_vunpack_in_place()
 *
 */
SPINEL_API_EXTERN spinel_ssize_t spinel_datatype_unpack_in_place(const uint8_t *data_in,
                                                                 spinel_size_t  data_len,
                                                                 const char *   pack_format,
                                                                 ...);
SPINEL_API_EXTERN spinel_ssize_t spinel_datatype_vunpack(const uint8_t *data_in,
                                                         spinel_size_t  data_len,
                                                         const char *   pack_format,
                                                         va_list        args);
/**
 * This function parses spinel data similar to vsscanf().
 *
 * @param[in]   data_in     A pointer to the data to parse.
 * @param[in]   data_len    The length of @p data_in in bytes.
 * @param[in]   pack_format C string that contains a format string follows the same specification of spinel.
 * @param[in]   args        A value identifying a variable arguments list.
 *
 * @returns The parsed length in bytes.
 *
 * @note This function behaves different from `spinel_datatype_vunpack()`:
 *       - This function expects composite data arguments of pointer to data type, while `spinel_datatype_vunpack()`
 *         expects them of pointer to data type pointer. For example, if `SPINEL_DATATYPE_EUI64_C` is present in
 *         @p pack_format, this function expects a `spinel_eui64_t *` is included in variable arguments, while
 *         `spinel_datatype_vunpack()` expects a `spinel_eui64_t **` is included.
 *       - For `SPINEL_DATATYPE_UTF8_C`, this function expects two arguments, the first of type `char *` and the
 *         second is of type `size_t` to indicate length of the provided buffer in the first argument just like
 *         `strncpy()`, while `spinel_datatype_vunpack()` only expects a `const char **`.
 *
 * @sa spinel_datatype_unpack_in_place()
 *
 */
SPINEL_API_EXTERN spinel_ssize_t spinel_datatype_vunpack_in_place(const uint8_t *data_in,
                                                                  spinel_size_t  data_len,
                                                                  const char *   pack_format,
                                                                  va_list        args);

SPINEL_API_EXTERN spinel_ssize_t spinel_packed_uint_decode(const uint8_t *bytes,
                                                           spinel_size_t  len,
                                                           unsigned int * value_ptr);
SPINEL_API_EXTERN spinel_ssize_t spinel_packed_uint_encode(uint8_t *bytes, spinel_size_t len, unsigned int value);
SPINEL_API_EXTERN spinel_ssize_t spinel_packed_uint_size(unsigned int value);

SPINEL_API_EXTERN const char *spinel_next_packed_datatype(const char *pack_format);

// ----------------------------------------------------------------------------

SPINEL_API_EXTERN const char *spinel_command_to_cstr(spinel_command_t command);

SPINEL_API_EXTERN const char *spinel_prop_key_to_cstr(spinel_prop_key_t prop_key);

SPINEL_API_EXTERN const char *spinel_net_role_to_cstr(uint8_t net_role);

SPINEL_API_EXTERN const char *spinel_mcu_power_state_to_cstr(uint8_t mcu_power_state);

SPINEL_API_EXTERN const char *spinel_status_to_cstr(spinel_status_t status);

SPINEL_API_EXTERN const char *spinel_capability_to_cstr(spinel_capability_t capability);

// ----------------------------------------------------------------------------

#if defined(__cplusplus)
}
#endif

#endif /* defined(SPINEL_HEADER_INCLUDED) */