libnet: API Documentation: libnet-functions.h Source File

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
37
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
83libnet_clear_packet(libnet_t *l);
84
91LIBNET_API
92void
93libnet_stats(libnet_t *l, struct libnet_stats *ls);
94
100LIBNET_API
101int
102libnet_getfd(libnet_t *l);
103
104#ifdef SO_SNDBUF
111LIBNET_API
112int
113libnet_setfd_max_sndbuf(libnet_t *l, int max_bytes);
114#endif /* SO_SNDBUF */
115
122LIBNET_API
123const char *
124libnet_getdevice(libnet_t *l);
125
134LIBNET_API
135uint8_t *
136libnet_getpbuf(libnet_t *l, libnet_ptag_t ptag);
137
146LIBNET_API
147uint32_t
148libnet_getpbuf_size(libnet_t *l, libnet_ptag_t ptag);
149
157LIBNET_API
158char *
159libnet_geterror(libnet_t *l);
160
167LIBNET_API
168uint32_t
169libnet_getpacket_size(libnet_t *l);
170
177LIBNET_API
178int
179libnet_seed_prand(libnet_t *l);
180
195LIBNET_API
196uint32_t
197libnet_get_prand(int mod);
198
221LIBNET_API
222int
223libnet_toggle_checksum(libnet_t *l, libnet_ptag_t ptag, int mode);
224
237LIBNET_API
238char *
239libnet_addr2name4(uint32_t in, uint8_t use_name);
240
255LIBNET_API
256uint32_t
257libnet_name2addr4(libnet_t *l, const char *host_name, uint8_t use_name);
258
259extern const struct libnet_in6_addr in6addr_error;
260
267LIBNET_API
268int
269libnet_in6_is_error(struct libnet_in6_addr addr);
270
284LIBNET_API
285struct libnet_in6_addr
286libnet_name2addr6(libnet_t *l, const char *host_name, uint8_t use_name);
287
303LIBNET_API
304void
305libnet_addr2name6_r(struct libnet_in6_addr addr, uint8_t use_name,
306 char *host_name, int host_name_len);
307
324LIBNET_API
325int
326libnet_plist_chain_new(libnet_t *l, libnet_plist_t **plist, char *token_list);
327
341LIBNET_API
342int
343libnet_plist_chain_next_pair(libnet_plist_t *plist, uint16_t *bport,
344uint16_t *eport);
345
353LIBNET_API
354int
355libnet_plist_chain_dump(libnet_plist_t *plist);
356
364LIBNET_API
365char *
366libnet_plist_chain_dump_string(libnet_plist_t *plist);
367
374LIBNET_API
375int
376libnet_plist_chain_free(libnet_plist_t *plist);
377
442
466LIBNET_API
467libnet_ptag_t
468libnet_build_802_1q(const uint8_t *dst, const uint8_t *src, uint16_t tpi,
469uint8_t priority, uint8_t cfi, uint16_t vlan_id, uint16_t len_proto,
470const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
471
484LIBNET_API
485libnet_ptag_t
486libnet_build_802_1x(uint8_t eap_ver, uint8_t eap_type, uint16_t length,
487const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
488
501LIBNET_API
502libnet_ptag_t
503libnet_build_802_2(uint8_t dsap, uint8_t ssap, uint8_t control,
504const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
505
520LIBNET_API
521libnet_ptag_t
522libnet_build_802_2snap(uint8_t dsap, uint8_t ssap, uint8_t control,
523uint8_t *oui, uint16_t type, const uint8_t* payload, uint32_t payload_s,
524libnet_t *l, libnet_ptag_t ptag);
525
542LIBNET_API
543libnet_ptag_t
544libnet_build_802_3(const uint8_t *dst, const uint8_t *src, uint16_t len,
545const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
546
563LIBNET_API
564libnet_ptag_t
565libnet_build_ethernet(const uint8_t *dst, const uint8_t *src, uint16_t type,
566const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
567
580LIBNET_API
581libnet_ptag_t
582libnet_autobuild_ethernet(const uint8_t *dst, uint16_t type, libnet_t *l);
583
601LIBNET_API
602libnet_ptag_t
603libnet_build_fddi(uint8_t fc, const uint8_t *dst, const uint8_t *src, uint8_t dsap,
604uint8_t ssap, uint8_t cf, const uint8_t *oui, uint16_t type, const uint8_t* payload,
605uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
606
620LIBNET_API
621libnet_ptag_t
622libnet_autobuild_fddi(uint8_t fc, const uint8_t *dst, uint8_t dsap, uint8_t ssap,
623uint8_t cf, const uint8_t *oui, uint16_t type, libnet_t *l);
624
645LIBNET_API
646libnet_ptag_t
647libnet_build_arp(uint16_t hrd, uint16_t pro, uint8_t hln, uint8_t pln,
648uint16_t op, const uint8_t *sha, const uint8_t *spa, const uint8_t *tha, const uint8_t *tpa,
649const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
650
664LIBNET_API
665libnet_ptag_t
666libnet_autobuild_arp(uint16_t op, const uint8_t *sha, const uint8_t *spa, const uint8_t *tha,
667const uint8_t *tpa, libnet_t *l);
668
687LIBNET_API
688libnet_ptag_t
689libnet_build_tcp(uint16_t sp, uint16_t dp, uint32_t seq, uint32_t ack,
690uint8_t control, uint16_t win, uint16_t sum, uint16_t urg, uint16_t len,
691const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
692
709LIBNET_API
710libnet_ptag_t
711libnet_build_tcp_options(const uint8_t *options, uint32_t options_s, libnet_t *l,
712libnet_ptag_t ptag);
713
727LIBNET_API
728libnet_ptag_t
729libnet_build_udp(uint16_t sp, uint16_t dp, uint16_t len, uint16_t sum,
730const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
731
752LIBNET_API
753libnet_ptag_t
754libnet_build_cdp(uint8_t version, uint8_t ttl, uint16_t sum, uint16_t type,
755uint16_t value_s, const uint8_t *value, const uint8_t* payload, uint32_t payload_s,
756libnet_t *l, libnet_ptag_t ptag);
757
768LIBNET_API
769libnet_ptag_t libnet_build_lldp_chassis(const uint8_t subtype,
770const uint8_t *value, const uint8_t value_s,
771libnet_t *l, libnet_ptag_t ptag);
772
783LIBNET_API
784libnet_ptag_t libnet_build_lldp_port(const uint8_t subtype,
785const uint8_t *value, const uint8_t value_s,
786libnet_t *l, libnet_ptag_t ptag);
787
796LIBNET_API
797libnet_ptag_t libnet_build_lldp_ttl(const uint16_t ttl,
798libnet_t *l, libnet_ptag_t ptag);
799
809LIBNET_API
810libnet_ptag_t libnet_build_lldp_end(libnet_t *l, libnet_ptag_t ptag);
811
821LIBNET_API
822libnet_ptag_t libnet_build_lldp_org_spec(const uint8_t *value,
823const uint16_t value_s, libnet_t *l, libnet_ptag_t ptag);
824
831//libnet_ptag_t libnet_build_lldp(libnet_t *l, libnet_ptag_t ptag);
832
848LIBNET_API
849libnet_ptag_t
850libnet_build_icmpv4_echo(uint8_t type, uint8_t code, uint16_t sum,
851uint16_t id, uint16_t seq, const uint8_t* payload, uint32_t payload_s,
852libnet_t *l, libnet_ptag_t ptag);
853
870LIBNET_API
871libnet_ptag_t
872libnet_build_icmpv4_mask(uint8_t type, uint8_t code, uint16_t sum,
873uint16_t id, uint16_t seq, uint32_t mask, const uint8_t* payload,
874uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
875
890LIBNET_API
891libnet_ptag_t
892libnet_build_icmpv4_unreach(uint8_t type, uint8_t code, uint16_t sum,
893const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
894
910LIBNET_API
911libnet_ptag_t
912libnet_build_icmpv4_redirect(uint8_t type, uint8_t code, uint16_t sum,
913uint32_t gateway, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
914libnet_ptag_t ptag);
915
931LIBNET_API
932libnet_ptag_t
933libnet_build_icmpv4_timeexceed(uint8_t type, uint8_t code, uint16_t sum,
934const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
935
955LIBNET_API
956libnet_ptag_t
957libnet_build_icmpv4_timestamp(uint8_t type, uint8_t code, uint16_t sum,
958uint16_t id, uint16_t seq, uint32_t otime, uint32_t rtime, uint32_t ttime,
959const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
960
977LIBNET_API
978libnet_ptag_t libnet_build_icmpv6_echo(uint8_t type, uint8_t code, uint16_t
979 sum, uint16_t id, uint16_t seq, uint8_t *payload, uint32_t payload_s,
980 libnet_t *l, libnet_ptag_t ptag);
981
997LIBNET_API
998libnet_ptag_t
999libnet_build_icmpv6_unreach(uint8_t type, uint8_t code, uint16_t sum,
1000uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1001
1017LIBNET_API
1018libnet_ptag_t libnet_build_icmpv6_ndp_nsol(uint8_t type, uint8_t code,
1019 uint16_t sum, struct libnet_in6_addr target, uint8_t *payload, uint32_t
1020 payload_s, libnet_t* l, libnet_ptag_t ptag);
1021
1038LIBNET_API
1039libnet_ptag_t libnet_build_icmpv6_ndp_nadv(uint8_t type, uint8_t code,
1040 uint16_t sum, uint32_t flags, struct libnet_in6_addr target, uint8_t
1041 *payload, uint32_t payload_s, libnet_t* l, libnet_ptag_t ptag);
1042
1053LIBNET_API
1054libnet_ptag_t libnet_build_icmpv6_ndp_opt(uint8_t type, uint8_t* option,
1055 uint32_t option_s, libnet_t* l, libnet_ptag_t ptag);
1056
1072LIBNET_API
1073libnet_ptag_t
1074libnet_build_igmp(uint8_t type, uint8_t reserved, uint16_t sum, uint32_t ip,
1075const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1076
1097LIBNET_API
1098libnet_ptag_t
1099libnet_build_ipv4(uint16_t ip_len, uint8_t tos, uint16_t id, uint16_t frag,
1100uint8_t ttl, uint8_t prot, uint16_t sum, uint32_t src, uint32_t dst,
1101const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1102
1122LIBNET_API
1123libnet_ptag_t
1124libnet_build_ipv4_options(const uint8_t *options, uint32_t options_s, libnet_t *l,
1125libnet_ptag_t ptag);
1126
1141LIBNET_API
1142libnet_ptag_t
1143libnet_autobuild_ipv4(uint16_t len, uint8_t prot, uint32_t dst, libnet_t *l);
1144
1161LIBNET_API
1162libnet_ptag_t
1163libnet_build_ipv6(uint8_t tc, uint32_t fl, uint16_t len, uint8_t nh,
1164uint8_t hl, struct libnet_in6_addr src, struct libnet_in6_addr dst,
1165const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1166
1180LIBNET_API
1181libnet_ptag_t
1182libnet_build_ipv6_frag(uint8_t nh, uint8_t reserved, uint16_t frag,
1183uint32_t id, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
1184libnet_ptag_t ptag);
1185
1204LIBNET_API
1205libnet_ptag_t
1206libnet_build_ipv6_routing(uint8_t nh, uint8_t len, uint8_t rtype,
1207uint8_t segments, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
1208libnet_ptag_t ptag);
1209
1224LIBNET_API
1225libnet_ptag_t
1226libnet_build_ipv6_destopts(uint8_t nh, uint8_t len, const uint8_t* payload,
1227uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1228
1244LIBNET_API
1245libnet_ptag_t
1246libnet_build_ipv6_hbhopts(uint8_t nh, uint8_t len, const uint8_t* payload,
1247uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1248
1266LIBNET_API
1267libnet_ptag_t
1268libnet_autobuild_ipv6(uint16_t len, uint8_t nh, struct libnet_in6_addr dst,
1269libnet_t *l, libnet_ptag_t ptag);
1270
1289LIBNET_API
1290libnet_ptag_t
1291libnet_build_isl(uint8_t *dhost, uint8_t type, uint8_t user,
1292uint8_t *shost, uint16_t len, const uint8_t *snap, uint16_t vid,
1293uint16_t portindex, uint16_t reserved, const uint8_t* payload,
1294uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1295
1308LIBNET_API
1309libnet_ptag_t
1310libnet_build_ipsec_esp_hdr(uint32_t spi, uint32_t seq, uint32_t iv,
1311const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1312
1325LIBNET_API
1326libnet_ptag_t
1327libnet_build_ipsec_esp_ftr(uint8_t len, uint8_t nh, int8_t *auth,
1328const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1329
1345LIBNET_API
1346libnet_ptag_t
1347libnet_build_ipsec_ah(uint8_t nh, uint8_t len, uint16_t res,
1348uint32_t spi, uint32_t seq, uint32_t auth, const uint8_t* payload,
1349uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1350
1368LIBNET_API
1369libnet_ptag_t
1370libnet_build_dnsv4(uint16_t h_len, uint16_t id, uint16_t flags,
1371uint16_t num_q, uint16_t num_anws_rr, uint16_t num_auth_rr,
1372uint16_t num_addi_rr, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
1373libnet_ptag_t ptag);
1374
1393LIBNET_API
1394libnet_ptag_t
1395libnet_build_rip(uint8_t cmd, uint8_t version, uint16_t rd, uint16_t af,
1396uint16_t rt, uint32_t addr, uint32_t mask, uint32_t next_hop,
1397uint32_t metric, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
1398libnet_ptag_t ptag);
1399
1423LIBNET_API
1424libnet_ptag_t
1425libnet_build_rpc_call(uint32_t rm, uint32_t xid, uint32_t prog_num,
1426uint32_t prog_vers, uint32_t procedure, uint32_t cflavor, uint32_t clength,
1427uint8_t *cdata, uint32_t vflavor, uint32_t vlength, const uint8_t *vdata,
1428const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1429
1453LIBNET_API
1454libnet_ptag_t
1455libnet_build_stp_conf(uint16_t id, uint8_t version, uint8_t bpdu_type,
1456uint8_t flags, const uint8_t *root_id, uint32_t root_pc, const uint8_t *bridge_id,
1457uint16_t port_id, uint16_t message_age, uint16_t max_age,
1458uint16_t hello_time, uint16_t f_delay, const uint8_t* payload,
1459uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1460
1475LIBNET_API
1476libnet_ptag_t
1477libnet_build_stp_tcn(uint16_t id, uint8_t version, uint8_t bpdu_type,
1478const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1479
1495LIBNET_API
1496libnet_ptag_t
1497libnet_build_udld_hdr(uint8_t version, uint8_t opcode, uint8_t flags, uint8_t checksum,
1498const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1499
1509LIBNET_API
1510libnet_ptag_t
1511libnet_build_udld_device_id(const uint8_t *value, const uint8_t value_s,
1512libnet_t *l, libnet_ptag_t ptag);
1513
1523LIBNET_API
1524libnet_ptag_t
1525libnet_build_udld_port_id(const uint8_t *value, const uint8_t value_s,
1526libnet_t *l, libnet_ptag_t ptag);
1527
1537LIBNET_API
1538libnet_ptag_t
1539libnet_build_udld_echo(const uint8_t *value, const uint8_t value_s,
1540libnet_t *l, libnet_ptag_t ptag);
1541
1550LIBNET_API
1551libnet_ptag_t
1552libnet_build_udld_message_interval(const uint8_t *value, libnet_t *l,
1553libnet_ptag_t ptag);
1554
1563LIBNET_API
1564libnet_ptag_t
1565libnet_build_udld_timeout_interval(const uint8_t *value, libnet_t *l,
1566libnet_ptag_t ptag);
1567
1577LIBNET_API
1578libnet_ptag_t
1579libnet_build_udld_device_name(const uint8_t *value, const uint8_t value_s,
1580libnet_t *l, libnet_ptag_t ptag);
1581
1590LIBNET_API
1591libnet_ptag_t
1592libnet_build_udld_sequence_number(const uint8_t *value, libnet_t *l,
1593libnet_ptag_t ptag);
1594
1613LIBNET_API
1614libnet_ptag_t
1615libnet_build_token_ring(uint8_t ac, uint8_t fc, const uint8_t *dst, const uint8_t *src,
1616uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t *oui, uint16_t type,
1617const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1618
1633LIBNET_API
1634libnet_ptag_t
1635libnet_autobuild_token_ring(uint8_t ac, uint8_t fc, const uint8_t *dst,
1636uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t *oui, uint16_t type,
1637libnet_t *l);
1638
1659LIBNET_API
1660libnet_ptag_t
1661libnet_build_vrrp(uint8_t version, uint8_t type, uint8_t vrouter_id,
1662uint8_t priority, uint8_t ip_count, uint8_t auth_type, uint8_t advert_int,
1663uint16_t sum, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
1664libnet_ptag_t ptag);
1665
1679LIBNET_API
1680libnet_ptag_t
1681libnet_build_mpls(uint32_t label, uint8_t experimental, uint8_t bos,
1682uint8_t ttl, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
1683libnet_ptag_t ptag);
1684
1713LIBNET_API
1714libnet_ptag_t
1715libnet_build_ntp(uint8_t leap_indicator, uint8_t version, uint8_t mode,
1716uint8_t stratum, uint8_t poll, uint8_t precision, uint16_t delay_int,
1717uint16_t delay_frac, uint16_t dispersion_int, uint16_t dispersion_frac,
1718uint32_t reference_id, uint32_t ref_ts_int, uint32_t ref_ts_frac,
1719uint32_t orig_ts_int, uint32_t orig_ts_frac, uint32_t rec_ts_int,
1720uint32_t rec_ts_frac, uint32_t xmt_ts_int, uint32_t xmt_ts_frac,
1721const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1722
1737LIBNET_API
1738libnet_ptag_t
1739libnet_build_ospfv2(uint16_t len, uint8_t type, uint32_t rtr_id,
1740uint32_t area_id, uint16_t sum, uint16_t autype, const uint8_t* payload,
1741uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1742
1758LIBNET_API
1759libnet_ptag_t
1760libnet_build_ospfv2_hello(uint32_t netmask, uint16_t interval, uint8_t opts,
1761uint8_t priority, uint32_t dead_int, uint32_t des_rtr, uint32_t bkup_rtr,
1762const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1763
1780libnet_ptag_t
1781libnet_build_ospfv2_hello_neighbor(uint32_t netmask, uint16_t interval, uint8_t opts,
1782uint8_t priority, uint32_t dead_int, uint32_t des_rtr, uint32_t bkup_rtr, uint32_t neighbor,
1783const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1784
1797LIBNET_API
1798libnet_ptag_t
1799libnet_build_ospfv2_dbd(uint16_t dgram_len, uint8_t opts, uint8_t type,
1800uint32_t seqnum, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
1801libnet_ptag_t ptag);
1802
1814LIBNET_API
1815libnet_ptag_t
1816libnet_build_ospfv2_lsr(uint32_t type, uint32_t lsid, uint32_t advrtr,
1817const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1818
1828LIBNET_API
1829libnet_ptag_t
1830libnet_build_ospfv2_lsu(uint32_t num, const uint8_t* payload, uint32_t payload_s,
1831libnet_t *l, libnet_ptag_t ptag);
1832
1849LIBNET_API
1850libnet_ptag_t
1851libnet_build_ospfv2_lsa(uint16_t age, uint8_t opts, uint8_t type,
1852uint32_t lsid, uint32_t advrtr, uint32_t seqnum, uint16_t sum, uint16_t len,
1853const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1854
1870LIBNET_API
1871libnet_ptag_t
1872libnet_build_ospfv2_lsa_rtr(uint16_t flags, uint16_t num, uint32_t id,
1873uint32_t data, uint8_t type, uint8_t tos, uint16_t metric, const uint8_t* payload,
1874uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1875
1886LIBNET_API
1887libnet_ptag_t
1888libnet_build_ospfv2_lsa_net(uint32_t nmask, uint32_t rtrid, const uint8_t* payload,
1889uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1890
1902LIBNET_API
1903libnet_ptag_t
1904libnet_build_ospfv2_lsa_sum(uint32_t nmask, uint32_t metric, uint32_t tos,
1905const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
1906
1919LIBNET_API
1920libnet_ptag_t
1921libnet_build_ospfv2_lsa_as(uint32_t nmask, uint32_t metric, uint32_t fwdaddr,
1922uint32_t tag, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
1923libnet_ptag_t ptag);
1924
1937LIBNET_API
1938libnet_ptag_t
1939libnet_build_data(const uint8_t* payload, uint32_t payload_s, libnet_t *l,
1940libnet_ptag_t ptag);
1941
1964LIBNET_API
1965libnet_ptag_t
1966libnet_build_dhcpv4(uint8_t opcode, uint8_t htype, uint8_t hlen,
1967uint8_t hopcount, uint32_t xid, uint16_t secs, uint16_t flags,
1968uint32_t cip, uint32_t yip, uint32_t sip, uint32_t gip, const uint8_t *chaddr,
1969const char *sname, const char *file, const uint8_t* payload, uint32_t payload_s,
1970libnet_t *l, libnet_ptag_t ptag);
1971
1994LIBNET_API
1995libnet_ptag_t
1996libnet_build_bootpv4(uint8_t opcode, uint8_t htype, uint8_t hlen,
1997uint8_t hopcount, uint32_t xid, uint16_t secs, uint16_t flags,
1998uint32_t cip, uint32_t yip, uint32_t sip, uint32_t gip, const uint8_t *chaddr,
1999const char *sname, const char *file, const uint8_t* payload, uint32_t payload_s,
2000libnet_t *l, libnet_ptag_t ptag);
2001
2007LIBNET_API
2008uint32_t
2009libnet_getgre_length(uint16_t fv);
2010
2034LIBNET_API
2035libnet_ptag_t
2036libnet_build_gre(uint16_t fv, uint16_t type, uint16_t sum,
2037uint16_t offset, uint32_t key, uint32_t seq, uint16_t len,
2038const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
2039
2062LIBNET_API
2063libnet_ptag_t
2064libnet_build_egre(uint16_t fv, uint16_t type, uint16_t sum,
2065uint16_t offset, uint32_t key, uint32_t seq, uint16_t len,
2066const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
2067
2080LIBNET_API
2081libnet_ptag_t
2082libnet_build_gre_sre(uint16_t af, uint8_t offset, uint8_t length,
2083uint8_t *routing, const uint8_t* payload, uint32_t payload_s, libnet_t *l,
2084libnet_ptag_t ptag);
2085
2092LIBNET_API
2093libnet_ptag_t
2094libnet_build_gre_last_sre(libnet_t *l, libnet_ptag_t ptag);
2095
2118LIBNET_API
2119libnet_ptag_t
2120libnet_build_bgp4_header(uint8_t marker[LIBNET_BGP4_MARKER_SIZE],
2121uint16_t len, uint8_t type, const uint8_t* payload, uint32_t payload_s,
2122libnet_t *l, libnet_ptag_t ptag);
2123
2141LIBNET_API
2142libnet_ptag_t
2143libnet_build_bgp4_open(uint8_t version, uint16_t src_as, uint16_t hold_time,
2144uint32_t bgp_id, uint8_t opt_len, const uint8_t* payload, uint32_t payload_s,
2145libnet_t *l, libnet_ptag_t ptag);
2146
2163LIBNET_API
2164libnet_ptag_t
2165libnet_build_bgp4_update(uint16_t unfeasible_rt_len, const uint8_t *withdrawn_rt,
2166uint16_t total_path_attr_len, const uint8_t *path_attributes, uint16_t info_len,
2167uint8_t *reachability_info, const uint8_t* payload, uint32_t payload_s,
2168libnet_t *l, libnet_ptag_t ptag);
2169
2183LIBNET_API
2184libnet_ptag_t
2185libnet_build_bgp4_notification(uint8_t err_code, uint8_t err_subcode,
2186const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
2187
2210LIBNET_API
2211libnet_ptag_t
2212libnet_build_sebek(uint32_t magic, uint16_t version, uint16_t type,
2213uint32_t counter, uint32_t time_sec, uint32_t time_usec, uint32_t pid,
2214uint32_t uid, uint32_t fd, uint8_t cmd[SEBEK_CMD_LENGTH], uint32_t length,
2215const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
2216
2237LIBNET_API
2238libnet_ptag_t
2239libnet_build_hsrp(uint8_t version, uint8_t opcode, uint8_t state,
2240uint8_t hello_time, uint8_t hold_time, uint8_t priority, uint8_t group,
2241uint8_t reserved, uint8_t authdata[HSRP_AUTHDATA_LENGTH], uint32_t virtual_ip,
2242const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
2243
2259LIBNET_API
2260libnet_ptag_t
2261libnet_build_link(const uint8_t *dst, const uint8_t *src, const uint8_t *oui, uint16_t type,
2262const uint8_t* payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
2263
2275LIBNET_API
2276libnet_ptag_t
2277libnet_autobuild_link(const uint8_t *dst, const uint8_t *oui, uint16_t type,
2278libnet_t *l);
2279
2293LIBNET_API
2294int
2295libnet_write(libnet_t *l);
2296
2306LIBNET_API
2307uint32_t
2308libnet_get_ipaddr4(libnet_t *l);
2309
2319LIBNET_API
2320struct libnet_in6_addr
2321libnet_get_ipaddr6(libnet_t *l);
2322
2331LIBNET_API
2332struct libnet_ether_addr *
2333libnet_get_hwaddr(libnet_t *l);
2334
2344LIBNET_API
2345uint8_t *
2346libnet_hex_aton(const char *s, int *len);
2347
2352LIBNET_API
2353const char *
2354libnet_version(void);
2355
2372LIBNET_API
2373int
2374libnet_adv_cull_packet(libnet_t *l, uint8_t **packet, uint32_t *packet_s);
2375
2389LIBNET_API
2390int
2391libnet_adv_cull_header(libnet_t *l, libnet_ptag_t ptag, uint8_t **header,
2392uint32_t *header_s);
2393
2408LIBNET_API
2409int
2410libnet_adv_write_link(libnet_t *l, const uint8_t *packet, uint32_t packet_s);
2411
2426LIBNET_API
2427int
2428libnet_adv_write_raw_ipv4(libnet_t *l, const uint8_t *packet, uint32_t packet_s);
2429
2436LIBNET_API
2437void
2438libnet_adv_free_packet(libnet_t *l, uint8_t *packet);
2439
2454int
2455libnet_cq_add(libnet_t *l, char *label);
2456
2472LIBNET_API
2473libnet_t *
2474libnet_cq_remove(libnet_t *l);
2475
2488LIBNET_API
2489libnet_t *
2490libnet_cq_remove_by_label(char *label);
2491
2498LIBNET_API
2499const char *
2500libnet_cq_getlabel(libnet_t *l);
2501
2509LIBNET_API
2510libnet_t *
2511libnet_cq_find_by_label(char *label);
2512
2518LIBNET_API
2519void
2520libnet_cq_destroy(void);
2521
2541LIBNET_API
2542libnet_t *
2543libnet_cq_head(void);
2544
2551LIBNET_API
2552int
2553libnet_cq_last(void);
2554
2560LIBNET_API
2561libnet_t *
2562libnet_cq_next(void);
2563
2569LIBNET_API
2570uint32_t
2571libnet_cq_size(void);
2572
2579LIBNET_API
2580uint32_t
2581libnet_cq_end_loop(void);
2582
2588LIBNET_API
2589void
2590libnet_diag_dump_context(libnet_t *l);
2591
2597LIBNET_API
2598void
2599libnet_diag_dump_pblock(libnet_t *l);
2600
2608LIBNET_API
2609char *
2610libnet_diag_dump_pblock_type(uint8_t type);
2611
2625void
2626libnet_diag_dump_hex(const uint8_t *packet, uint32_t len, int swap, FILE *stream);
2627
2628/*
2629 * [Internal]
2630 */
2631LIBNET_API
2632int
2633libnet_write_raw_ipv4(libnet_t *l, const uint8_t *packet, uint32_t size);
2634
2635/*
2636 * [Internal]
2637 */
2638LIBNET_API
2639int
2640libnet_write_raw_ipv6(libnet_t *l, const uint8_t *packet, uint32_t size);
2641
2642/*
2643 * [Internal]
2644 */
2645LIBNET_API
2646int
2647libnet_write_link(libnet_t *l, const uint8_t *packet, uint32_t size);
2648
2649/*
2650 * [Internal]
2651 */
2652int
2653libnet_open_raw4(libnet_t *l);
2654
2655/*
2656 * [Internal]
2657 */
2658LIBNET_API
2659int
2660libnet_close_raw4(libnet_t *l);
2661
2662/*
2663 * [Internal]
2664 */
2665int
2666libnet_open_raw6(libnet_t *l);
2667
2668/*
2669 * [Internal]
2670 */
2671int
2672libnet_close_raw6(libnet_t *l);
2673
2674/*
2675 * [Internal]
2676 */
2677int
2678libnet_select_device(libnet_t *l);
2679
2680/*
2681 * [Internal]
2682 */
2683int
2684libnet_open_link(libnet_t *l);
2685
2686/*
2687 * [Internal]
2688 */
2689int
2690libnet_close_link(libnet_t *l);
2691
2692/*
2693 * [Internal]
2694 * THIS FUNCTION IS BROKEN. IT WILL SEGFAULT OR CORRUPT MEMORY, OR JUST SILENTLY DO THE
2695 * WRONG THING IF NOT CALLED CORRECTLY, AND CALLING IT CORRECTLY IS UNDOCUMENTED, AND
2696 * ALMOST IMPOSSIBLE. YOU HAVE BEEN WARNED.
2697 */
2698int
2699libnet_do_checksum(libnet_t *l, uint8_t *iphdr, int protocol, int h_len);
2700
2701/* Calculate internet checksums.
2702 *
2703 * IP (TCP, UDP, IGMP, ICMP, etc...) checksums usually need information from
2704 * the IP header to construct the "pseudo header", this function takes a
2705 * pointer to that header, the buffer boundaries, the "h_len" (see pblock_t for
2706 * a description, it is increasingly unused, though, and I'm trying to remove it
2707 * altogether), and the protocol number for the protocol that is to be
2708 * checksummed.
2709 *
2710 * Finding that protocol requires that the IP header be well-formed... so this
2711 * won't work well for invalid packets. But then, what is the valid checksum
2712 * for a invalid packet, anyhow?
2713 *
2714 * This doesn't work well for non-inet checksums, sorry, that's an original design
2715 * flaw. pblock_t needs a pointer in it, to a packet assembly function that can be
2716 * called at runtime to do assembly and checksumming.
2717 */
2718LIBNET_API
2719int
2720libnet_inet_checksum(libnet_t *l, uint8_t *iphdr, int protocol, int h_len, const uint8_t *beg, const uint8_t * end);
2721
2722/*
2723 * [Internal]
2724 */
2725LIBNET_API
2726uint32_t
2727libnet_compute_crc(uint8_t *buf, uint32_t len);
2728
2729/*
2730 * [Internal]
2731 */
2732LIBNET_API
2733uint16_t
2734libnet_ip_check(uint16_t *addr, int len);
2735
2736/*
2737 * [Internal]
2738 */
2739LIBNET_API
2740int
2741libnet_in_cksum(uint16_t *addr, int len);
2742
2743/*
2744 * [Internal]
2745 * If ptag is 0, function will create a pblock for the protocol unit type,
2746 * append it to the list and return a pointer to it. If ptag is not 0,
2747 * function will search the pblock list for the specified protocol block
2748 * and return a pointer to it.
2749 */
2750LIBNET_API
2751libnet_pblock_t *
2752libnet_pblock_probe(libnet_t *l, libnet_ptag_t ptag, uint32_t b_len,
2753uint8_t type);
2754
2755/*
2756 * [Internal]
2757 * Function creates the pblock list if l->protocol_blocks == NULL or appends
2758 * an entry to the doubly linked list.
2759 */
2760LIBNET_API
2761libnet_pblock_t *
2762libnet_pblock_new(libnet_t *l, uint32_t b_len);
2763
2764/*
2765 * [Internal]
2766 * Function swaps two pblocks in memory.
2767 */
2768LIBNET_API
2769int
2770libnet_pblock_swap(libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2);
2771
2772/*
2773 * [Internal]
2774 * Function inserts ptag2 before ptag1 in the doubly linked list.
2775 */
2776LIBNET_API
2777int
2778libnet_pblock_insert_before(libnet_t *l, libnet_ptag_t ptag1,
2779libnet_ptag_t ptag2);
2780
2781/*
2782 * [Internal]
2783 * Function removes a pblock from context
2784 */
2785LIBNET_API
2786void
2787libnet_pblock_delete(libnet_t *l, libnet_pblock_t *p);
2788
2789/*
2790 * [Internal]
2791 * Function updates the pblock meta-information. Internally it updates the
2792 * ptag with a monotonically increasing variable kept in l. This way each
2793 * pblock has a successively increasing ptag identifier.
2794 */
2795LIBNET_API
2796libnet_ptag_t
2797libnet_pblock_update(libnet_t *l, libnet_pblock_t *p, uint32_t h, uint8_t type);
2798
2799
2800/*
2801 * [Internal]
2802 * Function locates a given block by it's ptag.
2803 */
2804LIBNET_API
2805libnet_pblock_t *
2806libnet_pblock_find(libnet_t *l, libnet_ptag_t ptag);
2807
2808/*
2809 * [Internal]
2810 * Function copies protocol block data over.
2811 */
2812LIBNET_API
2813int
2814libnet_pblock_append(libnet_t *l, libnet_pblock_t *p, const void *buf, uint32_t len);
2815
2816/*
2817 * [Internal]
2818 * Function sets pblock flags.
2819 */
2820LIBNET_API
2821void
2822libnet_pblock_setflags(libnet_pblock_t *p, uint8_t flags);
2823
2824/*
2825 * [Internal]
2826 * Function returns the protocol number for the protocol block type. If
2827 * the type is unknown, the function defaults to returning IPPROTO_IP.
2828 */
2829LIBNET_API
2830int
2831libnet_pblock_p2p(uint8_t type);
2832
2833/*
2834 * [Internal]
2835 * Function assembles the protocol blocks into a packet, checksums are
2836 * calculated if that was requested.
2837 */
2838LIBNET_API
2839int
2840libnet_pblock_coalesce(libnet_t *l, uint8_t **packet, uint32_t *size);
2841
2842#if !(__WIN32__)
2843/*
2844 * [Internal]
2845 * By testing if we can retrieve the FLAGS of an interface
2846 * we can know if it exists or not and if it is up.
2847 */
2848int
2849libnet_check_iface(libnet_t *l);
2850#endif
2851
2852#if defined(__WIN32__)
2853/*
2854 * [Internal]
2855 */
2856BYTE *
2857libnet_win32_get_remote_mac(libnet_t *l, DWORD IP);
2858
2859/*
2860 * [Internal]
2861 */
2862int
2863libnet_close_link_interface(libnet_t *l);
2864
2865/*
2866 * [Internal]
2867 */
2868BYTE *
2869libnet_win32_read_arp_table(DWORD IP);
2870#endif
2871#endif /* __LIBNET_FUNCTIONS_H */
2872
libnet_build_egre
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_build_icmpv6_echo
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_in6_is_error
LIBNET_API int libnet_in6_is_error(struct libnet_in6_addr addr)
libnet_seed_prand
LIBNET_API int libnet_seed_prand(libnet_t *l)
libnet_get_ipaddr4
LIBNET_API uint32_t libnet_get_ipaddr4(libnet_t *l)
libnet_build_udp
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_cq_remove_by_label
LIBNET_API libnet_t * libnet_cq_remove_by_label(char *label)
libnet_build_icmpv6_ndp_nadv
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_build_sebek
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_build_ipsec_esp_ftr
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_build_rip
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_plist_chain_dump
LIBNET_API int libnet_plist_chain_dump(libnet_plist_t *plist)
libnet_cq_destroy
LIBNET_API void libnet_cq_destroy(void)
libnet_build_ospfv2_lsr
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_build_udld_sequence_number
LIBNET_API libnet_ptag_t libnet_build_udld_sequence_number(const uint8_t *value, libnet_t *l, libnet_ptag_t ptag)
libnet_build_ipv6_hbhopts
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_build_ipv6_destopts
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_diag_dump_context
LIBNET_API void libnet_diag_dump_context(libnet_t *l)
libnet_build_lldp_org_spec
LIBNET_API libnet_ptag_t libnet_build_lldp_org_spec(const uint8_t *value, const uint16_t value_s, libnet_t *l, libnet_ptag_t ptag)
libnet_cq_add
int libnet_cq_add(libnet_t *l, char *label)
libnet_build_ospfv2_hello
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_build_ipsec_ah
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_build_802_2snap
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_build_ospfv2_lsa_net
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_diag_dump_pblock_type
LIBNET_API char * libnet_diag_dump_pblock_type(uint8_t type)
libnet_build_ipv4
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_getfd
LIBNET_API int libnet_getfd(libnet_t *l)
libnet_build_udld_timeout_interval
LIBNET_API libnet_ptag_t libnet_build_udld_timeout_interval(const uint8_t *value, libnet_t *l, libnet_ptag_t ptag)
libnet_build_dhcpv4
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_adv_write_raw_ipv4
LIBNET_API int libnet_adv_write_raw_ipv4(libnet_t *l, const uint8_t *packet, uint32_t packet_s)
libnet_autobuild_fddi
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_write
LIBNET_API int libnet_write(libnet_t *l)
libnet_build_bgp4_header
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_build_gre
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_build_ospfv2
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_diag_dump_pblock
LIBNET_API void libnet_diag_dump_pblock(libnet_t *l)
libnet_build_icmpv4_echo
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_build_rpc_call
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_build_bgp4_open
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_build_token_ring
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_build_icmpv4_timeexceed
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_addr2name4
LIBNET_API char * libnet_addr2name4(uint32_t in, uint8_t use_name)
libnet_build_ipv6
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_addr2name6_r
LIBNET_API void libnet_addr2name6_r(struct libnet_in6_addr addr, uint8_t use_name, char *host_name, int host_name_len)
libnet_build_mpls
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_build_bootpv4
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_build_dnsv4
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_plist_chain_free
LIBNET_API int libnet_plist_chain_free(libnet_plist_t *plist)
libnet_build_vrrp
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_cq_head
LIBNET_API libnet_t * libnet_cq_head(void)
libnet_build_udld_echo
LIBNET_API libnet_ptag_t libnet_build_udld_echo(const uint8_t *value, const uint8_t value_s, libnet_t *l, libnet_ptag_t ptag)
libnet_build_ospfv2_lsu
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_autobuild_ipv6
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_getgre_length
LIBNET_API uint32_t libnet_getgre_length(uint16_t fv)
libnet_name2addr4
LIBNET_API uint32_t libnet_name2addr4(libnet_t *l, const char *host_name, uint8_t use_name)
libnet_cq_end_loop
LIBNET_API uint32_t libnet_cq_end_loop(void)
libnet_build_ospfv2_lsa_rtr
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_build_udld_device_name
LIBNET_API libnet_ptag_t libnet_build_udld_device_name(const uint8_t *value, const uint8_t value_s, libnet_t *l, libnet_ptag_t ptag)
libnet_autobuild_ipv4
LIBNET_API libnet_ptag_t libnet_autobuild_ipv4(uint16_t len, uint8_t prot, uint32_t dst, libnet_t *l)
libnet_build_lldp_end
LIBNET_API libnet_ptag_t libnet_build_lldp_end(libnet_t *l, libnet_ptag_t ptag)
libnet_getdevice
LIBNET_API const char * libnet_getdevice(libnet_t *l)
libnet_getpbuf_size
LIBNET_API uint32_t libnet_getpbuf_size(libnet_t *l, libnet_ptag_t ptag)
libnet_geterror
LIBNET_API char * libnet_geterror(libnet_t *l)
libnet_autobuild_ethernet
LIBNET_API libnet_ptag_t libnet_autobuild_ethernet(const uint8_t *dst, uint16_t type, libnet_t *l)
libnet_build_icmpv4_redirect
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_build_802_2
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_build_udld_message_interval
LIBNET_API libnet_ptag_t libnet_build_udld_message_interval(const uint8_t *value, libnet_t *l, libnet_ptag_t ptag)
libnet_build_ospfv2_lsa
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_build_lldp_ttl
LIBNET_API libnet_ptag_t libnet_build_lldp_ttl(const uint16_t ttl, libnet_t *l, libnet_ptag_t ptag)
libnet_get_ipaddr6
LIBNET_API struct libnet_in6_addr libnet_get_ipaddr6(libnet_t *l)
libnet_cq_last
LIBNET_API int libnet_cq_last(void)
libnet_build_ipv6_routing
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_build_icmpv4_unreach
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_build_icmpv6_unreach
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_build_bgp4_update
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_autobuild_link
LIBNET_API libnet_ptag_t libnet_autobuild_link(const uint8_t *dst, const uint8_t *oui, uint16_t type, libnet_t *l)
libnet_destroy
LIBNET_API void libnet_destroy(libnet_t *l)
libnet_stats
LIBNET_API void libnet_stats(libnet_t *l, struct libnet_stats *ls)
libnet_build_ospfv2_lsa_as
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_build_stp_tcn
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_build_icmpv4_timestamp
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_adv_free_packet
LIBNET_API void libnet_adv_free_packet(libnet_t *l, uint8_t *packet)
libnet_cq_getlabel
LIBNET_API const char * libnet_cq_getlabel(libnet_t *l)
libnet_clear_packet
LIBNET_API void libnet_clear_packet(libnet_t *l)
libnet_build_udld_device_id
LIBNET_API libnet_ptag_t libnet_build_udld_device_id(const uint8_t *value, const uint8_t value_s, libnet_t *l, libnet_ptag_t ptag)
libnet_build_link
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_build_udld_port_id
LIBNET_API libnet_ptag_t libnet_build_udld_port_id(const uint8_t *value, const uint8_t value_s, libnet_t *l, libnet_ptag_t ptag)
libnet_build_ipv6_frag
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_build_ospfv2_dbd
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_adv_cull_packet
LIBNET_API int libnet_adv_cull_packet(libnet_t *l, uint8_t **packet, uint32_t *packet_s)
libnet_build_icmpv6_ndp_nsol
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_build_ipv4_options
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_build_data
LIBNET_API libnet_ptag_t libnet_build_data(const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_build_lldp_chassis
LIBNET_API libnet_ptag_t libnet_build_lldp_chassis(const uint8_t subtype, const uint8_t *value, const uint8_t value_s, libnet_t *l, libnet_ptag_t ptag)
libnet_adv_cull_header
LIBNET_API int libnet_adv_cull_header(libnet_t *l, libnet_ptag_t ptag, uint8_t **header, uint32_t *header_s)
libnet_build_ospfv2_hello_neighbor
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_plist_chain_new
LIBNET_API int libnet_plist_chain_new(libnet_t *l, libnet_plist_t **plist, char *token_list)
libnet_build_802_1x
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_hex_aton
LIBNET_API uint8_t * libnet_hex_aton(const char *s, int *len)
libnet_build_icmpv4_mask
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_build_arp
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_build_802_3
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_build_fddi
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_autobuild_arp
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_build_hsrp
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_plist_chain_next_pair
LIBNET_API int libnet_plist_chain_next_pair(libnet_plist_t *plist, uint16_t *bport, uint16_t *eport)
libnet_autobuild_token_ring
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_build_ethernet
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_build_802_1q
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_adv_write_link
LIBNET_API int libnet_adv_write_link(libnet_t *l, const uint8_t *packet, uint32_t packet_s)
libnet_build_tcp
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_version
LIBNET_API const char * libnet_version(void)
libnet_getpacket_size
LIBNET_API uint32_t libnet_getpacket_size(libnet_t *l)
libnet_build_stp_conf
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_build_ipsec_esp_hdr
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_get_hwaddr
LIBNET_API struct libnet_ether_addr * libnet_get_hwaddr(libnet_t *l)
libnet_diag_dump_hex
void libnet_diag_dump_hex(const uint8_t *packet, uint32_t len, int swap, FILE *stream)
libnet_cq_remove
LIBNET_API libnet_t * libnet_cq_remove(libnet_t *l)
libnet_plist_chain_dump_string
LIBNET_API char * libnet_plist_chain_dump_string(libnet_plist_t *plist)
libnet_getpbuf
LIBNET_API uint8_t * libnet_getpbuf(libnet_t *l, libnet_ptag_t ptag)
libnet_init
LIBNET_API libnet_t * libnet_init(int injection_type, const char *device, char *err_buf)
libnet_cq_size
LIBNET_API uint32_t libnet_cq_size(void)
libnet_cq_next
LIBNET_API libnet_t * libnet_cq_next(void)
libnet_get_prand
LIBNET_API uint32_t libnet_get_prand(int mod)
libnet_build_gre_sre
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_build_gre_last_sre
LIBNET_API libnet_ptag_t libnet_build_gre_last_sre(libnet_t *l, libnet_ptag_t ptag)
libnet_build_ospfv2_lsa_sum
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_build_lldp_port
LIBNET_API libnet_ptag_t libnet_build_lldp_port(const uint8_t subtype, const uint8_t *value, const uint8_t value_s, libnet_t *l, libnet_ptag_t ptag)
libnet_build_tcp_options
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_build_icmpv6_ndp_opt
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_build_cdp
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_toggle_checksum
LIBNET_API int libnet_toggle_checksum(libnet_t *l, libnet_ptag_t ptag, int mode)
libnet_build_udld_hdr
LIBNET_API libnet_ptag_t libnet_build_udld_hdr(uint8_t version, uint8_t opcode, uint8_t flags, uint8_t checksum, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_build_ntp
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_name2addr6
LIBNET_API struct libnet_in6_addr libnet_name2addr6(libnet_t *l, const char *host_name, uint8_t use_name)
libnet_cq_find_by_label
LIBNET_API libnet_t * libnet_cq_find_by_label(char *label)
libnet_build_igmp
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_build_isl
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_build_bgp4_notification
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)