libnet-functions.h
Go to the documentation of this file.
1/*
2 * libnet
3 * libnet-functions.h - function prototypes
4 *
5 * Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com>
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 */
30
31#ifndef __LIBNET_FUNCTIONS_H
32#define __LIBNET_FUNCTIONS_H
62LIBNET_API
63libnet_t *
64libnet_init(int injection_type, const char *device, char *err_buf);
65
71LIBNET_API
72void
73libnet_destroy(libnet_t *l);
74
81LIBNET_API
82void
84
91LIBNET_API
92void
93libnet_stats(libnet_t *l, struct libnet_stats *ls);
94
100LIBNET_API
101int
102libnet_getfd(libnet_t *l);
103
110LIBNET_API
111const char *
112libnet_getdevice(libnet_t *l);
113
122LIBNET_API
123uint8_t *
124libnet_getpbuf(libnet_t *l, libnet_ptag_t ptag);
125
134LIBNET_API
135uint32_t
136libnet_getpbuf_size(libnet_t *l, libnet_ptag_t ptag);
137
145LIBNET_API
146char *
147libnet_geterror(libnet_t *l);
148
155LIBNET_API
156uint32_t
158
165LIBNET_API
166int
167libnet_seed_prand(libnet_t *l);
168
183LIBNET_API
184uint32_t
186
209LIBNET_API
210int
211libnet_toggle_checksum(libnet_t *l, libnet_ptag_t ptag, int mode);
212
225LIBNET_API
226char *
227libnet_addr2name4(uint32_t in, uint8_t use_name);
228
243LIBNET_API
244uint32_t
245libnet_name2addr4(libnet_t *l, const char *host_name, uint8_t use_name);
246
247extern const struct libnet_in6_addr in6addr_error;
248
255LIBNET_API
256int
257libnet_in6_is_error(struct libnet_in6_addr addr);
258
272LIBNET_API
273struct libnet_in6_addr
274libnet_name2addr6(libnet_t *l, const char *host_name, uint8_t use_name);
275
279LIBNET_API
280void
281libnet_addr2name6_r(struct libnet_in6_addr addr, uint8_t use_name,
282char *host_name, int host_name_len);
283
300LIBNET_API
301int
302libnet_plist_chain_new(libnet_t *l, libnet_plist_t **plist, char *token_list);
303
317LIBNET_API
318int
319libnet_plist_chain_next_pair(libnet_plist_t *plist, uint16_t *bport,
320uint16_t *eport);
321
329LIBNET_API
330int
331libnet_plist_chain_dump(libnet_plist_t *plist);
332
340LIBNET_API
341char *
342libnet_plist_chain_dump_string(libnet_plist_t *plist);
343
350LIBNET_API
351int
352libnet_plist_chain_free(libnet_plist_t *plist);
353
442LIBNET_API
443libnet_ptag_t
444libnet_build_802_1q(const uint8_t *dst, const uint8_t *src, uint16_t tpi,
445uint8_t priority, uint8_t cfi, uint16_t vlan_id, uint16_t len_proto,
446const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
447
460LIBNET_API
461libnet_ptag_t
462libnet_build_802_1x(uint8_t eap_ver, uint8_t eap_type, uint16_t length,
463const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
464
477LIBNET_API
478libnet_ptag_t
479libnet_build_802_2(uint8_t dsap, uint8_t ssap, uint8_t control,
480const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
481
496LIBNET_API
497libnet_ptag_t
498libnet_build_802_2snap(uint8_t dsap, uint8_t ssap, uint8_t control,
499uint8_t *oui, uint16_t type, const uint8_t* payload, uint32_t payload_s,
500libnet_t *l, libnet_ptag_t ptag);
501
518LIBNET_API
519libnet_ptag_t
520libnet_build_802_3(const uint8_t *dst, const uint8_t *src, uint16_t len,
521const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
522
539LIBNET_API
540libnet_ptag_t
541libnet_build_ethernet(const uint8_t *dst, const uint8_t *src, uint16_t type,
542const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
543
556LIBNET_API
557libnet_ptag_t
558libnet_autobuild_ethernet(const uint8_t *dst, uint16_t type, libnet_t *l);
559
577LIBNET_API
578libnet_ptag_t
579libnet_build_fddi(uint8_t fc, const uint8_t *dst, const uint8_t *src, uint8_t dsap,
580uint8_t ssap, uint8_t cf, const uint8_t *oui, uint16_t type, const uint8_t* payload,
581uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
582
596LIBNET_API
597libnet_ptag_t
598libnet_autobuild_fddi(uint8_t fc, const uint8_t *dst, uint8_t dsap, uint8_t ssap,
599uint8_t cf, const uint8_t *oui, uint16_t type, libnet_t *l);
600
621LIBNET_API
622libnet_ptag_t
623libnet_build_arp(uint16_t hrd, uint16_t pro, uint8_t hln, uint8_t pln,
624uint16_t op, const uint8_t *sha, const uint8_t *spa, const uint8_t *tha, const uint8_t *tpa,
625const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
626
640LIBNET_API
641libnet_ptag_t
642libnet_autobuild_arp(uint16_t op, const uint8_t *sha, const uint8_t *spa, const uint8_t *tha,
643const uint8_t *tpa, libnet_t *l);
644
663LIBNET_API
664libnet_ptag_t
665libnet_build_tcp(uint16_t sp, uint16_t dp, uint32_t seq, uint32_t ack,
666uint8_t control, uint16_t win, uint16_t sum, uint16_t urg, uint16_t len,
667const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
668
685LIBNET_API
686libnet_ptag_t
687libnet_build_tcp_options(const uint8_t *options, uint32_t options_s, libnet_t *l,
688libnet_ptag_t ptag);
689
703LIBNET_API
704libnet_ptag_t
705libnet_build_udp(uint16_t sp, uint16_t dp, uint16_t len, uint16_t sum,
706const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
707
728LIBNET_API
729libnet_ptag_t
730libnet_build_cdp(uint8_t version, uint8_t ttl, uint16_t sum, uint16_t type,
731uint16_t value_s, const uint8_t *value, const uint8_t* payload, uint32_t payload_s,
732libnet_t *l, libnet_ptag_t ptag);
733
749LIBNET_API
750libnet_ptag_t
751libnet_build_icmpv4_echo(uint8_t type, uint8_t code, uint16_t sum,
752uint16_t id, uint16_t seq, const uint8_t* payload, uint32_t payload_s,
753libnet_t *l, libnet_ptag_t ptag);
754
771LIBNET_API
772libnet_ptag_t
773libnet_build_icmpv4_mask(uint8_t type, uint8_t code, uint16_t sum,
774uint16_t id, uint16_t seq, uint32_t mask, const uint8_t* payload,
775uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
776
791LIBNET_API
792libnet_ptag_t
793libnet_build_icmpv4_unreach(uint8_t type, uint8_t code, uint16_t sum,
794const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
795
811LIBNET_API
812libnet_ptag_t
813libnet_build_icmpv4_redirect(uint8_t type, uint8_t code, uint16_t sum,
814uint32_t gateway, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
815libnet_ptag_t ptag);
816
832LIBNET_API
833libnet_ptag_t
834libnet_build_icmpv4_timeexceed(uint8_t type, uint8_t code, uint16_t sum,
835const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
836
855LIBNET_API
856libnet_ptag_t
857libnet_build_icmpv4_timestamp(uint8_t type, uint8_t code, uint16_t sum,
858uint16_t id, uint16_t seq, uint32_t otime, uint32_t rtime, uint32_t ttime,
859const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
860
876LIBNET_API
877libnet_ptag_t libnet_build_icmpv6_echo(uint8_t type, uint8_t code, uint16_t
878 sum, uint16_t id, uint16_t seq, uint8_t *payload, uint32_t payload_s,
879 libnet_t *l, libnet_ptag_t ptag);
880
895LIBNET_API
896libnet_ptag_t
897libnet_build_icmpv6_unreach(uint8_t type, uint8_t code, uint16_t sum,
898uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
899
915LIBNET_API
916libnet_ptag_t libnet_build_icmpv6_ndp_nsol(uint8_t type, uint8_t code,
917 uint16_t sum, struct libnet_in6_addr target, uint8_t *payload, uint32_t
918 payload_s, libnet_t* l, libnet_ptag_t ptag);
919
936LIBNET_API
937libnet_ptag_t libnet_build_icmpv6_ndp_nadv(uint8_t type, uint8_t code,
938 uint16_t sum, uint32_t flags, struct libnet_in6_addr target, uint8_t
939 *payload, uint32_t payload_s, libnet_t* l, libnet_ptag_t ptag);
940
951LIBNET_API
952libnet_ptag_t libnet_build_icmpv6_ndp_opt(uint8_t type, uint8_t* option,
953 uint32_t option_s, libnet_t* l, libnet_ptag_t ptag);
954
970LIBNET_API
971libnet_ptag_t
972libnet_build_igmp(uint8_t type, uint8_t reserved, uint16_t sum, uint32_t ip,
973const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
974
995LIBNET_API
996libnet_ptag_t
997libnet_build_ipv4(uint16_t ip_len, uint8_t tos, uint16_t id, uint16_t frag,
998uint8_t ttl, uint8_t prot, uint16_t sum, uint32_t src, uint32_t dst,
999const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1000
1020LIBNET_API
1021libnet_ptag_t
1022libnet_build_ipv4_options(const uint8_t *options, uint32_t options_s, libnet_t *l,
1023libnet_ptag_t ptag);
1024
1039LIBNET_API
1040libnet_ptag_t
1041libnet_autobuild_ipv4(uint16_t len, uint8_t prot, uint32_t dst, libnet_t *l);
1042
1059LIBNET_API
1060libnet_ptag_t
1061libnet_build_ipv6(uint8_t tc, uint32_t fl, uint16_t len, uint8_t nh,
1062uint8_t hl, struct libnet_in6_addr src, struct libnet_in6_addr dst,
1063const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1064
1078LIBNET_API
1079libnet_ptag_t
1080libnet_build_ipv6_frag(uint8_t nh, uint8_t reserved, uint16_t frag,
1081uint32_t id, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
1082libnet_ptag_t ptag);
1083
1102LIBNET_API
1103libnet_ptag_t
1104libnet_build_ipv6_routing(uint8_t nh, uint8_t len, uint8_t rtype,
1105uint8_t segments, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
1106libnet_ptag_t ptag);
1107
1122LIBNET_API
1123libnet_ptag_t
1124libnet_build_ipv6_destopts(uint8_t nh, uint8_t len, const uint8_t* payload,
1125uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1126
1142LIBNET_API
1143libnet_ptag_t
1144libnet_build_ipv6_hbhopts(uint8_t nh, uint8_t len, const uint8_t* payload,
1145uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1146
1164LIBNET_API
1165libnet_ptag_t
1166libnet_autobuild_ipv6(uint16_t len, uint8_t nh, struct libnet_in6_addr dst,
1167libnet_t *l, libnet_ptag_t ptag);
1168
1187LIBNET_API
1188libnet_ptag_t
1189libnet_build_isl(uint8_t *dhost, uint8_t type, uint8_t user,
1190uint8_t *shost, uint16_t len, const uint8_t *snap, uint16_t vid,
1191uint16_t portindex, uint16_t reserved, const uint8_t* payload,
1192uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1193
1206LIBNET_API
1207libnet_ptag_t
1208libnet_build_ipsec_esp_hdr(uint32_t spi, uint32_t seq, uint32_t iv,
1209const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1210
1223LIBNET_API
1224libnet_ptag_t
1225libnet_build_ipsec_esp_ftr(uint8_t len, uint8_t nh, int8_t *auth,
1226const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1227
1243LIBNET_API
1244libnet_ptag_t
1245libnet_build_ipsec_ah(uint8_t nh, uint8_t len, uint16_t res,
1246uint32_t spi, uint32_t seq, uint32_t auth, const uint8_t* payload,
1247uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1248
1266LIBNET_API
1267libnet_ptag_t
1268libnet_build_dnsv4(uint16_t h_len, uint16_t id, uint16_t flags,
1269uint16_t num_q, uint16_t num_anws_rr, uint16_t num_auth_rr,
1270uint16_t num_addi_rr, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
1271libnet_ptag_t ptag);
1272
1291LIBNET_API
1292libnet_ptag_t
1293libnet_build_rip(uint8_t cmd, uint8_t version, uint16_t rd, uint16_t af,
1294uint16_t rt, uint32_t addr, uint32_t mask, uint32_t next_hop,
1295uint32_t metric, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
1296libnet_ptag_t ptag);
1297
1321LIBNET_API
1322libnet_ptag_t
1323libnet_build_rpc_call(uint32_t rm, uint32_t xid, uint32_t prog_num,
1324uint32_t prog_vers, uint32_t procedure, uint32_t cflavor, uint32_t clength,
1325uint8_t *cdata, uint32_t vflavor, uint32_t vlength, const uint8_t *vdata,
1326const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1327
1351LIBNET_API
1352libnet_ptag_t
1353libnet_build_stp_conf(uint16_t id, uint8_t version, uint8_t bpdu_type,
1354uint8_t flags, const uint8_t *root_id, uint32_t root_pc, const uint8_t *bridge_id,
1355uint16_t port_id, uint16_t message_age, uint16_t max_age,
1356uint16_t hello_time, uint16_t f_delay, const uint8_t* payload,
1357uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1358
1373LIBNET_API
1374libnet_ptag_t
1375libnet_build_stp_tcn(uint16_t id, uint8_t version, uint8_t bpdu_type,
1376const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1377
1396LIBNET_API
1397libnet_ptag_t
1398libnet_build_token_ring(uint8_t ac, uint8_t fc, const uint8_t *dst, const uint8_t *src,
1399uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t *oui, uint16_t type,
1400const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1401
1416LIBNET_API
1417libnet_ptag_t
1418libnet_autobuild_token_ring(uint8_t ac, uint8_t fc, const uint8_t *dst,
1419uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t *oui, uint16_t type,
1420libnet_t *l);
1421
1442LIBNET_API
1443libnet_ptag_t
1444libnet_build_vrrp(uint8_t version, uint8_t type, uint8_t vrouter_id,
1445uint8_t priority, uint8_t ip_count, uint8_t auth_type, uint8_t advert_int,
1446uint16_t sum, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
1447libnet_ptag_t ptag);
1448
1462LIBNET_API
1463libnet_ptag_t
1464libnet_build_mpls(uint32_t label, uint8_t experimental, uint8_t bos,
1465uint8_t ttl, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
1466libnet_ptag_t ptag);
1467
1496LIBNET_API
1497libnet_ptag_t
1498libnet_build_ntp(uint8_t leap_indicator, uint8_t version, uint8_t mode,
1499uint8_t stratum, uint8_t poll, uint8_t precision, uint16_t delay_int,
1500uint16_t delay_frac, uint16_t dispersion_int, uint16_t dispersion_frac,
1501uint32_t reference_id, uint32_t ref_ts_int, uint32_t ref_ts_frac,
1502uint32_t orig_ts_int, uint32_t orig_ts_frac, uint32_t rec_ts_int,
1503uint32_t rec_ts_frac, uint32_t xmt_ts_int, uint32_t xmt_ts_frac,
1504const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1505
1520LIBNET_API
1521libnet_ptag_t
1522libnet_build_ospfv2(uint16_t len, uint8_t type, uint32_t rtr_id,
1523uint32_t area_id, uint16_t sum, uint16_t autype, const uint8_t* payload,
1524uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1525
1541LIBNET_API
1542libnet_ptag_t
1543libnet_build_ospfv2_hello(uint32_t netmask, uint16_t interval, uint8_t opts,
1544uint8_t priority, uint32_t dead_int, uint32_t des_rtr, uint32_t bkup_rtr,
1545const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1546
1563libnet_ptag_t
1564libnet_build_ospfv2_hello_neighbor(uint32_t netmask, uint16_t interval, uint8_t opts,
1565uint8_t priority, uint32_t dead_int, uint32_t des_rtr, uint32_t bkup_rtr, uint32_t neighbor,
1566const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1567
1580LIBNET_API
1581libnet_ptag_t
1582libnet_build_ospfv2_dbd(uint16_t dgram_len, uint8_t opts, uint8_t type,
1583uint32_t seqnum, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
1584libnet_ptag_t ptag);
1585
1597LIBNET_API
1598libnet_ptag_t
1599libnet_build_ospfv2_lsr(uint32_t type, uint32_t lsid, uint32_t advrtr,
1600const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1601
1611LIBNET_API
1612libnet_ptag_t
1613libnet_build_ospfv2_lsu(uint32_t num, const uint8_t* payload, uint32_t payload_s,
1614libnet_t *l, libnet_ptag_t ptag);
1615
1632LIBNET_API
1633libnet_ptag_t
1634libnet_build_ospfv2_lsa(uint16_t age, uint8_t opts, uint8_t type,
1635uint32_t lsid, uint32_t advrtr, uint32_t seqnum, uint16_t sum, uint16_t len,
1636const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1637
1653LIBNET_API
1654libnet_ptag_t
1655libnet_build_ospfv2_lsa_rtr(uint16_t flags, uint16_t num, uint32_t id,
1656uint32_t data, uint8_t type, uint8_t tos, uint16_t metric, const uint8_t* payload,
1657uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1658
1669LIBNET_API
1670libnet_ptag_t
1671libnet_build_ospfv2_lsa_net(uint32_t nmask, uint32_t rtrid, const uint8_t* payload,
1672uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1673
1685LIBNET_API
1686libnet_ptag_t
1687libnet_build_ospfv2_lsa_sum(uint32_t nmask, uint32_t metric, uint32_t tos,
1688const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1689
1702LIBNET_API
1703libnet_ptag_t
1704libnet_build_ospfv2_lsa_as(uint32_t nmask, uint32_t metric, uint32_t fwdaddr,
1705uint32_t tag, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
1706libnet_ptag_t ptag);
1707
1720LIBNET_API
1721libnet_ptag_t
1722libnet_build_data(const uint8_t* payload, uint32_t payload_s, libnet_t *l,
1723libnet_ptag_t ptag);
1724
1747LIBNET_API
1748libnet_ptag_t
1749libnet_build_dhcpv4(uint8_t opcode, uint8_t htype, uint8_t hlen,
1750uint8_t hopcount, uint32_t xid, uint16_t secs, uint16_t flags,
1751uint32_t cip, uint32_t yip, uint32_t sip, uint32_t gip, const uint8_t *chaddr,
1752const char *sname, const char *file, const uint8_t* payload, uint32_t payload_s,
1753libnet_t *l, libnet_ptag_t ptag);
1754
1777LIBNET_API
1778libnet_ptag_t
1779libnet_build_bootpv4(uint8_t opcode, uint8_t htype, uint8_t hlen,
1780uint8_t hopcount, uint32_t xid, uint16_t secs, uint16_t flags,
1781uint32_t cip, uint32_t yip, uint32_t sip, uint32_t gip, const uint8_t *chaddr,
1782const char *sname, const char *file, const uint8_t* payload, uint32_t payload_s,
1783libnet_t *l, libnet_ptag_t ptag);
1784
1790LIBNET_API
1791uint32_t
1793
1817LIBNET_API
1818libnet_ptag_t
1819libnet_build_gre(uint16_t fv, uint16_t type, uint16_t sum,
1820uint16_t offset, uint32_t key, uint32_t seq, uint16_t len,
1821const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1822
1845LIBNET_API
1846libnet_ptag_t
1847libnet_build_egre(uint16_t fv, uint16_t type, uint16_t sum,
1848uint16_t offset, uint32_t key, uint32_t seq, uint16_t len,
1849const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1850
1863LIBNET_API
1864libnet_ptag_t
1865libnet_build_gre_sre(uint16_t af, uint8_t offset, uint8_t length,
1866uint8_t *routing, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
1867libnet_ptag_t ptag);
1868
1875LIBNET_API
1876libnet_ptag_t
1877libnet_build_gre_last_sre(libnet_t *l, libnet_ptag_t ptag);
1878
1901LIBNET_API
1902libnet_ptag_t
1903libnet_build_bgp4_header(uint8_t marker[LIBNET_BGP4_MARKER_SIZE],
1904uint16_t len, uint8_t type, const uint8_t* payload, uint32_t payload_s,
1905libnet_t *l, libnet_ptag_t ptag);
1906
1924LIBNET_API
1925libnet_ptag_t
1926libnet_build_bgp4_open(uint8_t version, uint16_t src_as, uint16_t hold_time,
1927uint32_t bgp_id, uint8_t opt_len, const uint8_t* payload, uint32_t payload_s,
1928libnet_t *l, libnet_ptag_t ptag);
1929
1946LIBNET_API
1947libnet_ptag_t
1948libnet_build_bgp4_update(uint16_t unfeasible_rt_len, const uint8_t *withdrawn_rt,
1949uint16_t total_path_attr_len, const uint8_t *path_attributes, uint16_t info_len,
1950uint8_t *reachability_info, const uint8_t* payload, uint32_t payload_s,
1951libnet_t *l, libnet_ptag_t ptag);
1952
1966LIBNET_API
1967libnet_ptag_t
1968libnet_build_bgp4_notification(uint8_t err_code, uint8_t err_subcode,
1969const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1970
1993LIBNET_API
1994libnet_ptag_t
1995libnet_build_sebek(uint32_t magic, uint16_t version, uint16_t type,
1996uint32_t counter, uint32_t time_sec, uint32_t time_usec, uint32_t pid,
1997uint32_t uid, uint32_t fd, uint8_t cmd[SEBEK_CMD_LENGTH], uint32_t length,
1998const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1999
2020LIBNET_API
2021libnet_ptag_t
2022libnet_build_hsrp(uint8_t version, uint8_t opcode, uint8_t state,
2023uint8_t hello_time, uint8_t hold_time, uint8_t priority, uint8_t group,
2024uint8_t reserved, uint8_t authdata[HSRP_AUTHDATA_LENGTH], uint32_t virtual_ip,
2025const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
2026
2042LIBNET_API
2043libnet_ptag_t
2044libnet_build_link(const uint8_t *dst, const uint8_t *src, const uint8_t *oui, uint16_t type,
2045const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
2046
2058LIBNET_API
2059libnet_ptag_t
2060libnet_autobuild_link(const uint8_t *dst, const uint8_t *oui, uint16_t type,
2061libnet_t *l);
2062
2076LIBNET_API
2077int
2078libnet_write(libnet_t *l);
2079
2089LIBNET_API
2090uint32_t
2092
2102LIBNET_API
2103struct libnet_in6_addr
2105
2114LIBNET_API
2115struct libnet_ether_addr *
2117
2127LIBNET_API
2128uint8_t *
2129libnet_hex_aton(const char *s, int *len);
2130
2135LIBNET_API
2136const char *
2138
2155LIBNET_API
2156int
2157libnet_adv_cull_packet(libnet_t *l, uint8_t **packet, uint32_t *packet_s);
2158
2172LIBNET_API
2173int
2174libnet_adv_cull_header(libnet_t *l, libnet_ptag_t ptag, uint8_t **header,
2175uint32_t *header_s);
2176
2191LIBNET_API
2192int
2193libnet_adv_write_link(libnet_t *l, const uint8_t *packet, uint32_t packet_s);
2194
2209LIBNET_API
2210int
2211libnet_adv_write_raw_ipv4(libnet_t *l, const uint8_t *packet, uint32_t packet_s);
2212
2219LIBNET_API
2220void
2221libnet_adv_free_packet(libnet_t *l, uint8_t *packet);
2222
2237int
2238libnet_cq_add(libnet_t *l, char *label);
2239
2255LIBNET_API
2256libnet_t *
2257libnet_cq_remove(libnet_t *l);
2258
2271LIBNET_API
2272libnet_t *
2274
2281LIBNET_API
2282const char *
2284
2292LIBNET_API
2293libnet_t *
2295
2301LIBNET_API
2302void
2304
2324LIBNET_API
2325libnet_t *
2327
2334LIBNET_API
2335int
2337
2343LIBNET_API
2344libnet_t *
2346
2352LIBNET_API
2353uint32_t
2355
2359LIBNET_API
2360uint32_t
2362
2368LIBNET_API
2369void
2371
2377LIBNET_API
2378void
2380
2388LIBNET_API
2389char *
2391
2405void
2406libnet_diag_dump_hex(const uint8_t *packet, uint32_t len, int swap, FILE *stream);
2407
2408/*
2409 * [Internal]
2410 */
2411LIBNET_API
2412int
2413libnet_write_raw_ipv4(libnet_t *l, const uint8_t *packet, uint32_t size);
2414
2415/*
2416 * [Internal]
2417 */
2418LIBNET_API
2419int
2420libnet_write_raw_ipv6(libnet_t *l, const uint8_t *packet, uint32_t size);
2421
2422/*
2423 * [Internal]
2424 */
2425LIBNET_API
2426int
2427libnet_write_link(libnet_t *l, const uint8_t *packet, uint32_t size);
2428
2429/*
2430 * [Internal]
2431 */
2432int
2433libnet_open_raw4(libnet_t *l);
2434
2435/*
2436 * [Internal]
2437 */
2438LIBNET_API
2439int
2440libnet_close_raw4(libnet_t *l);
2441
2442/*
2443 * [Internal]
2444 */
2445int
2446libnet_open_raw6(libnet_t *l);
2447
2448/*
2449 * [Internal]
2450 */
2451int
2452libnet_close_raw6(libnet_t *l);
2453
2454/*
2455 * [Internal]
2456 */
2457int
2458libnet_select_device(libnet_t *l);
2459
2460/*
2461 * [Internal]
2462 */
2463int
2464libnet_open_link(libnet_t *l);
2465
2466/*
2467 * [Internal]
2468 */
2469int
2470libnet_close_link(libnet_t *l);
2471
2472/*
2473 * [Internal]
2474 * THIS FUNCTION IS BROKEN. IT WILL SEGFAULT OR CORRUPT MEMORY, OR JUST SILENTLY DO THE
2475 * WRONG THING IF NOT CALLED CORRECTLY, AND CALLING IT CORRECTLY IS UNDOCUMENTED, AND
2476 * ALMOST IMPOSSIBLE. YOU HAVE BEEN WARNED.
2477 */
2478int
2479libnet_do_checksum(libnet_t *l, uint8_t *iphdr, int protocol, int h_len);
2480
2481/* Calculate internet checksums.
2482 *
2483 * IP (TCP, UDP, IGMP, ICMP, etc...) checksums usually need information from
2484 * the IP header to construct the "pseudo header", this function takes a
2485 * pointer to that header, the buffer boundaries, the "h_len" (see pblock_t for
2486 * a description, it is increasingly unused, though, and I'm trying to remove it
2487 * altogether), and the protocol number for the protocol that is to be
2488 * checksummed.
2489 *
2490 * Finding that protocol requires that the IP header be well-formed... so this
2491 * won't work well for invalid packets. But then, what is the valid checksum
2492 * for a invalid packet, anyhow?
2493 *
2494 * This doesn't work well for non-inet checksums, sorry, that's an original design
2495 * flaw. pblock_t needs a pointer in it, to a packet assembly function that can be
2496 * called at runtime to do assembly and checksumming.
2497 */
2498LIBNET_API
2499int
2500libnet_inet_checksum(libnet_t *l, uint8_t *iphdr, int protocol, int h_len, const uint8_t *beg, const uint8_t * end);
2501
2502/*
2503 * [Internal]
2504 */
2505LIBNET_API
2506uint32_t
2507libnet_compute_crc(uint8_t *buf, uint32_t len);
2508
2509/*
2510 * [Internal]
2511 */
2512LIBNET_API
2513uint16_t
2514libnet_ip_check(uint16_t *addr, int len);
2515
2516/*
2517 * [Internal]
2518 */
2519LIBNET_API
2520int
2521libnet_in_cksum(uint16_t *addr, int len);
2522
2523/*
2524 * [Internal]
2525 * If ptag is 0, function will create a pblock for the protocol unit type,
2526 * append it to the list and return a pointer to it. If ptag is not 0,
2527 * function will search the pblock list for the specified protocol block
2528 * and return a pointer to it.
2529 */
2530LIBNET_API
2531libnet_pblock_t *
2532libnet_pblock_probe(libnet_t *l, libnet_ptag_t ptag, uint32_t b_len,
2533uint8_t type);
2534
2535/*
2536 * [Internal]
2537 * Function creates the pblock list if l->protocol_blocks == NULL or appends
2538 * an entry to the doubly linked list.
2539 */
2540LIBNET_API
2541libnet_pblock_t *
2542libnet_pblock_new(libnet_t *l, uint32_t b_len);
2543
2544/*
2545 * [Internal]
2546 * Function swaps two pblocks in memory.
2547 */
2548LIBNET_API
2549int
2550libnet_pblock_swap(libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2);
2551
2552/*
2553 * [Internal]
2554 * Function inserts ptag2 before ptag1 in the doubly linked list.
2555 */
2556LIBNET_API
2557int
2558libnet_pblock_insert_before(libnet_t *l, libnet_ptag_t ptag1,
2559libnet_ptag_t ptag2);
2560
2561/*
2562 * [Internal]
2563 * Function removes a pblock from context
2564 */
2565LIBNET_API
2566void
2567libnet_pblock_delete(libnet_t *l, libnet_pblock_t *p);
2568
2569/*
2570 * [Internal]
2571 * Function updates the pblock meta-information. Internally it updates the
2572 * ptag with a monotonically increasing variable kept in l. This way each
2573 * pblock has a successively increasing ptag identifier.
2574 */
2575LIBNET_API
2576libnet_ptag_t
2577libnet_pblock_update(libnet_t *l, libnet_pblock_t *p, uint32_t h, uint8_t type);
2578
2579
2580/*
2581 * [Internal]
2582 * Function locates a given block by it's ptag.
2583 */
2584LIBNET_API
2585libnet_pblock_t *
2586libnet_pblock_find(libnet_t *l, libnet_ptag_t ptag);
2587
2588/*
2589 * [Internal]
2590 * Function copies protocol block data over.
2591 */
2592LIBNET_API
2593int
2594libnet_pblock_append(libnet_t *l, libnet_pblock_t *p, const void *buf, uint32_t len);
2595
2596/*
2597 * [Internal]
2598 * Function sets pblock flags.
2599 */
2600LIBNET_API
2601void
2602libnet_pblock_setflags(libnet_pblock_t *p, uint8_t flags);
2603
2604/*
2605 * [Internal]
2606 * Function returns the protocol number for the protocol block type. If
2607 * the type is unknown, the function defaults to returning IPPROTO_IP.
2608 */
2609LIBNET_API
2610int
2611libnet_pblock_p2p(uint8_t type);
2612
2613/*
2614 * [Internal]
2615 * Function assembles the protocol blocks into a packet, checksums are
2616 * calculated if that was requested.
2617 */
2618LIBNET_API
2619int
2620libnet_pblock_coalesce(libnet_t *l, uint8_t **packet, uint32_t *size);
2621
2622#if !(__WIN32__)
2623/*
2624 * [Internal]
2625 * By testing if we can retrieve the FLAGS of an interface
2626 * we can know if it exists or not and if it is up.
2627 */
2628int
2629libnet_check_iface(libnet_t *l);
2630#endif
2631
2632#if defined(__WIN32__)
2633/*
2634 * [Internal]
2635 */
2636BYTE *
2637libnet_win32_get_remote_mac(libnet_t *l, DWORD IP);
2638
2639/*
2640 * [Internal]
2641 */
2642int
2643libnet_close_link_interface(libnet_t *l);
2644
2645/*
2646 * [Internal]
2647 */
2648BYTE *
2649libnet_win32_read_arp_table(DWORD IP);
2650#endif
2651#endif /* __LIBNET_FUNCTIONS_H */
2652
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)
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)
LIBNET_API int libnet_in6_is_error(struct libnet_in6_addr addr)
LIBNET_API int libnet_seed_prand(libnet_t *l)
LIBNET_API uint32_t libnet_get_ipaddr4(libnet_t *l)
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)
LIBNET_API libnet_t * libnet_cq_remove_by_label(char *label)
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)
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)
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)
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)
LIBNET_API int libnet_plist_chain_dump(libnet_plist_t *plist)
LIBNET_API void libnet_cq_destroy(void)
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)
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)
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)
LIBNET_API void libnet_diag_dump_context(libnet_t *l)
int libnet_cq_add(libnet_t *l, char *label)
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)
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)
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)
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)
LIBNET_API char * libnet_diag_dump_pblock_type(uint8_t type)
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)
LIBNET_API int libnet_getfd(libnet_t *l)
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)
LIBNET_API int libnet_adv_write_raw_ipv4(libnet_t *l, const uint8_t *packet, uint32_t packet_s)
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)
LIBNET_API int libnet_write(libnet_t *l)
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)
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)
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)
LIBNET_API void libnet_diag_dump_pblock(libnet_t *l)
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)
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)
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)
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)
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)
LIBNET_API char * libnet_addr2name4(uint32_t in, uint8_t use_name)
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)
LIBNET_API void libnet_addr2name6_r(struct libnet_in6_addr addr, uint8_t use_name, char *host_name, int host_name_len)
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)
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)
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)
LIBNET_API int libnet_plist_chain_free(libnet_plist_t *plist)
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)
LIBNET_API libnet_t * libnet_cq_head(void)
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)
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)
LIBNET_API uint32_t libnet_getgre_length(uint16_t fv)
LIBNET_API uint32_t libnet_name2addr4(libnet_t *l, const char *host_name, uint8_t use_name)
LIBNET_API uint32_t libnet_cq_end_loop(void)
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)
LIBNET_API libnet_ptag_t libnet_autobuild_ipv4(uint16_t len, uint8_t prot, uint32_t dst, libnet_t *l)
LIBNET_API const char * libnet_getdevice(libnet_t *l)
LIBNET_API uint32_t libnet_getpbuf_size(libnet_t *l, libnet_ptag_t ptag)
LIBNET_API char * libnet_geterror(libnet_t *l)
LIBNET_API libnet_ptag_t libnet_autobuild_ethernet(const uint8_t *dst, uint16_t type, libnet_t *l)
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)
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)
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)
LIBNET_API struct libnet_in6_addr libnet_get_ipaddr6(libnet_t *l)
LIBNET_API int libnet_cq_last(void)
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)
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)
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)
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)
LIBNET_API libnet_ptag_t libnet_autobuild_link(const uint8_t *dst, const uint8_t *oui, uint16_t type, libnet_t *l)
LIBNET_API void libnet_destroy(libnet_t *l)
LIBNET_API void libnet_stats(libnet_t *l, struct libnet_stats *ls)
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)
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)
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)
LIBNET_API void libnet_adv_free_packet(libnet_t *l, uint8_t *packet)
LIBNET_API const char * libnet_cq_getlabel(libnet_t *l)
LIBNET_API void libnet_clear_packet(libnet_t *l)
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)
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)
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)
LIBNET_API int libnet_adv_cull_packet(libnet_t *l, uint8_t **packet, uint32_t *packet_s)
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)
LIBNET_API libnet_ptag_t libnet_build_ipv4_options(const uint8_t *options, uint32_t options_s, libnet_t *l, libnet_ptag_t ptag)
LIBNET_API libnet_ptag_t libnet_build_data(const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
LIBNET_API int libnet_adv_cull_header(libnet_t *l, libnet_ptag_t ptag, uint8_t **header, uint32_t *header_s)
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)
LIBNET_API int libnet_plist_chain_new(libnet_t *l, libnet_plist_t **plist, char *token_list)
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)
LIBNET_API uint8_t * libnet_hex_aton(const char *s, int *len)
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)
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)
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)
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)
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)
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)
LIBNET_API int libnet_plist_chain_next_pair(libnet_plist_t *plist, uint16_t *bport, uint16_t *eport)
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)
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)
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)
LIBNET_API int libnet_adv_write_link(libnet_t *l, const uint8_t *packet, uint32_t packet_s)
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)
LIBNET_API const char * libnet_version(void)
LIBNET_API uint32_t libnet_getpacket_size(libnet_t *l)
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)
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)
LIBNET_API struct libnet_ether_addr * libnet_get_hwaddr(libnet_t *l)
void libnet_diag_dump_hex(const uint8_t *packet, uint32_t len, int swap, FILE *stream)
LIBNET_API libnet_t * libnet_cq_remove(libnet_t *l)
LIBNET_API char * libnet_plist_chain_dump_string(libnet_plist_t *plist)
LIBNET_API uint8_t * libnet_getpbuf(libnet_t *l, libnet_ptag_t ptag)
LIBNET_API libnet_t * libnet_init(int injection_type, const char *device, char *err_buf)
LIBNET_API uint32_t libnet_cq_size(void)
LIBNET_API libnet_t * libnet_cq_next(void)
LIBNET_API uint32_t libnet_get_prand(int mod)
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)
LIBNET_API libnet_ptag_t libnet_build_gre_last_sre(libnet_t *l, libnet_ptag_t ptag)
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)
LIBNET_API libnet_ptag_t libnet_build_tcp_options(const uint8_t *options, uint32_t options_s, libnet_t *l, libnet_ptag_t ptag)
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)
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)
LIBNET_API int libnet_toggle_checksum(libnet_t *l, libnet_ptag_t ptag, int mode)
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)
LIBNET_API struct libnet_in6_addr libnet_name2addr6(libnet_t *l, const char *host_name, uint8_t use_name)
LIBNET_API libnet_t * libnet_cq_find_by_label(char *label)
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)
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)
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)

Documentation for libnet (version 1.2).
Generated on Sun Sep 24 2023 by Doxygen 1.9.7.