Annotation of embedaddon/libnet/doc/man/man3/libnet-functions.3, revision 1.1.1.1
1.1 misho 1: .TH "libnet-functions.h" 3 "Tue Oct 15 2019" "libnet-1.2" "libnet Programmers Guide" \" -*- nroff -*-
2: .ad l
3: .nh
4: .SH NAME
5: libnet-functions.h \- libnet exported function prototypes
6:
7: .SH SYNOPSIS
8: .br
9: .PP
10: .SS "Functions"
11:
12: .in +1c
13: .ti -1c
14: .RI "LIBNET_API libnet_t * \fBlibnet_init\fP (int injection_type, const char *device, char *err_buf)"
15: .br
16: .ti -1c
17: .RI "LIBNET_API void \fBlibnet_destroy\fP (libnet_t *l)"
18: .br
19: .ti -1c
20: .RI "LIBNET_API void \fBlibnet_clear_packet\fP (libnet_t *l)"
21: .br
22: .ti -1c
23: .RI "LIBNET_API void \fBlibnet_stats\fP (libnet_t *l, struct libnet_stats *ls)"
24: .br
25: .ti -1c
26: .RI "LIBNET_API int \fBlibnet_getfd\fP (libnet_t *l)"
27: .br
28: .ti -1c
29: .RI "LIBNET_API const char * \fBlibnet_getdevice\fP (libnet_t *l)"
30: .br
31: .ti -1c
32: .RI "LIBNET_API uint8_t * \fBlibnet_getpbuf\fP (libnet_t *l, libnet_ptag_t ptag)"
33: .br
34: .ti -1c
35: .RI "LIBNET_API uint32_t \fBlibnet_getpbuf_size\fP (libnet_t *l, libnet_ptag_t ptag)"
36: .br
37: .ti -1c
38: .RI "LIBNET_API char * \fBlibnet_geterror\fP (libnet_t *l)"
39: .br
40: .ti -1c
41: .RI "LIBNET_API uint32_t \fBlibnet_getpacket_size\fP (libnet_t *l)"
42: .br
43: .ti -1c
44: .RI "LIBNET_API int \fBlibnet_seed_prand\fP (libnet_t *l)"
45: .br
46: .ti -1c
47: .RI "LIBNET_API uint32_t \fBlibnet_get_prand\fP (int mod)"
48: .br
49: .ti -1c
50: .RI "LIBNET_API int \fBlibnet_toggle_checksum\fP (libnet_t *l, libnet_ptag_t ptag, int mode)"
51: .br
52: .ti -1c
53: .RI "LIBNET_API char * \fBlibnet_addr2name4\fP (uint32_t in, uint8_t use_name)"
54: .br
55: .ti -1c
56: .RI "LIBNET_API uint32_t \fBlibnet_name2addr4\fP (libnet_t *l, const char *host_name, uint8_t use_name)"
57: .br
58: .ti -1c
59: .RI "LIBNET_API int \fBlibnet_in6_is_error\fP (struct libnet_in6_addr addr)"
60: .br
61: .ti -1c
62: .RI "LIBNET_API struct libnet_in6_addr \fBlibnet_name2addr6\fP (libnet_t *l, const char *host_name, uint8_t use_name)"
63: .br
64: .ti -1c
65: .RI "LIBNET_API void \fBlibnet_addr2name6_r\fP (struct libnet_in6_addr addr, uint8_t use_name, char *host_name, int host_name_len)"
66: .br
67: .ti -1c
68: .RI "LIBNET_API int \fBlibnet_plist_chain_new\fP (libnet_t *l, libnet_plist_t **plist, char *token_list)"
69: .br
70: .ti -1c
71: .RI "LIBNET_API int \fBlibnet_plist_chain_next_pair\fP (libnet_plist_t *plist, uint16_t *bport, uint16_t *eport)"
72: .br
73: .ti -1c
74: .RI "LIBNET_API int \fBlibnet_plist_chain_dump\fP (libnet_plist_t *plist)"
75: .br
76: .ti -1c
77: .RI "LIBNET_API char * \fBlibnet_plist_chain_dump_string\fP (libnet_plist_t *plist)"
78: .br
79: .ti -1c
80: .RI "LIBNET_API int \fBlibnet_plist_chain_free\fP (libnet_plist_t *plist)"
81: .br
82: .ti -1c
83: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_802_1q\fP (const uint8_t *dst, const uint8_t *src, uint16_t tpi, uint8_t priority, uint8_t cfi, uint16_t vlan_id, uint16_t len_proto, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
84: .br
85: .ti -1c
86: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_802_1x\fP (uint8_t eap_ver, uint8_t eap_type, uint16_t length, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
87: .br
88: .ti -1c
89: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_802_2\fP (uint8_t dsap, uint8_t ssap, uint8_t control, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
90: .br
91: .ti -1c
92: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_802_2snap\fP (uint8_t dsap, uint8_t ssap, uint8_t control, uint8_t *oui, uint16_t type, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
93: .br
94: .ti -1c
95: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_802_3\fP (const uint8_t *dst, const uint8_t *src, uint16_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
96: .br
97: .ti -1c
98: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ethernet\fP (const uint8_t *dst, const uint8_t *src, uint16_t type, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
99: .br
100: .ti -1c
101: .RI "LIBNET_API libnet_ptag_t \fBlibnet_autobuild_ethernet\fP (const uint8_t *dst, uint16_t type, libnet_t *l)"
102: .br
103: .ti -1c
104: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_fddi\fP (uint8_t fc, const uint8_t *dst, const uint8_t *src, uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t *oui, uint16_t type, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
105: .br
106: .ti -1c
107: .RI "LIBNET_API libnet_ptag_t \fBlibnet_autobuild_fddi\fP (uint8_t fc, const uint8_t *dst, uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t *oui, uint16_t type, libnet_t *l)"
108: .br
109: .ti -1c
110: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_arp\fP (uint16_t hrd, uint16_t pro, uint8_t hln, uint8_t pln, uint16_t op, const uint8_t *sha, const uint8_t *spa, const uint8_t *tha, const uint8_t *tpa, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
111: .br
112: .ti -1c
113: .RI "LIBNET_API libnet_ptag_t \fBlibnet_autobuild_arp\fP (uint16_t op, const uint8_t *sha, const uint8_t *spa, const uint8_t *tha, const uint8_t *tpa, libnet_t *l)"
114: .br
115: .ti -1c
116: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_tcp\fP (uint16_t sp, uint16_t dp, uint32_t seq, uint32_t ack, uint8_t control, uint16_t win, uint16_t sum, uint16_t urg, uint16_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
117: .br
118: .ti -1c
119: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_tcp_options\fP (const uint8_t *options, uint32_t options_s, libnet_t *l, libnet_ptag_t ptag)"
120: .br
121: .ti -1c
122: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_udp\fP (uint16_t sp, uint16_t dp, uint16_t len, uint16_t sum, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
123: .br
124: .ti -1c
125: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_cdp\fP (uint8_t version, uint8_t ttl, uint16_t sum, uint16_t type, uint16_t value_s, const uint8_t *value, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
126: .br
127: .ti -1c
128: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_icmpv4_echo\fP (uint8_t type, uint8_t code, uint16_t sum, uint16_t id, uint16_t seq, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
129: .br
130: .ti -1c
131: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_icmpv4_mask\fP (uint8_t type, uint8_t code, uint16_t sum, uint16_t id, uint16_t seq, uint32_t mask, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
132: .br
133: .ti -1c
134: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_icmpv4_unreach\fP (uint8_t type, uint8_t code, uint16_t sum, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
135: .br
136: .ti -1c
137: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_icmpv4_redirect\fP (uint8_t type, uint8_t code, uint16_t sum, uint32_t gateway, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
138: .br
139: .ti -1c
140: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_icmpv4_timeexceed\fP (uint8_t type, uint8_t code, uint16_t sum, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
141: .br
142: .ti -1c
143: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_icmpv4_timestamp\fP (uint8_t type, uint8_t code, uint16_t sum, uint16_t id, uint16_t seq, uint32_t otime, uint32_t rtime, uint32_t ttime, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
144: .br
145: .ti -1c
146: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_icmpv6_echo\fP (uint8_t type, uint8_t code, uint16_t sum, uint16_t id, uint16_t seq, uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
147: .br
148: .ti -1c
149: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_icmpv6_unreach\fP (uint8_t type, uint8_t code, uint16_t sum, uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
150: .br
151: .ti -1c
152: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_icmpv6_ndp_nsol\fP (uint8_t type, uint8_t code, uint16_t sum, struct libnet_in6_addr target, uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
153: .br
154: .ti -1c
155: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_icmpv6_ndp_nadv\fP (uint8_t type, uint8_t code, uint16_t sum, uint32_t flags, struct libnet_in6_addr target, uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
156: .br
157: .ti -1c
158: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_icmpv6_ndp_opt\fP (uint8_t type, uint8_t *option, uint32_t option_s, libnet_t *l, libnet_ptag_t ptag)"
159: .br
160: .ti -1c
161: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_igmp\fP (uint8_t type, uint8_t reserved, uint16_t sum, uint32_t ip, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
162: .br
163: .ti -1c
164: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ipv4\fP (uint16_t ip_len, uint8_t tos, uint16_t id, uint16_t frag, uint8_t ttl, uint8_t prot, uint16_t sum, uint32_t src, uint32_t dst, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
165: .br
166: .ti -1c
167: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ipv4_options\fP (const uint8_t *options, uint32_t options_s, libnet_t *l, libnet_ptag_t ptag)"
168: .br
169: .ti -1c
170: .RI "LIBNET_API libnet_ptag_t \fBlibnet_autobuild_ipv4\fP (uint16_t len, uint8_t prot, uint32_t dst, libnet_t *l)"
171: .br
172: .ti -1c
173: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ipv6\fP (uint8_t tc, uint32_t fl, uint16_t len, uint8_t nh, uint8_t hl, struct libnet_in6_addr src, struct libnet_in6_addr dst, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
174: .br
175: .ti -1c
176: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ipv6_frag\fP (uint8_t nh, uint8_t reserved, uint16_t frag, uint32_t id, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
177: .br
178: .ti -1c
179: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ipv6_routing\fP (uint8_t nh, uint8_t len, uint8_t rtype, uint8_t segments, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
180: .br
181: .ti -1c
182: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ipv6_destopts\fP (uint8_t nh, uint8_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
183: .br
184: .ti -1c
185: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ipv6_hbhopts\fP (uint8_t nh, uint8_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
186: .br
187: .ti -1c
188: .RI "LIBNET_API libnet_ptag_t \fBlibnet_autobuild_ipv6\fP (uint16_t len, uint8_t nh, struct libnet_in6_addr dst, libnet_t *l, libnet_ptag_t ptag)"
189: .br
190: .ti -1c
191: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_isl\fP (uint8_t *dhost, uint8_t type, uint8_t user, uint8_t *shost, uint16_t len, const uint8_t *snap, uint16_t vid, uint16_t portindex, uint16_t reserved, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
192: .br
193: .ti -1c
194: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ipsec_esp_hdr\fP (uint32_t spi, uint32_t seq, uint32_t iv, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
195: .br
196: .ti -1c
197: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ipsec_esp_ftr\fP (uint8_t len, uint8_t nh, int8_t *auth, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
198: .br
199: .ti -1c
200: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ipsec_ah\fP (uint8_t nh, uint8_t len, uint16_t res, uint32_t spi, uint32_t seq, uint32_t auth, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
201: .br
202: .ti -1c
203: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_dnsv4\fP (uint16_t h_len, uint16_t id, uint16_t flags, uint16_t num_q, uint16_t num_anws_rr, uint16_t num_auth_rr, uint16_t num_addi_rr, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
204: .br
205: .ti -1c
206: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_rip\fP (uint8_t cmd, uint8_t version, uint16_t rd, uint16_t af, uint16_t rt, uint32_t addr, uint32_t mask, uint32_t next_hop, uint32_t metric, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
207: .br
208: .ti -1c
209: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_rpc_call\fP (uint32_t rm, uint32_t xid, uint32_t prog_num, uint32_t prog_vers, uint32_t procedure, uint32_t cflavor, uint32_t clength, uint8_t *cdata, uint32_t vflavor, uint32_t vlength, const uint8_t *vdata, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
210: .br
211: .ti -1c
212: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_stp_conf\fP (uint16_t id, uint8_t version, uint8_t bpdu_type, uint8_t flags, const uint8_t *root_id, uint32_t root_pc, const uint8_t *bridge_id, uint16_t port_id, uint16_t message_age, uint16_t max_age, uint16_t hello_time, uint16_t f_delay, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
213: .br
214: .ti -1c
215: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_stp_tcn\fP (uint16_t id, uint8_t version, uint8_t bpdu_type, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
216: .br
217: .ti -1c
218: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_token_ring\fP (uint8_t ac, uint8_t fc, const uint8_t *dst, const uint8_t *src, uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t *oui, uint16_t type, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
219: .br
220: .ti -1c
221: .RI "LIBNET_API libnet_ptag_t \fBlibnet_autobuild_token_ring\fP (uint8_t ac, uint8_t fc, const uint8_t *dst, uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t *oui, uint16_t type, libnet_t *l)"
222: .br
223: .ti -1c
224: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_vrrp\fP (uint8_t version, uint8_t type, uint8_t vrouter_id, uint8_t priority, uint8_t ip_count, uint8_t auth_type, uint8_t advert_int, uint16_t sum, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
225: .br
226: .ti -1c
227: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_mpls\fP (uint32_t label, uint8_t experimental, uint8_t bos, uint8_t ttl, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
228: .br
229: .ti -1c
230: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ntp\fP (uint8_t leap_indicator, uint8_t version, uint8_t mode, uint8_t stratum, uint8_t poll, uint8_t precision, uint16_t delay_int, uint16_t delay_frac, uint16_t dispersion_int, uint16_t dispersion_frac, uint32_t reference_id, uint32_t ref_ts_int, uint32_t ref_ts_frac, uint32_t orig_ts_int, uint32_t orig_ts_frac, uint32_t rec_ts_int, uint32_t rec_ts_frac, uint32_t xmt_ts_int, uint32_t xmt_ts_frac, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
231: .br
232: .ti -1c
233: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ospfv2\fP (uint16_t len, uint8_t type, uint32_t rtr_id, uint32_t area_id, uint16_t sum, uint16_t autype, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
234: .br
235: .ti -1c
236: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ospfv2_hello\fP (uint32_t netmask, uint16_t interval, uint8_t opts, uint8_t priority, uint32_t dead_int, uint32_t des_rtr, uint32_t bkup_rtr, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
237: .br
238: .ti -1c
239: .RI "libnet_ptag_t \fBlibnet_build_ospfv2_hello_neighbor\fP (uint32_t netmask, uint16_t interval, uint8_t opts, uint8_t priority, uint32_t dead_int, uint32_t des_rtr, uint32_t bkup_rtr, uint32_t neighbor, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
240: .br
241: .ti -1c
242: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ospfv2_dbd\fP (uint16_t dgram_len, uint8_t opts, uint8_t type, uint32_t seqnum, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
243: .br
244: .ti -1c
245: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ospfv2_lsr\fP (uint32_t type, uint32_t lsid, uint32_t advrtr, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
246: .br
247: .ti -1c
248: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ospfv2_lsu\fP (uint32_t num, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
249: .br
250: .ti -1c
251: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ospfv2_lsa\fP (uint16_t age, uint8_t opts, uint8_t type, uint32_t lsid, uint32_t advrtr, uint32_t seqnum, uint16_t sum, uint16_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
252: .br
253: .ti -1c
254: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ospfv2_lsa_rtr\fP (uint16_t flags, uint16_t num, uint32_t id, uint32_t data, uint8_t type, uint8_t tos, uint16_t metric, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
255: .br
256: .ti -1c
257: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ospfv2_lsa_net\fP (uint32_t nmask, uint32_t rtrid, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
258: .br
259: .ti -1c
260: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ospfv2_lsa_sum\fP (uint32_t nmask, uint32_t metric, uint32_t tos, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
261: .br
262: .ti -1c
263: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_ospfv2_lsa_as\fP (uint32_t nmask, uint32_t metric, uint32_t fwdaddr, uint32_t tag, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
264: .br
265: .ti -1c
266: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_data\fP (const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
267: .br
268: .ti -1c
269: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_dhcpv4\fP (uint8_t opcode, uint8_t htype, uint8_t hlen, uint8_t hopcount, uint32_t xid, uint16_t secs, uint16_t flags, uint32_t cip, uint32_t yip, uint32_t sip, uint32_t gip, const uint8_t *chaddr, const char *sname, const char *file, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
270: .br
271: .ti -1c
272: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_bootpv4\fP (uint8_t opcode, uint8_t htype, uint8_t hlen, uint8_t hopcount, uint32_t xid, uint16_t secs, uint16_t flags, uint32_t cip, uint32_t yip, uint32_t sip, uint32_t gip, const uint8_t *chaddr, const char *sname, const char *file, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
273: .br
274: .ti -1c
275: .RI "LIBNET_API uint32_t \fBlibnet_getgre_length\fP (uint16_t fv)"
276: .br
277: .ti -1c
278: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_gre\fP (uint16_t fv, uint16_t type, uint16_t sum, uint16_t offset, uint32_t key, uint32_t seq, uint16_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
279: .br
280: .ti -1c
281: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_egre\fP (uint16_t fv, uint16_t type, uint16_t sum, uint16_t offset, uint32_t key, uint32_t seq, uint16_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
282: .br
283: .ti -1c
284: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_gre_sre\fP (uint16_t af, uint8_t offset, uint8_t length, uint8_t *routing, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
285: .br
286: .ti -1c
287: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_gre_last_sre\fP (libnet_t *l, libnet_ptag_t ptag)"
288: .br
289: .ti -1c
290: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_bgp4_header\fP (uint8_t marker[LIBNET_BGP4_MARKER_SIZE], uint16_t len, uint8_t type, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
291: .br
292: .ti -1c
293: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_bgp4_open\fP (uint8_t version, uint16_t src_as, uint16_t hold_time, uint32_t bgp_id, uint8_t opt_len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
294: .br
295: .ti -1c
296: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_bgp4_update\fP (uint16_t unfeasible_rt_len, const uint8_t *withdrawn_rt, uint16_t total_path_attr_len, const uint8_t *path_attributes, uint16_t info_len, uint8_t *reachability_info, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
297: .br
298: .ti -1c
299: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_bgp4_notification\fP (uint8_t err_code, uint8_t err_subcode, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
300: .br
301: .ti -1c
302: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_sebek\fP (uint32_t magic, uint16_t version, uint16_t type, uint32_t counter, uint32_t time_sec, uint32_t time_usec, uint32_t pid, uint32_t uid, uint32_t fd, uint8_t cmd[SEBEK_CMD_LENGTH], uint32_t length, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
303: .br
304: .ti -1c
305: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_hsrp\fP (uint8_t version, uint8_t opcode, uint8_t state, uint8_t hello_time, uint8_t hold_time, uint8_t priority, uint8_t group, uint8_t reserved, uint8_t authdata[HSRP_AUTHDATA_LENGTH], uint32_t virtual_ip, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
306: .br
307: .ti -1c
308: .RI "LIBNET_API libnet_ptag_t \fBlibnet_build_link\fP (const uint8_t *dst, const uint8_t *src, const uint8_t *oui, uint16_t type, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
309: .br
310: .ti -1c
311: .RI "LIBNET_API libnet_ptag_t \fBlibnet_autobuild_link\fP (const uint8_t *dst, const uint8_t *oui, uint16_t type, libnet_t *l)"
312: .br
313: .ti -1c
314: .RI "LIBNET_API int \fBlibnet_write\fP (libnet_t *l)"
315: .br
316: .ti -1c
317: .RI "LIBNET_API uint32_t \fBlibnet_get_ipaddr4\fP (libnet_t *l)"
318: .br
319: .ti -1c
320: .RI "LIBNET_API struct libnet_in6_addr \fBlibnet_get_ipaddr6\fP (libnet_t *l)"
321: .br
322: .ti -1c
323: .RI "LIBNET_API struct libnet_ether_addr * \fBlibnet_get_hwaddr\fP (libnet_t *l)"
324: .br
325: .ti -1c
326: .RI "LIBNET_API uint8_t * \fBlibnet_hex_aton\fP (const char *s, int *len)"
327: .br
328: .ti -1c
329: .RI "LIBNET_API const char * \fBlibnet_version\fP (void)"
330: .br
331: .ti -1c
332: .RI "LIBNET_API int \fBlibnet_adv_cull_packet\fP (libnet_t *l, uint8_t **packet, uint32_t *packet_s)"
333: .br
334: .ti -1c
335: .RI "LIBNET_API int \fBlibnet_adv_cull_header\fP (libnet_t *l, libnet_ptag_t ptag, uint8_t **header, uint32_t *header_s)"
336: .br
337: .ti -1c
338: .RI "LIBNET_API int \fBlibnet_adv_write_link\fP (libnet_t *l, const uint8_t *packet, uint32_t packet_s)"
339: .br
340: .ti -1c
341: .RI "LIBNET_API int \fBlibnet_adv_write_raw_ipv4\fP (libnet_t *l, const uint8_t *packet, uint32_t packet_s)"
342: .br
343: .ti -1c
344: .RI "LIBNET_API void \fBlibnet_adv_free_packet\fP (libnet_t *l, uint8_t *packet)"
345: .br
346: .ti -1c
347: .RI "int \fBlibnet_cq_add\fP (libnet_t *l, char *label)"
348: .br
349: .ti -1c
350: .RI "LIBNET_API libnet_t * \fBlibnet_cq_remove\fP (libnet_t *l)"
351: .br
352: .ti -1c
353: .RI "LIBNET_API libnet_t * \fBlibnet_cq_remove_by_label\fP (char *label)"
354: .br
355: .ti -1c
356: .RI "LIBNET_API const char * \fBlibnet_cq_getlabel\fP (libnet_t *l)"
357: .br
358: .ti -1c
359: .RI "LIBNET_API libnet_t * \fBlibnet_cq_find_by_label\fP (char *label)"
360: .br
361: .ti -1c
362: .RI "LIBNET_API void \fBlibnet_cq_destroy\fP (void)"
363: .br
364: .ti -1c
365: .RI "LIBNET_API libnet_t * \fBlibnet_cq_head\fP (void)"
366: .br
367: .ti -1c
368: .RI "LIBNET_API int \fBlibnet_cq_last\fP (void)"
369: .br
370: .ti -1c
371: .RI "LIBNET_API libnet_t * \fBlibnet_cq_next\fP (void)"
372: .br
373: .ti -1c
374: .RI "LIBNET_API uint32_t \fBlibnet_cq_size\fP (void)"
375: .br
376: .ti -1c
377: .RI "LIBNET_API uint32_t \fBlibnet_cq_end_loop\fP (void)"
378: .br
379: .ti -1c
380: .RI "LIBNET_API void \fBlibnet_diag_dump_context\fP (libnet_t *l)"
381: .br
382: .ti -1c
383: .RI "LIBNET_API void \fBlibnet_diag_dump_pblock\fP (libnet_t *l)"
384: .br
385: .ti -1c
386: .RI "LIBNET_API char * \fBlibnet_diag_dump_pblock_type\fP (uint8_t type)"
387: .br
388: .ti -1c
389: .RI "void \fBlibnet_diag_dump_hex\fP (const uint8_t *packet, uint32_t len, int swap, FILE *stream)"
390: .br
391: .in -1c
392: .SH "Detailed Description"
393: .PP
394: libnet exported function prototypes
395:
396:
397: .SH "Function Documentation"
398: .PP
399: .SS "LIBNET_API char* libnet_addr2name4 (uint32_t in, uint8_t use_name)"
400: Takes a network byte ordered IPv4 address and returns a pointer to either a canonical DNS name (if it has one) or a string of dotted decimals\&. This may incur a DNS lookup if the hostname and mode is set to LIBNET_RESOLVE\&. If mode is set to LIBNET_DONT_RESOLVE, no DNS lookup will be performed and the function will return a pointer to a dotted decimal string\&. The function cannot fail -- if no canonical name exists, it will fall back on returning a dotted decimal string\&. This function is non-reentrant\&.
401: .PP
402: \fBParameters:\fP
403: .RS 4
404: \fIin\fP network byte ordered IPv4 address
405: .br
406: \fIuse_name\fP LIBNET_RESOLVE or LIBNET_DONT_RESOLVE
407: .RE
408: .PP
409: \fBReturns:\fP
410: .RS 4
411: a pointer to presentation format string
412: .RE
413: .PP
414:
415: .SS "LIBNET_API void libnet_addr2name6_r (struct libnet_in6_addr addr, uint8_t use_name, char * host_name, int host_name_len)"
416: Should document this baby right here\&.
417: .SS "LIBNET_API int libnet_adv_cull_header (libnet_t * l, libnet_ptag_t ptag, uint8_t ** header, uint32_t * header_s)"
418: [Advanced Interface] Pulls the header from the specified ptag from the given libnet context\&. This function is part of the advanced interface and is only available when libnet is initialized in advanced mode\&. If the function fails \fBlibnet_geterror()\fP can tell you why\&.
419: .PP
420: \fBParameters:\fP
421: .RS 4
422: \fIl\fP pointer to a libnet context
423: .br
424: \fIptag\fP the ptag referencing the header to pull
425: .br
426: \fIheader\fP will contain the header
427: .br
428: \fIheader_s\fP will contain the header size
429: .RE
430: .PP
431: \fBReturn values:\fP
432: .RS 4
433: \fI1\fP on success
434: .br
435: \fI-1\fP on failure
436: .RE
437: .PP
438:
439: .SS "LIBNET_API int libnet_adv_cull_packet (libnet_t * l, uint8_t ** packet, uint32_t * packet_s)"
440: [Advanced Interface] Yanks a prebuilt, wire-ready packet from the given libnet context\&. If libnet was configured to do so (which it is by default) the packet will have all checksums written in\&. This function is part of the advanced interface and is only available when libnet is initialized in advanced mode\&. It is important to note that the function performs an implicit malloc() and a corresponding call to \fBlibnet_adv_free_packet()\fP should be made to free the memory packet occupies\&. If the function fails \fBlibnet_geterror()\fP can tell you why\&.
441: .PP
442: \fBParameters:\fP
443: .RS 4
444: \fIl\fP pointer to a libnet context
445: .br
446: \fIpacket\fP will contain the wire-ready packet
447: .br
448: \fIpacket_s\fP will contain the packet size
449: .RE
450: .PP
451: \fBReturn values:\fP
452: .RS 4
453: \fI1\fP on success
454: .br
455: \fI-1\fP on failure
456: .RE
457: .PP
458:
459: .SS "LIBNET_API void libnet_adv_free_packet (libnet_t * l, uint8_t * packet)"
460: [Advanced Interface] Frees the memory allocated when \fBlibnet_adv_cull_packet()\fP is called\&.
461: .PP
462: \fBParameters:\fP
463: .RS 4
464: \fIl\fP pointer to a libnet context
465: .br
466: \fIpacket\fP a pointer to the packet to free
467: .RE
468: .PP
469:
470: .SS "LIBNET_API int libnet_adv_write_link (libnet_t * l, const uint8_t * packet, uint32_t packet_s)"
471: [Advanced Interface] Writes a packet the network at the link layer\&. This function is useful to write a packet that has been constructed by hand by the application programmer or, more commonly, to write a packet that has been returned by a call to \fBlibnet_adv_cull_packet()\fP\&. This function is part of the advanced interface and is only available when libnet is initialized in advanced mode\&. If the function fails \fBlibnet_geterror()\fP can tell you why\&.
472: .PP
473: \fBParameters:\fP
474: .RS 4
475: \fIl\fP pointer to a libnet context
476: .br
477: \fIpacket\fP a pointer to the packet to inject
478: .br
479: \fIpacket_s\fP the size of the packet
480: .RE
481: .PP
482: \fBReturns:\fP
483: .RS 4
484: the number of bytes written
485: .RE
486: .PP
487: \fBReturn values:\fP
488: .RS 4
489: \fI-1\fP on failure
490: .RE
491: .PP
492:
493: .SS "LIBNET_API int libnet_adv_write_raw_ipv4 (libnet_t * l, const uint8_t * packet, uint32_t packet_s)"
494: [Advanced Interface] Writes a packet the network at the raw socket layer\&. This function is useful to write a packet that has been constructed by hand by the application programmer or, more commonly, to write a packet that has been returned by a call to \fBlibnet_adv_cull_packet()\fP\&. This function is part of the advanced interface and is only available when libnet is initialized in advanced mode\&. If the function fails \fBlibnet_geterror()\fP can tell you why\&.
495: .PP
496: \fBParameters:\fP
497: .RS 4
498: \fIl\fP pointer to a libnet context
499: .br
500: \fIpacket\fP a pointer to the packet to inject
501: .br
502: \fIpacket_s\fP the size of the packet
503: .RE
504: .PP
505: \fBReturns:\fP
506: .RS 4
507: the number of bytes written
508: .RE
509: .PP
510: \fBReturn values:\fP
511: .RS 4
512: \fI-1\fP on failure
513: .RE
514: .PP
515:
516: .SS "LIBNET_API libnet_ptag_t libnet_autobuild_arp (uint16_t op, const uint8_t * sha, const uint8_t * spa, const uint8_t * tha, const uint8_t * tpa, libnet_t * l)"
517: Autouilds an Address Resolution Protocol (ARP) header\&. Depending on the op value, the function builds one of several different types of RFC 826 or RFC 903 RARP packets\&.
518: .PP
519: \fBParameters:\fP
520: .RS 4
521: \fIop\fP ARP operation type
522: .br
523: \fIsha\fP sender's hardware address
524: .br
525: \fIspa\fP sender's protocol address
526: .br
527: \fItha\fP target hardware address
528: .br
529: \fItpa\fP target protocol address
530: .br
531: \fIl\fP pointer to a libnet context
532: .RE
533: .PP
534: \fBReturns:\fP
535: .RS 4
536: protocol tag value on success
537: .RE
538: .PP
539: \fBReturn values:\fP
540: .RS 4
541: \fI-1\fP on error
542: .RE
543: .PP
544:
545: .SS "LIBNET_API libnet_ptag_t libnet_autobuild_ethernet (const uint8_t * dst, uint16_t type, libnet_t * l)"
546: Autobuilds an Ethernet header\&. The RFC 894 Ethernet II header is almost identical to the IEEE 802\&.3 header, with the exception that the field immediately following the source address holds the layer 3 protocol (as opposed to frame's length)\&. You should only use this function when libnet is initialized with the LIBNET_LINK interface\&.
547: .PP
548: \fBParameters:\fP
549: .RS 4
550: \fIdst\fP destination ethernet address
551: .br
552: \fItype\fP upper layer protocol type
553: .br
554: \fIl\fP pointer to a libnet context
555: .RE
556: .PP
557: \fBReturns:\fP
558: .RS 4
559: protocol tag value on success
560: .RE
561: .PP
562: \fBReturn values:\fP
563: .RS 4
564: \fI-1\fP on error
565: .RE
566: .PP
567:
568: .SS "LIBNET_API libnet_ptag_t libnet_autobuild_fddi (uint8_t fc, const uint8_t * dst, uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t * oui, uint16_t type, libnet_t * l)"
569: Autobuilds a Fiber Distributed Data Interface (FDDI) header\&.
570: .PP
571: \fBParameters:\fP
572: .RS 4
573: \fIfc\fP class format and priority
574: .br
575: \fIdst\fP destination fddi address
576: .br
577: \fIdsap\fP destination service access point
578: .br
579: \fIssap\fP source service access point
580: .br
581: \fIcf\fP cf
582: .br
583: \fIoui\fP IEEE organizational code
584: .br
585: \fItype\fP upper layer protocol
586: .br
587: \fIl\fP pointer to a libnet context
588: .RE
589: .PP
590: \fBReturns:\fP
591: .RS 4
592: protocol tag value on success
593: .RE
594: .PP
595: \fBReturn values:\fP
596: .RS 4
597: \fI-1\fP on error
598: .RE
599: .PP
600:
601: .SS "LIBNET_API libnet_ptag_t libnet_autobuild_ipv4 (uint16_t len, uint8_t prot, uint32_t dst, libnet_t * l)"
602: Autobuilds a version 4 Internet Protocol (IP) header\&. The function is useful to build an IP header quickly when you do not need a granular level of control\&. The function takes the same len, prot, and dst arguments as \fBlibnet_build_ipv4()\fP\&. The function does not accept a ptag argument, but it does return a ptag\&. In other words, you can use it to build a new IP header but not to modify an existing one\&.
603: .PP
604: \fBParameters:\fP
605: .RS 4
606: \fIlen\fP total length of the IP packet including all subsequent data
607: .br
608: \fIprot\fP upper layer protocol
609: .br
610: \fIdst\fP destination IPv4 address (little endian)
611: .br
612: \fIl\fP pointer to a libnet context
613: .RE
614: .PP
615: \fBReturns:\fP
616: .RS 4
617: protocol tag value on success
618: .RE
619: .PP
620: \fBReturn values:\fP
621: .RS 4
622: \fI-1\fP on error
623: .RE
624: .PP
625:
626: .SS "LIBNET_API libnet_ptag_t libnet_autobuild_ipv6 (uint16_t len, uint8_t nh, struct libnet_in6_addr dst, libnet_t * l, libnet_ptag_t ptag)"
627: Autobuilds a version 6 RFC 2460 Internet Protocol (IP) header\&. The function is useful to build an IP header quickly when you do not need a granular level of control\&. The function takes the same len, nh, and dst arguments as \fBlibnet_build_ipv4()\fP\&. The function does not accept a ptag argument, but it does return a ptag\&. In other words, you can use it to build a new IP header but not to modify an existing one\&. This function requires \fBlibnet_get_ipaddr6()\fP, which is not yet implemented for Win32 platforms\&.
628: .PP
629: \fBParameters:\fP
630: .RS 4
631: \fIlen\fP length
632: .br
633: \fInh\fP next header
634: .br
635: \fIdst\fP destination IPv6 address
636: .br
637: \fIl\fP pointer to a libnet context
638: .br
639: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
640: .RE
641: .PP
642: \fBReturns:\fP
643: .RS 4
644: protocol tag value on success
645: .RE
646: .PP
647: \fBReturn values:\fP
648: .RS 4
649: \fI-1\fP on error
650: .RE
651: .PP
652:
653: .SS "LIBNET_API libnet_ptag_t libnet_autobuild_link (const uint8_t * dst, const uint8_t * oui, uint16_t type, libnet_t * l)"
654: Automatically builds a link layer header for an initialized l\&. The function determines the proper link layer header format from how l was initialized\&. The function current supports Ethernet and Token Ring link layers\&.
655: .PP
656: \fBParameters:\fP
657: .RS 4
658: \fIdst\fP the destination MAC address
659: .br
660: \fIoui\fP Organizationally Unique Identifier (unused for Ethernet)
661: .br
662: \fItype\fP the upper layer protocol type
663: .br
664: \fIl\fP pointer to a libnet context
665: .RE
666: .PP
667: \fBReturns:\fP
668: .RS 4
669: protocol tag value on success
670: .RE
671: .PP
672: \fBReturn values:\fP
673: .RS 4
674: \fI-1\fP on error
675: .RE
676: .PP
677:
678: .SS "LIBNET_API libnet_ptag_t libnet_autobuild_token_ring (uint8_t ac, uint8_t fc, const uint8_t * dst, uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t * oui, uint16_t type, libnet_t * l)"
679: Auto-builds a token ring header\&.
680: .PP
681: \fBParameters:\fP
682: .RS 4
683: \fIac\fP access control
684: .br
685: \fIfc\fP frame control
686: .br
687: \fIdst\fP destination address
688: .br
689: \fIdsap\fP destination service access point
690: .br
691: \fIssap\fP source service access point
692: .br
693: \fIcf\fP control field
694: .br
695: \fIoui\fP Organizationally Unique Identifier
696: .br
697: \fItype\fP upper layer protocol type
698: .br
699: \fIl\fP pointer to a libnet context
700: .RE
701: .PP
702: \fBReturns:\fP
703: .RS 4
704: protocol tag value on success
705: .RE
706: .PP
707: \fBReturn values:\fP
708: .RS 4
709: \fI-1\fP on error
710: .RE
711: .PP
712:
713: .SS "LIBNET_API libnet_ptag_t libnet_build_802_1q (const uint8_t * dst, const uint8_t * src, uint16_t tpi, uint8_t priority, uint8_t cfi, uint16_t vlan_id, uint16_t len_proto, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
714:
715: .SH "Packet Builder Functions"
716: .PP
717: The core of libnet is the platform-independent packet-building functionality\&. These functions enable an application programmer to build protocol headers (and data) in a simple and consistent manner without having to worry (too much) about low-level network odds and ends\&. Each libnet_build() function builds a piece of a packet (generally a protocol header)\&. While it is perfectly possible to build an entire, ready-to-transmit packet with a single call to a libnet_build() function, generally more than one builder-class function call is required to construct a full packet\&. A complete wire-ready packet generally consists of more than one piece\&. Every function that builds a protocol header takes a series of arguments roughly corresponding to the header values as they appear on the wire\&. This process is intuitive but often makes for functions with huge prototypes and large stack frames\&. One important thing to note is that you must call these functions in order, corresponding to how they should appear on the wire (from the highest protocol layer on down)\&. This building process is intuitive; it approximates what happens in an operating system kernel\&. In other words, to build a Network Time Protocol (NTP) packet by using the link-layer interface, the application programmer would call the libnet_build() functions in the following order:
718: .IP "1." 4
719: \fBlibnet_build_ntp()\fP
720: .IP "2." 4
721: \fBlibnet_build_udp()\fP
722: .IP "3." 4
723: \fBlibnet_build_ipv4()\fP
724: .IP "4." 4
725: \fBlibnet_build_ethernet()\fP This ordering is essential for libnet 1\&.1\&.x to properly link together the packet internally (previous libnet versions did not have the requirement)\&.
726: .PP
727: .SS "The Payload Interface"
728: The payload interface specifies an optional way to include data directly after the protocol header in question\&. You can use this function for a variety of purposes, including the following:
729: .IP "\(bu" 2
730: Including additional or arbitrary protocol header information that is not available from a libnet interface
731: .IP "\(bu" 2
732: Including a packet payload (data segment)
733: .IP "\(bu" 2
734: Building another protocol header that is not available from a libnet interface To employ the interface, the application programmer should construct the i payload data and pass a const uint8_t * to this data and its size to the desired libnet_build() function\&. Libnet handles the rest\&.
735: .PP
736: .PP
737: It is important to note that some functions (notably the IPv6 builders) do use the payload interface to specify variable length but ostensibly non-optional data\&. See the individual libnet_build_ipv6*() functions for more information\&.
738: .SS "Protocol Tags and Packet Builder Return Values"
739: Libnet uses the protocol tag (ptag) to identify individual pieces of a packet after being created\&. A new ptag results every time a libnet_build() function with an empty (0) ptag argument completes successfully\&. This new ptag now refers to the packet piece just created\&. The application programmer's responsibility is to save this value if he or she plans to modify this particular portion later on in the program\&. If the application programmer needs to modify some portion of that particular packet piece again, he or she calls the same libnet_build() function specifying the saved ptag argument\&. Libnet then searches for that packet piece and modifies it rather than creating a new one\&. Upon failure for any reason, libnet_build() functions return -1; \fBlibnet_geterror()\fP tells you why\&. Builds an IEEE 802\&.1q VLAN tagging header\&. Depending on the value of len_proto, the function wraps the 802\&.1q header inside either an IEEE 802\&.3 header or an RFC 894 Ethernet II (DIX) header (both resulting in an 18-byte frame)\&. If len is 1500 or less, most receiving protocol stacks parse the frame as an IEEE 802\&.3 encapsulated frame\&. If len is one of the Ethernet type values, most protocol stacks parse the frame as an RFC 894 Ethernet II encapsulated frame\&. Note the length value is calculated without the 802\&.1q header of 18 bytes\&.
740: .PP
741: \fBParameters:\fP
742: .RS 4
743: \fIdst\fP pointer to a six byte source ethernet address
744: .br
745: \fIsrc\fP pointer to a six byte destination ethernet address
746: .br
747: \fItpi\fP tag protocol identifier
748: .br
749: \fIpriority\fP priority
750: .br
751: \fIcfi\fP canonical format indicator
752: .br
753: \fIvlan_id\fP vlan identifier
754: .br
755: \fIlen_proto\fP length (802\&.3) protocol (Ethernet II)
756: .br
757: \fIpayload\fP optional payload or NULL
758: .br
759: \fIpayload_s\fP payload length or 0
760: .br
761: \fIl\fP pointer to a libnet context
762: .br
763: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
764: .RE
765: .PP
766: \fBReturns:\fP
767: .RS 4
768: protocol tag value on success
769: .RE
770: .PP
771: \fBReturn values:\fP
772: .RS 4
773: \fI-1\fP on error
774: .RE
775: .PP
776:
777: .SS "LIBNET_API libnet_ptag_t libnet_build_802_1x (uint8_t eap_ver, uint8_t eap_type, uint16_t length, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
778: Builds an IEEE 802\&.1x extended authentication protocol header\&.
779: .PP
780: \fBParameters:\fP
781: .RS 4
782: \fIeap_ver\fP the EAP version
783: .br
784: \fIeap_type\fP the EAP type
785: .br
786: \fIlength\fP frame length
787: .br
788: \fIpayload\fP optional payload or NULL
789: .br
790: \fIpayload_s\fP payload length or 0
791: .br
792: \fIl\fP pointer to a libnet context
793: .br
794: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
795: .RE
796: .PP
797: \fBReturns:\fP
798: .RS 4
799: protocol tag value on success
800: .RE
801: .PP
802: \fBReturn values:\fP
803: .RS 4
804: \fI-1\fP on error
805: .RE
806: .PP
807:
808: .SS "LIBNET_API libnet_ptag_t libnet_build_802_2 (uint8_t dsap, uint8_t ssap, uint8_t control, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
809: Builds an IEEE 802\&.2 LLC header\&.
810: .PP
811: \fBParameters:\fP
812: .RS 4
813: \fIdsap\fP destination service access point
814: .br
815: \fIssap\fP source service access point
816: .br
817: \fIcontrol\fP control field
818: .br
819: \fIpayload\fP optional payload or NULL
820: .br
821: \fIpayload_s\fP payload length or 0
822: .br
823: \fIl\fP pointer to a libnet context
824: .br
825: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
826: .RE
827: .PP
828: \fBReturns:\fP
829: .RS 4
830: protocol tag value on success
831: .RE
832: .PP
833: \fBReturn values:\fP
834: .RS 4
835: \fI-1\fP on error
836: .RE
837: .PP
838:
839: .SS "LIBNET_API libnet_ptag_t libnet_build_802_2snap (uint8_t dsap, uint8_t ssap, uint8_t control, uint8_t * oui, uint16_t type, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
840: Builds an IEEE 802\&.2 LLC SNAP header\&.
841: .PP
842: \fBParameters:\fP
843: .RS 4
844: \fIdsap\fP destination service access point
845: .br
846: \fIssap\fP source service access point
847: .br
848: \fIcontrol\fP control field
849: .br
850: \fIoui\fP Organizationally Unique Identifier
851: .br
852: \fItype\fP upper layer protocol
853: .br
854: \fIpayload\fP optional payload or NULL
855: .br
856: \fIpayload_s\fP payload length or 0
857: .br
858: \fIl\fP pointer to a libnet context
859: .br
860: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
861: .RE
862: .PP
863: \fBReturns:\fP
864: .RS 4
865: protocol tag value on success
866: .RE
867: .PP
868: \fBReturn values:\fP
869: .RS 4
870: \fI-1\fP on error
871: .RE
872: .PP
873:
874: .SS "LIBNET_API libnet_ptag_t libnet_build_802_3 (const uint8_t * dst, const uint8_t * src, uint16_t len, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
875: Builds an IEEE 802\&.3 header\&. The 802\&.3 header is almost identical to the RFC 894 Ethernet II header, the exception being that the field immediately following the source address holds the frame's length (as opposed to the layer 3 protocol)\&. You should only use this function when libnet is initialized with the LIBNET_LINK interface\&.
876: .PP
877: \fBParameters:\fP
878: .RS 4
879: \fIdst\fP destination ethernet address
880: .br
881: \fIsrc\fP source ethernet address
882: .br
883: \fIlen\fP frame length sans header
884: .br
885: \fIpayload\fP optional payload or NULL
886: .br
887: \fIpayload_s\fP payload length or 0
888: .br
889: \fIl\fP pointer to a libnet context
890: .br
891: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
892: .RE
893: .PP
894: \fBReturns:\fP
895: .RS 4
896: protocol tag value on success
897: .RE
898: .PP
899: \fBReturn values:\fP
900: .RS 4
901: \fI-1\fP on error
902: .RE
903: .PP
904:
905: .SS "LIBNET_API libnet_ptag_t libnet_build_arp (uint16_t hrd, uint16_t pro, uint8_t hln, uint8_t pln, uint16_t op, const uint8_t * sha, const uint8_t * spa, const uint8_t * tha, const uint8_t * tpa, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
906: Builds an Address Resolution Protocol (ARP) header\&. Depending on the op value, the function builds one of several different types of RFC 826 or RFC 903 RARP packets\&.
907: .PP
908: \fBParameters:\fP
909: .RS 4
910: \fIhrd\fP hardware address format
911: .br
912: \fIpro\fP protocol address format
913: .br
914: \fIhln\fP hardware address length
915: .br
916: \fIpln\fP protocol address length
917: .br
918: \fIop\fP ARP operation type
919: .br
920: \fIsha\fP sender's hardware address
921: .br
922: \fIspa\fP sender's protocol address
923: .br
924: \fItha\fP target hardware address
925: .br
926: \fItpa\fP target protocol address
927: .br
928: \fIpayload\fP optional payload or NULL
929: .br
930: \fIpayload_s\fP payload length or 0
931: .br
932: \fIl\fP pointer to a libnet context
933: .br
934: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
935: .RE
936: .PP
937: \fBReturns:\fP
938: .RS 4
939: protocol tag value on success
940: .RE
941: .PP
942: \fBReturn values:\fP
943: .RS 4
944: \fI-1\fP on error
945: .RE
946: .PP
947:
948: .SS "LIBNET_API libnet_ptag_t libnet_build_bgp4_header (uint8_t marker[LIBNET_BGP4_MARKER_SIZE], uint16_t len, uint8_t type, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
949: Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) header\&. The primary function of a BGP speaking system is to exchange network reachability information with other BGP systems\&. This network reachability information includes information on the list of Autonomous Systems (ASs) that reachability information traverses\&. This information is sufficient to construct a graph of AS connectivity from which routing loops may be pruned and some policy decisions at the AS level may be enforced\&. This function builds the base BGP header which is used as a preamble before any other BGP header\&. For example, a BGP KEEPALIVE message may be built with only this function, while an error notification requires a subsequent call to libnet_build_bgp4_notification\&.
950: .PP
951: \fBParameters:\fP
952: .RS 4
953: \fImarker\fP a value the receiver can predict (if the message type is not BGP OPEN, or no authentication is used, these 16 bytes are normally set as all ones)
954: .br
955: \fIlen\fP total length of the BGP message, including the header
956: .br
957: \fItype\fP type code of the message (OPEN, UPDATE, NOTIFICATION or KEEPALIVE)
958: .br
959: \fIpayload\fP optional payload or NULL
960: .br
961: \fIpayload_s\fP payload length or 0
962: .br
963: \fIl\fP pointer to a libnet context
964: .br
965: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
966: .RE
967: .PP
968: \fBReturns:\fP
969: .RS 4
970: protocol tag value on success
971: .RE
972: .PP
973: \fBReturn values:\fP
974: .RS 4
975: \fI-1\fP on error
976: .RE
977: .PP
978:
979: .SS "LIBNET_API libnet_ptag_t libnet_build_bgp4_notification (uint8_t err_code, uint8_t err_subcode, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
980: Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) notification header\&. A NOTIFICATION message is sent when an error condition is detected\&. Specific error information may be passed through the payload interface\&.
981: .PP
982: \fBParameters:\fP
983: .RS 4
984: \fIerr_code\fP type of notification
985: .br
986: \fIerr_subcode\fP more specific information about the reported error\&.
987: .br
988: \fIpayload\fP optional payload or NULL
989: .br
990: \fIpayload_s\fP payload length or 0
991: .br
992: \fIl\fP pointer to a libnet context
993: .br
994: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
995: .RE
996: .PP
997: \fBReturns:\fP
998: .RS 4
999: protocol tag value on success
1000: .RE
1001: .PP
1002: \fBReturn values:\fP
1003: .RS 4
1004: \fI-1\fP on error
1005: .RE
1006: .PP
1007:
1008: .SS "LIBNET_API libnet_ptag_t libnet_build_bgp4_open (uint8_t version, uint16_t src_as, uint16_t hold_time, uint32_t bgp_id, uint8_t opt_len, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
1009: Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) OPEN header\&. This is the first message sent by each side of a BGP connection\&. The optional parameters options should be constructed using the payload interface (see RFC 1771 for the options structures)\&.
1010: .PP
1011: \fBParameters:\fP
1012: .RS 4
1013: \fIversion\fP protocol version (should be set to 4)
1014: .br
1015: \fIsrc_as\fP Autonomous System of the sender
1016: .br
1017: \fIhold_time\fP used to compute the maximum allowed time between the receipt of KEEPALIVE, and/or UPDATE messages by the sender
1018: .br
1019: \fIbgp_id\fP BGP identifier of the sender
1020: .br
1021: \fIopt_len\fP total length of the optional parameters field in bytes
1022: .br
1023: \fIpayload\fP optional payload or NULL
1024: .br
1025: \fIpayload_s\fP payload length or 0
1026: .br
1027: \fIl\fP pointer to a libnet context
1028: .br
1029: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1030: .RE
1031: .PP
1032: \fBReturns:\fP
1033: .RS 4
1034: protocol tag value on success
1035: .RE
1036: .PP
1037: \fBReturn values:\fP
1038: .RS 4
1039: \fI-1\fP on error
1040: .RE
1041: .PP
1042:
1043: .SS "LIBNET_API libnet_ptag_t libnet_build_bgp4_update (uint16_t unfeasible_rt_len, const uint8_t * withdrawn_rt, uint16_t total_path_attr_len, const uint8_t * path_attributes, uint16_t info_len, uint8_t * reachability_info, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
1044: Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) update header\&. Update messages are used to transfer routing information between BGP peers\&.
1045: .PP
1046: \fBParameters:\fP
1047: .RS 4
1048: \fIunfeasible_rt_len\fP indicates the length of the (next) 'withdrawn routes' field in bytes
1049: .br
1050: \fIwithdrawn_rt\fP list of IP addresses prefixes for the routes that are being withdrawn; each IP address prefix is built as a 2-tuple <length (1 byte), prefix (variable)>
1051: .br
1052: \fItotal_path_attr_len\fP indicates the length of the (next) 'path attributes' field in bytes
1053: .br
1054: \fIpath_attributes\fP each attribute is a 3-tuple <type (2 bytes), length, value>
1055: .br
1056: \fIinfo_len\fP indicates the length of the (next) 'network layer reachability information' field in bytes (needed for internal memory size calculation)
1057: .br
1058: \fIreachability_info\fP 2-tuples <length (1 byte), prefix (variable)>\&.
1059: .br
1060: \fIpayload\fP optional payload or NULL
1061: .br
1062: \fIpayload_s\fP payload length or 0
1063: .br
1064: \fIl\fP pointer to a libnet context
1065: .br
1066: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1067: .RE
1068: .PP
1069: \fBReturns:\fP
1070: .RS 4
1071: protocol tag value on success
1072: .RE
1073: .PP
1074: \fBReturn values:\fP
1075: .RS 4
1076: \fI-1\fP on error
1077: .RE
1078: .PP
1079:
1080: .SS "LIBNET_API libnet_ptag_t libnet_build_bootpv4 (uint8_t opcode, uint8_t htype, uint8_t hlen, uint8_t hopcount, uint32_t xid, uint16_t secs, uint16_t flags, uint32_t cip, uint32_t yip, uint32_t sip, uint32_t gip, const uint8_t * chaddr, const char * sname, const char * file, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
1081:
1082: .PP
1083: \fBParameters:\fP
1084: .RS 4
1085: \fIopcode\fP
1086: .br
1087: \fIhtype\fP
1088: .br
1089: \fIhlen\fP
1090: .br
1091: \fIhopcount\fP
1092: .br
1093: \fIxid\fP
1094: .br
1095: \fIsecs\fP
1096: .br
1097: \fIflags\fP
1098: .br
1099: \fIcip\fP
1100: .br
1101: \fIyip\fP
1102: .br
1103: \fIsip\fP
1104: .br
1105: \fIgip\fP
1106: .br
1107: \fIchaddr\fP client hardware address, length is hlen
1108: .br
1109: \fIsname\fP server host name, a null terminated string
1110: .br
1111: \fIfile\fP boot file name, a null terminated string
1112: .br
1113: \fIpayload\fP optional payload or NULL
1114: .br
1115: \fIpayload_s\fP payload length or 0
1116: .br
1117: \fIl\fP pointer to a libnet context
1118: .br
1119: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1120: .RE
1121: .PP
1122: \fBReturns:\fP
1123: .RS 4
1124: protocol tag value on success
1125: .RE
1126: .PP
1127: \fBReturn values:\fP
1128: .RS 4
1129: \fI-1\fP on error
1130: .RE
1131: .PP
1132:
1133: .SS "LIBNET_API libnet_ptag_t libnet_build_cdp (uint8_t version, uint8_t ttl, uint16_t sum, uint16_t type, uint16_t value_s, const uint8_t * value, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
1134: Builds a Cisco Discovery Protocol (CDP) header\&. Cisco Systems designed CDP to aid in the network management of adjacent Cisco devices\&. The CDP protocol specifies data by using a type/length/value (TLV) setup\&. The first TLV can specified by using the functions type, length, and value arguments\&. To specify additional TLVs, the programmer could either use the payload interface or \fBlibnet_build_data()\fP to construct them\&.
1135: .PP
1136: \fBParameters:\fP
1137: .RS 4
1138: \fIversion\fP CDP version
1139: .br
1140: \fIttl\fP time to live (time information should be cached by recipient)
1141: .br
1142: \fIsum\fP checksum (0 for libnet to auto-fill)
1143: .br
1144: \fItype\fP type of data contained in value
1145: .br
1146: \fIvalue_s\fP length of value argument
1147: .br
1148: \fIvalue\fP the CDP information string
1149: .br
1150: \fIpayload\fP optional payload or NULL
1151: .br
1152: \fIpayload_s\fP payload length or 0
1153: .br
1154: \fIl\fP pointer to a libnet context
1155: .br
1156: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1157: .RE
1158: .PP
1159: \fBReturns:\fP
1160: .RS 4
1161: protocol tag value on success
1162: .RE
1163: .PP
1164: \fBReturn values:\fP
1165: .RS 4
1166: \fI-1\fP on error
1167: .RE
1168: .PP
1169:
1170: .SS "LIBNET_API libnet_ptag_t libnet_build_data (const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
1171: Builds a generic libnet protocol header\&. This is useful for including an optional payload to a packet that might need to change repeatedly inside of a loop\&. This won't work for TCP or IP payload, they have special types (this is probably a bug)\&.
1172: .PP
1173: \fBParameters:\fP
1174: .RS 4
1175: \fIpayload\fP optional payload or NULL
1176: .br
1177: \fIpayload_s\fP payload length or 0
1178: .br
1179: \fIl\fP pointer to a libnet context
1180: .br
1181: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1182: .RE
1183: .PP
1184: \fBReturns:\fP
1185: .RS 4
1186: protocol tag value on success
1187: .RE
1188: .PP
1189: \fBReturn values:\fP
1190: .RS 4
1191: \fI-1\fP on error
1192: .RE
1193: .PP
1194:
1195: .SS "LIBNET_API libnet_ptag_t libnet_build_dhcpv4 (uint8_t opcode, uint8_t htype, uint8_t hlen, uint8_t hopcount, uint32_t xid, uint16_t secs, uint16_t flags, uint32_t cip, uint32_t yip, uint32_t sip, uint32_t gip, const uint8_t * chaddr, const char * sname, const char * file, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
1196:
1197: .PP
1198: \fBParameters:\fP
1199: .RS 4
1200: \fIopcode\fP
1201: .br
1202: \fIhtype\fP
1203: .br
1204: \fIhlen\fP
1205: .br
1206: \fIhopcount\fP
1207: .br
1208: \fIxid\fP
1209: .br
1210: \fIsecs\fP
1211: .br
1212: \fIflags\fP
1213: .br
1214: \fIcip\fP
1215: .br
1216: \fIyip\fP
1217: .br
1218: \fIsip\fP
1219: .br
1220: \fIgip\fP
1221: .br
1222: \fIchaddr\fP client hardware address, length is hlen
1223: .br
1224: \fIsname\fP server host name, a null terminated string
1225: .br
1226: \fIfile\fP boot file name, a null terminated string
1227: .br
1228: \fIpayload\fP optional payload or NULL
1229: .br
1230: \fIpayload_s\fP payload length or 0
1231: .br
1232: \fIl\fP pointer to a libnet context
1233: .br
1234: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1235: .RE
1236: .PP
1237: \fBReturns:\fP
1238: .RS 4
1239: protocol tag value on success
1240: .RE
1241: .PP
1242: \fBReturn values:\fP
1243: .RS 4
1244: \fI-1\fP on error
1245: .RE
1246: .PP
1247:
1248: .SS "LIBNET_API libnet_ptag_t libnet_build_dnsv4 (uint16_t h_len, uint16_t id, uint16_t flags, uint16_t num_q, uint16_t num_anws_rr, uint16_t num_auth_rr, uint16_t num_addi_rr, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
1249: Builds an RFC 1035 version 4 DNS header\&. Additional DNS payload information should be specified using the payload interface\&.
1250: .PP
1251: \fBParameters:\fP
1252: .RS 4
1253: \fIh_len\fP
1254: .br
1255: \fIid\fP DNS packet id
1256: .br
1257: \fIflags\fP control flags
1258: .br
1259: \fInum_q\fP number of questions
1260: .br
1261: \fInum_anws_rr\fP number of answer resource records
1262: .br
1263: \fInum_auth_rr\fP number of authority resource records
1264: .br
1265: \fInum_addi_rr\fP number of additional resource records
1266: .br
1267: \fIpayload\fP optional payload or NULL
1268: .br
1269: \fIpayload_s\fP payload length or 0
1270: .br
1271: \fIl\fP pointer to a libnet context
1272: .br
1273: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1274: .RE
1275: .PP
1276: \fBReturns:\fP
1277: .RS 4
1278: protocol tag value on success
1279: .RE
1280: .PP
1281: \fBReturn values:\fP
1282: .RS 4
1283: \fI-1\fP on error
1284: .RE
1285: .PP
1286:
1287: .SS "LIBNET_API libnet_ptag_t libnet_build_egre (uint16_t fv, uint16_t type, uint16_t sum, uint16_t offset, uint32_t key, uint32_t seq, uint16_t len, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
1288: Generic Routing Encapsulation (GRE - RFC 1701) is used to encapsulate any protocol\&. Hence, the IP part of the packet is usually referred as 'delivery
1289: header'\&. It is then followed by the GRE header and finally the encapsulated packet (IP or whatever)\&. As GRE is very modular, the first GRE header describes the structure of the header, using bits and flag to specify which fields will be present in the header\&.
1290: .PP
1291: \fBParameters:\fP
1292: .RS 4
1293: \fIfv\fP the 16 0 to 7: which fields are included in the header (checksum, seq\&. number, key, \&.\&.\&.), bits 8 to 12: flag, bits 13 to 15: version\&.
1294: .br
1295: \fItype\fP which protocol is encapsulated (PPP, IP, \&.\&.\&.)
1296: .br
1297: \fIsum\fP checksum (0 for libnet to auto-fill)\&.
1298: .br
1299: \fIoffset\fP byte offset from the start of the routing field to the first byte of the SRE
1300: .br
1301: \fIkey\fP inserted by the encapsulator to authenticate the source
1302: .br
1303: \fIseq\fP sequence number used by the receiver to sort the packets
1304: .br
1305: \fIlen\fP size of the GRE packet
1306: .br
1307: \fIpayload\fP optional payload or NULL
1308: .br
1309: \fIpayload_s\fP payload length or 0
1310: .br
1311: \fIl\fP pointer to a libnet context
1312: .br
1313: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1314: .RE
1315: .PP
1316: \fBReturns:\fP
1317: .RS 4
1318: protocol tag value on success
1319: .RE
1320: .PP
1321: \fBReturn values:\fP
1322: .RS 4
1323: \fI-1\fP on error
1324: .RE
1325: .PP
1326:
1327: .SS "LIBNET_API libnet_ptag_t libnet_build_ethernet (const uint8_t * dst, const uint8_t * src, uint16_t type, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
1328: Builds an Ethernet header\&. The RFC 894 Ethernet II header is almost identical to the IEEE 802\&.3 header, with the exception that the field immediately following the source address holds the layer 3 protocol (as opposed to frame's length)\&. You should only use this function when libnet is initialized with the LIBNET_LINK interface\&.
1329: .PP
1330: \fBParameters:\fP
1331: .RS 4
1332: \fIdst\fP destination ethernet address
1333: .br
1334: \fIsrc\fP source ethernet address
1335: .br
1336: \fItype\fP upper layer protocol type
1337: .br
1338: \fIpayload\fP optional payload or NULL
1339: .br
1340: \fIpayload_s\fP payload length or 0
1341: .br
1342: \fIl\fP pointer to a libnet context
1343: .br
1344: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1345: .RE
1346: .PP
1347: \fBReturns:\fP
1348: .RS 4
1349: protocol tag value on success
1350: .RE
1351: .PP
1352: \fBReturn values:\fP
1353: .RS 4
1354: \fI-1\fP on error
1355: .RE
1356: .PP
1357:
1358: .SS "LIBNET_API libnet_ptag_t libnet_build_fddi (uint8_t fc, const uint8_t * dst, const uint8_t * src, uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t * oui, uint16_t type, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
1359: Builds a Fiber Distributed Data Interface (FDDI) header\&.
1360: .PP
1361: \fBParameters:\fP
1362: .RS 4
1363: \fIfc\fP class format and priority
1364: .br
1365: \fIdst\fP destination fddi address
1366: .br
1367: \fIsrc\fP source fddi address
1368: .br
1369: \fIdsap\fP destination service access point
1370: .br
1371: \fIssap\fP source service access point
1372: .br
1373: \fIcf\fP cf
1374: .br
1375: \fIoui\fP 3 byte IEEE organizational code
1376: .br
1377: \fItype\fP upper layer protocol
1378: .br
1379: \fIpayload\fP optional payload or NULL
1380: .br
1381: \fIpayload_s\fP payload length or 0
1382: .br
1383: \fIl\fP pointer to a libnet context
1384: .br
1385: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1386: .RE
1387: .PP
1388: \fBReturns:\fP
1389: .RS 4
1390: protocol tag value on success
1391: .RE
1392: .PP
1393: \fBReturn values:\fP
1394: .RS 4
1395: \fI-1\fP on error
1396: .RE
1397: .PP
1398:
1399: .SS "LIBNET_API libnet_ptag_t libnet_build_gre (uint16_t fv, uint16_t type, uint16_t sum, uint16_t offset, uint32_t key, uint32_t seq, uint16_t len, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
1400: Generic Routing Encapsulation (GRE - RFC 1701) is used to encapsulate any protocol\&. Hence, the IP part of the packet is usually referred as 'delivery
1401: header'\&. It is then followed by the GRE header and finally the encapsulated packet (IP or whatever)\&. As GRE is very modular, the first GRE header describes the structure of the header, using bits and flag to specify which fields will be present in the header\&.
1402: .PP
1403: \fBParameters:\fP
1404: .RS 4
1405: \fIfv\fP the 16 0 to 7: which fields are included in the header (checksum, seq\&. number, key, \&.\&.\&.), bits 8 to 12: flag, bits 13 to 15: version\&.
1406: .br
1407: \fItype\fP which protocol is encapsulated (PPP, IP, \&.\&.\&.)
1408: .br
1409: \fIsum\fP checksum (0 for libnet to auto-fill)\&.
1410: .br
1411: \fIoffset\fP byte offset from the start of the routing field to the first byte of the SRE
1412: .br
1413: \fIkey\fP inserted by the encapsulator to authenticate the source
1414: .br
1415: \fIseq\fP sequence number used by the receiver to sort the packets
1416: .br
1417: \fIlen\fP size of the GRE packet
1418: .br
1419: \fIpayload\fP
1420: .br
1421: \fIpayload_s\fP payload length or 0
1422: .br
1423: \fIl\fP pointer to a libnet context
1424: .br
1425: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1426: .RE
1427: .PP
1428: \fBReturns:\fP
1429: .RS 4
1430: protocol tag value on success
1431: .RE
1432: .PP
1433: \fBReturn values:\fP
1434: .RS 4
1435: \fI-1\fP on error
1436: .RE
1437: .PP
1438:
1439: .SS "LIBNET_API libnet_ptag_t libnet_build_gre_last_sre (libnet_t * l, libnet_ptag_t ptag)"
1440:
1441: .PP
1442: \fBParameters:\fP
1443: .RS 4
1444: \fIl\fP pointer to a libnet context
1445: .br
1446: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1447: .RE
1448: .PP
1449: \fBReturns:\fP
1450: .RS 4
1451: protocol tag value on success
1452: .RE
1453: .PP
1454: \fBReturn values:\fP
1455: .RS 4
1456: \fI-1\fP on error
1457: .RE
1458: .PP
1459:
1460: .SS "LIBNET_API libnet_ptag_t libnet_build_gre_sre (uint16_t af, uint8_t offset, uint8_t length, uint8_t * routing, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
1461:
1462: .PP
1463: \fBParameters:\fP
1464: .RS 4
1465: \fIaf\fP
1466: .br
1467: \fIoffset\fP
1468: .br
1469: \fIlength\fP
1470: .br
1471: \fIrouting\fP
1472: .br
1473: \fIpayload\fP optional payload or NULL
1474: .br
1475: \fIpayload_s\fP payload length or 0
1476: .br
1477: \fIl\fP pointer to a libnet context
1478: .br
1479: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1480: .RE
1481: .PP
1482: \fBReturns:\fP
1483: .RS 4
1484: protocol tag value on success
1485: .RE
1486: .PP
1487: \fBReturn values:\fP
1488: .RS 4
1489: \fI-1\fP on error
1490: .RE
1491: .PP
1492:
1493: .SS "LIBNET_API libnet_ptag_t libnet_build_hsrp (uint8_t version, uint8_t opcode, uint8_t state, uint8_t hello_time, uint8_t hold_time, uint8_t priority, uint8_t group, uint8_t reserved, uint8_t authdata[HSRP_AUTHDATA_LENGTH], uint32_t virtual_ip, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
1494: Builds a HSRP header\&. HSRP is a Cisco proprietary protocol defined in RFC 2281
1495: .PP
1496: \fBParameters:\fP
1497: .RS 4
1498: \fIversion\fP version of the HSRP messages
1499: .br
1500: \fIopcode\fP type of message
1501: .br
1502: \fIstate\fP current state of the router
1503: .br
1504: \fIhello_time\fP period in seconds between hello messages
1505: .br
1506: \fIhold_time\fP seconds that the current hello message is valid
1507: .br
1508: \fIpriority\fP priority for the election process
1509: .br
1510: \fIgroup\fP standby group
1511: .br
1512: \fIreserved\fP reserved field
1513: .br
1514: \fIauthdata\fP password
1515: .br
1516: \fIvirtual_ip\fP virtual ip address
1517: .br
1518: \fIpayload\fP optional payload or NULL
1519: .br
1520: \fIpayload_s\fP payload length or 0
1521: .br
1522: \fIl\fP pointer to a libnet context
1523: .br
1524: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1525: .RE
1526: .PP
1527: \fBReturns:\fP
1528: .RS 4
1529: protocol tag value on success
1530: .RE
1531: .PP
1532: \fBReturn values:\fP
1533: .RS 4
1534: \fI-1\fP on error
1535: .RE
1536: .PP
1537:
1538: .SS "LIBNET_API libnet_ptag_t libnet_build_icmpv4_echo (uint8_t type, uint8_t code, uint16_t sum, uint16_t id, uint16_t seq, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
1539: Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) echo request/reply header
1540: .PP
1541: \fBParameters:\fP
1542: .RS 4
1543: \fItype\fP type of ICMP packet (should be ICMP_ECHOREPLY or ICMP_ECHO)
1544: .br
1545: \fIcode\fP code of ICMP packet (should be 0)
1546: .br
1547: \fIsum\fP checksum (0 for libnet to auto-fill)
1548: .br
1549: \fIid\fP identification number
1550: .br
1551: \fIseq\fP packet sequence number
1552: .br
1553: \fIpayload\fP optional payload or NULL
1554: .br
1555: \fIpayload_s\fP payload length or 0
1556: .br
1557: \fIl\fP pointer to a libnet context
1558: .br
1559: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1560: .RE
1561: .PP
1562: \fBReturns:\fP
1563: .RS 4
1564: protocol tag value on success
1565: .RE
1566: .PP
1567: \fBReturn values:\fP
1568: .RS 4
1569: \fI-1\fP on error
1570: .RE
1571: .PP
1572:
1573: .SS "LIBNET_API libnet_ptag_t libnet_build_icmpv4_mask (uint8_t type, uint8_t code, uint16_t sum, uint16_t id, uint16_t seq, uint32_t mask, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
1574: Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) IP netmask request/reply header\&.
1575: .PP
1576: \fBParameters:\fP
1577: .RS 4
1578: \fItype\fP type of ICMP packet (should be ICMP_MASKREQ or ICMP_MASKREPLY)
1579: .br
1580: \fIcode\fP code of ICMP packet (should be 0)
1581: .br
1582: \fIsum\fP checksum (0 for libnet to auto-fill)
1583: .br
1584: \fIid\fP identification number
1585: .br
1586: \fIseq\fP packet sequence number
1587: .br
1588: \fImask\fP subnet mask
1589: .br
1590: \fIpayload\fP optional payload or NULL
1591: .br
1592: \fIpayload_s\fP payload length or 0
1593: .br
1594: \fIl\fP pointer to a libnet context
1595: .br
1596: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1597: .RE
1598: .PP
1599: \fBReturns:\fP
1600: .RS 4
1601: protocol tag value on success
1602: .RE
1603: .PP
1604: \fBReturn values:\fP
1605: .RS 4
1606: \fI-1\fP on error
1607: .RE
1608: .PP
1609:
1610: .SS "LIBNET_API libnet_ptag_t libnet_build_icmpv4_redirect (uint8_t type, uint8_t code, uint16_t sum, uint32_t gateway, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
1611: Builds an IP version 4 RFC 792 Internet Message Control Protocol (ICMP) redirect header\&. The IP header that caused the error message should be built by a previous call to \fBlibnet_build_ipv4()\fP\&.
1612: .PP
1613: \fBParameters:\fP
1614: .RS 4
1615: \fItype\fP type of ICMP packet (should be ICMP_REDIRECT)
1616: .br
1617: \fIcode\fP code of ICMP packet (should be one of the four redirect codes)
1618: .br
1619: \fIsum\fP checksum (0 for libnet to auto-fill)
1620: .br
1621: \fIgateway\fP
1622: .br
1623: \fIpayload\fP optional payload or NULL
1624: .br
1625: \fIpayload_s\fP payload length or 0
1626: .br
1627: \fIl\fP pointer to a libnet context
1628: .br
1629: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1630: .RE
1631: .PP
1632: \fBReturns:\fP
1633: .RS 4
1634: protocol tag value on success
1635: .RE
1636: .PP
1637: \fBReturn values:\fP
1638: .RS 4
1639: \fI-1\fP on error
1640: .RE
1641: .PP
1642:
1643: .SS "LIBNET_API libnet_ptag_t libnet_build_icmpv4_timeexceed (uint8_t type, uint8_t code, uint16_t sum, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
1644: Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) time exceeded header\&. The IP header that caused the error message should be built by a previous call to \fBlibnet_build_ipv4()\fP\&.
1645: .PP
1646: \fBParameters:\fP
1647: .RS 4
1648: \fItype\fP type of ICMP packet (should be ICMP_TIMXCEED)
1649: .br
1650: \fIcode\fP code of ICMP packet (ICMP_TIMXCEED_INTRANS / ICMP_TIMXCEED_REASS)
1651: .br
1652: \fIsum\fP checksum (0 for libnet to auto-fill)
1653: .br
1654: \fIpayload\fP optional payload or NULL
1655: .br
1656: \fIpayload\fP optional payload or NULL
1657: .br
1658: \fIpayload_s\fP payload length or 0
1659: .br
1660: \fIl\fP pointer to a libnet context
1661: .br
1662: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1663: .RE
1664: .PP
1665: \fBReturns:\fP
1666: .RS 4
1667: protocol tag value on success
1668: .RE
1669: .PP
1670: \fBReturn values:\fP
1671: .RS 4
1672: \fI-1\fP on error
1673: .RE
1674: .PP
1675:
1676: .SS "LIBNET_API libnet_ptag_t libnet_build_icmpv4_timestamp (uint8_t type, uint8_t code, uint16_t sum, uint16_t id, uint16_t seq, uint32_t otime, uint32_t rtime, uint32_t ttime, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
1677: Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) timestamp request/reply header\&.
1678: .PP
1679: \fBParameters:\fP
1680: .RS 4
1681: \fItype\fP type of ICMP packet (should be ICMP_TSTAMP or ICMP_TSTAMPREPLY)
1682: .br
1683: \fIcode\fP code of ICMP packet (should be 0)
1684: .br
1685: \fIsum\fP checksum (0 for libnet to auto-fill)
1686: .br
1687: \fIid\fP identification number
1688: .br
1689: \fIseq\fP sequence number
1690: .br
1691: \fIotime\fP originate timestamp
1692: .br
1693: \fIrtime\fP receive timestamp
1694: .br
1695: \fIttime\fP transmit timestamp
1696: .br
1697: \fIpayload\fP optional payload or NULL
1698: .br
1699: \fIpayload_s\fP payload length or 0
1700: .br
1701: \fIl\fP pointer to a libnet context
1702: .br
1703: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1704: .RE
1705: .PP
1706: \fBReturns:\fP
1707: .RS 4
1708: protocol tag value on success
1709: .RE
1710: .PP
1711: \fBReturn values:\fP
1712: .RS 4
1713: \fI-1\fP on error
1714: .RE
1715: .PP
1716:
1717: .SS "LIBNET_API libnet_ptag_t libnet_build_icmpv4_unreach (uint8_t type, uint8_t code, uint16_t sum, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
1718: Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) unreachable header\&. The IP header that caused the error message should be built by a previous call to \fBlibnet_build_ipv4()\fP\&.
1719: .PP
1720: \fBParameters:\fP
1721: .RS 4
1722: \fItype\fP type of ICMP packet (should be ICMP_UNREACH)
1723: .br
1724: \fIcode\fP code of ICMP packet (should be one of the 16 unreachable codes)
1725: .br
1726: \fIsum\fP checksum (0 for libnet to auto-fill)
1727: .br
1728: \fIpayload\fP optional payload or NULL
1729: .br
1730: \fIpayload_s\fP payload length or 0
1731: .br
1732: \fIl\fP pointer to a libnet context
1733: .br
1734: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1735: .RE
1736: .PP
1737: \fBReturns:\fP
1738: .RS 4
1739: protocol tag value on success
1740: .RE
1741: .PP
1742: \fBReturn values:\fP
1743: .RS 4
1744: \fI-1\fP on error
1745: .RE
1746: .PP
1747:
1748: .SS "LIBNET_API libnet_ptag_t libnet_build_icmpv6_echo (uint8_t type, uint8_t code, uint16_t sum, uint16_t id, uint16_t seq, uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
1749: Builds an IP version 6 RFC 4443 Internet Control Message Protocol (ICMP) echo or echo reply header\&.
1750: .PP
1751: \fBParameters:\fP
1752: .RS 4
1753: \fItype\fP type of ICMP packet (should be ICMP6_ECHO_REQUEST or ICMP6_ECHO_REPLY)
1754: .br
1755: \fIcode\fP code of ICMP packet (should be zero)
1756: .br
1757: \fIsum\fP checksum (0 for libnet to auto-fill)
1758: .br
1759: \fIid\fP echo id number
1760: .br
1761: \fIseq\fP echo sequence number
1762: .br
1763: \fIpayload\fP optional payload or NULL
1764: .br
1765: \fIpayload_s\fP payload length or 0
1766: .br
1767: \fIl\fP pointer to a libnet context
1768: .br
1769: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1770: .RE
1771: .PP
1772: \fBReturns:\fP
1773: .RS 4
1774: protocol tag value on success
1775: .RE
1776: .PP
1777: \fBReturn values:\fP
1778: .RS 4
1779: \fI-1\fP on error
1780: .RE
1781: .PP
1782:
1783: .SS "LIBNET_API libnet_ptag_t libnet_build_icmpv6_ndp_nadv (uint8_t type, uint8_t code, uint16_t sum, uint32_t flags, struct libnet_in6_addr target, uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
1784: Builds an IP version 6 RFC 2461 Internet Control Message Protocol (ICMP) NDP neighbour advertisement header\&. Could be used with \fBlibnet_build_icmpv6_ndp_opt()\fP and ND_OPT_TARGET_LINKADDR\&.
1785: .PP
1786: \fBParameters:\fP
1787: .RS 4
1788: \fItype\fP type of ICMP packet (should be ND_NEIGHBOR_ADVERT)
1789: .br
1790: \fIcode\fP code of ICMP packet (should be zero)
1791: .br
1792: \fIsum\fP checksum (0 for libnet to auto-fill)
1793: .br
1794: \fIflags\fP should be a bitwise or of any applicable ND_NA_FLAG_* flags
1795: .br
1796: \fItarget\fP target ipv6 address
1797: .br
1798: \fIpayload\fP optional payload or NULL
1799: .br
1800: \fIpayload_s\fP payload length or 0
1801: .br
1802: \fIl\fP pointer to a libnet context
1803: .br
1804: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1805: .RE
1806: .PP
1807: \fBReturns:\fP
1808: .RS 4
1809: protocol tag value on success
1810: .RE
1811: .PP
1812: \fBReturn values:\fP
1813: .RS 4
1814: \fI-1\fP on error
1815: .RE
1816: .PP
1817:
1818: .SS "LIBNET_API libnet_ptag_t libnet_build_icmpv6_ndp_nsol (uint8_t type, uint8_t code, uint16_t sum, struct libnet_in6_addr target, uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
1819: Builds an IP version 6 RFC 2461 Internet Control Message Protocol (ICMP) NDP neighbour solicitation header\&. Could be used with \fBlibnet_build_icmpv6_ndp_opt()\fP and ICMPV6_NDP_OPT_SLLA\&.
1820: .PP
1821: \fBParameters:\fP
1822: .RS 4
1823: \fItype\fP type of ICMP packet (should be ND_NEIGHBOR_SOLICIT)
1824: .br
1825: \fIcode\fP code of ICMP packet (should be zero)
1826: .br
1827: \fIsum\fP checksum (0 for libnet to auto-fill)
1828: .br
1829: \fItarget\fP target ipv6 address
1830: .br
1831: \fIpayload\fP optional payload or NULL
1832: .br
1833: \fIpayload_s\fP payload length or 0
1834: .br
1835: \fIl\fP pointer to a libnet context
1836: .br
1837: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1838: .RE
1839: .PP
1840: \fBReturns:\fP
1841: .RS 4
1842: protocol tag value on success
1843: .RE
1844: .PP
1845: \fBReturn values:\fP
1846: .RS 4
1847: \fI-1\fP on error
1848: .RE
1849: .PP
1850:
1851: .SS "LIBNET_API libnet_ptag_t libnet_build_icmpv6_ndp_opt (uint8_t type, uint8_t * option, uint32_t option_s, libnet_t * l, libnet_ptag_t ptag)"
1852: Builds ICMPv6 NDP options\&.
1853: .PP
1854: \fBParameters:\fP
1855: .RS 4
1856: \fItype\fP one of ND_OPT_* types
1857: .br
1858: \fIoption\fP option data
1859: .br
1860: \fIoption_s\fP size of option data (will be padded out to an 8-byte boundary)
1861: .br
1862: \fIl\fP pointer to a libnet context
1863: .br
1864: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1865: .RE
1866: .PP
1867: \fBReturns:\fP
1868: .RS 4
1869: protocol tag value on success
1870: .RE
1871: .PP
1872: \fBReturn values:\fP
1873: .RS 4
1874: \fI-1\fP on error
1875: .RE
1876: .PP
1877:
1878: .SS "LIBNET_API libnet_ptag_t libnet_build_icmpv6_unreach (uint8_t type, uint8_t code, uint16_t sum, uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
1879: Builds an IP version 6 RFC 4443 Internet Control Message Protocol (ICMP) unreachable header\&. The IP header that caused the error message should be built by a previous call to \fBlibnet_build_ipv6()\fP\&.
1880: .PP
1881: \fBParameters:\fP
1882: .RS 4
1883: \fItype\fP type of ICMP packet (should be ICMP6_DST_UNREACH)
1884: .br
1885: \fIcode\fP code of ICMP packet (should be one of the 5 ICMP6_DST_UNREACH_* codes)
1886: .br
1887: \fIsum\fP checksum (0 for libnet to auto-fill)
1888: .br
1889: \fIpayload\fP optional payload or NULL
1890: .br
1891: \fIpayload_s\fP payload length or 0
1892: .br
1893: \fIl\fP pointer to a libnet context
1894: .br
1895: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1896: .RE
1897: .PP
1898: \fBReturns:\fP
1899: .RS 4
1900: protocol tag value on success
1901: .RE
1902: .PP
1903: \fBReturn values:\fP
1904: .RS 4
1905: \fI-1\fP on error
1906: .RE
1907: .PP
1908:
1909: .SS "LIBNET_API libnet_ptag_t libnet_build_igmp (uint8_t type, uint8_t reserved, uint16_t sum, uint32_t ip, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
1910: Builds an RFC 1112 Internet Group Membership Protocol (IGMP) header\&.
1911: .PP
1912: \fBParameters:\fP
1913: .RS 4
1914: \fItype\fP packet type
1915: .br
1916: \fIreserved\fP (should be 0 for IGMPv1)
1917: .br
1918: \fIsum\fP checksum (0 for libnet to auto-fill)
1919: .br
1920: \fIip\fP IPv4 address (in standard/network byte order)
1921: .br
1922: \fIpayload\fP optional payload or NULL
1923: .br
1924: \fIpayload_s\fP payload length or 0
1925: .br
1926: \fIl\fP pointer to a libnet context
1927: .br
1928: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1929: .RE
1930: .PP
1931: \fBReturns:\fP
1932: .RS 4
1933: protocol tag value on success
1934: .RE
1935: .PP
1936: \fBReturn values:\fP
1937: .RS 4
1938: \fI-1\fP on error
1939: .RE
1940: .PP
1941: \fBNote:\fP
1942: .RS 4
1943: 'reserved' was previously called 'code', which it is not, in any IGMP version\&.
1944: .RE
1945: .PP
1946:
1947: .SS "LIBNET_API libnet_ptag_t libnet_build_ipsec_ah (uint8_t nh, uint8_t len, uint16_t res, uint32_t spi, uint32_t seq, uint32_t auth, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
1948: Builds an Internet Protocol Security Authentication header\&.
1949: .PP
1950: \fBParameters:\fP
1951: .RS 4
1952: \fInh\fP next header
1953: .br
1954: \fIlen\fP payload length
1955: .br
1956: \fIres\fP reserved
1957: .br
1958: \fIspi\fP security parameter index
1959: .br
1960: \fIseq\fP sequence number
1961: .br
1962: \fIauth\fP authentication data
1963: .br
1964: \fIpayload\fP optional payload or NULL
1965: .br
1966: \fIpayload_s\fP payload length or 0
1967: .br
1968: \fIl\fP pointer to a libnet context
1969: .br
1970: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1971: .RE
1972: .PP
1973: \fBReturns:\fP
1974: .RS 4
1975: protocol tag value on success
1976: .RE
1977: .PP
1978: \fBReturn values:\fP
1979: .RS 4
1980: \fI-1\fP on error
1981: .RE
1982: .PP
1983:
1984: .SS "LIBNET_API libnet_ptag_t libnet_build_ipsec_esp_ftr (uint8_t len, uint8_t nh, int8_t * auth, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
1985: Builds an Internet Protocol Security Encapsulating Security Payload footer\&.
1986: .PP
1987: \fBParameters:\fP
1988: .RS 4
1989: \fIlen\fP padding length
1990: .br
1991: \fInh\fP next header
1992: .br
1993: \fIauth\fP authentication data
1994: .br
1995: \fIpayload\fP optional payload or NULL
1996: .br
1997: \fIpayload_s\fP payload length or 0
1998: .br
1999: \fIl\fP pointer to a libnet context
2000: .br
2001: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2002: .RE
2003: .PP
2004: \fBReturns:\fP
2005: .RS 4
2006: protocol tag value on success
2007: .RE
2008: .PP
2009: \fBReturn values:\fP
2010: .RS 4
2011: \fI-1\fP on error
2012: .RE
2013: .PP
2014:
2015: .SS "LIBNET_API libnet_ptag_t libnet_build_ipsec_esp_hdr (uint32_t spi, uint32_t seq, uint32_t iv, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
2016: Builds an Internet Protocol Security Encapsulating Security Payload header\&.
2017: .PP
2018: \fBParameters:\fP
2019: .RS 4
2020: \fIspi\fP security parameter index
2021: .br
2022: \fIseq\fP ESP sequence number
2023: .br
2024: \fIiv\fP initialization vector
2025: .br
2026: \fIpayload\fP optional payload or NULL
2027: .br
2028: \fIpayload_s\fP payload length or 0
2029: .br
2030: \fIl\fP pointer to a libnet context
2031: .br
2032: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2033: .RE
2034: .PP
2035: \fBReturns:\fP
2036: .RS 4
2037: protocol tag value on success
2038: .RE
2039: .PP
2040: \fBReturn values:\fP
2041: .RS 4
2042: \fI-1\fP on error
2043: .RE
2044: .PP
2045:
2046: .SS "LIBNET_API libnet_ptag_t libnet_build_ipv4 (uint16_t ip_len, uint8_t tos, uint16_t id, uint16_t frag, uint8_t ttl, uint8_t prot, uint16_t sum, uint32_t src, uint32_t dst, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
2047: Builds a version 4 RFC 791 Internet Protocol (IP) header\&.
2048: .PP
2049: \fBParameters:\fP
2050: .RS 4
2051: \fIip_len\fP total length of the IP packet including all subsequent data (subsequent data includes any IP options and IP options padding)
2052: .br
2053: \fItos\fP type of service bits
2054: .br
2055: \fIid\fP IP identification number
2056: .br
2057: \fIfrag\fP fragmentation bits and offset
2058: .br
2059: \fIttl\fP time to live in the network
2060: .br
2061: \fIprot\fP upper layer protocol
2062: .br
2063: \fIsum\fP checksum (0 for libnet to auto-fill)
2064: .br
2065: \fIsrc\fP source IPv4 address (little endian)
2066: .br
2067: \fIdst\fP destination IPv4 address (little endian)
2068: .br
2069: \fIpayload\fP optional payload or NULL
2070: .br
2071: \fIpayload_s\fP payload length or 0
2072: .br
2073: \fIl\fP pointer to a libnet context
2074: .br
2075: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2076: .RE
2077: .PP
2078: \fBReturns:\fP
2079: .RS 4
2080: protocol tag value on success
2081: .RE
2082: .PP
2083: \fBReturn values:\fP
2084: .RS 4
2085: \fI-1\fP on error
2086: .RE
2087: .PP
2088:
2089: .SS "LIBNET_API libnet_ptag_t libnet_build_ipv4_options (const uint8_t * options, uint32_t options_s, libnet_t * l, libnet_ptag_t ptag)"
2090: Builds an version 4 Internet Protocol (IP) options header\&. The function expects options to be a valid IP options string of size options_s, no larger than 40 bytes (the maximum size of an options string)\&.
2091: .PP
2092: When building a chain, the options must be built, then the IPv4 header\&.
2093: .PP
2094: When updating a chain, if the block following the options is an IPv4 header, it's total length and header length will be updated if the options block size changes\&.
2095: .PP
2096: \fBParameters:\fP
2097: .RS 4
2098: \fIoptions\fP byte string of IP options (it will be padded up to be an integral multiple of 32-bit words)\&.
2099: .br
2100: \fIoptions_s\fP length of options string
2101: .br
2102: \fIl\fP pointer to a libnet context
2103: .br
2104: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2105: .RE
2106: .PP
2107: \fBReturns:\fP
2108: .RS 4
2109: protocol tag value on success
2110: .RE
2111: .PP
2112: \fBReturn values:\fP
2113: .RS 4
2114: \fI-1\fP on error
2115: .RE
2116: .PP
2117:
2118: .SS "LIBNET_API libnet_ptag_t libnet_build_ipv6 (uint8_t tc, uint32_t fl, uint16_t len, uint8_t nh, uint8_t hl, struct libnet_in6_addr src, struct libnet_in6_addr dst, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
2119: Builds a version 6 RFC 2460 Internet Protocol (IP) header\&.
2120: .PP
2121: \fBParameters:\fP
2122: .RS 4
2123: \fItc\fP traffic class
2124: .br
2125: \fIfl\fP flow label
2126: .br
2127: \fIlen\fP total length of the IP packet
2128: .br
2129: \fInh\fP next header
2130: .br
2131: \fIhl\fP hop limit
2132: .br
2133: \fIsrc\fP source IPv6 address
2134: .br
2135: \fIdst\fP destination IPv6 address
2136: .br
2137: \fIpayload\fP optional payload or NULL
2138: .br
2139: \fIpayload_s\fP payload length or 0
2140: .br
2141: \fIl\fP pointer to a libnet context
2142: .br
2143: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2144: .RE
2145: .PP
2146: \fBReturns:\fP
2147: .RS 4
2148: protocol tag value on success
2149: .RE
2150: .PP
2151: \fBReturn values:\fP
2152: .RS 4
2153: \fI-1\fP on error
2154: .RE
2155: .PP
2156:
2157: .SS "LIBNET_API libnet_ptag_t libnet_build_ipv6_destopts (uint8_t nh, uint8_t len, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
2158: Builds a version 6 RFC 2460 Internet Protocol (IP) destination options header\&. This function is special in that it uses the payload interface to include the options data\&. The application programmer will build an IPv6 options byte string and pass it to the function using the payload interface\&.
2159: .PP
2160: \fBParameters:\fP
2161: .RS 4
2162: \fInh\fP next header
2163: .br
2164: \fIlen\fP length of the header in 8-byte octets not including the first 8 octets
2165: .br
2166: \fIpayload\fP options payload
2167: .br
2168: \fIpayload_s\fP payload length
2169: .br
2170: \fIl\fP pointer to a libnet context
2171: .br
2172: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2173: .RE
2174: .PP
2175: \fBReturns:\fP
2176: .RS 4
2177: protocol tag value on success
2178: .RE
2179: .PP
2180: \fBReturn values:\fP
2181: .RS 4
2182: \fI-1\fP on error
2183: .RE
2184: .PP
2185:
2186: .SS "LIBNET_API libnet_ptag_t libnet_build_ipv6_frag (uint8_t nh, uint8_t reserved, uint16_t frag, uint32_t id, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
2187: Builds a version 6 RFC 2460 Internet Protocol (IP) fragmentation header\&.
2188: .PP
2189: \fBParameters:\fP
2190: .RS 4
2191: \fInh\fP next header
2192: .br
2193: \fIreserved\fP unused value\&.\&.\&. OR IS IT!
2194: .br
2195: \fIfrag\fP fragmentation bits (ala ipv4)
2196: .br
2197: \fIid\fP packet identification
2198: .br
2199: \fIpayload\fP optional payload or NULL
2200: .br
2201: \fIpayload_s\fP payload length or 0
2202: .br
2203: \fIl\fP pointer to a libnet context
2204: .br
2205: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2206: .RE
2207: .PP
2208: \fBReturns:\fP
2209: .RS 4
2210: protocol tag value on success
2211: .RE
2212: .PP
2213: \fBReturn values:\fP
2214: .RS 4
2215: \fI-1\fP on error
2216: .RE
2217: .PP
2218:
2219: .SS "LIBNET_API libnet_ptag_t libnet_build_ipv6_hbhopts (uint8_t nh, uint8_t len, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
2220: Builds a version 6 RFC 2460 Internet Protocol (IP) hop by hop options header\&. This function is special in that it uses the payload interface to include the options data\&. The application programmer will build an IPv6 hop by hop options byte string and pass it to the function using the payload interface\&.
2221: .PP
2222: \fBParameters:\fP
2223: .RS 4
2224: \fInh\fP next header
2225: .br
2226: \fIlen\fP length of the header in 8-byte octets not including the first 8 octets
2227: .br
2228: \fIpayload\fP options payload
2229: .br
2230: \fIpayload_s\fP payload length
2231: .br
2232: \fIl\fP pointer to a libnet context
2233: .br
2234: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2235: .RE
2236: .PP
2237: \fBReturns:\fP
2238: .RS 4
2239: protocol tag value on success
2240: .RE
2241: .PP
2242: \fBReturn values:\fP
2243: .RS 4
2244: \fI-1\fP on error
2245: .RE
2246: .PP
2247:
2248: .SS "LIBNET_API libnet_ptag_t libnet_build_ipv6_routing (uint8_t nh, uint8_t len, uint8_t rtype, uint8_t segments, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
2249: Builds a version 6 RFC 2460 Internet Protocol (IP) routing header\&. This function is special in that it uses the payload interface to include the 'type-specific data'; that is the routing information\&. Most often this will be a number of 128-bit IPv6 addresses\&. The application programmer will build a byte string of IPv6 address and pass them to the function using the payload interface\&.
2250: .PP
2251: \fBParameters:\fP
2252: .RS 4
2253: \fInh\fP next header
2254: .br
2255: \fIlen\fP length of the header in 8-byte octets not including the first 8 octets
2256: .br
2257: \fIrtype\fP routing header type
2258: .br
2259: \fIsegments\fP number of routing segments that follow
2260: .br
2261: \fIpayload\fP optional payload of routing information
2262: .br
2263: \fIpayload_s\fP payload length
2264: .br
2265: \fIl\fP pointer to a libnet context
2266: .br
2267: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2268: .RE
2269: .PP
2270: \fBReturns:\fP
2271: .RS 4
2272: protocol tag value on success
2273: .RE
2274: .PP
2275: \fBReturn values:\fP
2276: .RS 4
2277: \fI-1\fP on error
2278: .RE
2279: .PP
2280:
2281: .SS "LIBNET_API libnet_ptag_t libnet_build_isl (uint8_t * dhost, uint8_t type, uint8_t user, uint8_t * shost, uint16_t len, const uint8_t * snap, uint16_t vid, uint16_t portindex, uint16_t reserved, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
2282: Builds a Cisco Inter-Switch Link (ISL) header\&.
2283: .PP
2284: \fBParameters:\fP
2285: .RS 4
2286: \fIdhost\fP destination address (should be 01:00:0c:00:00)
2287: .br
2288: \fItype\fP type of frame
2289: .br
2290: \fIuser\fP user defined data
2291: .br
2292: \fIshost\fP source mac address
2293: .br
2294: \fIlen\fP total length of the encapsulated packet less 18 bytes
2295: .br
2296: \fIsnap\fP SNAP information (0xaaaa03 + vendor code)
2297: .br
2298: \fIvid\fP 15 bit VLAN ID, 1 bit BPDU or CDP indicator
2299: .br
2300: \fIportindex\fP port index
2301: .br
2302: \fIreserved\fP used for FDDI and token ring
2303: .br
2304: \fIpayload\fP optional payload or NULL
2305: .br
2306: \fIpayload_s\fP payload length or 0
2307: .br
2308: \fIl\fP pointer to a libnet context
2309: .br
2310: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2311: .RE
2312: .PP
2313: \fBReturns:\fP
2314: .RS 4
2315: protocol tag value on success
2316: .RE
2317: .PP
2318: \fBReturn values:\fP
2319: .RS 4
2320: \fI-1\fP on error
2321: .RE
2322: .PP
2323:
2324: .SS "LIBNET_API libnet_ptag_t libnet_build_link (const uint8_t * dst, const uint8_t * src, const uint8_t * oui, uint16_t type, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
2325: Builds a link layer header for an initialized l\&. The function determines the proper link layer header format from how l was initialized\&. The function current supports Ethernet and Token Ring link layers\&.
2326: .PP
2327: \fBParameters:\fP
2328: .RS 4
2329: \fIdst\fP the destination MAC address
2330: .br
2331: \fIsrc\fP the source MAC address
2332: .br
2333: \fIoui\fP Organizationally Unique Identifier (unused for Ethernet)
2334: .br
2335: \fItype\fP the upper layer protocol type
2336: .br
2337: \fIpayload\fP optional payload or NULL
2338: .br
2339: \fIpayload_s\fP payload length or 0
2340: .br
2341: \fIl\fP pointer to a libnet context
2342: .br
2343: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2344: .RE
2345: .PP
2346: \fBReturns:\fP
2347: .RS 4
2348: protocol tag value on success
2349: .RE
2350: .PP
2351: \fBReturn values:\fP
2352: .RS 4
2353: \fI-1\fP on error
2354: .RE
2355: .PP
2356:
2357: .SS "LIBNET_API libnet_ptag_t libnet_build_mpls (uint32_t label, uint8_t experimental, uint8_t bos, uint8_t ttl, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
2358: Builds an RFC 3032 Multi-Protocol Label Switching (MPLS) header\&.
2359: .PP
2360: \fBParameters:\fP
2361: .RS 4
2362: \fIlabel\fP 20-bit label value
2363: .br
2364: \fIexperimental\fP 3-bit reserved field
2365: .br
2366: \fIbos\fP 1-bit bottom of stack identifier
2367: .br
2368: \fIttl\fP time to live
2369: .br
2370: \fIpayload\fP optional payload or NULL
2371: .br
2372: \fIpayload_s\fP payload length or 0
2373: .br
2374: \fIl\fP pointer to a libnet context
2375: .br
2376: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2377: .RE
2378: .PP
2379: \fBReturns:\fP
2380: .RS 4
2381: protocol tag value on success
2382: .RE
2383: .PP
2384: \fBReturn values:\fP
2385: .RS 4
2386: \fI-1\fP on error
2387: .RE
2388: .PP
2389:
2390: .SS "LIBNET_API libnet_ptag_t libnet_build_ntp (uint8_t leap_indicator, uint8_t version, uint8_t mode, uint8_t stratum, uint8_t poll, uint8_t precision, uint16_t delay_int, uint16_t delay_frac, uint16_t dispersion_int, uint16_t dispersion_frac, uint32_t reference_id, uint32_t ref_ts_int, uint32_t ref_ts_frac, uint32_t orig_ts_int, uint32_t orig_ts_frac, uint32_t rec_ts_int, uint32_t rec_ts_frac, uint32_t xmt_ts_int, uint32_t xmt_ts_frac, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
2391: Builds an RFC 958 Network Time Protocol (NTP) header\&.
2392: .PP
2393: \fBParameters:\fP
2394: .RS 4
2395: \fIleap_indicator\fP the leap indicator
2396: .br
2397: \fIversion\fP NTP protocol version
2398: .br
2399: \fImode\fP NTP mode
2400: .br
2401: \fIstratum\fP stratum
2402: .br
2403: \fIpoll\fP polling interval
2404: .br
2405: \fIprecision\fP precision
2406: .br
2407: \fIdelay_int\fP delay interval
2408: .br
2409: \fIdelay_frac\fP delay fraction
2410: .br
2411: \fIdispersion_int\fP dispersion interval
2412: .br
2413: \fIdispersion_frac\fP dispersion fraction
2414: .br
2415: \fIreference_id\fP reference id
2416: .br
2417: \fIref_ts_int\fP reference timestamp integer
2418: .br
2419: \fIref_ts_frac\fP reference timestamp fraction
2420: .br
2421: \fIorig_ts_int\fP original timestamp integer
2422: .br
2423: \fIorig_ts_frac\fP original timestamp fraction
2424: .br
2425: \fIrec_ts_int\fP receiver timestamp integer
2426: .br
2427: \fIrec_ts_frac\fP receiver timestamp fraction
2428: .br
2429: \fIxmt_ts_int\fP transmit timestamp integer
2430: .br
2431: \fIxmt_ts_frac\fP transmit timestamp integer
2432: .br
2433: \fIpayload\fP optional payload or NULL
2434: .br
2435: \fIpayload_s\fP payload length or 0
2436: .br
2437: \fIl\fP pointer to a libnet context
2438: .br
2439: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2440: .RE
2441: .PP
2442: \fBReturns:\fP
2443: .RS 4
2444: protocol tag value on success
2445: .RE
2446: .PP
2447: \fBReturn values:\fP
2448: .RS 4
2449: \fI-1\fP on error
2450: .RE
2451: .PP
2452:
2453: .SS "LIBNET_API libnet_ptag_t libnet_build_ospfv2 (uint16_t len, uint8_t type, uint32_t rtr_id, uint32_t area_id, uint16_t sum, uint16_t autype, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
2454:
2455: .PP
2456: \fBParameters:\fP
2457: .RS 4
2458: \fIlen\fP
2459: .br
2460: \fItype\fP
2461: .br
2462: \fIrtr_id\fP
2463: .br
2464: \fIarea_id\fP
2465: .br
2466: \fIsum\fP
2467: .br
2468: \fIautype\fP
2469: .br
2470: \fIpayload\fP optional payload or NULL
2471: .br
2472: \fIpayload_s\fP payload length or 0
2473: .br
2474: \fIl\fP pointer to a libnet context
2475: .br
2476: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2477: .RE
2478: .PP
2479: \fBReturns:\fP
2480: .RS 4
2481: protocol tag value on success
2482: .RE
2483: .PP
2484: \fBReturn values:\fP
2485: .RS 4
2486: \fI-1\fP on error
2487: .RE
2488: .PP
2489:
2490: .SS "LIBNET_API libnet_ptag_t libnet_build_ospfv2_dbd (uint16_t dgram_len, uint8_t opts, uint8_t type, uint32_t seqnum, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
2491:
2492: .PP
2493: \fBParameters:\fP
2494: .RS 4
2495: \fIdgram_len\fP
2496: .br
2497: \fIopts\fP
2498: .br
2499: \fItype\fP
2500: .br
2501: \fIseqnum\fP
2502: .br
2503: \fIpayload\fP optional payload or NULL
2504: .br
2505: \fIpayload_s\fP payload length or 0
2506: .br
2507: \fIl\fP pointer to a libnet context
2508: .br
2509: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2510: .RE
2511: .PP
2512: \fBReturns:\fP
2513: .RS 4
2514: protocol tag value on success
2515: .RE
2516: .PP
2517: \fBReturn values:\fP
2518: .RS 4
2519: \fI-1\fP on error
2520: .RE
2521: .PP
2522:
2523: .SS "LIBNET_API libnet_ptag_t libnet_build_ospfv2_hello (uint32_t netmask, uint16_t interval, uint8_t opts, uint8_t priority, uint32_t dead_int, uint32_t des_rtr, uint32_t bkup_rtr, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
2524:
2525: .PP
2526: \fBParameters:\fP
2527: .RS 4
2528: \fInetmask\fP
2529: .br
2530: \fIinterval\fP
2531: .br
2532: \fIopts\fP
2533: .br
2534: \fIpriority\fP
2535: .br
2536: \fIdead_int\fP
2537: .br
2538: \fIdes_rtr\fP
2539: .br
2540: \fIbkup_rtr\fP
2541: .br
2542: \fIpayload\fP optional payload or NULL
2543: .br
2544: \fIpayload_s\fP payload length or 0
2545: .br
2546: \fIl\fP pointer to a libnet context
2547: .br
2548: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2549: .RE
2550: .PP
2551: \fBReturns:\fP
2552: .RS 4
2553: protocol tag value on success
2554: .RE
2555: .PP
2556: \fBReturn values:\fP
2557: .RS 4
2558: \fI-1\fP on error
2559: .RE
2560: .PP
2561:
2562: .SS "libnet_ptag_t libnet_build_ospfv2_hello_neighbor (uint32_t netmask, uint16_t interval, uint8_t opts, uint8_t priority, uint32_t dead_int, uint32_t des_rtr, uint32_t bkup_rtr, uint32_t neighbor, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
2563:
2564: .PP
2565: \fBParameters:\fP
2566: .RS 4
2567: \fInetmask\fP
2568: .br
2569: \fIinterval\fP
2570: .br
2571: \fIopts\fP
2572: .br
2573: \fIpriority\fP
2574: .br
2575: \fIdead_int\fP
2576: .br
2577: \fIdes_rtr\fP
2578: .br
2579: \fIbkup_rtr\fP
2580: .br
2581: \fIneighbor\fP
2582: .br
2583: \fIpayload\fP optional payload or NULL
2584: .br
2585: \fIpayload_s\fP payload length or 0
2586: .br
2587: \fIl\fP pointer to a libnet context
2588: .br
2589: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2590: .RE
2591: .PP
2592: \fBReturns:\fP
2593: .RS 4
2594: protocol tag value on success
2595: .RE
2596: .PP
2597: \fBReturn values:\fP
2598: .RS 4
2599: \fI-1\fP on error
2600: .RE
2601: .PP
2602:
2603: .SS "LIBNET_API libnet_ptag_t libnet_build_ospfv2_lsa (uint16_t age, uint8_t opts, uint8_t type, uint32_t lsid, uint32_t advrtr, uint32_t seqnum, uint16_t sum, uint16_t len, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
2604:
2605: .PP
2606: \fBParameters:\fP
2607: .RS 4
2608: \fIage\fP
2609: .br
2610: \fIopts\fP
2611: .br
2612: \fItype\fP
2613: .br
2614: \fIlsid\fP
2615: .br
2616: \fIadvrtr\fP
2617: .br
2618: \fIseqnum\fP
2619: .br
2620: \fIsum\fP
2621: .br
2622: \fIlen\fP
2623: .br
2624: \fIpayload\fP optional payload or NULL
2625: .br
2626: \fIpayload_s\fP payload length or 0
2627: .br
2628: \fIl\fP pointer to a libnet context
2629: .br
2630: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2631: .RE
2632: .PP
2633: \fBReturns:\fP
2634: .RS 4
2635: protocol tag value on success
2636: .RE
2637: .PP
2638: \fBReturn values:\fP
2639: .RS 4
2640: \fI-1\fP on error
2641: .RE
2642: .PP
2643:
2644: .SS "LIBNET_API libnet_ptag_t libnet_build_ospfv2_lsa_as (uint32_t nmask, uint32_t metric, uint32_t fwdaddr, uint32_t tag, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
2645:
2646: .PP
2647: \fBParameters:\fP
2648: .RS 4
2649: \fInmask\fP
2650: .br
2651: \fImetric\fP
2652: .br
2653: \fIfwdaddr\fP
2654: .br
2655: \fItag\fP
2656: .br
2657: \fIpayload\fP optional payload or NULL
2658: .br
2659: \fIpayload_s\fP payload length or 0
2660: .br
2661: \fIl\fP pointer to a libnet context
2662: .br
2663: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2664: .RE
2665: .PP
2666: \fBReturns:\fP
2667: .RS 4
2668: protocol tag value on success
2669: .RE
2670: .PP
2671: \fBReturn values:\fP
2672: .RS 4
2673: \fI-1\fP on error
2674: .RE
2675: .PP
2676:
2677: .SS "LIBNET_API libnet_ptag_t libnet_build_ospfv2_lsa_net (uint32_t nmask, uint32_t rtrid, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
2678:
2679: .PP
2680: \fBParameters:\fP
2681: .RS 4
2682: \fInmask\fP
2683: .br
2684: \fIrtrid\fP
2685: .br
2686: \fIpayload\fP optional payload or NULL
2687: .br
2688: \fIpayload_s\fP payload length or 0
2689: .br
2690: \fIl\fP pointer to a libnet context
2691: .br
2692: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2693: .RE
2694: .PP
2695: \fBReturns:\fP
2696: .RS 4
2697: protocol tag value on success
2698: .RE
2699: .PP
2700: \fBReturn values:\fP
2701: .RS 4
2702: \fI-1\fP on error
2703: .RE
2704: .PP
2705:
2706: .SS "LIBNET_API libnet_ptag_t libnet_build_ospfv2_lsa_rtr (uint16_t flags, uint16_t num, uint32_t id, uint32_t data, uint8_t type, uint8_t tos, uint16_t metric, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
2707:
2708: .PP
2709: \fBParameters:\fP
2710: .RS 4
2711: \fIflags\fP
2712: .br
2713: \fInum\fP
2714: .br
2715: \fIid\fP
2716: .br
2717: \fIdata\fP
2718: .br
2719: \fItype\fP
2720: .br
2721: \fItos\fP
2722: .br
2723: \fImetric\fP
2724: .br
2725: \fIpayload\fP optional payload or NULL
2726: .br
2727: \fIpayload_s\fP payload length or 0
2728: .br
2729: \fIl\fP pointer to a libnet context
2730: .br
2731: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2732: .RE
2733: .PP
2734: \fBReturns:\fP
2735: .RS 4
2736: protocol tag value on success
2737: .RE
2738: .PP
2739: \fBReturn values:\fP
2740: .RS 4
2741: \fI-1\fP on error
2742: .RE
2743: .PP
2744:
2745: .SS "LIBNET_API libnet_ptag_t libnet_build_ospfv2_lsa_sum (uint32_t nmask, uint32_t metric, uint32_t tos, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
2746:
2747: .PP
2748: \fBParameters:\fP
2749: .RS 4
2750: \fInmask\fP
2751: .br
2752: \fImetric\fP
2753: .br
2754: \fItos\fP
2755: .br
2756: \fIpayload\fP optional payload or NULL
2757: .br
2758: \fIpayload_s\fP payload length or 0
2759: .br
2760: \fIl\fP pointer to a libnet context
2761: .br
2762: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2763: .RE
2764: .PP
2765: \fBReturns:\fP
2766: .RS 4
2767: protocol tag value on success
2768: .RE
2769: .PP
2770: \fBReturn values:\fP
2771: .RS 4
2772: \fI-1\fP on error
2773: .RE
2774: .PP
2775:
2776: .SS "LIBNET_API libnet_ptag_t libnet_build_ospfv2_lsr (uint32_t type, uint32_t lsid, uint32_t advrtr, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
2777:
2778: .PP
2779: \fBParameters:\fP
2780: .RS 4
2781: \fItype\fP
2782: .br
2783: \fIlsid\fP
2784: .br
2785: \fIadvrtr\fP
2786: .br
2787: \fIpayload\fP optional payload or NULL
2788: .br
2789: \fIpayload_s\fP payload length or 0
2790: .br
2791: \fIl\fP pointer to a libnet context
2792: .br
2793: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2794: .RE
2795: .PP
2796: \fBReturns:\fP
2797: .RS 4
2798: protocol tag value on success
2799: .RE
2800: .PP
2801: \fBReturn values:\fP
2802: .RS 4
2803: \fI-1\fP on error
2804: .RE
2805: .PP
2806:
2807: .SS "LIBNET_API libnet_ptag_t libnet_build_ospfv2_lsu (uint32_t num, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
2808:
2809: .PP
2810: \fBParameters:\fP
2811: .RS 4
2812: \fInum\fP
2813: .br
2814: \fIpayload\fP optional payload or NULL
2815: .br
2816: \fIpayload_s\fP payload length or 0
2817: .br
2818: \fIl\fP pointer to a libnet context
2819: .br
2820: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2821: .RE
2822: .PP
2823: \fBReturns:\fP
2824: .RS 4
2825: protocol tag value on success
2826: .RE
2827: .PP
2828: \fBReturn values:\fP
2829: .RS 4
2830: \fI-1\fP on error
2831: .RE
2832: .PP
2833:
2834: .SS "LIBNET_API libnet_ptag_t libnet_build_rip (uint8_t cmd, uint8_t version, uint16_t rd, uint16_t af, uint16_t rt, uint32_t addr, uint32_t mask, uint32_t next_hop, uint32_t metric, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
2835: Builds a Routing Information Protocol header (RFCs 1058 and 2453)\&.
2836: .PP
2837: \fBParameters:\fP
2838: .RS 4
2839: \fIcmd\fP command
2840: .br
2841: \fIversion\fP protocol version
2842: .br
2843: \fIrd\fP version one: 0, version two: routing domain
2844: .br
2845: \fIaf\fP address family
2846: .br
2847: \fIrt\fP version one: 0, version two: route tag
2848: .br
2849: \fIaddr\fP IPv4 address
2850: .br
2851: \fImask\fP version one: 0, version two: subnet mask
2852: .br
2853: \fInext_hop\fP version one: 0, version two: next hop address
2854: .br
2855: \fImetric\fP routing metric
2856: .br
2857: \fIpayload\fP optional payload or NULL
2858: .br
2859: \fIpayload_s\fP payload length or 0
2860: .br
2861: \fIl\fP pointer to a libnet context
2862: .br
2863: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2864: .RE
2865: .PP
2866: \fBReturns:\fP
2867: .RS 4
2868: protocol tag value on success
2869: .RE
2870: .PP
2871: \fBReturn values:\fP
2872: .RS 4
2873: \fI-1\fP on error
2874: .RE
2875: .PP
2876:
2877: .SS "LIBNET_API libnet_ptag_t libnet_build_rpc_call (uint32_t rm, uint32_t xid, uint32_t prog_num, uint32_t prog_vers, uint32_t procedure, uint32_t cflavor, uint32_t clength, uint8_t * cdata, uint32_t vflavor, uint32_t vlength, const uint8_t * vdata, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
2878: Builds an Remote Procedure Call (Version 2) Call message header as specified in RFC 1831\&. This builder provides the option for specifying the record marking which is required when used with streaming protocols (TCP)\&.
2879: .PP
2880: \fBParameters:\fP
2881: .RS 4
2882: \fIrm\fP record marking indicating the position in a stream, 0 otherwise
2883: .br
2884: \fIxid\fP transaction identifier used to link calls and replies
2885: .br
2886: \fIprog_num\fP remote program specification typically between 0 - 1fffffff
2887: .br
2888: \fIprog_vers\fP remote program version specification
2889: .br
2890: \fIprocedure\fP procedure to be performed by remote program
2891: .br
2892: \fIcflavor\fP authentication credential type
2893: .br
2894: \fIclength\fP credential length (should be 0)
2895: .br
2896: \fIcdata\fP opaque credential data (currently unused)
2897: .br
2898: \fIvflavor\fP authentication verifier type
2899: .br
2900: \fIvlength\fP verifier length (should be 0)
2901: .br
2902: \fIvdata\fP opaque verifier data (currently unused)
2903: .br
2904: \fIpayload\fP optional payload or NULL
2905: .br
2906: \fIpayload_s\fP payload length or 0
2907: .br
2908: \fIl\fP pointer to a libnet context
2909: .br
2910: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2911: .RE
2912: .PP
2913: \fBReturns:\fP
2914: .RS 4
2915: protocol tag value on success
2916: .RE
2917: .PP
2918: \fBReturn values:\fP
2919: .RS 4
2920: \fI-1\fP on error
2921: .RE
2922: .PP
2923:
2924: .SS "LIBNET_API libnet_ptag_t libnet_build_sebek (uint32_t magic, uint16_t version, uint16_t type, uint32_t counter, uint32_t time_sec, uint32_t time_usec, uint32_t pid, uint32_t uid, uint32_t fd, uint8_t cmd[SEBEK_CMD_LENGTH], uint32_t length, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
2925: Builds a Sebek header\&. The Sebek protocol was designed by the Honeynet Project as a transport mechanism for post-intrusion forensic data\&. More information may be found here: http://www.honeynet.org/papers/sebek.pdf\&.
2926: .PP
2927: \fBParameters:\fP
2928: .RS 4
2929: \fImagic\fP identify packets that should be hidden
2930: .br
2931: \fIversion\fP protocol version, currently 1
2932: .br
2933: \fItype\fP type of record (read data is type 0, write data is type 1)
2934: .br
2935: \fIcounter\fP PDU counter used to identify when packet are lost
2936: .br
2937: \fItime_sec\fP seconds since EPOCH according to the honeypot
2938: .br
2939: \fItime_usec\fP residual microseconds
2940: .br
2941: \fIpid\fP PID
2942: .br
2943: \fIuid\fP UID
2944: .br
2945: \fIfd\fP FD
2946: .br
2947: \fIcmd\fP 12 first characters of the command
2948: .br
2949: \fIlength\fP length in bytes of the PDU's body
2950: .br
2951: \fIpayload\fP optional payload or NULL
2952: .br
2953: \fIpayload_s\fP payload length or 0
2954: .br
2955: \fIl\fP pointer to a libnet context
2956: .br
2957: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2958: .RE
2959: .PP
2960: \fBReturns:\fP
2961: .RS 4
2962: protocol tag value on success
2963: .RE
2964: .PP
2965: \fBReturn values:\fP
2966: .RS 4
2967: \fI-1\fP on error
2968: .RE
2969: .PP
2970:
2971: .SS "LIBNET_API libnet_ptag_t libnet_build_stp_conf (uint16_t id, uint8_t version, uint8_t bpdu_type, uint8_t flags, const uint8_t * root_id, uint32_t root_pc, const uint8_t * bridge_id, uint16_t port_id, uint16_t message_age, uint16_t max_age, uint16_t hello_time, uint16_t f_delay, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
2972: Builds an IEEE 802\&.1d Spanning Tree Protocol (STP) configuration header\&. STP frames are usually encapsulated inside of an 802\&.2 + 802\&.3 frame combination\&.
2973: .PP
2974: \fBParameters:\fP
2975: .RS 4
2976: \fIid\fP protocol id
2977: .br
2978: \fIversion\fP protocol version
2979: .br
2980: \fIbpdu_type\fP bridge protocol data unit type
2981: .br
2982: \fIflags\fP flags
2983: .br
2984: \fIroot_id\fP root id
2985: .br
2986: \fIroot_pc\fP root path cost
2987: .br
2988: \fIbridge_id\fP bridge id
2989: .br
2990: \fIport_id\fP port id
2991: .br
2992: \fImessage_age\fP message age
2993: .br
2994: \fImax_age\fP max age
2995: .br
2996: \fIhello_time\fP hello time
2997: .br
2998: \fIf_delay\fP forward delay
2999: .br
3000: \fIpayload\fP optional payload or NULL
3001: .br
3002: \fIpayload_s\fP payload length or 0
3003: .br
3004: \fIl\fP pointer to a libnet context
3005: .br
3006: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
3007: .RE
3008: .PP
3009: \fBReturns:\fP
3010: .RS 4
3011: protocol tag value on success
3012: .RE
3013: .PP
3014: \fBReturn values:\fP
3015: .RS 4
3016: \fI-1\fP on error
3017: .RE
3018: .PP
3019:
3020: .SS "LIBNET_API libnet_ptag_t libnet_build_stp_tcn (uint16_t id, uint8_t version, uint8_t bpdu_type, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
3021: Builds an IEEE 802\&.1d Spanning Tree Protocol (STP) topology change notification header\&. STP frames are usually encapsulated inside of an 802\&.2 + 802\&.3 frame combination\&.
3022: .PP
3023: \fBParameters:\fP
3024: .RS 4
3025: \fIid\fP protocol id
3026: .br
3027: \fIversion\fP protocol version
3028: .br
3029: \fIbpdu_type\fP bridge protocol data unit type
3030: .br
3031: \fIpayload\fP optional payload or NULL
3032: .br
3033: \fIpayload_s\fP payload length or 0
3034: .br
3035: \fIl\fP pointer to a libnet context
3036: .br
3037: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
3038: .RE
3039: .PP
3040: \fBReturns:\fP
3041: .RS 4
3042: protocol tag value on success
3043: .RE
3044: .PP
3045: \fBReturn values:\fP
3046: .RS 4
3047: \fI-1\fP on error
3048: .RE
3049: .PP
3050:
3051: .SS "LIBNET_API libnet_ptag_t libnet_build_tcp (uint16_t sp, uint16_t dp, uint32_t seq, uint32_t ack, uint8_t control, uint16_t win, uint16_t sum, uint16_t urg, uint16_t len, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
3052: Builds an RFC 793 Transmission Control Protocol (TCP) header\&.
3053: .PP
3054: \fBParameters:\fP
3055: .RS 4
3056: \fIsp\fP source port
3057: .br
3058: \fIdp\fP destination port
3059: .br
3060: \fIseq\fP sequence number
3061: .br
3062: \fIack\fP acknowledgement number
3063: .br
3064: \fIcontrol\fP control flags
3065: .br
3066: \fIwin\fP window size
3067: .br
3068: \fIsum\fP checksum (0 for libnet to auto-fill)
3069: .br
3070: \fIurg\fP urgent pointer
3071: .br
3072: \fIlen\fP total length of the TCP packet (for checksum calculation)
3073: .br
3074: \fIpayload\fP
3075: .br
3076: \fIpayload_s\fP payload length or 0
3077: .br
3078: \fIl\fP pointer to a libnet context
3079: .br
3080: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
3081: .RE
3082: .PP
3083: \fBReturns:\fP
3084: .RS 4
3085: protocol tag value on success
3086: .RE
3087: .PP
3088: \fBReturn values:\fP
3089: .RS 4
3090: \fI-1\fP on error
3091: .RE
3092: .PP
3093:
3094: .SS "LIBNET_API libnet_ptag_t libnet_build_tcp_options (const uint8_t * options, uint32_t options_s, libnet_t * l, libnet_ptag_t ptag)"
3095: Builds an RFC 793 Transmission Control Protocol (TCP) options header\&. The function expects options to be a valid TCP options string of size options_s, which is no larger than 40 bytes (the maximum size of an options string)\&. The function checks to ensure that the packet consists of a TCP header preceded by an IPv4 header, and that the addition of the options string would not result in a packet larger than 65,535 bytes (IPMAXPACKET)\&. The function counts up the number of 32-bit words in the options string and adjusts the TCP header length value as necessary\&.
3096: .PP
3097: \fBParameters:\fP
3098: .RS 4
3099: \fIoptions\fP byte string of TCP options
3100: .br
3101: \fIoptions_s\fP length of options string
3102: .br
3103: \fIl\fP pointer to a libnet context
3104: .br
3105: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
3106: .RE
3107: .PP
3108: \fBReturns:\fP
3109: .RS 4
3110: protocol tag value on success
3111: .RE
3112: .PP
3113: \fBReturn values:\fP
3114: .RS 4
3115: \fI-1\fP on error
3116: .RE
3117: .PP
3118:
3119: .SS "LIBNET_API libnet_ptag_t libnet_build_token_ring (uint8_t ac, uint8_t fc, const uint8_t * dst, const uint8_t * src, uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t * oui, uint16_t type, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
3120: Builds a token ring header\&.
3121: .PP
3122: \fBParameters:\fP
3123: .RS 4
3124: \fIac\fP access control
3125: .br
3126: \fIfc\fP frame control
3127: .br
3128: \fIdst\fP destination address
3129: .br
3130: \fIsrc\fP source address
3131: .br
3132: \fIdsap\fP destination service access point
3133: .br
3134: \fIssap\fP source service access point
3135: .br
3136: \fIcf\fP control field
3137: .br
3138: \fIoui\fP Organizationally Unique Identifier
3139: .br
3140: \fItype\fP upper layer protocol type
3141: .br
3142: \fIpayload\fP optional payload or NULL
3143: .br
3144: \fIpayload_s\fP payload length or 0
3145: .br
3146: \fIl\fP pointer to a libnet context
3147: .br
3148: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
3149: .RE
3150: .PP
3151: \fBReturns:\fP
3152: .RS 4
3153: protocol tag value on success
3154: .RE
3155: .PP
3156: \fBReturn values:\fP
3157: .RS 4
3158: \fI-1\fP on error
3159: .RE
3160: .PP
3161:
3162: .SS "LIBNET_API libnet_ptag_t libnet_build_udp (uint16_t sp, uint16_t dp, uint16_t len, uint16_t sum, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
3163: Builds an RFC 768 User Datagram Protocol (UDP) header\&.
3164: .PP
3165: \fBParameters:\fP
3166: .RS 4
3167: \fIsp\fP source port
3168: .br
3169: \fIdp\fP destination port
3170: .br
3171: \fIlen\fP total length of the UDP packet
3172: .br
3173: \fIsum\fP checksum (0 for libnet to auto-fill)
3174: .br
3175: \fIpayload\fP optional payload or NULL
3176: .br
3177: \fIpayload_s\fP payload length or 0
3178: .br
3179: \fIl\fP pointer to a libnet context
3180: .br
3181: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
3182: .RE
3183: .PP
3184: \fBReturns:\fP
3185: .RS 4
3186: protocol tag value on success
3187: .RE
3188: .PP
3189: \fBReturn values:\fP
3190: .RS 4
3191: \fI-1\fP on error
3192: .RE
3193: .PP
3194:
3195: .SS "LIBNET_API libnet_ptag_t libnet_build_vrrp (uint8_t version, uint8_t type, uint8_t vrouter_id, uint8_t priority, uint8_t ip_count, uint8_t auth_type, uint8_t advert_int, uint16_t sum, const uint8_t * payload, uint32_t payload_s, libnet_t * l, libnet_ptag_t ptag)"
3196: Builds an RFC 2338 Virtual Router Redundacy Protool (VRRP) header\&. Use the payload interface to specify address and authentication information\&. To build a 'legal' packet, the destination IPv4 address should be the multicast * address 224\&.0\&.0\&.18, the IP TTL should be set to 255, and the IP protocol should be set to 112\&.
3197: .PP
3198: \fBParameters:\fP
3199: .RS 4
3200: \fIversion\fP VRRP version (should be 2)
3201: .br
3202: \fItype\fP VRRP packet type (should be 1 -- ADVERTISEMENT)
3203: .br
3204: \fIvrouter_id\fP virtual router identification
3205: .br
3206: \fIpriority\fP priority (higher numbers indicate higher priority)
3207: .br
3208: \fIip_count\fP number of IPv4 addresses contained in this advertisement
3209: .br
3210: \fIauth_type\fP type of authentication (0, 1, 2 -- see RFC)
3211: .br
3212: \fIadvert_int\fP interval between advertisements
3213: .br
3214: \fIsum\fP checksum (0 for libnet to autofill)
3215: .br
3216: \fIpayload\fP optional payload or NULL
3217: .br
3218: \fIpayload_s\fP payload length or 0
3219: .br
3220: \fIl\fP pointer to a libnet context
3221: .br
3222: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
3223: .RE
3224: .PP
3225: \fBReturns:\fP
3226: .RS 4
3227: protocol tag value on success
3228: .RE
3229: .PP
3230: \fBReturn values:\fP
3231: .RS 4
3232: \fI-1\fP on error
3233: .RE
3234: .PP
3235:
3236: .SS "LIBNET_API void libnet_clear_packet (libnet_t * l)"
3237: Clears the current packet referenced and frees all pblocks\&. Should be called when the programmer want to send a completely new packet of a different type using the same context\&.
3238: .PP
3239: \fBParameters:\fP
3240: .RS 4
3241: \fIl\fP pointer to a libnet context
3242: .RE
3243: .PP
3244:
3245: .SS "int libnet_cq_add (libnet_t * l, char * label)"
3246: [Context Queue] Adds a new context to the libnet context queue\&. If no queue exists, this function will create the queue and add the specified libnet context as the first entry on the list\&. The functions checks to ensure niether l nor label are NULL, and that label doesn't refer to an existing context already in the queue\&. Additionally, l should refer to a libnet context previously initialized with a call to \fBlibnet_init()\fP\&. If the context queue in write locked, this function will fail\&.
3247: .PP
3248: \fBParameters:\fP
3249: .RS 4
3250: \fIl\fP pointer to a libnet context
3251: .br
3252: \fIlabel\fP a canonical name given to recognize the new context, no longer than LIBNET_LABEL_SIZE
3253: .RE
3254: .PP
3255: \fBReturn values:\fP
3256: .RS 4
3257: \fI1\fP on success
3258: .br
3259: \fI-1\fP on failure
3260: .RE
3261: .PP
3262:
3263: .SS "LIBNET_API void libnet_cq_destroy (void)"
3264: [Context Queue] Destroys the entire context queue, calling \fBlibnet_destroy()\fP on each member context\&.
3265: .SS "LIBNET_API uint32_t libnet_cq_end_loop (void)"
3266: [Context Queue]
3267: .SS "LIBNET_API libnet_t* libnet_cq_find_by_label (char * label)"
3268: [Context Queue] Locates a libnet context from the queue, indexed by a canonical label\&.
3269: .PP
3270: \fBParameters:\fP
3271: .RS 4
3272: \fIlabel\fP canonical label of the libnet context to retrieve
3273: .RE
3274: .PP
3275: \fBReturns:\fP
3276: .RS 4
3277: the expected libnet context
3278: .RE
3279: .PP
3280: \fBReturn values:\fP
3281: .RS 4
3282: \fINULL\fP on failure
3283: .RE
3284: .PP
3285:
3286: .SS "LIBNET_API const char* libnet_cq_getlabel (libnet_t * l)"
3287: [Context Queue] Returns the canonical label associated with the context\&.
3288: .PP
3289: \fBParameters:\fP
3290: .RS 4
3291: \fIl\fP pointer to a libnet context
3292: .RE
3293: .PP
3294: \fBReturns:\fP
3295: .RS 4
3296: pointer to the libnet context's label
3297: .RE
3298: .PP
3299:
3300: .SS "LIBNET_API libnet_t* libnet_cq_head (void)"
3301: [Context Queue] Intiailizes the interator interface and set a write lock on the entire queue\&. This function is intended to be called just prior to interating through the entire list of contexts (with the probable intent of inject a series of packets in rapid succession)\&. This function is often used as per the following:
3302: .PP
3303: for (l = \fBlibnet_cq_head()\fP; \fBlibnet_cq_last()\fP; l = \fBlibnet_cq_next()\fP) { \&.\&.\&. }
3304: .PP
3305: Much of the time, the application programmer will use the iterator as it is written above; as such, libnet provides a macro to do exactly that, \fBfor_each_context_in_cq(l)\fP\&. Warning: do not call the iterator more than once in a single loop\&.
3306: .PP
3307: \fBReturns:\fP
3308: .RS 4
3309: the head of the context queue
3310: .RE
3311: .PP
3312:
3313: .SS "LIBNET_API int libnet_cq_last (void)"
3314: [Context Queue] Check whether the iterator is at the last context in the queue\&.
3315: .PP
3316: \fBReturn values:\fP
3317: .RS 4
3318: \fI1\fP if at the end of the context queue
3319: .br
3320: \fI0\fP otherwise
3321: .RE
3322: .PP
3323:
3324: .SS "LIBNET_API libnet_t* libnet_cq_next (void)"
3325: [Context Queue] Get next context from the context queue\&.
3326: .PP
3327: \fBReturns:\fP
3328: .RS 4
3329: the next context from the context queue
3330: .RE
3331: .PP
3332:
3333: .SS "LIBNET_API libnet_t* libnet_cq_remove (libnet_t * l)"
3334: [Context Queue] Removes a specified context from the libnet context queue by specifying the libnet context pointer\&. Note the function will remove the specified context from the context queue and cleanup internal memory from the queue, it is up to the application programmer to free the returned libnet context with a call to \fBlibnet_destroy()\fP\&. Also, as it is not necessary to keep the libnet context pointer when initially adding it to the context queue, most application programmers will prefer to refer to entries on the context queue by canonical name and would use \fBlibnet_cq_remove_by_label()\fP\&. If the context queue is write locked, this function will fail\&.
3335: .PP
3336: \fBParameters:\fP
3337: .RS 4
3338: \fIl\fP pointer to a libnet context
3339: .RE
3340: .PP
3341: \fBReturns:\fP
3342: .RS 4
3343: the pointer to the removed libnet context
3344: .RE
3345: .PP
3346: \fBReturn values:\fP
3347: .RS 4
3348: \fINULL\fP on failure
3349: .RE
3350: .PP
3351:
3352: .SS "LIBNET_API libnet_t* libnet_cq_remove_by_label (char * label)"
3353: [Context Queue] Removes a specified context from the libnet context queue by specifying the canonical name\&. Note the function will remove the specified context from the context queue and cleanup internal memory from the queue, it is up to the application programmer to free the returned libnet context with a call to \fBlibnet_destroy()\fP\&. If the context queue is write locked, this function will fail\&.
3354: .PP
3355: \fBParameters:\fP
3356: .RS 4
3357: \fIlabel\fP canonical name of the context to remove
3358: .RE
3359: .PP
3360: \fBReturns:\fP
3361: .RS 4
3362: the pointer to the removed libnet context
3363: .RE
3364: .PP
3365: \fBReturn values:\fP
3366: .RS 4
3367: \fINULL\fP on failure
3368: .RE
3369: .PP
3370:
3371: .SS "LIBNET_API uint32_t libnet_cq_size (void)"
3372: [Context Queue] Function returns the number of libnet contexts that are in the queue\&.
3373: .PP
3374: \fBReturns:\fP
3375: .RS 4
3376: the number of libnet contexts currently in the queue
3377: .RE
3378: .PP
3379:
3380: .SS "LIBNET_API void libnet_destroy (libnet_t * l)"
3381: Shuts down the libnet session referenced by l\&. It closes the network interface and frees all internal memory structures associated with l\&.
3382: .PP
3383: \fBParameters:\fP
3384: .RS 4
3385: \fIl\fP pointer to a libnet context
3386: .RE
3387: .PP
3388:
3389: .SS "LIBNET_API void libnet_diag_dump_context (libnet_t * l)"
3390: [Diagnostic] Prints the contents of the given context\&.
3391: .PP
3392: \fBParameters:\fP
3393: .RS 4
3394: \fIl\fP pointer to a libnet context
3395: .RE
3396: .PP
3397:
3398: .SS "void libnet_diag_dump_hex (const uint8_t * packet, uint32_t len, int swap, FILE * stream)"
3399: [Diagnostic] Function prints the contents of the supplied buffer to the supplied stream pointer\&. Will swap endianness based disposition of mode variable\&. Useful to be used in conjunction with the advanced interface and a culled packet\&.
3400: .PP
3401: \fBParameters:\fP
3402: .RS 4
3403: \fIpacket\fP the packet to print
3404: .br
3405: \fIlen\fP length of the packet in bytes
3406: .br
3407: \fIswap\fP 1 to swap byte order, 0 to not\&. Counter-intuitively, it is necessary to swap in order to see the byte order as it is on the wire (this may be a bug)\&.
3408: .br
3409: \fIstream\fP a stream pointer to print to
3410: .RE
3411: .PP
3412:
3413: .SS "LIBNET_API void libnet_diag_dump_pblock (libnet_t * l)"
3414: [Diagnostic] Prints the contents of every pblock\&.
3415: .PP
3416: \fBParameters:\fP
3417: .RS 4
3418: \fIl\fP pointer to a libnet context
3419: .RE
3420: .PP
3421:
3422: .SS "LIBNET_API char* libnet_diag_dump_pblock_type (uint8_t type)"
3423: [Diagnostic] Returns the canonical name of the pblock type\&.
3424: .PP
3425: \fBParameters:\fP
3426: .RS 4
3427: \fItype\fP pblock type
3428: .RE
3429: .PP
3430: \fBReturns:\fP
3431: .RS 4
3432: a string representing the pblock type type
3433: .RE
3434: .PP
3435: \fBReturn values:\fP
3436: .RS 4
3437: \fIunknown\fP for an unknown value
3438: .RE
3439: .PP
3440:
3441: .SS "LIBNET_API struct libnet_ether_addr* libnet_get_hwaddr (libnet_t * l)"
3442: Returns the MAC address for the device libnet was initialized with\&. If libnet was initialized without a device the function will attempt to find one\&. If the function fails and returns NULL a call to \fBlibnet_geterror()\fP will tell you why\&.
3443: .PP
3444: \fBParameters:\fP
3445: .RS 4
3446: \fIl\fP pointer to a libnet context
3447: .RE
3448: .PP
3449: \fBReturns:\fP
3450: .RS 4
3451: a pointer to the MAC address or NULL
3452: .RE
3453: .PP
3454:
3455: .SS "LIBNET_API uint32_t libnet_get_ipaddr4 (libnet_t * l)"
3456: Returns the IP address for the device libnet was initialized with\&. If libnet was initialized without a device (in raw socket mode) the function will attempt to find one\&. If the function fails and returns -1 a call to libnet_geterrror() will tell you why\&.
3457: .PP
3458: \fBParameters:\fP
3459: .RS 4
3460: \fIl\fP pointer to a libnet context
3461: .RE
3462: .PP
3463: \fBReturns:\fP
3464: .RS 4
3465: a big endian IP address suitable for use in a libnet_build function
3466: .RE
3467: .PP
3468: \fBReturn values:\fP
3469: .RS 4
3470: \fI-1\fP
3471: .RE
3472: .PP
3473:
3474: .SS "LIBNET_API struct libnet_in6_addr libnet_get_ipaddr6 (libnet_t * l)"
3475: Returns the IPv6 address for the device libnet was initialized with\&. If libnet was initialized without a device (in raw socket mode) the function will attempt to find one\&. If the function fails and returns in6addr_error, a call to libnet_geterrror() will tell you why\&. This function is not yet implemented for Win32 platforms\&.
3476: .PP
3477: \fBParameters:\fP
3478: .RS 4
3479: \fIl\fP pointer to a libnet context
3480: .RE
3481: .PP
3482: \fBReturn values:\fP
3483: .RS 4
3484: \fIin6addr_error\fP on failure
3485: .RE
3486: .PP
3487:
3488: .SS "LIBNET_API uint32_t libnet_get_prand (int mod)"
3489: Generates an unsigned pseudo-random value within the range specified by mod\&. LIBNET_PR2 0 - 1 LIBNET_PR8 0 - 255 LIBNET_PR16 0 - 32767 LIBNET_PRu16 0 - 65535 LIBNET_PR32 0 - 2147483647 LIBNET_PRu32 0 - 4294967295
3490: .PP
3491: \fBParameters:\fP
3492: .RS 4
3493: \fImod\fP one the of LIBNET_PR* constants
3494: .RE
3495: .PP
3496: \fBReturn values:\fP
3497: .RS 4
3498: \fI1\fP on success
3499: .br
3500: \fI-1\fP on failure
3501: .RE
3502: .PP
3503:
3504: .SS "LIBNET_API const char* libnet_getdevice (libnet_t * l)"
3505: Returns the canonical name of the device used for packet injection\&.
3506: .PP
3507: \fBParameters:\fP
3508: .RS 4
3509: \fIl\fP pointer to a libnet context
3510: .RE
3511: .PP
3512: \fBReturns:\fP
3513: .RS 4
3514: the canonical name of the device used for packet injection\&. Note it can be NULL without being an error\&.
3515: .RE
3516: .PP
3517:
3518: .SS "LIBNET_API char* libnet_geterror (libnet_t * l)"
3519: Returns the last error set inside of the referenced libnet context\&. This function should be called anytime a function fails or an error condition is detected inside of libnet\&.
3520: .PP
3521: \fBParameters:\fP
3522: .RS 4
3523: \fIl\fP pointer to a libnet context
3524: .RE
3525: .PP
3526: \fBReturns:\fP
3527: .RS 4
3528: an error string or NULL if no error has occurred
3529: .RE
3530: .PP
3531:
3532: .SS "LIBNET_API int libnet_getfd (libnet_t * l)"
3533: Returns the FILENO of the file descriptor used for packet injection\&.
3534: .PP
3535: \fBParameters:\fP
3536: .RS 4
3537: \fIl\fP pointer to a libnet context
3538: .RE
3539: .PP
3540: \fBReturns:\fP
3541: .RS 4
3542: the file number of the file descriptor used for packet injection
3543: .RE
3544: .PP
3545:
3546: .SS "LIBNET_API uint32_t libnet_getgre_length (uint16_t fv)"
3547:
3548: .PP
3549: \fBParameters:\fP
3550: .RS 4
3551: \fIfv\fP see \fBlibnet_build_gre()\fP\&.
3552: .RE
3553: .PP
3554: \fBReturns:\fP
3555: .RS 4
3556: size
3557: .RE
3558: .PP
3559: \fBSee also:\fP
3560: .RS 4
3561: \fBlibnet_build_gre()\fP\&.
3562: .RE
3563: .PP
3564:
3565: .SS "LIBNET_API uint32_t libnet_getpacket_size (libnet_t * l)"
3566: Returns the sum of the size of all of the pblocks inside of l (this should be the resulting packet size)\&.
3567: .PP
3568: \fBParameters:\fP
3569: .RS 4
3570: \fIl\fP pointer to a libnet context
3571: .RE
3572: .PP
3573: \fBReturns:\fP
3574: .RS 4
3575: the size of the packet in l
3576: .RE
3577: .PP
3578:
3579: .SS "LIBNET_API uint8_t* libnet_getpbuf (libnet_t * l, libnet_ptag_t ptag)"
3580: Returns the pblock buffer contents for the specified ptag; a subsequent call to \fBlibnet_getpbuf_size()\fP should be made to determine the size of the buffer\&.
3581: .PP
3582: \fBParameters:\fP
3583: .RS 4
3584: \fIl\fP pointer to a libnet context
3585: .br
3586: \fIptag\fP the ptag reference number
3587: .RE
3588: .PP
3589: \fBReturns:\fP
3590: .RS 4
3591: a pointer to the pblock buffer or NULL on error
3592: .RE
3593: .PP
3594:
3595: .SS "LIBNET_API uint32_t libnet_getpbuf_size (libnet_t * l, libnet_ptag_t ptag)"
3596: Returns the pblock buffer size for the specified ptag; a previous call to \fBlibnet_getpbuf()\fP should be made to pull the actual buffer contents\&.
3597: .PP
3598: \fBParameters:\fP
3599: .RS 4
3600: \fIl\fP pointer to a libnet context
3601: .br
3602: \fIptag\fP the ptag reference number
3603: .RE
3604: .PP
3605: \fBReturns:\fP
3606: .RS 4
3607: the size of the pblock buffer
3608: .RE
3609: .PP
3610:
3611: .SS "LIBNET_API uint8_t* libnet_hex_aton (const char * s, int * len)"
3612: Takes a colon separated hexidecimal address (from the command line) and returns a bytestring suitable for use in a libnet_build function\&. Note this function performs an implicit malloc and the return value should be freed after its use\&.
3613: .PP
3614: \fBParameters:\fP
3615: .RS 4
3616: \fIs\fP the string to be parsed
3617: .br
3618: \fIlen\fP the resulting size of the returned byte string
3619: .RE
3620: .PP
3621: \fBReturns:\fP
3622: .RS 4
3623: a byte string or NULL on failure
3624: .RE
3625: .PP
3626:
3627: .SS "LIBNET_API int libnet_in6_is_error (struct libnet_in6_addr addr)"
3628: Check a libnet_in6_addr structure for identity with in6addr_error\&.
3629: .PP
3630: \fBParameters:\fP
3631: .RS 4
3632: \fIaddr\fP address to check
3633: .RE
3634: .PP
3635: \fBReturn values:\fP
3636: .RS 4
3637: \fI1\fP if addr is in6addr_error
3638: .br
3639: \fI0\fP if it is not
3640: .RE
3641: .PP
3642:
3643: .SS "LIBNET_API libnet_t* libnet_init (int injection_type, const char * device, char * err_buf)"
3644: Creates the libnet environment\&. It initializes the library and returns a libnet context\&. If the injection_type is LIBNET_LINK or LIBNET_LINK_ADV, the function initializes the injection primitives for the link-layer interface enabling the application programmer to build packets starting at the data-link layer (which also provides more granular control over the IP layer)\&. If libnet uses the link-layer and the device argument is non-NULL, the function attempts to use the specified network device for packet injection\&. This is either a canonical string that references the device (such as 'eth0' for a 100MB Ethernet card on Linux or 'fxp0' for a 100MB Ethernet card on OpenBSD) or the dots and decimals representation of the device's IP address (192\&.168\&.0\&.1)\&. If device is NULL, libnet attempts to find a suitable device to use\&. If the injection_type is LIBNET_RAW4 or LIBNET_RAW4_ADV, the function initializes the injection primitives for the IPv4 raw socket interface\&. The final argument, err_buf, should be a buffer of size LIBNET_ERRBUF_SIZE and holds an error message if the function fails\&. This function requires root privileges to execute successfully\&. Upon success, the function returns a valid libnet context for use in later function calls; upon failure, the function returns NULL\&.
3645: .PP
3646: \fBParameters:\fP
3647: .RS 4
3648: \fIinjection_type\fP packet injection type (LIBNET_LINK, LIBNET_LINK_ADV, LIBNET_RAW4, LIBNET_RAW4_ADV, LIBNET_RAW6, LIBNET_RAW6_ADV)
3649: .br
3650: \fIdevice\fP the interface to use (NULL and libnet will choose one)
3651: .br
3652: \fIerr_buf\fP will contain an error message on failure
3653: .RE
3654: .PP
3655: \fBReturns:\fP
3656: .RS 4
3657: libnet context ready for use or NULL on error\&.
3658: .RE
3659: .PP
3660:
3661: .SS "LIBNET_API uint32_t libnet_name2addr4 (libnet_t * l, const char * host_name, uint8_t use_name)"
3662: Takes a dotted decimal string or a canonical DNS name and returns a network byte ordered IPv4 address\&. This may incur a DNS lookup if mode is set to LIBNET_RESOLVE and host_name refers to a canonical DNS name\&. If mode is set to LIBNET_DONT_RESOLVE no DNS lookup will occur\&. The function can fail if DNS lookup fails or if mode is set to LIBNET_DONT_RESOLVE and host_name refers to a canonical DNS name\&.
3663: .PP
3664: \fBParameters:\fP
3665: .RS 4
3666: \fIl\fP pointer to a libnet context
3667: .br
3668: \fIhost_name\fP pointer to a string containing a presentation format host name
3669: .br
3670: \fIuse_name\fP LIBNET_RESOLVE or LIBNET_DONT_RESOLVE
3671: .RE
3672: .PP
3673: \fBReturns:\fP
3674: .RS 4
3675: address in network byte order
3676: .RE
3677: .PP
3678: \fBReturn values:\fP
3679: .RS 4
3680: \fI-1\fP (2^32 - 1) on error
3681: .RE
3682: .PP
3683:
3684: .SS "LIBNET_API struct libnet_in6_addr libnet_name2addr6 (libnet_t * l, const char * host_name, uint8_t use_name)"
3685: Takes a dotted decimal string or a canonical DNS name and returns a network byte ordered IPv6 address\&. This may incur a DNS lookup if mode is set to LIBNET_RESOLVE and host_name refers to a canonical DNS name\&. If mode is set to LIBNET_DONT_RESOLVE no DNS lookup will occur\&. The function can fail if DNS lookup fails or if mode is set to LIBNET_DONT_RESOLVE and host_name refers to a canonical DNS name\&.
3686: .PP
3687: \fBParameters:\fP
3688: .RS 4
3689: \fIl\fP pointer to a libnet context
3690: .br
3691: \fIhost_name\fP pointer to a string containing a presentation format host name
3692: .br
3693: \fIuse_name\fP LIBNET_RESOLVE or LIBNET_DONT_RESOLVE
3694: .RE
3695: .PP
3696: \fBReturns:\fP
3697: .RS 4
3698: network byte ordered IPv6 address structure
3699: .RE
3700: .PP
3701:
3702: .SS "LIBNET_API int libnet_plist_chain_dump (libnet_plist_t * plist)"
3703: Runs through the port list and prints the contents of the port list chain list to stdout\&.
3704: .PP
3705: \fBParameters:\fP
3706: .RS 4
3707: \fIplist\fP previously created portlist
3708: .RE
3709: .PP
3710: \fBReturn values:\fP
3711: .RS 4
3712: \fI1\fP on success
3713: .br
3714: \fI-1\fP on failure
3715: .RE
3716: .PP
3717:
3718: .SS "LIBNET_API char* libnet_plist_chain_dump_string (libnet_plist_t * plist)"
3719: Runs through the port list and prints the contents of the port list chain list to string\&. This function uses strdup and is not re-entrant\&. It also has a memory leak and should not really be used\&.
3720: .PP
3721: \fBParameters:\fP
3722: .RS 4
3723: \fIplist\fP previously created portlist
3724: .RE
3725: .PP
3726: \fBReturns:\fP
3727: .RS 4
3728: a printable string containing the port list contents on success or NULL on error
3729: .RE
3730: .PP
3731:
3732: .SS "LIBNET_API int libnet_plist_chain_free (libnet_plist_t * plist)"
3733: Frees all memory associated with port list chain\&.
3734: .PP
3735: \fBParameters:\fP
3736: .RS 4
3737: \fIplist\fP previously created portlist
3738: .RE
3739: .PP
3740: \fBReturn values:\fP
3741: .RS 4
3742: \fI1\fP on success
3743: .br
3744: \fI-1\fP on failure
3745: .RE
3746: .PP
3747:
3748: .SS "LIBNET_API int libnet_plist_chain_new (libnet_t * l, libnet_plist_t ** plist, char * token_list)"
3749: Creates a new port list\&. Port list chains are useful for TCP and UDP-based applications that need to send packets to a range of ports (contiguous or otherwise)\&. The port list chain, which token_list points to, should contain a series of int8_tacters from the following list: '0123456789,-' of the general format 'x - y, z', where 'xyz' are port numbers between 0 and 65,535\&. plist points to the front of the port list chain list for use in further libnet_plist_chain() functions\&. Upon success, the function returns
3750: .IP "1." 4
3751: Upon failure, the function returns -1 and \fBlibnet_geterror()\fP can tell you why\&.
3752: .PP
3753: \fBParameters:\fP
3754: .RS 4
3755: \fIl\fP pointer to a libnet context
3756: .br
3757: \fIplist\fP if successful, will refer to the portlist, if not, NULL
3758: .br
3759: \fItoken_list\fP string containing the port list primitive
3760: .RE
3761: .PP
3762: \fBReturn values:\fP
3763: .RS 4
3764: \fI1\fP on success
3765: .br
3766: \fI-1\fP on failure
3767: .RE
3768: .PP
3769:
3770: .PP
3771:
3772: .SS "LIBNET_API int libnet_plist_chain_next_pair (libnet_plist_t * plist, uint16_t * bport, uint16_t * eport)"
3773: Returns the next port list chain pair from the port list chain plist\&. bport and eport contain the starting port number and ending port number, respectively\&. Upon success, the function returns 1 and fills in the port variables; however, if the list is empty, the function returns 0 and sets both port variables to 0\&. Upon failure, the function returns -1\&.
3774: .PP
3775: \fBParameters:\fP
3776: .RS 4
3777: \fIplist\fP previously created portlist
3778: .br
3779: \fIbport\fP will contain the beginning port number or 0
3780: .br
3781: \fIeport\fP will contain the ending port number or 0
3782: .RE
3783: .PP
3784: \fBReturn values:\fP
3785: .RS 4
3786: \fI1\fP on success
3787: .br
3788: \fI0\fP if empty
3789: .br
3790: \fI-1\fP on failure
3791: .RE
3792: .PP
3793:
3794: .SS "LIBNET_API int libnet_seed_prand (libnet_t * l)"
3795: Seeds the pseudo-random number generator\&.
3796: .PP
3797: \fBParameters:\fP
3798: .RS 4
3799: \fIl\fP pointer to a libnet context
3800: .RE
3801: .PP
3802: \fBReturn values:\fP
3803: .RS 4
3804: \fI1\fP on success
3805: .br
3806: \fI-1\fP on failure
3807: .RE
3808: .PP
3809:
3810: .SS "LIBNET_API void libnet_stats (libnet_t * l, struct libnet_stats * ls)"
3811: Fills in a libnet_stats structure with packet injection statistics (packets written, bytes written, packet sending errors)\&.
3812: .PP
3813: \fBParameters:\fP
3814: .RS 4
3815: \fIl\fP pointer to a libnet context
3816: .br
3817: \fIls\fP pointer to a libnet statistics structure
3818: .RE
3819: .PP
3820:
3821: .SS "LIBNET_API int libnet_toggle_checksum (libnet_t * l, libnet_ptag_t ptag, int mode)"
3822: If a given protocol header is built with the checksum field set to '0', by default libnet will calculate the header checksum prior to injection\&. If the header is set to any other value, by default libnet will not calculate the header checksum\&. To over-ride this behavior, use \fBlibnet_toggle_checksum()\fP\&. Switches auto-checksumming on or off for the specified ptag\&. If mode is set to LIBNET_ON, libnet will mark the specified ptag to calculate a checksum for the ptag prior to injection\&. This assumes that the ptag refers to a protocol that has a checksum field\&. If mode is set to LIBNET_OFF, libnet will clear the checksum flag and no checksum will be computed prior to injection\&. This assumes that the programmer will assign a value (zero or otherwise) to the checksum field\&. Often times this is useful if a precomputed checksum or some other predefined value is going to be used\&. Note that when libnet is initialized with LIBNET_RAW4, the IPv4 header checksum will always be computed by the kernel prior to injection, regardless of what the programmer sets\&.
3823: .PP
3824: \fBParameters:\fP
3825: .RS 4
3826: \fIl\fP pointer to a libnet context
3827: .br
3828: \fIptag\fP the ptag reference number
3829: .br
3830: \fImode\fP LIBNET_ON or LIBNET_OFF
3831: .RE
3832: .PP
3833: \fBReturn values:\fP
3834: .RS 4
3835: \fI1\fP on success
3836: .br
3837: \fI-1\fP on failure
3838: .RE
3839: .PP
3840:
3841: .SS "LIBNET_API const char* libnet_version (void)"
3842: Returns the version of libnet\&.
3843: .PP
3844: \fBReturns:\fP
3845: .RS 4
3846: the libnet version
3847: .RE
3848: .PP
3849:
3850: .SS "LIBNET_API int libnet_write (libnet_t * l)"
3851: Writes a prebuilt packet to the network\&. The function assumes that l was previously initialized (via a call to \fBlibnet_init()\fP) and that a previously constructed packet has been built inside this context (via one or more calls to the libnet_build* family of functions) and is ready to go\&. Depending on how libnet was initialized, the function will write the packet to the wire either via the raw or link layer interface\&. The function will also bump up the internal libnet stat counters which are retrievable via \fBlibnet_stats()\fP\&.
3852: .PP
3853: \fBParameters:\fP
3854: .RS 4
3855: \fIl\fP pointer to a libnet context
3856: .RE
3857: .PP
3858: \fBReturns:\fP
3859: .RS 4
3860: the number of bytes written
3861: .RE
3862: .PP
3863: \fBReturn values:\fP
3864: .RS 4
3865: \fI-1\fP on error
3866: .RE
3867: .PP
3868:
3869: .SH "SEE ALSO"
3870: \.IX Header "SEE ALSO"
3871: libnet(3)
3872: .SH "AUTHORS"
3873: .IX Header "AUTHORS"
3874: The original author of libnet is Mike D. Schiffman.
3875: .PP
3876: libnet has been maintained and extensively enhanced since 2009 by Sam Roberts.
3877: .PP
3878: It is maintained by the Libnet Developer Community at GitHub.
3879: .PP
3880: .Vb 1
3881: \& <https://github.com/libnet/libnet>
3882: .Ve
3883: .SH "BUGS"
3884: .IX Header "BUGS"
3885: Suggestions, bug reports/fixes, and pull requests, see:
3886: .PP
3887: .Vb 1
3888: \& <https://github.com/libnet/libnet/issues>
3889: .Ve
3890: .SH "COPYRIGHT"
3891: .IX Header "COPYRIGHT"
3892: libnet is licensed under the 3\-Clause \s-1BSD\s0 License.
3893: .SH "SEE ALSO"
3894: \.IX Header "SEE ALSO"
3895: libnet(3)
3896: .SH "AUTHORS"
3897: .IX Header "AUTHORS"
3898: The original author of libnet is Mike D. Schiffman.
3899: .PP
3900: libnet has been maintained and extensively enhanced since 2009 by Sam Roberts.
3901: .PP
3902: It is maintained by the Libnet Developer Community at GitHub.
3903: .PP
3904: .Vb 1
3905: \& <https://github.com/libnet/libnet>
3906: .Ve
3907: .SH "BUGS"
3908: .IX Header "BUGS"
3909: Suggestions, bug reports/fixes, and pull requests, see:
3910: .PP
3911: .Vb 1
3912: \& <https://github.com/libnet/libnet/issues>
3913: .Ve
3914: .SH "COPYRIGHT"
3915: .IX Header "COPYRIGHT"
3916: libnet is licensed under the 3\-Clause \s-1BSD\s0 License.
3917: .SH "SEE ALSO"
3918: \.IX Header "SEE ALSO"
3919: libnet(3)
3920: .SH "AUTHORS"
3921: .IX Header "AUTHORS"
3922: The original author of libnet is Mike D. Schiffman.
3923: .PP
3924: libnet has been maintained and extensively enhanced since 2009 by Sam Roberts.
3925: .PP
3926: It is maintained by the Libnet Developer Community at GitHub.
3927: .PP
3928: .Vb 1
3929: \& <https://github.com/libnet/libnet>
3930: .Ve
3931: .SH "BUGS"
3932: .IX Header "BUGS"
3933: Suggestions, bug reports/fixes, and pull requests, see:
3934: .PP
3935: .Vb 1
3936: \& <https://github.com/libnet/libnet/issues>
3937: .Ve
3938: .SH "COPYRIGHT"
3939: .IX Header "COPYRIGHT"
3940: libnet is licensed under the 3\-Clause \s-1BSD\s0 License.
3941: .SH "SEE ALSO"
3942: \.IX Header "SEE ALSO"
3943: libnet(3)
3944: .SH "AUTHORS"
3945: .IX Header "AUTHORS"
3946: The original author of libnet is Mike D. Schiffman.
3947: .PP
3948: libnet has been maintained and extensively enhanced since 2009 by Sam Roberts.
3949: .PP
3950: It is maintained by the Libnet Developer Community at GitHub.
3951: .PP
3952: .Vb 1
3953: \& <https://github.com/libnet/libnet>
3954: .Ve
3955: .SH "BUGS"
3956: .IX Header "BUGS"
3957: Suggestions, bug reports/fixes, and pull requests, see:
3958: .PP
3959: .Vb 1
3960: \& <https://github.com/libnet/libnet/issues>
3961: .Ve
3962: .SH "COPYRIGHT"
3963: .IX Header "COPYRIGHT"
3964: libnet is licensed under the 3\-Clause \s-1BSD\s0 License.
3965: .SH "SEE ALSO"
3966: \.IX Header "SEE ALSO"
3967: libnet(3)
3968: .SH "AUTHORS"
3969: .IX Header "AUTHORS"
3970: The original author of libnet is Mike D. Schiffman.
3971: .PP
3972: libnet has been maintained and extensively enhanced since 2009 by Sam Roberts.
3973: .PP
3974: It is maintained by the Libnet Developer Community at GitHub.
3975: .PP
3976: .Vb 1
3977: \& <https://github.com/libnet/libnet>
3978: .Ve
3979: .SH "BUGS"
3980: .IX Header "BUGS"
3981: Suggestions, bug reports/fixes, and pull requests, see:
3982: .PP
3983: .Vb 1
3984: \& <https://github.com/libnet/libnet/issues>
3985: .Ve
3986: .SH "COPYRIGHT"
3987: .IX Header "COPYRIGHT"
3988: libnet is licensed under the 3\-Clause \s-1BSD\s0 License.
3989: .SH "SEE ALSO"
3990: \.IX Header "SEE ALSO"
3991: libnet(3)
3992: .SH "AUTHORS"
3993: .IX Header "AUTHORS"
3994: The original author of libnet is Mike D. Schiffman.
3995: .PP
3996: libnet has been maintained and extensively enhanced since 2009 by Sam Roberts.
3997: .PP
3998: It is maintained by the Libnet Developer Community at GitHub.
3999: .PP
4000: .Vb 1
4001: \& <https://github.com/libnet/libnet>
4002: .Ve
4003: .SH "BUGS"
4004: .IX Header "BUGS"
4005: Suggestions, bug reports/fixes, and pull requests, see:
4006: .PP
4007: .Vb 1
4008: \& <https://github.com/libnet/libnet/issues>
4009: .Ve
4010: .SH "COPYRIGHT"
4011: .IX Header "COPYRIGHT"
4012: libnet is licensed under the 3\-Clause \s-1BSD\s0 License.
4013: .SH "SEE ALSO"
4014: \.IX Header "SEE ALSO"
4015: libnet(3)
4016: .SH "AUTHORS"
4017: .IX Header "AUTHORS"
4018: The original author of libnet is Mike D. Schiffman.
4019: .PP
4020: libnet has been maintained and extensively enhanced since 2009 by Sam Roberts.
4021: .PP
4022: It is maintained by the Libnet Developer Community at GitHub.
4023: .PP
4024: .Vb 1
4025: \& <https://github.com/libnet/libnet>
4026: .Ve
4027: .SH "BUGS"
4028: .IX Header "BUGS"
4029: Suggestions, bug reports/fixes, and pull requests, see:
4030: .PP
4031: .Vb 1
4032: \& <https://github.com/libnet/libnet/issues>
4033: .Ve
4034: .SH "COPYRIGHT"
4035: .IX Header "COPYRIGHT"
4036: libnet is licensed under the 3\-Clause \s-1BSD\s0 License.
4037: .SH "SEE ALSO"
4038: \.IX Header "SEE ALSO"
4039: libnet(3)
4040: .SH "AUTHORS"
4041: .IX Header "AUTHORS"
4042: The original author of libnet is Mike D. Schiffman.
4043: .PP
4044: libnet has been maintained and extensively enhanced since 2009 by Sam Roberts.
4045: .PP
4046: It is maintained by the Libnet Developer Community at GitHub.
4047: .PP
4048: .Vb 1
4049: \& <https://github.com/libnet/libnet>
4050: .Ve
4051: .SH "BUGS"
4052: .IX Header "BUGS"
4053: Suggestions, bug reports/fixes, and pull requests, see:
4054: .PP
4055: .Vb 1
4056: \& <https://github.com/libnet/libnet/issues>
4057: .Ve
4058: .SH "COPYRIGHT"
4059: .IX Header "COPYRIGHT"
4060: libnet is licensed under the 3\-Clause \s-1BSD\s0 License.
4061: .SH "SEE ALSO"
4062: \.IX Header "SEE ALSO"
4063: libnet(3)
4064: .SH "AUTHORS"
4065: .IX Header "AUTHORS"
4066: The original author of libnet is Mike D. Schiffman.
4067: .PP
4068: libnet has been maintained and extensively enhanced since 2009 by Sam Roberts.
4069: .PP
4070: It is maintained by the Libnet Developer Community at GitHub.
4071: .PP
4072: .Vb 1
4073: \& <https://github.com/libnet/libnet>
4074: .Ve
4075: .SH "BUGS"
4076: .IX Header "BUGS"
4077: Suggestions, bug reports/fixes, and pull requests, see:
4078: .PP
4079: .Vb 1
4080: \& <https://github.com/libnet/libnet/issues>
4081: .Ve
4082: .SH "COPYRIGHT"
4083: .IX Header "COPYRIGHT"
4084: libnet is licensed under the 3\-Clause \s-1BSD\s0 License.
4085: .SH "SEE ALSO"
4086: \.IX Header "SEE ALSO"
4087: libnet(3)
4088: .SH "AUTHORS"
4089: .IX Header "AUTHORS"
4090: The original author of libnet is Mike D. Schiffman.
4091: .PP
4092: libnet has been maintained and extensively enhanced since 2009 by Sam Roberts.
4093: .PP
4094: It is maintained by the Libnet Developer Community at GitHub.
4095: .PP
4096: .Vb 1
4097: \& <https://github.com/libnet/libnet>
4098: .Ve
4099: .SH "BUGS"
4100: .IX Header "BUGS"
4101: Suggestions, bug reports/fixes, and pull requests, see:
4102: .PP
4103: .Vb 1
4104: \& <https://github.com/libnet/libnet/issues>
4105: .Ve
4106: .SH "COPYRIGHT"
4107: .IX Header "COPYRIGHT"
4108: libnet is licensed under the 3\-Clause \s-1BSD\s0 License.
4109: .SH "SEE ALSO"
4110: \.IX Header "SEE ALSO"
4111: libnet(3)
4112: .SH "AUTHORS"
4113: .IX Header "AUTHORS"
4114: The original author of libnet is Mike D. Schiffman.
4115: .PP
4116: libnet has been maintained and extensively enhanced since 2009 by Sam Roberts.
4117: .PP
4118: It is maintained by the Libnet Developer Community at GitHub.
4119: .PP
4120: .Vb 1
4121: \& <https://github.com/libnet/libnet>
4122: .Ve
4123: .SH "BUGS"
4124: .IX Header "BUGS"
4125: Suggestions, bug reports/fixes, and pull requests, see:
4126: .PP
4127: .Vb 1
4128: \& <https://github.com/libnet/libnet/issues>
4129: .Ve
4130: .SH "COPYRIGHT"
4131: .IX Header "COPYRIGHT"
4132: libnet is licensed under the 3\-Clause \s-1BSD\s0 License.
4133: .SH "SEE ALSO"
4134: \.IX Header "SEE ALSO"
4135: libnet(3)
4136: .SH "AUTHORS"
4137: .IX Header "AUTHORS"
4138: The original author of libnet is Mike D. Schiffman.
4139: .PP
4140: libnet has been maintained and extensively enhanced since 2009 by Sam Roberts.
4141: .PP
4142: It is maintained by the Libnet Developer Community at GitHub.
4143: .PP
4144: .Vb 1
4145: \& <https://github.com/libnet/libnet>
4146: .Ve
4147: .SH "BUGS"
4148: .IX Header "BUGS"
4149: Suggestions, bug reports/fixes, and pull requests, see:
4150: .PP
4151: .Vb 1
4152: \& <https://github.com/libnet/libnet/issues>
4153: .Ve
4154: .SH "COPYRIGHT"
4155: .IX Header "COPYRIGHT"
4156: libnet is licensed under the 3\-Clause \s-1BSD\s0 License.
4157: .SH "SEE ALSO"
4158: \.IX Header "SEE ALSO"
4159: libnet(3)
4160: .SH "AUTHORS"
4161: .IX Header "AUTHORS"
4162: The original author of libnet is Mike D. Schiffman.
4163: .PP
4164: libnet has been maintained and extensively enhanced since 2009 by Sam Roberts.
4165: .PP
4166: It is maintained by the Libnet Developer Community at GitHub.
4167: .PP
4168: .Vb 1
4169: \& <https://github.com/libnet/libnet>
4170: .Ve
4171: .SH "BUGS"
4172: .IX Header "BUGS"
4173: Suggestions, bug reports/fixes, and pull requests, see:
4174: .PP
4175: .Vb 1
4176: \& <https://github.com/libnet/libnet/issues>
4177: .Ve
4178: .SH "COPYRIGHT"
4179: .IX Header "COPYRIGHT"
4180: libnet is licensed under the 3\-Clause \s-1BSD\s0 License.
4181: .SH "SEE ALSO"
4182: \.IX Header "SEE ALSO"
4183: libnet(3)
4184: .SH "AUTHORS"
4185: .IX Header "AUTHORS"
4186: The original author of libnet is Mike D. Schiffman.
4187: .PP
4188: libnet has been maintained and extensively enhanced since 2009 by Sam Roberts.
4189: .PP
4190: It is maintained by the Libnet Developer Community at GitHub.
4191: .PP
4192: .Vb 1
4193: \& <https://github.com/libnet/libnet>
4194: .Ve
4195: .SH "BUGS"
4196: .IX Header "BUGS"
4197: Suggestions, bug reports/fixes, and pull requests, see:
4198: .PP
4199: .Vb 1
4200: \& <https://github.com/libnet/libnet/issues>
4201: .Ve
4202: .SH "COPYRIGHT"
4203: .IX Header "COPYRIGHT"
4204: libnet is licensed under the 3\-Clause \s-1BSD\s0 License.
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>