summaryrefslogtreecommitdiff
path: root/doc/man/man3/libnet-functions.3
blob: ac48714a545855a922900dfbd5a3acb3d02aeb2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
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
.TH "libnet-functions.h" 3 "Sun Sep 29 2019" "libnet-1.2-rc3" "libnet Programmers Guide" \" -*- nroff -*-
.ad l
.nh
.SH NAME
libnet-functions.h \- libnet exported function prototypes  

.SH SYNOPSIS
.br
.PP
.SS "Functions"

.in +1c
.ti -1c
.RI "LIBNET_API libnet_t * \fBlibnet_init\fP (int injection_type, const char *device, char *err_buf)"
.br
.ti -1c
.RI "LIBNET_API void \fBlibnet_destroy\fP (libnet_t *l)"
.br
.ti -1c
.RI "LIBNET_API void \fBlibnet_clear_packet\fP (libnet_t *l)"
.br
.ti -1c
.RI "LIBNET_API void \fBlibnet_stats\fP (libnet_t *l, struct libnet_stats *ls)"
.br
.ti -1c
.RI "LIBNET_API int \fBlibnet_getfd\fP (libnet_t *l)"
.br
.ti -1c
.RI "LIBNET_API const char * \fBlibnet_getdevice\fP (libnet_t *l)"
.br
.ti -1c
.RI "LIBNET_API uint8_t * \fBlibnet_getpbuf\fP (libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API uint32_t \fBlibnet_getpbuf_size\fP (libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API char * \fBlibnet_geterror\fP (libnet_t *l)"
.br
.ti -1c
.RI "LIBNET_API uint32_t \fBlibnet_getpacket_size\fP (libnet_t *l)"
.br
.ti -1c
.RI "LIBNET_API int \fBlibnet_seed_prand\fP (libnet_t *l)"
.br
.ti -1c
.RI "LIBNET_API uint32_t \fBlibnet_get_prand\fP (int mod)"
.br
.ti -1c
.RI "LIBNET_API int \fBlibnet_toggle_checksum\fP (libnet_t *l, libnet_ptag_t ptag, int mode)"
.br
.ti -1c
.RI "LIBNET_API char * \fBlibnet_addr2name4\fP (uint32_t in, uint8_t use_name)"
.br
.ti -1c
.RI "LIBNET_API uint32_t \fBlibnet_name2addr4\fP (libnet_t *l, const char *host_name, uint8_t use_name)"
.br
.ti -1c
.RI "LIBNET_API int \fBlibnet_in6_is_error\fP (struct libnet_in6_addr addr)"
.br
.ti -1c
.RI "LIBNET_API struct libnet_in6_addr \fBlibnet_name2addr6\fP (libnet_t *l, const char *host_name, uint8_t use_name)"
.br
.ti -1c
.RI "LIBNET_API void \fBlibnet_addr2name6_r\fP (struct libnet_in6_addr addr, uint8_t use_name, char *host_name, int host_name_len)"
.br
.ti -1c
.RI "LIBNET_API int \fBlibnet_plist_chain_new\fP (libnet_t *l, libnet_plist_t **plist, char *token_list)"
.br
.ti -1c
.RI "LIBNET_API int \fBlibnet_plist_chain_next_pair\fP (libnet_plist_t *plist, uint16_t *bport, uint16_t *eport)"
.br
.ti -1c
.RI "LIBNET_API int \fBlibnet_plist_chain_dump\fP (libnet_plist_t *plist)"
.br
.ti -1c
.RI "LIBNET_API char * \fBlibnet_plist_chain_dump_string\fP (libnet_plist_t *plist)"
.br
.ti -1c
.RI "LIBNET_API int \fBlibnet_plist_chain_free\fP (libnet_plist_t *plist)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_802_1q\fP (const uint8_t *dst, const uint8_t *src, uint16_t tpi, uint8_t priority, uint8_t cfi, uint16_t vlan_id, uint16_t len_proto, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_802_1x\fP (uint8_t eap_ver, uint8_t eap_type, uint16_t length, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_802_2\fP (uint8_t dsap, uint8_t ssap, uint8_t control, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_802_2snap\fP (uint8_t dsap, uint8_t ssap, uint8_t control, uint8_t *oui, uint16_t type, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_802_3\fP (const uint8_t *dst, const uint8_t *src, uint16_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ethernet\fP (const uint8_t *dst, const uint8_t *src, uint16_t type, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_autobuild_ethernet\fP (const uint8_t *dst, uint16_t type, libnet_t *l)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_fddi\fP (uint8_t fc, const uint8_t *dst, const uint8_t *src, uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t *oui, uint16_t type, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_autobuild_fddi\fP (uint8_t fc, const uint8_t *dst, uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t *oui, uint16_t type, libnet_t *l)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_arp\fP (uint16_t hrd, uint16_t pro, uint8_t hln, uint8_t pln, uint16_t op, const uint8_t *sha, const uint8_t *spa, const uint8_t *tha, const uint8_t *tpa, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_autobuild_arp\fP (uint16_t op, const uint8_t *sha, const uint8_t *spa, const uint8_t *tha, const uint8_t *tpa, libnet_t *l)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_tcp\fP (uint16_t sp, uint16_t dp, uint32_t seq, uint32_t ack, uint8_t control, uint16_t win, uint16_t sum, uint16_t urg, uint16_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_tcp_options\fP (const uint8_t *options, uint32_t options_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_udp\fP (uint16_t sp, uint16_t dp, uint16_t len, uint16_t sum, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_cdp\fP (uint8_t version, uint8_t ttl, uint16_t sum, uint16_t type, uint16_t value_s, const uint8_t *value, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_icmpv4_echo\fP (uint8_t type, uint8_t code, uint16_t sum, uint16_t id, uint16_t seq, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_icmpv4_mask\fP (uint8_t type, uint8_t code, uint16_t sum, uint16_t id, uint16_t seq, uint32_t mask, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_icmpv4_unreach\fP (uint8_t type, uint8_t code, uint16_t sum, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_icmpv4_redirect\fP (uint8_t type, uint8_t code, uint16_t sum, uint32_t gateway, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_icmpv4_timeexceed\fP (uint8_t type, uint8_t code, uint16_t sum, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_icmpv4_timestamp\fP (uint8_t type, uint8_t code, uint16_t sum, uint16_t id, uint16_t seq, uint32_t otime, uint32_t rtime, uint32_t ttime, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_icmpv6_echo\fP (uint8_t type, uint8_t code, uint16_t sum, uint16_t id, uint16_t seq, uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_icmpv6_unreach\fP (uint8_t type, uint8_t code, uint16_t sum, uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_icmpv6_ndp_nsol\fP (uint8_t type, uint8_t code, uint16_t sum, struct libnet_in6_addr target, uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_icmpv6_ndp_nadv\fP (uint8_t type, uint8_t code, uint16_t sum, uint32_t flags, struct libnet_in6_addr target, uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_icmpv6_ndp_opt\fP (uint8_t type, uint8_t *option, uint32_t option_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_igmp\fP (uint8_t type, uint8_t reserved, uint16_t sum, uint32_t ip, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ipv4\fP (uint16_t ip_len, uint8_t tos, uint16_t id, uint16_t frag, uint8_t ttl, uint8_t prot, uint16_t sum, uint32_t src, uint32_t dst, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ipv4_options\fP (const uint8_t *options, uint32_t options_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_autobuild_ipv4\fP (uint16_t len, uint8_t prot, uint32_t dst, libnet_t *l)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ipv6\fP (uint8_t tc, uint32_t fl, uint16_t len, uint8_t nh, uint8_t hl, struct libnet_in6_addr src, struct libnet_in6_addr dst, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ipv6_frag\fP (uint8_t nh, uint8_t reserved, uint16_t frag, uint32_t id, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ipv6_routing\fP (uint8_t nh, uint8_t len, uint8_t rtype, uint8_t segments, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ipv6_destopts\fP (uint8_t nh, uint8_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ipv6_hbhopts\fP (uint8_t nh, uint8_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_autobuild_ipv6\fP (uint16_t len, uint8_t nh, struct libnet_in6_addr dst, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_isl\fP (uint8_t *dhost, uint8_t type, uint8_t user, uint8_t *shost, uint16_t len, const uint8_t *snap, uint16_t vid, uint16_t portindex, uint16_t reserved, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ipsec_esp_hdr\fP (uint32_t spi, uint32_t seq, uint32_t iv, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ipsec_esp_ftr\fP (uint8_t len, uint8_t nh, int8_t *auth, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ipsec_ah\fP (uint8_t nh, uint8_t len, uint16_t res, uint32_t spi, uint32_t seq, uint32_t auth, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_dnsv4\fP (uint16_t h_len, uint16_t id, uint16_t flags, uint16_t num_q, uint16_t num_anws_rr, uint16_t num_auth_rr, uint16_t num_addi_rr, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_rip\fP (uint8_t cmd, uint8_t version, uint16_t rd, uint16_t af, uint16_t rt, uint32_t addr, uint32_t mask, uint32_t next_hop, uint32_t metric, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_rpc_call\fP (uint32_t rm, uint32_t xid, uint32_t prog_num, uint32_t prog_vers, uint32_t procedure, uint32_t cflavor, uint32_t clength, uint8_t *cdata, uint32_t vflavor, uint32_t vlength, const uint8_t *vdata, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_stp_conf\fP (uint16_t id, uint8_t version, uint8_t bpdu_type, uint8_t flags, const uint8_t *root_id, uint32_t root_pc, const uint8_t *bridge_id, uint16_t port_id, uint16_t message_age, uint16_t max_age, uint16_t hello_time, uint16_t f_delay, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_stp_tcn\fP (uint16_t id, uint8_t version, uint8_t bpdu_type, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_token_ring\fP (uint8_t ac, uint8_t fc, const uint8_t *dst, const uint8_t *src, uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t *oui, uint16_t type, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_autobuild_token_ring\fP (uint8_t ac, uint8_t fc, const uint8_t *dst, uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t *oui, uint16_t type, libnet_t *l)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_vrrp\fP (uint8_t version, uint8_t type, uint8_t vrouter_id, uint8_t priority, uint8_t ip_count, uint8_t auth_type, uint8_t advert_int, uint16_t sum, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_mpls\fP (uint32_t label, uint8_t experimental, uint8_t bos, uint8_t ttl, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ntp\fP (uint8_t leap_indicator, uint8_t version, uint8_t mode, uint8_t stratum, uint8_t poll, uint8_t precision, uint16_t delay_int, uint16_t delay_frac, uint16_t dispersion_int, uint16_t dispersion_frac, uint32_t reference_id, uint32_t ref_ts_int, uint32_t ref_ts_frac, uint32_t orig_ts_int, uint32_t orig_ts_frac, uint32_t rec_ts_int, uint32_t rec_ts_frac, uint32_t xmt_ts_int, uint32_t xmt_ts_frac, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ospfv2\fP (uint16_t len, uint8_t type, uint32_t rtr_id, uint32_t area_id, uint16_t sum, uint16_t autype, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ospfv2_hello\fP (uint32_t netmask, uint16_t interval, uint8_t opts, uint8_t priority, uint32_t dead_int, uint32_t des_rtr, uint32_t bkup_rtr, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "libnet_ptag_t \fBlibnet_build_ospfv2_hello_neighbor\fP (uint32_t netmask, uint16_t interval, uint8_t opts, uint8_t priority, uint32_t dead_int, uint32_t des_rtr, uint32_t bkup_rtr, uint32_t neighbor, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ospfv2_dbd\fP (uint16_t dgram_len, uint8_t opts, uint8_t type, uint32_t seqnum, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ospfv2_lsr\fP (uint32_t type, uint32_t lsid, uint32_t advrtr, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ospfv2_lsu\fP (uint32_t num, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ospfv2_lsa\fP (uint16_t age, uint8_t opts, uint8_t type, uint32_t lsid, uint32_t advrtr, uint32_t seqnum, uint16_t sum, uint16_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ospfv2_lsa_rtr\fP (uint16_t flags, uint16_t num, uint32_t id, uint32_t data, uint8_t type, uint8_t tos, uint16_t metric, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ospfv2_lsa_net\fP (uint32_t nmask, uint32_t rtrid, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ospfv2_lsa_sum\fP (uint32_t nmask, uint32_t metric, uint32_t tos, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ospfv2_lsa_as\fP (uint32_t nmask, uint32_t metric, uint32_t fwdaddr, uint32_t tag, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_data\fP (const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_dhcpv4\fP (uint8_t opcode, uint8_t htype, uint8_t hlen, uint8_t hopcount, uint32_t xid, uint16_t secs, uint16_t flags, uint32_t cip, uint32_t yip, uint32_t sip, uint32_t gip, const uint8_t *chaddr, const char *sname, const char *file, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_bootpv4\fP (uint8_t opcode, uint8_t htype, uint8_t hlen, uint8_t hopcount, uint32_t xid, uint16_t secs, uint16_t flags, uint32_t cip, uint32_t yip, uint32_t sip, uint32_t gip, const uint8_t *chaddr, const char *sname, const char *file, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API uint32_t \fBlibnet_getgre_length\fP (uint16_t fv)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_gre\fP (uint16_t fv, uint16_t type, uint16_t sum, uint16_t offset, uint32_t key, uint32_t seq, uint16_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_egre\fP (uint16_t fv, uint16_t type, uint16_t sum, uint16_t offset, uint32_t key, uint32_t seq, uint16_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_gre_sre\fP (uint16_t af, uint8_t offset, uint8_t length, uint8_t *routing, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_gre_last_sre\fP (libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_bgp4_header\fP (uint8_t marker[LIBNET_BGP4_MARKER_SIZE], uint16_t len, uint8_t type, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_bgp4_open\fP (uint8_t version, uint16_t src_as, uint16_t hold_time, uint32_t bgp_id, uint8_t opt_len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_bgp4_update\fP (uint16_t unfeasible_rt_len, const uint8_t *withdrawn_rt, uint16_t total_path_attr_len, const uint8_t *path_attributes, uint16_t info_len, uint8_t *reachability_info, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_bgp4_notification\fP (uint8_t err_code, uint8_t err_subcode, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_sebek\fP (uint32_t magic, uint16_t version, uint16_t type, uint32_t counter, uint32_t time_sec, uint32_t time_usec, uint32_t pid, uint32_t uid, uint32_t fd, uint8_t cmd[SEBEK_CMD_LENGTH], uint32_t length, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_hsrp\fP (uint8_t version, uint8_t opcode, uint8_t state, uint8_t hello_time, uint8_t hold_time, uint8_t priority, uint8_t group, uint8_t reserved, uint8_t authdata[HSRP_AUTHDATA_LENGTH], uint32_t virtual_ip, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_build_link\fP (const uint8_t *dst, const uint8_t *src, const uint8_t *oui, uint16_t type, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
.br
.ti -1c
.RI "LIBNET_API libnet_ptag_t \fBlibnet_autobuild_link\fP (const uint8_t *dst, const uint8_t *oui, uint16_t type, libnet_t *l)"
.br
.ti -1c
.RI "LIBNET_API int \fBlibnet_write\fP (libnet_t *l)"
.br
.ti -1c
.RI "LIBNET_API uint32_t \fBlibnet_get_ipaddr4\fP (libnet_t *l)"
.br
.ti -1c
.RI "LIBNET_API struct libnet_in6_addr \fBlibnet_get_ipaddr6\fP (libnet_t *l)"
.br
.ti -1c
.RI "LIBNET_API struct libnet_ether_addr * \fBlibnet_get_hwaddr\fP (libnet_t *l)"
.br
.ti -1c
.RI "LIBNET_API uint8_t * \fBlibnet_hex_aton\fP (const char *s, int *len)"
.br
.ti -1c
.RI "LIBNET_API const char * \fBlibnet_version\fP (void)"
.br
.ti -1c
.RI "LIBNET_API int \fBlibnet_adv_cull_packet\fP (libnet_t *l, uint8_t **packet, uint32_t *packet_s)"
.br
.ti -1c
.RI "LIBNET_API int \fBlibnet_adv_cull_header\fP (libnet_t *l, libnet_ptag_t ptag, uint8_t **header, uint32_t *header_s)"
.br
.ti -1c
.RI "LIBNET_API int \fBlibnet_adv_write_link\fP (libnet_t *l, const uint8_t *packet, uint32_t packet_s)"
.br
.ti -1c
.RI "LIBNET_API int \fBlibnet_adv_write_raw_ipv4\fP (libnet_t *l, const uint8_t *packet, uint32_t packet_s)"
.br
.ti -1c
.RI "LIBNET_API void \fBlibnet_adv_free_packet\fP (libnet_t *l, uint8_t *packet)"
.br
.ti -1c
.RI "int \fBlibnet_cq_add\fP (libnet_t *l, char *label)"
.br
.ti -1c
.RI "LIBNET_API libnet_t * \fBlibnet_cq_remove\fP (libnet_t *l)"
.br
.ti -1c
.RI "LIBNET_API libnet_t * \fBlibnet_cq_remove_by_label\fP (char *label)"
.br
.ti -1c
.RI "LIBNET_API const char * \fBlibnet_cq_getlabel\fP (libnet_t *l)"
.br
.ti -1c
.RI "LIBNET_API libnet_t * \fBlibnet_cq_find_by_label\fP (char *label)"
.br
.ti -1c
.RI "LIBNET_API void \fBlibnet_cq_destroy\fP (void)"
.br
.ti -1c
.RI "LIBNET_API libnet_t * \fBlibnet_cq_head\fP (void)"
.br
.ti -1c
.RI "LIBNET_API int \fBlibnet_cq_last\fP (void)"
.br
.ti -1c
.RI "LIBNET_API libnet_t * \fBlibnet_cq_next\fP (void)"
.br
.ti -1c
.RI "LIBNET_API uint32_t \fBlibnet_cq_size\fP (void)"
.br
.ti -1c
.RI "LIBNET_API uint32_t \fBlibnet_cq_end_loop\fP (void)"
.br
.ti -1c
.RI "LIBNET_API void \fBlibnet_diag_dump_context\fP (libnet_t *l)"
.br
.ti -1c
.RI "LIBNET_API void \fBlibnet_diag_dump_pblock\fP (libnet_t *l)"
.br
.ti -1c
.RI "LIBNET_API char * \fBlibnet_diag_dump_pblock_type\fP (uint8_t type)"
.br
.ti -1c
.RI "void \fBlibnet_diag_dump_hex\fP (const uint8_t *packet, uint32_t len, int swap, FILE *stream)"
.br
.in -1c
.SH "Detailed Description"
.PP 
libnet exported function prototypes 


.SH "Function Documentation"
.PP 
.SS "LIBNET_API char* libnet_addr2name4 (uint32_t in, uint8_t use_name)"
Takes a network byte ordered IPv4 address and returns a pointer to either a canonical DNS name (if it has one) or a string of dotted decimals\&. This may incur a DNS lookup if the hostname and mode is set to LIBNET_RESOLVE\&. If mode is set to LIBNET_DONT_RESOLVE, no DNS lookup will be performed and the function will return a pointer to a dotted decimal string\&. The function cannot fail -- if no canonical name exists, it will fall back on returning a dotted decimal string\&. This function is non-reentrant\&. 
.PP
\fBParameters:\fP
.RS 4
\fIin\fP network byte ordered IPv4 address 
.br
\fIuse_name\fP LIBNET_RESOLVE or LIBNET_DONT_RESOLVE 
.RE
.PP
\fBReturns:\fP
.RS 4
a pointer to presentation format string 
.RE
.PP

.SS "LIBNET_API void libnet_addr2name6_r (struct libnet_in6_addr addr, uint8_t use_name, char * host_name, int host_name_len)"
Should document this baby right here\&. 
.SS "LIBNET_API int libnet_adv_cull_header (libnet_t * l, libnet_ptag_t ptag, uint8_t ** header, uint32_t * header_s)"
[Advanced Interface] Pulls the header from the specified ptag from the given libnet context\&. This function is part of the advanced interface and is only available when libnet is initialized in advanced mode\&. If the function fails \fBlibnet_geterror()\fP can tell you why\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP the ptag referencing the header to pull 
.br
\fIheader\fP will contain the header 
.br
\fIheader_s\fP will contain the header size 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI1\fP on success 
.br
\fI-1\fP on failure 
.RE
.PP

.SS "LIBNET_API int libnet_adv_cull_packet (libnet_t * l, uint8_t ** packet, uint32_t * packet_s)"
[Advanced Interface] Yanks a prebuilt, wire-ready packet from the given libnet context\&. If libnet was configured to do so (which it is by default) the packet will have all checksums written in\&. This function is part of the advanced interface and is only available when libnet is initialized in advanced mode\&. It is important to note that the function performs an implicit malloc() and a corresponding call to \fBlibnet_adv_free_packet()\fP should be made to free the memory packet occupies\&. If the function fails \fBlibnet_geterror()\fP can tell you why\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.br
\fIpacket\fP will contain the wire-ready packet 
.br
\fIpacket_s\fP will contain the packet size 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI1\fP on success 
.br
\fI-1\fP on failure 
.RE
.PP

.SS "LIBNET_API void libnet_adv_free_packet (libnet_t * l, uint8_t * packet)"
[Advanced Interface] Frees the memory allocated when \fBlibnet_adv_cull_packet()\fP is called\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.br
\fIpacket\fP a pointer to the packet to free 
.RE
.PP

.SS "LIBNET_API int libnet_adv_write_link (libnet_t * l, const uint8_t * packet, uint32_t packet_s)"
[Advanced Interface] Writes a packet the network at the link layer\&. This function is useful to write a packet that has been constructed by hand by the application programmer or, more commonly, to write a packet that has been returned by a call to \fBlibnet_adv_cull_packet()\fP\&. This function is part of the advanced interface and is only available when libnet is initialized in advanced mode\&. If the function fails \fBlibnet_geterror()\fP can tell you why\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.br
\fIpacket\fP a pointer to the packet to inject 
.br
\fIpacket_s\fP the size of the packet 
.RE
.PP
\fBReturns:\fP
.RS 4
the number of bytes written 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on failure 
.RE
.PP

.SS "LIBNET_API int libnet_adv_write_raw_ipv4 (libnet_t * l, const uint8_t * packet, uint32_t packet_s)"
[Advanced Interface] Writes a packet the network at the raw socket layer\&. This function is useful to write a packet that has been constructed by hand by the application programmer or, more commonly, to write a packet that has been returned by a call to \fBlibnet_adv_cull_packet()\fP\&. This function is part of the advanced interface and is only available when libnet is initialized in advanced mode\&. If the function fails \fBlibnet_geterror()\fP can tell you why\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.br
\fIpacket\fP a pointer to the packet to inject 
.br
\fIpacket_s\fP the size of the packet 
.RE
.PP
\fBReturns:\fP
.RS 4
the number of bytes written 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on failure 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_autobuild_arp (uint16_t op, const uint8_t * sha, const uint8_t * spa, const uint8_t * tha, const uint8_t * tpa, libnet_t * l)"
Autouilds an Address Resolution Protocol (ARP) header\&. Depending on the op value, the function builds one of several different types of RFC 826 or RFC 903 RARP packets\&. 
.PP
\fBParameters:\fP
.RS 4
\fIop\fP ARP operation type 
.br
\fIsha\fP sender's hardware address 
.br
\fIspa\fP sender's protocol address 
.br
\fItha\fP target hardware address 
.br
\fItpa\fP target protocol address 
.br
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_autobuild_ethernet (const uint8_t * dst, uint16_t type, libnet_t * l)"
Autobuilds an Ethernet header\&. The RFC 894 Ethernet II header is almost identical to the IEEE 802\&.3 header, with the exception that the field immediately following the source address holds the layer 3 protocol (as opposed to frame's length)\&. You should only use this function when libnet is initialized with the LIBNET_LINK interface\&. 
.PP
\fBParameters:\fP
.RS 4
\fIdst\fP destination ethernet address 
.br
\fItype\fP upper layer protocol type 
.br
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_autobuild_fddi (uint8_t fc, const uint8_t * dst, uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t * oui, uint16_t type, libnet_t * l)"
Autobuilds a Fiber Distributed Data Interface (FDDI) header\&. 
.PP
\fBParameters:\fP
.RS 4
\fIfc\fP class format and priority 
.br
\fIdst\fP destination fddi address 
.br
\fIdsap\fP destination service access point 
.br
\fIssap\fP source service access point 
.br
\fIcf\fP cf 
.br
\fIoui\fP IEEE organizational code 
.br
\fItype\fP upper layer protocol 
.br
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_autobuild_ipv4 (uint16_t len, uint8_t prot, uint32_t dst, libnet_t * l)"
Autobuilds a version 4 Internet Protocol (IP) header\&. The function is useful to build an IP header quickly when you do not need a granular level of control\&. The function takes the same len, prot, and dst arguments as \fBlibnet_build_ipv4()\fP\&. The function does not accept a ptag argument, but it does return a ptag\&. In other words, you can use it to build a new IP header but not to modify an existing one\&. 
.PP
\fBParameters:\fP
.RS 4
\fIlen\fP total length of the IP packet including all subsequent data 
.br
\fIprot\fP upper layer protocol 
.br
\fIdst\fP destination IPv4 address (little endian) 
.br
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_autobuild_ipv6 (uint16_t len, uint8_t nh, struct libnet_in6_addr dst, libnet_t * l, libnet_ptag_t ptag)"
Autobuilds a version 6 RFC 2460 Internet Protocol (IP) header\&. The function is useful to build an IP header quickly when you do not need a granular level of control\&. The function takes the same len, nh, and dst arguments as \fBlibnet_build_ipv4()\fP\&. The function does not accept a ptag argument, but it does return a ptag\&. In other words, you can use it to build a new IP header but not to modify an existing one\&. This function requires \fBlibnet_get_ipaddr6()\fP, which is not yet implemented for Win32 platforms\&. 
.PP
\fBParameters:\fP
.RS 4
\fIlen\fP length 
.br
\fInh\fP next header 
.br
\fIdst\fP destination IPv6 address 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_autobuild_link (const uint8_t * dst, const uint8_t * oui, uint16_t type, libnet_t * l)"
Automatically builds a link layer header for an initialized l\&. The function determines the proper link layer header format from how l was initialized\&. The function current supports Ethernet and Token Ring link layers\&. 
.PP
\fBParameters:\fP
.RS 4
\fIdst\fP the destination MAC address 
.br
\fIoui\fP Organizationally Unique Identifier (unused for Ethernet) 
.br
\fItype\fP the upper layer protocol type 
.br
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_autobuild_token_ring (uint8_t ac, uint8_t fc, const uint8_t * dst, uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t * oui, uint16_t type, libnet_t * l)"
Auto-builds a token ring header\&. 
.PP
\fBParameters:\fP
.RS 4
\fIac\fP access control 
.br
\fIfc\fP frame control 
.br
\fIdst\fP destination address 
.br
\fIdsap\fP destination service access point 
.br
\fIssap\fP source service access point 
.br
\fIcf\fP control field 
.br
\fIoui\fP Organizationally Unique Identifier 
.br
\fItype\fP upper layer protocol type 
.br
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_802_1q (const uint8_t * dst, const uint8_t * src, uint16_t tpi, uint8_t priority, uint8_t cfi, uint16_t vlan_id, uint16_t len_proto, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"

.SH "Packet Builder Functions"
.PP
The core of libnet is the platform-independent packet-building functionality\&. These functions enable an application programmer to build protocol headers (and data) in a simple and consistent manner without having to worry (too much) about low-level network odds and ends\&. Each libnet_build() function builds a piece of a packet (generally a protocol header)\&. While it is perfectly possible to build an entire, ready-to-transmit packet with a single call to a libnet_build() function, generally more than one builder-class function call is required to construct a full packet\&. A complete wire-ready packet generally consists of more than one piece\&. Every function that builds a protocol header takes a series of arguments roughly corresponding to the header values as they appear on the wire\&. This process is intuitive but often makes for functions with huge prototypes and large stack frames\&. One important thing to note is that you must call these functions in order, corresponding to how they should appear on the wire (from the highest protocol layer on down)\&. This building process is intuitive; it approximates what happens in an operating system kernel\&. In other words, to build a Network Time Protocol (NTP) packet by using the link-layer interface, the application programmer would call the libnet_build() functions in the following order:
.IP "1." 4
\fBlibnet_build_ntp()\fP
.IP "2." 4
\fBlibnet_build_udp()\fP
.IP "3." 4
\fBlibnet_build_ipv4()\fP
.IP "4." 4
\fBlibnet_build_ethernet()\fP This ordering is essential for libnet 1\&.1\&.x to properly link together the packet internally (previous libnet versions did not have the requirement)\&.
.PP
.SS "The Payload Interface"
The payload interface specifies an optional way to include data directly after the protocol header in question\&. You can use this function for a variety of purposes, including the following:
.IP "\(bu" 2
Including additional or arbitrary protocol header information that is not available from a libnet interface
.IP "\(bu" 2
Including a packet payload (data segment)
.IP "\(bu" 2
Building another protocol header that is not available from a libnet interface To employ the interface, the application programmer should construct the i payload data and pass a const uint8_t * to this data and its size to the desired libnet_build() function\&. Libnet handles the rest\&.
.PP
.PP
It is important to note that some functions (notably the IPv6 builders) do use the payload interface to specify variable length but ostensibly non-optional data\&. See the individual libnet_build_ipv6*() functions for more information\&.
.SS "Protocol Tags and Packet Builder Return Values"
Libnet uses the protocol tag (ptag) to identify individual pieces of a packet after being created\&. A new ptag results every time a libnet_build() function with an empty (0) ptag argument completes successfully\&. This new ptag now refers to the packet piece just created\&. The application programmer's responsibility is to save this value if he or she plans to modify this particular portion later on in the program\&. If the application programmer needs to modify some portion of that particular packet piece again, he or she calls the same libnet_build() function specifying the saved ptag argument\&. Libnet then searches for that packet piece and modifies it rather than creating a new one\&. Upon failure for any reason, libnet_build() functions return -1; \fBlibnet_geterror()\fP tells you why\&. Builds an IEEE 802\&.1q VLAN tagging header\&. Depending on the value of len_proto, the function wraps the 802\&.1q header inside either an IEEE 802\&.3 header or an RFC 894 Ethernet II (DIX) header (both resulting in an 18-byte frame)\&. If len is 1500 or less, most receiving protocol stacks parse the frame as an IEEE 802\&.3 encapsulated frame\&. If len is one of the Ethernet type values, most protocol stacks parse the frame as an RFC 894 Ethernet II encapsulated frame\&. Note the length value is calculated without the 802\&.1q header of 18 bytes\&. 
.PP
\fBParameters:\fP
.RS 4
\fIdst\fP pointer to a six byte source ethernet address 
.br
\fIsrc\fP pointer to a six byte destination ethernet address 
.br
\fItpi\fP tag protocol identifier 
.br
\fIpriority\fP priority 
.br
\fIcfi\fP canonical format indicator 
.br
\fIvlan_id\fP vlan identifier 
.br
\fIlen_proto\fP length (802\&.3) protocol (Ethernet II) 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_802_1x (uint8_t eap_ver, uint8_t eap_type, uint16_t length, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an IEEE 802\&.1x extended authentication protocol header\&. 
.PP
\fBParameters:\fP
.RS 4
\fIeap_ver\fP the EAP version 
.br
\fIeap_type\fP the EAP type 
.br
\fIlength\fP frame length 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_802_2 (uint8_t dsap, uint8_t ssap, uint8_t control, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an IEEE 802\&.2 LLC header\&. 
.PP
\fBParameters:\fP
.RS 4
\fIdsap\fP destination service access point 
.br
\fIssap\fP source service access point 
.br
\fIcontrol\fP control field 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_802_2snap (uint8_t dsap, uint8_t ssap, uint8_t control, uint8_t * oui, uint16_t type, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an IEEE 802\&.2 LLC SNAP header\&. 
.PP
\fBParameters:\fP
.RS 4
\fIdsap\fP destination service access point 
.br
\fIssap\fP source service access point 
.br
\fIcontrol\fP control field 
.br
\fIoui\fP Organizationally Unique Identifier 
.br
\fItype\fP upper layer protocol 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_802_3 (const uint8_t * dst, const uint8_t * src, uint16_t len, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an IEEE 802\&.3 header\&. The 802\&.3 header is almost identical to the RFC 894 Ethernet II header, the exception being that the field immediately following the source address holds the frame's length (as opposed to the layer 3 protocol)\&. You should only use this function when libnet is initialized with the LIBNET_LINK interface\&. 
.PP
\fBParameters:\fP
.RS 4
\fIdst\fP destination ethernet address 
.br
\fIsrc\fP source ethernet address 
.br
\fIlen\fP frame length sans header 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_arp (uint16_t hrd, uint16_t pro, uint8_t hln, uint8_t pln, uint16_t op, const uint8_t * sha, const uint8_t * spa, const uint8_t * tha, const uint8_t * tpa, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an Address Resolution Protocol (ARP) header\&. Depending on the op value, the function builds one of several different types of RFC 826 or RFC 903 RARP packets\&. 
.PP
\fBParameters:\fP
.RS 4
\fIhrd\fP hardware address format 
.br
\fIpro\fP protocol address format 
.br
\fIhln\fP hardware address length 
.br
\fIpln\fP protocol address length 
.br
\fIop\fP ARP operation type 
.br
\fIsha\fP sender's hardware address 
.br
\fIspa\fP sender's protocol address 
.br
\fItha\fP target hardware address 
.br
\fItpa\fP target protocol address 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_bgp4_header (uint8_t marker[LIBNET_BGP4_MARKER_SIZE], uint16_t len, uint8_t type, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) header\&. The primary function of a BGP speaking system is to exchange network reachability information with other BGP systems\&. This network reachability information includes information on the list of Autonomous Systems (ASs) that reachability information traverses\&. This information is sufficient to construct a graph of AS connectivity from which routing loops may be pruned and some policy decisions at the AS level may be enforced\&. This function builds the base BGP header which is used as a preamble before any other BGP header\&. For example, a BGP KEEPALIVE message may be built with only this function, while an error notification requires a subsequent call to libnet_build_bgp4_notification\&. 
.PP
\fBParameters:\fP
.RS 4
\fImarker\fP a value the receiver can predict (if the message type is not BGP OPEN, or no authentication is used, these 16 bytes are normally set as all ones) 
.br
\fIlen\fP total length of the BGP message, including the header 
.br
\fItype\fP type code of the message (OPEN, UPDATE, NOTIFICATION or KEEPALIVE) 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_bgp4_notification (uint8_t err_code, uint8_t err_subcode, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) notification header\&. A NOTIFICATION message is sent when an error condition is detected\&. Specific error information may be passed through the payload interface\&. 
.PP
\fBParameters:\fP
.RS 4
\fIerr_code\fP type of notification 
.br
\fIerr_subcode\fP more specific information about the reported error\&. 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_bgp4_open (uint8_t version, uint16_t src_as, uint16_t hold_time, uint32_t bgp_id, uint8_t opt_len, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) OPEN header\&. This is the first message sent by each side of a BGP connection\&. The optional parameters options should be constructed using the payload interface (see RFC 1771 for the options structures)\&. 
.PP
\fBParameters:\fP
.RS 4
\fIversion\fP protocol version (should be set to 4) 
.br
\fIsrc_as\fP Autonomous System of the sender 
.br
\fIhold_time\fP used to compute the maximum allowed time between the receipt of KEEPALIVE, and/or UPDATE messages by the sender 
.br
\fIbgp_id\fP BGP identifier of the sender 
.br
\fIopt_len\fP total length of the optional parameters field in bytes 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_bgp4_update (uint16_t unfeasible_rt_len, const uint8_t * withdrawn_rt, uint16_t total_path_attr_len, const uint8_t * path_attributes, uint16_t info_len, uint8_t * reachability_info, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) update header\&. Update messages are used to transfer routing information between BGP peers\&. 
.PP
\fBParameters:\fP
.RS 4
\fIunfeasible_rt_len\fP indicates the length of the (next) 'withdrawn routes' field in bytes 
.br
\fIwithdrawn_rt\fP list of IP addresses prefixes for the routes that are being withdrawn; each IP address prefix is built as a 2-tuple <length (1 byte), prefix (variable)> 
.br
\fItotal_path_attr_len\fP indicates the length of the (next) 'path attributes' field in bytes 
.br
\fIpath_attributes\fP each attribute is a 3-tuple <type (2 bytes), length, value> 
.br
\fIinfo_len\fP indicates the length of the (next) 'network layer reachability information' field in bytes (needed for internal memory size calculation) 
.br
\fIreachability_info\fP 2-tuples <length (1 byte), prefix (variable)>\&. 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_bootpv4 (uint8_t opcode, uint8_t htype, uint8_t hlen, uint8_t hopcount, uint32_t xid, uint16_t secs, uint16_t flags, uint32_t cip, uint32_t yip, uint32_t sip, uint32_t gip, const uint8_t * chaddr, const char * sname, const char * file, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"

.PP
\fBParameters:\fP
.RS 4
\fIopcode\fP 
.br
\fIhtype\fP 
.br
\fIhlen\fP 
.br
\fIhopcount\fP 
.br
\fIxid\fP 
.br
\fIsecs\fP 
.br
\fIflags\fP 
.br
\fIcip\fP 
.br
\fIyip\fP 
.br
\fIsip\fP 
.br
\fIgip\fP 
.br
\fIchaddr\fP client hardware address, length is hlen 
.br
\fIsname\fP server host name, a null terminated string 
.br
\fIfile\fP boot file name, a null terminated string 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_cdp (uint8_t version, uint8_t ttl, uint16_t sum, uint16_t type, uint16_t value_s, const uint8_t * value, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds a Cisco Discovery Protocol (CDP) header\&. Cisco Systems designed CDP to aid in the network management of adjacent Cisco devices\&. The CDP protocol specifies data by using a type/length/value (TLV) setup\&. The first TLV can specified by using the functions type, length, and value arguments\&. To specify additional TLVs, the programmer could either use the payload interface or \fBlibnet_build_data()\fP to construct them\&. 
.PP
\fBParameters:\fP
.RS 4
\fIversion\fP CDP version 
.br
\fIttl\fP time to live (time information should be cached by recipient) 
.br
\fIsum\fP checksum (0 for libnet to auto-fill) 
.br
\fItype\fP type of data contained in value 
.br
\fIvalue_s\fP length of value argument 
.br
\fIvalue\fP the CDP information string 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_data (const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds a generic libnet protocol header\&. This is useful for including an optional payload to a packet that might need to change repeatedly inside of a loop\&. This won't work for TCP or IP payload, they have special types (this is probably a bug)\&. 
.PP
\fBParameters:\fP
.RS 4
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_dhcpv4 (uint8_t opcode, uint8_t htype, uint8_t hlen, uint8_t hopcount, uint32_t xid, uint16_t secs, uint16_t flags, uint32_t cip, uint32_t yip, uint32_t sip, uint32_t gip, const uint8_t * chaddr, const char * sname, const char * file, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"

.PP
\fBParameters:\fP
.RS 4
\fIopcode\fP 
.br
\fIhtype\fP 
.br
\fIhlen\fP 
.br
\fIhopcount\fP 
.br
\fIxid\fP 
.br
\fIsecs\fP 
.br
\fIflags\fP 
.br
\fIcip\fP 
.br
\fIyip\fP 
.br
\fIsip\fP 
.br
\fIgip\fP 
.br
\fIchaddr\fP client hardware address, length is hlen 
.br
\fIsname\fP server host name, a null terminated string 
.br
\fIfile\fP boot file name, a null terminated string 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_dnsv4 (uint16_t h_len, uint16_t id, uint16_t flags, uint16_t num_q, uint16_t num_anws_rr, uint16_t num_auth_rr, uint16_t num_addi_rr, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an RFC 1035 version 4 DNS header\&. Additional DNS payload information should be specified using the payload interface\&. 
.PP
\fBParameters:\fP
.RS 4
\fIh_len\fP 
.br
\fIid\fP DNS packet id 
.br
\fIflags\fP control flags 
.br
\fInum_q\fP number of questions 
.br
\fInum_anws_rr\fP number of answer resource records 
.br
\fInum_auth_rr\fP number of authority resource records 
.br
\fInum_addi_rr\fP number of additional resource records 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_egre (uint16_t fv, uint16_t type, uint16_t sum, uint16_t offset, uint32_t key, uint32_t seq, uint16_t len, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Generic Routing Encapsulation (GRE - RFC 1701) is used to encapsulate any protocol\&. Hence, the IP part of the packet is usually referred as 'delivery
header'\&. It is then followed by the GRE header and finally the encapsulated packet (IP or whatever)\&. As GRE is very modular, the first GRE header describes the structure of the header, using bits and flag to specify which fields will be present in the header\&. 
.PP
\fBParameters:\fP
.RS 4
\fIfv\fP the 16 0 to 7: which fields are included in the header (checksum, seq\&. number, key, \&.\&.\&.), bits 8 to 12: flag, bits 13 to 15: version\&. 
.br
\fItype\fP which protocol is encapsulated (PPP, IP, \&.\&.\&.) 
.br
\fIsum\fP checksum (0 for libnet to auto-fill)\&. 
.br
\fIoffset\fP byte offset from the start of the routing field to the first byte of the SRE 
.br
\fIkey\fP inserted by the encapsulator to authenticate the source 
.br
\fIseq\fP sequence number used by the receiver to sort the packets 
.br
\fIlen\fP size of the GRE packet 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_ethernet (const uint8_t * dst, const uint8_t * src, uint16_t type, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an Ethernet header\&. The RFC 894 Ethernet II header is almost identical to the IEEE 802\&.3 header, with the exception that the field immediately following the source address holds the layer 3 protocol (as opposed to frame's length)\&. You should only use this function when libnet is initialized with the LIBNET_LINK interface\&. 
.PP
\fBParameters:\fP
.RS 4
\fIdst\fP destination ethernet address 
.br
\fIsrc\fP source ethernet address 
.br
\fItype\fP upper layer protocol type 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_fddi (uint8_t fc, const uint8_t * dst, const uint8_t * src, uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t * oui, uint16_t type, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds a Fiber Distributed Data Interface (FDDI) header\&. 
.PP
\fBParameters:\fP
.RS 4
\fIfc\fP class format and priority 
.br
\fIdst\fP destination fddi address 
.br
\fIsrc\fP source fddi address 
.br
\fIdsap\fP destination service access point 
.br
\fIssap\fP source service access point 
.br
\fIcf\fP cf 
.br
\fIoui\fP 3 byte IEEE organizational code 
.br
\fItype\fP upper layer protocol 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_gre (uint16_t fv, uint16_t type, uint16_t sum, uint16_t offset, uint32_t key, uint32_t seq, uint16_t len, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Generic Routing Encapsulation (GRE - RFC 1701) is used to encapsulate any protocol\&. Hence, the IP part of the packet is usually referred as 'delivery
header'\&. It is then followed by the GRE header and finally the encapsulated packet (IP or whatever)\&. As GRE is very modular, the first GRE header describes the structure of the header, using bits and flag to specify which fields will be present in the header\&. 
.PP
\fBParameters:\fP
.RS 4
\fIfv\fP the 16 0 to 7: which fields are included in the header (checksum, seq\&. number, key, \&.\&.\&.), bits 8 to 12: flag, bits 13 to 15: version\&. 
.br
\fItype\fP which protocol is encapsulated (PPP, IP, \&.\&.\&.) 
.br
\fIsum\fP checksum (0 for libnet to auto-fill)\&. 
.br
\fIoffset\fP byte offset from the start of the routing field to the first byte of the SRE 
.br
\fIkey\fP inserted by the encapsulator to authenticate the source 
.br
\fIseq\fP sequence number used by the receiver to sort the packets 
.br
\fIlen\fP size of the GRE packet 
.br
\fIpayload\fP 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_gre_last_sre (libnet_t * l, libnet_ptag_t ptag)"

.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_gre_sre (uint16_t af, uint8_t offset, uint8_t length, uint8_t * routing, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"

.PP
\fBParameters:\fP
.RS 4
\fIaf\fP 
.br
\fIoffset\fP 
.br
\fIlength\fP 
.br
\fIrouting\fP 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_hsrp (uint8_t version, uint8_t opcode, uint8_t state, uint8_t hello_time, uint8_t hold_time, uint8_t priority, uint8_t group, uint8_t reserved, uint8_t authdata[HSRP_AUTHDATA_LENGTH], uint32_t virtual_ip, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds a HSRP header\&. HSRP is a Cisco proprietary protocol defined in RFC 2281 
.PP
\fBParameters:\fP
.RS 4
\fIversion\fP version of the HSRP messages 
.br
\fIopcode\fP type of message 
.br
\fIstate\fP current state of the router 
.br
\fIhello_time\fP period in seconds between hello messages 
.br
\fIhold_time\fP seconds that the current hello message is valid 
.br
\fIpriority\fP priority for the election process 
.br
\fIgroup\fP standby group 
.br
\fIreserved\fP reserved field 
.br
\fIauthdata\fP password 
.br
\fIvirtual_ip\fP virtual ip address 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_icmpv4_echo (uint8_t type, uint8_t code, uint16_t sum, uint16_t id, uint16_t seq, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) echo request/reply header 
.PP
\fBParameters:\fP
.RS 4
\fItype\fP type of ICMP packet (should be ICMP_ECHOREPLY or ICMP_ECHO) 
.br
\fIcode\fP code of ICMP packet (should be 0) 
.br
\fIsum\fP checksum (0 for libnet to auto-fill) 
.br
\fIid\fP identification number 
.br
\fIseq\fP packet sequence number 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_icmpv4_mask (uint8_t type, uint8_t code, uint16_t sum, uint16_t id, uint16_t seq, uint32_t mask, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) IP netmask request/reply header\&. 
.PP
\fBParameters:\fP
.RS 4
\fItype\fP type of ICMP packet (should be ICMP_MASKREQ or ICMP_MASKREPLY) 
.br
\fIcode\fP code of ICMP packet (should be 0) 
.br
\fIsum\fP checksum (0 for libnet to auto-fill) 
.br
\fIid\fP identification number 
.br
\fIseq\fP packet sequence number 
.br
\fImask\fP subnet mask 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_icmpv4_redirect (uint8_t type, uint8_t code, uint16_t sum, uint32_t gateway, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an IP version 4 RFC 792 Internet Message Control Protocol (ICMP) redirect header\&. The IP header that caused the error message should be built by a previous call to \fBlibnet_build_ipv4()\fP\&. 
.PP
\fBParameters:\fP
.RS 4
\fItype\fP type of ICMP packet (should be ICMP_REDIRECT) 
.br
\fIcode\fP code of ICMP packet (should be one of the four redirect codes) 
.br
\fIsum\fP checksum (0 for libnet to auto-fill) 
.br
\fIgateway\fP 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_icmpv4_timeexceed (uint8_t type, uint8_t code, uint16_t sum, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) time exceeded header\&. The IP header that caused the error message should be built by a previous call to \fBlibnet_build_ipv4()\fP\&. 
.PP
\fBParameters:\fP
.RS 4
\fItype\fP type of ICMP packet (should be ICMP_TIMXCEED) 
.br
\fIcode\fP code of ICMP packet (ICMP_TIMXCEED_INTRANS / ICMP_TIMXCEED_REASS) 
.br
\fIsum\fP checksum (0 for libnet to auto-fill) 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_icmpv4_timestamp (uint8_t type, uint8_t code, uint16_t sum, uint16_t id, uint16_t seq, uint32_t otime, uint32_t rtime, uint32_t ttime, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) timestamp request/reply header\&. 
.PP
\fBParameters:\fP
.RS 4
\fItype\fP type of ICMP packet (should be ICMP_TSTAMP or ICMP_TSTAMPREPLY) 
.br
\fIcode\fP code of ICMP packet (should be 0) 
.br
\fIsum\fP checksum (0 for libnet to auto-fill) 
.br
\fIid\fP identification number 
.br
\fIseq\fP sequence number 
.br
\fIotime\fP originate timestamp 
.br
\fIrtime\fP receive timestamp 
.br
\fIttime\fP transmit timestamp 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_icmpv4_unreach (uint8_t type, uint8_t code, uint16_t sum, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) unreachable header\&. The IP header that caused the error message should be built by a previous call to \fBlibnet_build_ipv4()\fP\&. 
.PP
\fBParameters:\fP
.RS 4
\fItype\fP type of ICMP packet (should be ICMP_UNREACH) 
.br
\fIcode\fP code of ICMP packet (should be one of the 16 unreachable codes) 
.br
\fIsum\fP checksum (0 for libnet to auto-fill) 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_icmpv6_echo (uint8_t type, uint8_t code, uint16_t sum, uint16_t id, uint16_t seq, uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an IP version 6 RFC 4443 Internet Control Message Protocol (ICMP) echo or echo reply header\&. 
.PP
\fBParameters:\fP
.RS 4
\fItype\fP type of ICMP packet (should be ICMP6_ECHO_REQUEST or ICMP6_ECHO_REPLY) 
.br
\fIcode\fP code of ICMP packet (should be zero) 
.br
\fIsum\fP checksum (0 for libnet to auto-fill) 
.br
\fIid\fP echo id number 
.br
\fIseq\fP echo sequence number 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_icmpv6_ndp_nadv (uint8_t type, uint8_t code, uint16_t sum, uint32_t flags, struct libnet_in6_addr target, uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an IP version 6 RFC 2461 Internet Control Message Protocol (ICMP) NDP neighbour advertisement header\&. Could be used with \fBlibnet_build_icmpv6_ndp_opt()\fP and ND_OPT_TARGET_LINKADDR\&. 
.PP
\fBParameters:\fP
.RS 4
\fItype\fP type of ICMP packet (should be ND_NEIGHBOR_ADVERT) 
.br
\fIcode\fP code of ICMP packet (should be zero) 
.br
\fIsum\fP checksum (0 for libnet to auto-fill) 
.br
\fIflags\fP should be a bitwise or of any applicable ND_NA_FLAG_* flags 
.br
\fItarget\fP target ipv6 address 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_icmpv6_ndp_nsol (uint8_t type, uint8_t code, uint16_t sum, struct libnet_in6_addr target, uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an IP version 6 RFC 2461 Internet Control Message Protocol (ICMP) NDP neighbour solicitation header\&. Could be used with \fBlibnet_build_icmpv6_ndp_opt()\fP and ICMPV6_NDP_OPT_SLLA\&. 
.PP
\fBParameters:\fP
.RS 4
\fItype\fP type of ICMP packet (should be ND_NEIGHBOR_SOLICIT) 
.br
\fIcode\fP code of ICMP packet (should be zero) 
.br
\fIsum\fP checksum (0 for libnet to auto-fill) 
.br
\fItarget\fP target ipv6 address 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_icmpv6_ndp_opt (uint8_t type, uint8_t * option, uint32_t option_s, libnet_t * l, libnet_ptag_t ptag)"
Builds ICMPv6 NDP options\&. 
.PP
\fBParameters:\fP
.RS 4
\fItype\fP one of ND_OPT_* types 
.br
\fIoption\fP option data 
.br
\fIoption_s\fP size of option data (will be padded out to an 8-byte boundary) 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_icmpv6_unreach (uint8_t type, uint8_t code, uint16_t sum, uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an IP version 6 RFC 4443 Internet Control Message Protocol (ICMP) unreachable header\&. The IP header that caused the error message should be built by a previous call to \fBlibnet_build_ipv6()\fP\&. 
.PP
\fBParameters:\fP
.RS 4
\fItype\fP type of ICMP packet (should be ICMP6_DST_UNREACH) 
.br
\fIcode\fP code of ICMP packet (should be one of the 5 ICMP6_DST_UNREACH_* codes) 
.br
\fIsum\fP checksum (0 for libnet to auto-fill) 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_igmp (uint8_t type, uint8_t reserved, uint16_t sum, uint32_t ip, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an RFC 1112 Internet Group Membership Protocol (IGMP) header\&. 
.PP
\fBParameters:\fP
.RS 4
\fItype\fP packet type 
.br
\fIreserved\fP (should be 0 for IGMPv1) 
.br
\fIsum\fP checksum (0 for libnet to auto-fill) 
.br
\fIip\fP IPv4 address (in standard/network byte order) 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error
.RE
.PP
\fBNote:\fP
.RS 4
'reserved' was previously called 'code', which it is not, in any IGMP version\&. 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_ipsec_ah (uint8_t nh, uint8_t len, uint16_t res, uint32_t spi, uint32_t seq, uint32_t auth, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an Internet Protocol Security Authentication header\&. 
.PP
\fBParameters:\fP
.RS 4
\fInh\fP next header 
.br
\fIlen\fP payload length 
.br
\fIres\fP reserved 
.br
\fIspi\fP security parameter index 
.br
\fIseq\fP sequence number 
.br
\fIauth\fP authentication data 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_ipsec_esp_ftr (uint8_t len, uint8_t nh, int8_t * auth, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an Internet Protocol Security Encapsulating Security Payload footer\&. 
.PP
\fBParameters:\fP
.RS 4
\fIlen\fP padding length 
.br
\fInh\fP next header 
.br
\fIauth\fP authentication data 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_ipsec_esp_hdr (uint32_t spi, uint32_t seq, uint32_t iv, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an Internet Protocol Security Encapsulating Security Payload header\&. 
.PP
\fBParameters:\fP
.RS 4
\fIspi\fP security parameter index 
.br
\fIseq\fP ESP sequence number 
.br
\fIiv\fP initialization vector 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_ipv4 (uint16_t ip_len, uint8_t tos, uint16_t id, uint16_t frag, uint8_t ttl, uint8_t prot, uint16_t sum, uint32_t src, uint32_t dst, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds a version 4 RFC 791 Internet Protocol (IP) header\&.
.PP
\fBParameters:\fP
.RS 4
\fIip_len\fP total length of the IP packet including all subsequent data (subsequent data includes any IP options and IP options padding) 
.br
\fItos\fP type of service bits 
.br
\fIid\fP IP identification number 
.br
\fIfrag\fP fragmentation bits and offset 
.br
\fIttl\fP time to live in the network 
.br
\fIprot\fP upper layer protocol 
.br
\fIsum\fP checksum (0 for libnet to auto-fill) 
.br
\fIsrc\fP source IPv4 address (little endian) 
.br
\fIdst\fP destination IPv4 address (little endian) 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_ipv4_options (const uint8_t * options, uint32_t options_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an version 4 Internet Protocol (IP) options header\&. The function expects options to be a valid IP options string of size options_s, no larger than 40 bytes (the maximum size of an options string)\&.
.PP
When building a chain, the options must be built, then the IPv4 header\&.
.PP
When updating a chain, if the block following the options is an IPv4 header, it's total length and header length will be updated if the options block size changes\&.
.PP
\fBParameters:\fP
.RS 4
\fIoptions\fP byte string of IP options (it will be padded up to be an integral multiple of 32-bit words)\&. 
.br
\fIoptions_s\fP length of options string 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_ipv6 (uint8_t tc, uint32_t fl, uint16_t len, uint8_t nh, uint8_t hl, struct libnet_in6_addr src, struct libnet_in6_addr dst, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds a version 6 RFC 2460 Internet Protocol (IP) header\&. 
.PP
\fBParameters:\fP
.RS 4
\fItc\fP traffic class 
.br
\fIfl\fP flow label 
.br
\fIlen\fP total length of the IP packet 
.br
\fInh\fP next header 
.br
\fIhl\fP hop limit 
.br
\fIsrc\fP source IPv6 address 
.br
\fIdst\fP destination IPv6 address 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_ipv6_destopts (uint8_t nh, uint8_t len, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds a version 6 RFC 2460 Internet Protocol (IP) destination options header\&. This function is special in that it uses the payload interface to include the options data\&. The application programmer will build an IPv6 options byte string and pass it to the function using the payload interface\&. 
.PP
\fBParameters:\fP
.RS 4
\fInh\fP next header 
.br
\fIlen\fP length of the header in 8-byte octets not including the first 8 octets 
.br
\fIpayload\fP options payload 
.br
\fIpayload_s\fP payload length 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_ipv6_frag (uint8_t nh, uint8_t reserved, uint16_t frag, uint32_t id, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds a version 6 RFC 2460 Internet Protocol (IP) fragmentation header\&. 
.PP
\fBParameters:\fP
.RS 4
\fInh\fP next header 
.br
\fIreserved\fP unused value\&.\&.\&. OR IS IT! 
.br
\fIfrag\fP fragmentation bits (ala ipv4) 
.br
\fIid\fP packet identification 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_ipv6_hbhopts (uint8_t nh, uint8_t len, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds a version 6 RFC 2460 Internet Protocol (IP) hop by hop options header\&. This function is special in that it uses the payload interface to include the options data\&. The application programmer will build an IPv6 hop by hop options byte string and pass it to the function using the payload interface\&. 
.PP
\fBParameters:\fP
.RS 4
\fInh\fP next header 
.br
\fIlen\fP length of the header in 8-byte octets not including the first 8 octets 
.br
\fIpayload\fP options payload 
.br
\fIpayload_s\fP payload length 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_ipv6_routing (uint8_t nh, uint8_t len, uint8_t rtype, uint8_t segments, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds a version 6 RFC 2460 Internet Protocol (IP) routing header\&. This function is special in that it uses the payload interface to include the 'type-specific data'; that is the routing information\&. Most often this will be a number of 128-bit IPv6 addresses\&. The application programmer will build a byte string of IPv6 address and pass them to the function using the payload interface\&. 
.PP
\fBParameters:\fP
.RS 4
\fInh\fP next header 
.br
\fIlen\fP length of the header in 8-byte octets not including the first 8 octets 
.br
\fIrtype\fP routing header type 
.br
\fIsegments\fP number of routing segments that follow 
.br
\fIpayload\fP optional payload of routing information 
.br
\fIpayload_s\fP payload length 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_isl (uint8_t * dhost, uint8_t type, uint8_t user, uint8_t * shost, uint16_t len, const uint8_t * snap, uint16_t vid, uint16_t portindex, uint16_t reserved, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds a Cisco Inter-Switch Link (ISL) header\&. 
.PP
\fBParameters:\fP
.RS 4
\fIdhost\fP destination address (should be 01:00:0c:00:00) 
.br
\fItype\fP type of frame 
.br
\fIuser\fP user defined data 
.br
\fIshost\fP source mac address 
.br
\fIlen\fP total length of the encapsulated packet less 18 bytes 
.br
\fIsnap\fP SNAP information (0xaaaa03 + vendor code) 
.br
\fIvid\fP 15 bit VLAN ID, 1 bit BPDU or CDP indicator 
.br
\fIportindex\fP port index 
.br
\fIreserved\fP used for FDDI and token ring 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_link (const uint8_t * dst, const uint8_t * src, const uint8_t * oui, uint16_t type, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds a link layer header for an initialized l\&. The function determines the proper link layer header format from how l was initialized\&. The function current supports Ethernet and Token Ring link layers\&. 
.PP
\fBParameters:\fP
.RS 4
\fIdst\fP the destination MAC address 
.br
\fIsrc\fP the source MAC address 
.br
\fIoui\fP Organizationally Unique Identifier (unused for Ethernet) 
.br
\fItype\fP the upper layer protocol type 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_mpls (uint32_t label, uint8_t experimental, uint8_t bos, uint8_t ttl, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an RFC 3032 Multi-Protocol Label Switching (MPLS) header\&. 
.PP
\fBParameters:\fP
.RS 4
\fIlabel\fP 20-bit label value 
.br
\fIexperimental\fP 3-bit reserved field 
.br
\fIbos\fP 1-bit bottom of stack identifier 
.br
\fIttl\fP time to live 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_ntp (uint8_t leap_indicator, uint8_t version, uint8_t mode, uint8_t stratum, uint8_t poll, uint8_t precision, uint16_t delay_int, uint16_t delay_frac, uint16_t dispersion_int, uint16_t dispersion_frac, uint32_t reference_id, uint32_t ref_ts_int, uint32_t ref_ts_frac, uint32_t orig_ts_int, uint32_t orig_ts_frac, uint32_t rec_ts_int, uint32_t rec_ts_frac, uint32_t xmt_ts_int, uint32_t xmt_ts_frac, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an RFC 958 Network Time Protocol (NTP) header\&. 
.PP
\fBParameters:\fP
.RS 4
\fIleap_indicator\fP the leap indicator 
.br
\fIversion\fP NTP protocol version 
.br
\fImode\fP NTP mode 
.br
\fIstratum\fP stratum 
.br
\fIpoll\fP polling interval 
.br
\fIprecision\fP precision 
.br
\fIdelay_int\fP delay interval 
.br
\fIdelay_frac\fP delay fraction 
.br
\fIdispersion_int\fP dispersion interval 
.br
\fIdispersion_frac\fP dispersion fraction 
.br
\fIreference_id\fP reference id 
.br
\fIref_ts_int\fP reference timestamp integer 
.br
\fIref_ts_frac\fP reference timestamp fraction 
.br
\fIorig_ts_int\fP original timestamp integer 
.br
\fIorig_ts_frac\fP original timestamp fraction 
.br
\fIrec_ts_int\fP receiver timestamp integer 
.br
\fIrec_ts_frac\fP receiver timestamp fraction 
.br
\fIxmt_ts_int\fP transmit timestamp integer 
.br
\fIxmt_ts_frac\fP transmit timestamp integer 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_ospfv2 (uint16_t len, uint8_t type, uint32_t rtr_id, uint32_t area_id, uint16_t sum, uint16_t autype, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"

.PP
\fBParameters:\fP
.RS 4
\fIlen\fP 
.br
\fItype\fP 
.br
\fIrtr_id\fP 
.br
\fIarea_id\fP 
.br
\fIsum\fP 
.br
\fIautype\fP 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_ospfv2_dbd (uint16_t dgram_len, uint8_t opts, uint8_t type, uint32_t seqnum, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"

.PP
\fBParameters:\fP
.RS 4
\fIdgram_len\fP 
.br
\fIopts\fP 
.br
\fItype\fP 
.br
\fIseqnum\fP 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_ospfv2_hello (uint32_t netmask, uint16_t interval, uint8_t opts, uint8_t priority, uint32_t dead_int, uint32_t des_rtr, uint32_t bkup_rtr, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"

.PP
\fBParameters:\fP
.RS 4
\fInetmask\fP 
.br
\fIinterval\fP 
.br
\fIopts\fP 
.br
\fIpriority\fP 
.br
\fIdead_int\fP 
.br
\fIdes_rtr\fP 
.br
\fIbkup_rtr\fP 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "libnet_ptag_t libnet_build_ospfv2_hello_neighbor (uint32_t netmask, uint16_t interval, uint8_t opts, uint8_t priority, uint32_t dead_int, uint32_t des_rtr, uint32_t bkup_rtr, uint32_t neighbor, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"

.PP
\fBParameters:\fP
.RS 4
\fInetmask\fP 
.br
\fIinterval\fP 
.br
\fIopts\fP 
.br
\fIpriority\fP 
.br
\fIdead_int\fP 
.br
\fIdes_rtr\fP 
.br
\fIbkup_rtr\fP 
.br
\fIneighbor\fP 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_ospfv2_lsa (uint16_t age, uint8_t opts, uint8_t type, uint32_t lsid, uint32_t advrtr, uint32_t seqnum, uint16_t sum, uint16_t len, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"

.PP
\fBParameters:\fP
.RS 4
\fIage\fP 
.br
\fIopts\fP 
.br
\fItype\fP 
.br
\fIlsid\fP 
.br
\fIadvrtr\fP 
.br
\fIseqnum\fP 
.br
\fIsum\fP 
.br
\fIlen\fP 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_ospfv2_lsa_as (uint32_t nmask, uint32_t metric, uint32_t fwdaddr, uint32_t tag, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"

.PP
\fBParameters:\fP
.RS 4
\fInmask\fP 
.br
\fImetric\fP 
.br
\fIfwdaddr\fP 
.br
\fItag\fP 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_ospfv2_lsa_net (uint32_t nmask, uint32_t rtrid, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"

.PP
\fBParameters:\fP
.RS 4
\fInmask\fP 
.br
\fIrtrid\fP 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_ospfv2_lsa_rtr (uint16_t flags, uint16_t num, uint32_t id, uint32_t data, uint8_t type, uint8_t tos, uint16_t metric, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"

.PP
\fBParameters:\fP
.RS 4
\fIflags\fP 
.br
\fInum\fP 
.br
\fIid\fP 
.br
\fIdata\fP 
.br
\fItype\fP 
.br
\fItos\fP 
.br
\fImetric\fP 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_ospfv2_lsa_sum (uint32_t nmask, uint32_t metric, uint32_t tos, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"

.PP
\fBParameters:\fP
.RS 4
\fInmask\fP 
.br
\fImetric\fP 
.br
\fItos\fP 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_ospfv2_lsr (uint32_t type, uint32_t lsid, uint32_t advrtr, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"

.PP
\fBParameters:\fP
.RS 4
\fItype\fP 
.br
\fIlsid\fP 
.br
\fIadvrtr\fP 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_ospfv2_lsu (uint32_t num, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"

.PP
\fBParameters:\fP
.RS 4
\fInum\fP 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_rip (uint8_t cmd, uint8_t version, uint16_t rd, uint16_t af, uint16_t rt, uint32_t addr, uint32_t mask, uint32_t next_hop, uint32_t metric, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds a Routing Information Protocol header (RFCs 1058 and 2453)\&. 
.PP
\fBParameters:\fP
.RS 4
\fIcmd\fP command 
.br
\fIversion\fP protocol version 
.br
\fIrd\fP version one: 0, version two: routing domain 
.br
\fIaf\fP address family 
.br
\fIrt\fP version one: 0, version two: route tag 
.br
\fIaddr\fP IPv4 address 
.br
\fImask\fP version one: 0, version two: subnet mask 
.br
\fInext_hop\fP version one: 0, version two: next hop address 
.br
\fImetric\fP routing metric 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_rpc_call (uint32_t rm, uint32_t xid, uint32_t prog_num, uint32_t prog_vers, uint32_t procedure, uint32_t cflavor, uint32_t clength, uint8_t * cdata, uint32_t vflavor, uint32_t vlength, const uint8_t * vdata, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an Remote Procedure Call (Version 2) Call message header as specified in RFC 1831\&. This builder provides the option for specifying the record marking which is required when used with streaming protocols (TCP)\&. 
.PP
\fBParameters:\fP
.RS 4
\fIrm\fP record marking indicating the position in a stream, 0 otherwise 
.br
\fIxid\fP transaction identifier used to link calls and replies 
.br
\fIprog_num\fP remote program specification typically between 0 - 1fffffff 
.br
\fIprog_vers\fP remote program version specification 
.br
\fIprocedure\fP procedure to be performed by remote program 
.br
\fIcflavor\fP authentication credential type 
.br
\fIclength\fP credential length (should be 0) 
.br
\fIcdata\fP opaque credential data (currently unused) 
.br
\fIvflavor\fP authentication verifier type 
.br
\fIvlength\fP verifier length (should be 0) 
.br
\fIvdata\fP opaque verifier data (currently unused) 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_sebek (uint32_t magic, uint16_t version, uint16_t type, uint32_t counter, uint32_t time_sec, uint32_t time_usec, uint32_t pid, uint32_t uid, uint32_t fd, uint8_t cmd[SEBEK_CMD_LENGTH], uint32_t length, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds a Sebek header\&. The Sebek protocol was designed by the Honeynet Project as a transport mechanism for post-intrusion forensic data\&. More information may be found here: http://www.honeynet.org/papers/sebek.pdf\&. 
.PP
\fBParameters:\fP
.RS 4
\fImagic\fP identify packets that should be hidden 
.br
\fIversion\fP protocol version, currently 1 
.br
\fItype\fP type of record (read data is type 0, write data is type 1) 
.br
\fIcounter\fP PDU counter used to identify when packet are lost 
.br
\fItime_sec\fP seconds since EPOCH according to the honeypot 
.br
\fItime_usec\fP residual microseconds 
.br
\fIpid\fP PID 
.br
\fIuid\fP UID 
.br
\fIfd\fP FD 
.br
\fIcmd\fP 12 first characters of the command 
.br
\fIlength\fP length in bytes of the PDU's body 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_stp_conf (uint16_t id, uint8_t version, uint8_t bpdu_type, uint8_t flags, const uint8_t * root_id, uint32_t root_pc, const uint8_t * bridge_id, uint16_t port_id, uint16_t message_age, uint16_t max_age, uint16_t hello_time, uint16_t f_delay, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an IEEE 802\&.1d Spanning Tree Protocol (STP) configuration header\&. STP frames are usually encapsulated inside of an 802\&.2 + 802\&.3 frame combination\&. 
.PP
\fBParameters:\fP
.RS 4
\fIid\fP protocol id 
.br
\fIversion\fP protocol version 
.br
\fIbpdu_type\fP bridge protocol data unit type 
.br
\fIflags\fP flags 
.br
\fIroot_id\fP root id 
.br
\fIroot_pc\fP root path cost 
.br
\fIbridge_id\fP bridge id 
.br
\fIport_id\fP port id 
.br
\fImessage_age\fP message age 
.br
\fImax_age\fP max age 
.br
\fIhello_time\fP hello time 
.br
\fIf_delay\fP forward delay 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_stp_tcn (uint16_t id, uint8_t version, uint8_t bpdu_type, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an IEEE 802\&.1d Spanning Tree Protocol (STP) topology change notification header\&. STP frames are usually encapsulated inside of an 802\&.2 + 802\&.3 frame combination\&. 
.PP
\fBParameters:\fP
.RS 4
\fIid\fP protocol id 
.br
\fIversion\fP protocol version 
.br
\fIbpdu_type\fP bridge protocol data unit type 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_tcp (uint16_t sp, uint16_t dp, uint32_t seq, uint32_t ack, uint8_t control, uint16_t win, uint16_t sum, uint16_t urg, uint16_t len, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an RFC 793 Transmission Control Protocol (TCP) header\&. 
.PP
\fBParameters:\fP
.RS 4
\fIsp\fP source port 
.br
\fIdp\fP destination port 
.br
\fIseq\fP sequence number 
.br
\fIack\fP acknowledgement number 
.br
\fIcontrol\fP control flags 
.br
\fIwin\fP window size 
.br
\fIsum\fP checksum (0 for libnet to auto-fill) 
.br
\fIurg\fP urgent pointer 
.br
\fIlen\fP total length of the TCP packet (for checksum calculation) 
.br
\fIpayload\fP 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_tcp_options (const uint8_t * options, uint32_t options_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an RFC 793 Transmission Control Protocol (TCP) options header\&. The function expects options to be a valid TCP options string of size options_s, which is no larger than 40 bytes (the maximum size of an options string)\&. The function checks to ensure that the packet consists of a TCP header preceded by an IPv4 header, and that the addition of the options string would not result in a packet larger than 65,535 bytes (IPMAXPACKET)\&. The function counts up the number of 32-bit words in the options string and adjusts the TCP header length value as necessary\&. 
.PP
\fBParameters:\fP
.RS 4
\fIoptions\fP byte string of TCP options 
.br
\fIoptions_s\fP length of options string 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_token_ring (uint8_t ac, uint8_t fc, const uint8_t * dst, const uint8_t * src, uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t * oui, uint16_t type, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds a token ring header\&. 
.PP
\fBParameters:\fP
.RS 4
\fIac\fP access control 
.br
\fIfc\fP frame control 
.br
\fIdst\fP destination address 
.br
\fIsrc\fP source address 
.br
\fIdsap\fP destination service access point 
.br
\fIssap\fP source service access point 
.br
\fIcf\fP control field 
.br
\fIoui\fP Organizationally Unique Identifier 
.br
\fItype\fP upper layer protocol type 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_udp (uint16_t sp, uint16_t dp, uint16_t len, uint16_t sum, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an RFC 768 User Datagram Protocol (UDP) header\&. 
.PP
\fBParameters:\fP
.RS 4
\fIsp\fP source port 
.br
\fIdp\fP destination port 
.br
\fIlen\fP total length of the UDP packet 
.br
\fIsum\fP checksum (0 for libnet to auto-fill) 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API libnet_ptag_t libnet_build_vrrp (uint8_t version, uint8_t type, uint8_t vrouter_id, uint8_t priority, uint8_t ip_count, uint8_t auth_type, uint8_t advert_int, uint16_t sum, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
Builds an RFC 2338 Virtual Router Redundacy Protool (VRRP) header\&. Use the payload interface to specify address and authentication information\&. To build a 'legal' packet, the destination IPv4 address should be the multicast * address 224\&.0\&.0\&.18, the IP TTL should be set to 255, and the IP protocol should be set to 112\&. 
.PP
\fBParameters:\fP
.RS 4
\fIversion\fP VRRP version (should be 2) 
.br
\fItype\fP VRRP packet type (should be 1 -- ADVERTISEMENT) 
.br
\fIvrouter_id\fP virtual router identification 
.br
\fIpriority\fP priority (higher numbers indicate higher priority) 
.br
\fIip_count\fP number of IPv4 addresses contained in this advertisement 
.br
\fIauth_type\fP type of authentication (0, 1, 2 -- see RFC) 
.br
\fIadvert_int\fP interval between advertisements 
.br
\fIsum\fP checksum (0 for libnet to autofill) 
.br
\fIpayload\fP optional payload or NULL 
.br
\fIpayload_s\fP payload length or 0 
.br
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP protocol tag to modify an existing header, 0 to build a new one 
.RE
.PP
\fBReturns:\fP
.RS 4
protocol tag value on success 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SS "LIBNET_API void libnet_clear_packet (libnet_t * l)"
Clears the current packet referenced and frees all pblocks\&. Should be called when the programmer want to send a completely new packet of a different type using the same context\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP

.SS "int libnet_cq_add (libnet_t * l, char * label)"
[Context Queue] Adds a new context to the libnet context queue\&. If no queue exists, this function will create the queue and add the specified libnet context as the first entry on the list\&. The functions checks to ensure niether l nor label are NULL, and that label doesn't refer to an existing context already in the queue\&. Additionally, l should refer to a libnet context previously initialized with a call to \fBlibnet_init()\fP\&. If the context queue in write locked, this function will fail\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.br
\fIlabel\fP a canonical name given to recognize the new context, no longer than LIBNET_LABEL_SIZE 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI1\fP on success 
.br
\fI-1\fP on failure 
.RE
.PP

.SS "LIBNET_API void libnet_cq_destroy (void)"
[Context Queue] Destroys the entire context queue, calling \fBlibnet_destroy()\fP on each member context\&. 
.SS "LIBNET_API uint32_t libnet_cq_end_loop (void)"
[Context Queue] 
.SS "LIBNET_API libnet_t* libnet_cq_find_by_label (char * label)"
[Context Queue] Locates a libnet context from the queue, indexed by a canonical label\&. 
.PP
\fBParameters:\fP
.RS 4
\fIlabel\fP canonical label of the libnet context to retrieve 
.RE
.PP
\fBReturns:\fP
.RS 4
the expected libnet context 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fINULL\fP on failure 
.RE
.PP

.SS "LIBNET_API const char* libnet_cq_getlabel (libnet_t * l)"
[Context Queue] Returns the canonical label associated with the context\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
pointer to the libnet context's label 
.RE
.PP

.SS "LIBNET_API libnet_t* libnet_cq_head (void)"
[Context Queue] Intiailizes the interator interface and set a write lock on the entire queue\&. This function is intended to be called just prior to interating through the entire list of contexts (with the probable intent of inject a series of packets in rapid succession)\&. This function is often used as per the following:
.PP
for (l = \fBlibnet_cq_head()\fP; \fBlibnet_cq_last()\fP; l = \fBlibnet_cq_next()\fP) { \&.\&.\&. }
.PP
Much of the time, the application programmer will use the iterator as it is written above; as such, libnet provides a macro to do exactly that, \fBfor_each_context_in_cq(l)\fP\&. Warning: do not call the iterator more than once in a single loop\&. 
.PP
\fBReturns:\fP
.RS 4
the head of the context queue 
.RE
.PP

.SS "LIBNET_API int libnet_cq_last (void)"
[Context Queue] Check whether the iterator is at the last context in the queue\&. 
.PP
\fBReturn values:\fP
.RS 4
\fI1\fP if at the end of the context queue 
.br
\fI0\fP otherwise 
.RE
.PP

.SS "LIBNET_API libnet_t* libnet_cq_next (void)"
[Context Queue] Get next context from the context queue\&. 
.PP
\fBReturns:\fP
.RS 4
the next context from the context queue 
.RE
.PP

.SS "LIBNET_API libnet_t* libnet_cq_remove (libnet_t * l)"
[Context Queue] Removes a specified context from the libnet context queue by specifying the libnet context pointer\&. Note the function will remove the specified context from the context queue and cleanup internal memory from the queue, it is up to the application programmer to free the returned libnet context with a call to \fBlibnet_destroy()\fP\&. Also, as it is not necessary to keep the libnet context pointer when initially adding it to the context queue, most application programmers will prefer to refer to entries on the context queue by canonical name and would use \fBlibnet_cq_remove_by_label()\fP\&. If the context queue is write locked, this function will fail\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
the pointer to the removed libnet context 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fINULL\fP on failure 
.RE
.PP

.SS "LIBNET_API libnet_t* libnet_cq_remove_by_label (char * label)"
[Context Queue] Removes a specified context from the libnet context queue by specifying the canonical name\&. Note the function will remove the specified context from the context queue and cleanup internal memory from the queue, it is up to the application programmer to free the returned libnet context with a call to \fBlibnet_destroy()\fP\&. If the context queue is write locked, this function will fail\&. 
.PP
\fBParameters:\fP
.RS 4
\fIlabel\fP canonical name of the context to remove 
.RE
.PP
\fBReturns:\fP
.RS 4
the pointer to the removed libnet context 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fINULL\fP on failure 
.RE
.PP

.SS "LIBNET_API uint32_t libnet_cq_size (void)"
[Context Queue] Function returns the number of libnet contexts that are in the queue\&. 
.PP
\fBReturns:\fP
.RS 4
the number of libnet contexts currently in the queue 
.RE
.PP

.SS "LIBNET_API void libnet_destroy (libnet_t * l)"
Shuts down the libnet session referenced by l\&. It closes the network interface and frees all internal memory structures associated with l\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP

.SS "LIBNET_API void libnet_diag_dump_context (libnet_t * l)"
[Diagnostic] Prints the contents of the given context\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP

.SS "void libnet_diag_dump_hex (const uint8_t * packet, uint32_t len, int swap, FILE * stream)"
[Diagnostic] Function prints the contents of the supplied buffer to the supplied stream pointer\&. Will swap endianness based disposition of mode variable\&. Useful to be used in conjunction with the advanced interface and a culled packet\&. 
.PP
\fBParameters:\fP
.RS 4
\fIpacket\fP the packet to print 
.br
\fIlen\fP length of the packet in bytes 
.br
\fIswap\fP 1 to swap byte order, 0 to not\&. Counter-intuitively, it is necessary to swap in order to see the byte order as it is on the wire (this may be a bug)\&. 
.br
\fIstream\fP a stream pointer to print to 
.RE
.PP

.SS "LIBNET_API void libnet_diag_dump_pblock (libnet_t * l)"
[Diagnostic] Prints the contents of every pblock\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP

.SS "LIBNET_API char* libnet_diag_dump_pblock_type (uint8_t type)"
[Diagnostic] Returns the canonical name of the pblock type\&. 
.PP
\fBParameters:\fP
.RS 4
\fItype\fP pblock type 
.RE
.PP
\fBReturns:\fP
.RS 4
a string representing the pblock type type 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fIunknown\fP for an unknown value 
.RE
.PP

.SS "LIBNET_API struct libnet_ether_addr* libnet_get_hwaddr (libnet_t * l)"
Returns the MAC address for the device libnet was initialized with\&. If libnet was initialized without a device the function will attempt to find one\&. If the function fails and returns NULL a call to \fBlibnet_geterror()\fP will tell you why\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
a pointer to the MAC address or NULL 
.RE
.PP

.SS "LIBNET_API uint32_t libnet_get_ipaddr4 (libnet_t * l)"
Returns the IP address for the device libnet was initialized with\&. If libnet was initialized without a device (in raw socket mode) the function will attempt to find one\&. If the function fails and returns -1 a call to libnet_geterrror() will tell you why\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
a big endian IP address suitable for use in a libnet_build function 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP 
.RE
.PP

.SS "LIBNET_API struct libnet_in6_addr libnet_get_ipaddr6 (libnet_t * l)"
Returns the IPv6 address for the device libnet was initialized with\&. If libnet was initialized without a device (in raw socket mode) the function will attempt to find one\&. If the function fails and returns in6addr_error, a call to libnet_geterrror() will tell you why\&. This function is not yet implemented for Win32 platforms\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fIin6addr_error\fP on failure 
.RE
.PP

.SS "LIBNET_API uint32_t libnet_get_prand (int mod)"
Generates an unsigned pseudo-random value within the range specified by mod\&. LIBNET_PR2 0 - 1 LIBNET_PR8 0 - 255 LIBNET_PR16 0 - 32767 LIBNET_PRu16 0 - 65535 LIBNET_PR32 0 - 2147483647 LIBNET_PRu32 0 - 4294967295
.PP
\fBParameters:\fP
.RS 4
\fImod\fP one the of LIBNET_PR* constants 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI1\fP on success 
.br
\fI-1\fP on failure 
.RE
.PP

.SS "LIBNET_API const char* libnet_getdevice (libnet_t * l)"
Returns the canonical name of the device used for packet injection\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
the canonical name of the device used for packet injection\&. Note it can be NULL without being an error\&. 
.RE
.PP

.SS "LIBNET_API char* libnet_geterror (libnet_t * l)"
Returns the last error set inside of the referenced libnet context\&. This function should be called anytime a function fails or an error condition is detected inside of libnet\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
an error string or NULL if no error has occurred 
.RE
.PP

.SS "LIBNET_API int libnet_getfd (libnet_t * l)"
Returns the FILENO of the file descriptor used for packet injection\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
the file number of the file descriptor used for packet injection 
.RE
.PP

.SS "LIBNET_API uint32_t libnet_getgre_length (uint16_t fv)"

.PP
\fBParameters:\fP
.RS 4
\fIfv\fP see \fBlibnet_build_gre()\fP\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
size 
.RE
.PP
\fBSee also:\fP
.RS 4
\fBlibnet_build_gre()\fP\&. 
.RE
.PP

.SS "LIBNET_API uint32_t libnet_getpacket_size (libnet_t * l)"
Returns the sum of the size of all of the pblocks inside of l (this should be the resulting packet size)\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
the size of the packet in l 
.RE
.PP

.SS "LIBNET_API uint8_t* libnet_getpbuf (libnet_t * l, libnet_ptag_t ptag)"
Returns the pblock buffer contents for the specified ptag; a subsequent call to \fBlibnet_getpbuf_size()\fP should be made to determine the size of the buffer\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP the ptag reference number 
.RE
.PP
\fBReturns:\fP
.RS 4
a pointer to the pblock buffer or NULL on error 
.RE
.PP

.SS "LIBNET_API uint32_t libnet_getpbuf_size (libnet_t * l, libnet_ptag_t ptag)"
Returns the pblock buffer size for the specified ptag; a previous call to \fBlibnet_getpbuf()\fP should be made to pull the actual buffer contents\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP the ptag reference number 
.RE
.PP
\fBReturns:\fP
.RS 4
the size of the pblock buffer 
.RE
.PP

.SS "LIBNET_API uint8_t* libnet_hex_aton (const char * s, int * len)"
Takes a colon separated hexidecimal address (from the command line) and returns a bytestring suitable for use in a libnet_build function\&. Note this function performs an implicit malloc and the return value should be freed after its use\&. 
.PP
\fBParameters:\fP
.RS 4
\fIs\fP the string to be parsed 
.br
\fIlen\fP the resulting size of the returned byte string 
.RE
.PP
\fBReturns:\fP
.RS 4
a byte string or NULL on failure 
.RE
.PP

.SS "LIBNET_API int libnet_in6_is_error (struct libnet_in6_addr addr)"
Check a libnet_in6_addr structure for identity with in6addr_error\&. 
.PP
\fBParameters:\fP
.RS 4
\fIaddr\fP address to check 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI1\fP if addr is in6addr_error 
.br
\fI0\fP if it is not 
.RE
.PP

.SS "LIBNET_API libnet_t* libnet_init (int injection_type, const char * device, char * err_buf)"
Creates the libnet environment\&. It initializes the library and returns a libnet context\&. If the injection_type is LIBNET_LINK or LIBNET_LINK_ADV, the function initializes the injection primitives for the link-layer interface enabling the application programmer to build packets starting at the data-link layer (which also provides more granular control over the IP layer)\&. If libnet uses the link-layer and the device argument is non-NULL, the function attempts to use the specified network device for packet injection\&. This is either a canonical string that references the device (such as 'eth0' for a 100MB Ethernet card on Linux or 'fxp0' for a 100MB Ethernet card on OpenBSD) or the dots and decimals representation of the device's IP address (192\&.168\&.0\&.1)\&. If device is NULL, libnet attempts to find a suitable device to use\&. If the injection_type is LIBNET_RAW4 or LIBNET_RAW4_ADV, the function initializes the injection primitives for the IPv4 raw socket interface\&. The final argument, err_buf, should be a buffer of size LIBNET_ERRBUF_SIZE and holds an error message if the function fails\&. This function requires root privileges to execute successfully\&. Upon success, the function returns a valid libnet context for use in later function calls; upon failure, the function returns NULL\&. 
.PP
\fBParameters:\fP
.RS 4
\fIinjection_type\fP packet injection type (LIBNET_LINK, LIBNET_LINK_ADV, LIBNET_RAW4, LIBNET_RAW4_ADV, LIBNET_RAW6, LIBNET_RAW6_ADV) 
.br
\fIdevice\fP the interface to use (NULL and libnet will choose one) 
.br
\fIerr_buf\fP will contain an error message on failure 
.RE
.PP
\fBReturns:\fP
.RS 4
libnet context ready for use or NULL on error\&. 
.RE
.PP

.SS "LIBNET_API uint32_t libnet_name2addr4 (libnet_t * l, const char * host_name, uint8_t use_name)"
Takes a dotted decimal string or a canonical DNS name and returns a network byte ordered IPv4 address\&. This may incur a DNS lookup if mode is set to LIBNET_RESOLVE and host_name refers to a canonical DNS name\&. If mode is set to LIBNET_DONT_RESOLVE no DNS lookup will occur\&. The function can fail if DNS lookup fails or if mode is set to LIBNET_DONT_RESOLVE and host_name refers to a canonical DNS name\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.br
\fIhost_name\fP pointer to a string containing a presentation format host name 
.br
\fIuse_name\fP LIBNET_RESOLVE or LIBNET_DONT_RESOLVE 
.RE
.PP
\fBReturns:\fP
.RS 4
address in network byte order 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP (2^32 - 1) on error 
.RE
.PP

.SS "LIBNET_API struct libnet_in6_addr libnet_name2addr6 (libnet_t * l, const char * host_name, uint8_t use_name)"
Takes a dotted decimal string or a canonical DNS name and returns a network byte ordered IPv6 address\&. This may incur a DNS lookup if mode is set to LIBNET_RESOLVE and host_name refers to a canonical DNS name\&. If mode is set to LIBNET_DONT_RESOLVE no DNS lookup will occur\&. The function can fail if DNS lookup fails or if mode is set to LIBNET_DONT_RESOLVE and host_name refers to a canonical DNS name\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.br
\fIhost_name\fP pointer to a string containing a presentation format host name 
.br
\fIuse_name\fP LIBNET_RESOLVE or LIBNET_DONT_RESOLVE 
.RE
.PP
\fBReturns:\fP
.RS 4
network byte ordered IPv6 address structure 
.RE
.PP

.SS "LIBNET_API int libnet_plist_chain_dump (libnet_plist_t * plist)"
Runs through the port list and prints the contents of the port list chain list to stdout\&. 
.PP
\fBParameters:\fP
.RS 4
\fIplist\fP previously created portlist 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI1\fP on success 
.br
\fI-1\fP on failure 
.RE
.PP

.SS "LIBNET_API char* libnet_plist_chain_dump_string (libnet_plist_t * plist)"
Runs through the port list and prints the contents of the port list chain list to string\&. This function uses strdup and is not re-entrant\&. It also has a memory leak and should not really be used\&. 
.PP
\fBParameters:\fP
.RS 4
\fIplist\fP previously created portlist 
.RE
.PP
\fBReturns:\fP
.RS 4
a printable string containing the port list contents on success or NULL on error 
.RE
.PP

.SS "LIBNET_API int libnet_plist_chain_free (libnet_plist_t * plist)"
Frees all memory associated with port list chain\&. 
.PP
\fBParameters:\fP
.RS 4
\fIplist\fP previously created portlist 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI1\fP on success 
.br
\fI-1\fP on failure 
.RE
.PP

.SS "LIBNET_API int libnet_plist_chain_new (libnet_t * l, libnet_plist_t ** plist, char * token_list)"
Creates a new port list\&. Port list chains are useful for TCP and UDP-based applications that need to send packets to a range of ports (contiguous or otherwise)\&. The port list chain, which token_list points to, should contain a series of int8_tacters from the following list: '0123456789,-' of the general format 'x - y, z', where 'xyz' are port numbers between 0 and 65,535\&. plist points to the front of the port list chain list for use in further libnet_plist_chain() functions\&. Upon success, the function returns
.IP "1." 4
Upon failure, the function returns -1 and \fBlibnet_geterror()\fP can tell you why\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.br
\fIplist\fP if successful, will refer to the portlist, if not, NULL 
.br
\fItoken_list\fP string containing the port list primitive 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI1\fP on success 
.br
\fI-1\fP on failure 
.RE
.PP

.PP

.SS "LIBNET_API int libnet_plist_chain_next_pair (libnet_plist_t * plist, uint16_t * bport, uint16_t * eport)"
Returns the next port list chain pair from the port list chain plist\&. bport and eport contain the starting port number and ending port number, respectively\&. Upon success, the function returns 1 and fills in the port variables; however, if the list is empty, the function returns 0 and sets both port variables to 0\&. Upon failure, the function returns -1\&. 
.PP
\fBParameters:\fP
.RS 4
\fIplist\fP previously created portlist 
.br
\fIbport\fP will contain the beginning port number or 0 
.br
\fIeport\fP will contain the ending port number or 0 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI1\fP on success 
.br
\fI0\fP if empty 
.br
\fI-1\fP on failure 
.RE
.PP

.SS "LIBNET_API int libnet_seed_prand (libnet_t * l)"
Seeds the pseudo-random number generator\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI1\fP on success 
.br
\fI-1\fP on failure 
.RE
.PP

.SS "LIBNET_API void libnet_stats (libnet_t * l, struct libnet_stats * ls)"
Fills in a libnet_stats structure with packet injection statistics (packets written, bytes written, packet sending errors)\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.br
\fIls\fP pointer to a libnet statistics structure 
.RE
.PP

.SS "LIBNET_API int libnet_toggle_checksum (libnet_t * l, libnet_ptag_t ptag, int mode)"
If a given protocol header is built with the checksum field set to '0', by default libnet will calculate the header checksum prior to injection\&. If the header is set to any other value, by default libnet will not calculate the header checksum\&. To over-ride this behavior, use \fBlibnet_toggle_checksum()\fP\&. Switches auto-checksumming on or off for the specified ptag\&. If mode is set to LIBNET_ON, libnet will mark the specified ptag to calculate a checksum for the ptag prior to injection\&. This assumes that the ptag refers to a protocol that has a checksum field\&. If mode is set to LIBNET_OFF, libnet will clear the checksum flag and no checksum will be computed prior to injection\&. This assumes that the programmer will assign a value (zero or otherwise) to the checksum field\&. Often times this is useful if a precomputed checksum or some other predefined value is going to be used\&. Note that when libnet is initialized with LIBNET_RAW4, the IPv4 header checksum will always be computed by the kernel prior to injection, regardless of what the programmer sets\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.br
\fIptag\fP the ptag reference number 
.br
\fImode\fP LIBNET_ON or LIBNET_OFF 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI1\fP on success 
.br
\fI-1\fP on failure 
.RE
.PP

.SS "LIBNET_API const char* libnet_version (void)"
Returns the version of libnet\&. 
.PP
\fBReturns:\fP
.RS 4
the libnet version 
.RE
.PP

.SS "LIBNET_API int libnet_write (libnet_t * l)"
Writes a prebuilt packet to the network\&. The function assumes that l was previously initialized (via a call to \fBlibnet_init()\fP) and that a previously constructed packet has been built inside this context (via one or more calls to the libnet_build* family of functions) and is ready to go\&. Depending on how libnet was initialized, the function will write the packet to the wire either via the raw or link layer interface\&. The function will also bump up the internal libnet stat counters which are retrievable via \fBlibnet_stats()\fP\&. 
.PP
\fBParameters:\fP
.RS 4
\fIl\fP pointer to a libnet context 
.RE
.PP
\fBReturns:\fP
.RS 4
the number of bytes written 
.RE
.PP
\fBReturn values:\fP
.RS 4
\fI-1\fP on error 
.RE
.PP

.SH "SEE ALSO"
\.IX Header "SEE ALSO"
libnet(3)
.SH "AUTHORS"
.IX Header "AUTHORS"
The original author of libnet is Mike D. Schiffman.
.PP
libnet has been maintained and extensively enhanced since 2009 by Sam Roberts.
.PP
It is currently maintained by Ali Abdulkadir and available at
.PP
.Vb 1
\& <https://github.com/sgeto/libnet>
.Ve
.SH "BUGS"
.IX Header "BUGS"
For bugs, questions, patch submissions, desirable enhancements, etc. see:
.PP
.Vb 1
\& <https://github.com/sgeto/libnet/issues>
.Ve
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
libnet is licensed under the 3\-Clause \s-1BSD\s0 License. You can basically
do whatever you want with it.