Annotation of embedaddon/libnet/doc/man/man3/libnet-functions.h.3, revision 1.1.1.2
1.1.1.2 ! misho 1: .TH "libnet-functions.h" 3 "Thu Mar 29 2012" "Version 1.1" "libnet" \" -*- nroff -*-
1.1 misho 2: .ad l
3: .nh
4: .SH NAME
1.1.1.2 ! misho 5: libnet-functions.h \-
! 6: .PP
! 7: libnet exported function prototypes
1.1 misho 8:
9: .SH SYNOPSIS
10: .br
11: .PP
12: .SS "Functions"
13:
14: .in +1c
15: .ti -1c
1.1.1.2 ! misho 16: .RI "libnet_t * \fBlibnet_init\fP (int injection_type, const char *device, char *err_buf)"
1.1 misho 17: .br
18: .ti -1c
19: .RI "void \fBlibnet_destroy\fP (libnet_t *l)"
20: .br
21: .ti -1c
22: .RI "void \fBlibnet_clear_packet\fP (libnet_t *l)"
23: .br
24: .ti -1c
25: .RI "void \fBlibnet_stats\fP (libnet_t *l, struct libnet_stats *ls)"
26: .br
27: .ti -1c
28: .RI "int \fBlibnet_getfd\fP (libnet_t *l)"
29: .br
30: .ti -1c
1.1.1.2 ! misho 31: .RI "const char * \fBlibnet_getdevice\fP (libnet_t *l)"
1.1 misho 32: .br
33: .ti -1c
1.1.1.2 ! misho 34: .RI "uint8_t * \fBlibnet_getpbuf\fP (libnet_t *l, libnet_ptag_t ptag)"
1.1 misho 35: .br
36: .ti -1c
1.1.1.2 ! misho 37: .RI "uint32_t \fBlibnet_getpbuf_size\fP (libnet_t *l, libnet_ptag_t ptag)"
1.1 misho 38: .br
39: .ti -1c
40: .RI "char * \fBlibnet_geterror\fP (libnet_t *l)"
41: .br
42: .ti -1c
1.1.1.2 ! misho 43: .RI "uint32_t \fBlibnet_getpacket_size\fP (libnet_t *l)"
1.1 misho 44: .br
45: .ti -1c
46: .RI "int \fBlibnet_seed_prand\fP (libnet_t *l)"
47: .br
48: .ti -1c
1.1.1.2 ! misho 49: .RI "uint32_t \fBlibnet_get_prand\fP (int mod)"
1.1 misho 50: .br
51: .ti -1c
52: .RI "int \fBlibnet_toggle_checksum\fP (libnet_t *l, libnet_ptag_t ptag, int mode)"
53: .br
54: .ti -1c
1.1.1.2 ! misho 55: .RI "char * \fBlibnet_addr2name4\fP (uint32_t in, uint8_t use_name)"
! 56: .br
! 57: .ti -1c
! 58: .RI "uint32_t \fBlibnet_name2addr4\fP (libnet_t *l, char *host_name, uint8_t use_name)"
1.1 misho 59: .br
60: .ti -1c
1.1.1.2 ! misho 61: .RI "int \fBlibnet_in6_is_error\fP (struct libnet_in6_addr addr)"
1.1 misho 62: .br
63: .ti -1c
1.1.1.2 ! misho 64: .RI "struct libnet_in6_addr \fBlibnet_name2addr6\fP (libnet_t *l, const char *host_name, uint8_t use_name)"
1.1 misho 65: .br
66: .ti -1c
1.1.1.2 ! misho 67: .RI "void \fBlibnet_addr2name6_r\fP (struct libnet_in6_addr addr, uint8_t use_name, char *host_name, int host_name_len)"
1.1 misho 68: .br
69: .ti -1c
70: .RI "int \fBlibnet_plist_chain_new\fP (libnet_t *l, libnet_plist_t **plist, char *token_list)"
71: .br
72: .ti -1c
1.1.1.2 ! misho 73: .RI "int \fBlibnet_plist_chain_next_pair\fP (libnet_plist_t *plist, uint16_t *bport, uint16_t *eport)"
1.1 misho 74: .br
75: .ti -1c
76: .RI "int \fBlibnet_plist_chain_dump\fP (libnet_plist_t *plist)"
77: .br
78: .ti -1c
79: .RI "char * \fBlibnet_plist_chain_dump_string\fP (libnet_plist_t *plist)"
80: .br
81: .ti -1c
82: .RI "int \fBlibnet_plist_chain_free\fP (libnet_plist_t *plist)"
83: .br
84: .ti -1c
1.1.1.2 ! misho 85: .RI "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)"
! 86: .br
! 87: .ti -1c
! 88: .RI "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)"
! 89: .br
! 90: .ti -1c
! 91: .RI "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)"
1.1 misho 92: .br
93: .ti -1c
1.1.1.2 ! misho 94: .RI "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)"
1.1 misho 95: .br
96: .ti -1c
1.1.1.2 ! misho 97: .RI "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)"
1.1 misho 98: .br
99: .ti -1c
1.1.1.2 ! misho 100: .RI "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)"
1.1 misho 101: .br
102: .ti -1c
1.1.1.2 ! misho 103: .RI "libnet_ptag_t \fBlibnet_autobuild_ethernet\fP (const uint8_t *dst, uint16_t type, libnet_t *l)"
1.1 misho 104: .br
105: .ti -1c
1.1.1.2 ! misho 106: .RI "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)"
1.1 misho 107: .br
108: .ti -1c
1.1.1.2 ! misho 109: .RI "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)"
1.1 misho 110: .br
111: .ti -1c
1.1.1.2 ! misho 112: .RI "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)"
1.1 misho 113: .br
114: .ti -1c
1.1.1.2 ! misho 115: .RI "libnet_ptag_t \fBlibnet_autobuild_arp\fP (uint16_t op, const uint8_t *sha, const uint8_t *spa, const uint8_t *tha, uint8_t *tpa, libnet_t *l)"
1.1 misho 116: .br
117: .ti -1c
1.1.1.2 ! misho 118: .RI "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)"
1.1 misho 119: .br
120: .ti -1c
1.1.1.2 ! misho 121: .RI "libnet_ptag_t \fBlibnet_build_tcp_options\fP (const uint8_t *options, uint32_t options_s, libnet_t *l, libnet_ptag_t ptag)"
1.1 misho 122: .br
123: .ti -1c
1.1.1.2 ! misho 124: .RI "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)"
1.1 misho 125: .br
126: .ti -1c
1.1.1.2 ! misho 127: .RI "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)"
1.1 misho 128: .br
129: .ti -1c
1.1.1.2 ! misho 130: .RI "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)"
1.1 misho 131: .br
132: .ti -1c
1.1.1.2 ! misho 133: .RI "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)"
1.1 misho 134: .br
135: .ti -1c
1.1.1.2 ! misho 136: .RI "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)"
1.1 misho 137: .br
138: .ti -1c
1.1.1.2 ! misho 139: .RI "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)"
1.1 misho 140: .br
141: .ti -1c
1.1.1.2 ! misho 142: .RI "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)"
1.1 misho 143: .br
144: .ti -1c
1.1.1.2 ! misho 145: .RI "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)"
1.1 misho 146: .br
147: .ti -1c
1.1.1.2 ! misho 148: .RI "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)"
1.1 misho 149: .br
150: .ti -1c
1.1.1.2 ! misho 151: .RI "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)"
1.1 misho 152: .br
153: .ti -1c
1.1.1.2 ! misho 154: .RI "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)"
1.1 misho 155: .br
156: .ti -1c
1.1.1.2 ! misho 157: .RI "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)"
1.1 misho 158: .br
159: .ti -1c
1.1.1.2 ! misho 160: .RI "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)"
1.1 misho 161: .br
162: .ti -1c
1.1.1.2 ! misho 163: .RI "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)"
1.1 misho 164: .br
165: .ti -1c
1.1.1.2 ! misho 166: .RI "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)"
1.1 misho 167: .br
168: .ti -1c
1.1.1.2 ! misho 169: .RI "libnet_ptag_t \fBlibnet_build_ipv4_options\fP (const uint8_t *options, uint32_t options_s, libnet_t *l, libnet_ptag_t ptag)"
1.1 misho 170: .br
171: .ti -1c
1.1.1.2 ! misho 172: .RI "libnet_ptag_t \fBlibnet_autobuild_ipv4\fP (uint16_t len, uint8_t prot, uint32_t dst, libnet_t *l)"
1.1 misho 173: .br
174: .ti -1c
1.1.1.2 ! misho 175: .RI "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)"
1.1 misho 176: .br
177: .ti -1c
1.1.1.2 ! misho 178: .RI "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)"
1.1 misho 179: .br
180: .ti -1c
1.1.1.2 ! misho 181: .RI "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)"
1.1 misho 182: .br
183: .ti -1c
1.1.1.2 ! misho 184: .RI "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)"
1.1 misho 185: .br
186: .ti -1c
1.1.1.2 ! misho 187: .RI "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)"
1.1 misho 188: .br
189: .ti -1c
1.1.1.2 ! misho 190: .RI "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)"
1.1 misho 191: .br
192: .ti -1c
1.1.1.2 ! misho 193: .RI "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)"
1.1 misho 194: .br
195: .ti -1c
1.1.1.2 ! misho 196: .RI "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)"
1.1 misho 197: .br
198: .ti -1c
1.1.1.2 ! misho 199: .RI "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)"
1.1 misho 200: .br
201: .ti -1c
1.1.1.2 ! misho 202: .RI "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)"
1.1 misho 203: .br
204: .ti -1c
1.1.1.2 ! misho 205: .RI "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)"
1.1 misho 206: .br
207: .ti -1c
1.1.1.2 ! misho 208: .RI "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)"
1.1 misho 209: .br
210: .ti -1c
1.1.1.2 ! misho 211: .RI "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)"
1.1 misho 212: .br
213: .ti -1c
1.1.1.2 ! misho 214: .RI "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)"
1.1 misho 215: .br
216: .ti -1c
1.1.1.2 ! misho 217: .RI "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)"
1.1 misho 218: .br
219: .ti -1c
1.1.1.2 ! misho 220: .RI "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)"
1.1 misho 221: .br
222: .ti -1c
1.1.1.2 ! misho 223: .RI "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)"
1.1 misho 224: .br
225: .ti -1c
1.1.1.2 ! misho 226: .RI "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)"
1.1 misho 227: .br
228: .ti -1c
1.1.1.2 ! misho 229: .RI "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)"
1.1 misho 230: .br
231: .ti -1c
1.1.1.2 ! misho 232: .RI "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)"
1.1 misho 233: .br
234: .ti -1c
1.1.1.2 ! misho 235: .RI "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)"
1.1 misho 236: .br
237: .ti -1c
1.1.1.2 ! misho 238: .RI "libnet_ptag_t \fBlibnet_build_ospfv2_hello\fP (uint32_t netmask, uint16_t interval, uint8_t opts, uint8_t priority, uint 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)"
1.1 misho 239: .br
240: .ti -1c
1.1.1.2 ! misho 241: .RI "libnet_ptag_t \fBlibnet_build_ospfv2_dbd\fP (uint16_t dgram_len, uint8_t opts, uint8_t type, uint seqnum, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
1.1 misho 242: .br
243: .ti -1c
1.1.1.2 ! misho 244: .RI "libnet_ptag_t \fBlibnet_build_ospfv2_lsr\fP (uint type, uint lsid, uint32_t advrtr, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
1.1 misho 245: .br
246: .ti -1c
1.1.1.2 ! misho 247: .RI "libnet_ptag_t \fBlibnet_build_ospfv2_lsu\fP (uint num, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
1.1 misho 248: .br
249: .ti -1c
1.1.1.2 ! misho 250: .RI "libnet_ptag_t \fBlibnet_build_ospfv2_lsa\fP (uint16_t age, uint8_t opts, uint8_t type, uint lsid, uint32_t advrtr, uint seqnum, uint16_t sum, uint16_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
1.1 misho 251: .br
252: .ti -1c
1.1.1.2 ! misho 253: .RI "libnet_ptag_t \fBlibnet_build_ospfv2_lsa_rtr\fP (uint16_t flags, uint16_t num, uint id, uint 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)"
1.1 misho 254: .br
255: .ti -1c
1.1.1.2 ! misho 256: .RI "libnet_ptag_t \fBlibnet_build_ospfv2_lsa_net\fP (uint32_t nmask, uint rtrid, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
1.1 misho 257: .br
258: .ti -1c
1.1.1.2 ! misho 259: .RI "libnet_ptag_t \fBlibnet_build_ospfv2_lsa_sum\fP (uint32_t nmask, uint metric, uint tos, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
1.1 misho 260: .br
261: .ti -1c
1.1.1.2 ! misho 262: .RI "libnet_ptag_t \fBlibnet_build_ospfv2_lsa_as\fP (uint32_t nmask, uint metric, uint32_t fwdaddr, uint tag, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
1.1 misho 263: .br
264: .ti -1c
1.1.1.2 ! misho 265: .RI "libnet_ptag_t \fBlibnet_build_data\fP (const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)"
1.1 misho 266: .br
267: .ti -1c
1.1.1.2 ! misho 268: .RI "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)"
1.1 misho 269: .br
270: .ti -1c
1.1.1.2 ! misho 271: .RI "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)"
1.1 misho 272: .br
273: .ti -1c
1.1.1.2 ! misho 274: .RI "uint32_t \fBlibnet_getgre_length\fP (uint16_t fv)"
! 275: .br
! 276: .ti -1c
! 277: .RI "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)"
! 278: .br
! 279: .ti -1c
! 280: .RI "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)"
! 281: .br
! 282: .ti -1c
! 283: .RI "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)"
1.1 misho 284: .br
285: .ti -1c
286: .RI "libnet_ptag_t \fBlibnet_build_gre_last_sre\fP (libnet_t *l, libnet_ptag_t ptag)"
287: .br
288: .ti -1c
1.1.1.2 ! misho 289: .RI "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)"
1.1 misho 290: .br
291: .ti -1c
1.1.1.2 ! misho 292: .RI "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)"
1.1 misho 293: .br
294: .ti -1c
1.1.1.2 ! misho 295: .RI "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)"
1.1 misho 296: .br
297: .ti -1c
1.1.1.2 ! misho 298: .RI "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)"
1.1 misho 299: .br
300: .ti -1c
1.1.1.2 ! misho 301: .RI "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)"
1.1 misho 302: .br
303: .ti -1c
1.1.1.2 ! misho 304: .RI "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)"
1.1 misho 305: .br
306: .ti -1c
1.1.1.2 ! misho 307: .RI "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)"
! 308: .br
! 309: .ti -1c
! 310: .RI "libnet_ptag_t \fBlibnet_autobuild_link\fP (const uint8_t *dst, const uint8_t *oui, uint16_t type, libnet_t *l)"
1.1 misho 311: .br
312: .ti -1c
313: .RI "int \fBlibnet_write\fP (libnet_t *l)"
314: .br
315: .ti -1c
1.1.1.2 ! misho 316: .RI "uint32_t \fBlibnet_get_ipaddr4\fP (libnet_t *l)"
! 317: .br
! 318: .ti -1c
! 319: .RI "struct libnet_in6_addr \fBlibnet_get_ipaddr6\fP (libnet_t *l)"
1.1 misho 320: .br
321: .ti -1c
1.1.1.2 ! misho 322: .RI "struct libnet_ether_addr * \fBlibnet_get_hwaddr\fP (libnet_t *l)"
1.1 misho 323: .br
324: .ti -1c
1.1.1.2 ! misho 325: .RI "uint8_t * \fBlibnet_hex_aton\fP (const char *s, int *len)"
1.1 misho 326: .br
327: .ti -1c
1.1.1.2 ! misho 328: .RI "const char * \fBlibnet_version\fP (void)"
1.1 misho 329: .br
330: .ti -1c
1.1.1.2 ! misho 331: .RI "int \fBlibnet_adv_cull_packet\fP (libnet_t *l, uint8_t **packet, uint32_t *packet_s)"
1.1 misho 332: .br
333: .ti -1c
1.1.1.2 ! misho 334: .RI "int \fBlibnet_adv_cull_header\fP (libnet_t *l, libnet_ptag_t ptag, uint8_t **header, uint32_t *header_s)"
1.1 misho 335: .br
336: .ti -1c
1.1.1.2 ! misho 337: .RI "int \fBlibnet_adv_write_link\fP (libnet_t *l, const uint8_t *packet, uint32_t packet_s)"
1.1 misho 338: .br
339: .ti -1c
1.1.1.2 ! misho 340: .RI "int \fBlibnet_adv_write_raw_ipv4\fP (libnet_t *l, const uint8_t *packet, uint32_t packet_s)"
! 341: .br
! 342: .ti -1c
! 343: .RI "void \fBlibnet_adv_free_packet\fP (libnet_t *l, uint8_t *packet)"
1.1 misho 344: .br
345: .ti -1c
346: .RI "int \fBlibnet_cq_add\fP (libnet_t *l, char *label)"
347: .br
348: .ti -1c
349: .RI "libnet_t * \fBlibnet_cq_remove\fP (libnet_t *l)"
350: .br
351: .ti -1c
352: .RI "libnet_t * \fBlibnet_cq_remove_by_label\fP (char *label)"
353: .br
354: .ti -1c
1.1.1.2 ! misho 355: .RI "const char * \fBlibnet_cq_getlabel\fP (libnet_t *l)"
1.1 misho 356: .br
357: .ti -1c
358: .RI "libnet_t * \fBlibnet_cq_find_by_label\fP (char *label)"
359: .br
360: .ti -1c
1.1.1.2 ! misho 361: .RI "void \fBlibnet_cq_destroy\fP (void)"
! 362: .br
! 363: .ti -1c
! 364: .RI "libnet_t * \fBlibnet_cq_head\fP (void)"
1.1 misho 365: .br
366: .ti -1c
1.1.1.2 ! misho 367: .RI "int \fBlibnet_cq_last\fP (void)"
1.1 misho 368: .br
369: .ti -1c
1.1.1.2 ! misho 370: .RI "libnet_t * \fBlibnet_cq_next\fP (void)"
1.1 misho 371: .br
372: .ti -1c
1.1.1.2 ! misho 373: .RI "uint32_t \fBlibnet_cq_size\fP (void)"
1.1 misho 374: .br
375: .ti -1c
1.1.1.2 ! misho 376: .RI "uint32_t \fBlibnet_cq_end_loop\fP (void)"
1.1 misho 377: .br
378: .ti -1c
379: .RI "void \fBlibnet_diag_dump_context\fP (libnet_t *l)"
380: .br
381: .ti -1c
382: .RI "void \fBlibnet_diag_dump_pblock\fP (libnet_t *l)"
383: .br
384: .ti -1c
1.1.1.2 ! misho 385: .RI "char * \fBlibnet_diag_dump_pblock_type\fP (uint8_t type)"
1.1 misho 386: .br
387: .ti -1c
1.1.1.2 ! misho 388: .RI "void \fBlibnet_diag_dump_hex\fP (const uint8_t *packet, uint32_t len, int swap, FILE *stream)"
1.1 misho 389: .br
390: .ti -1c
1.1.1.2 ! misho 391: .RI "int \fBlibnet_write_raw_ipv4\fP (libnet_t *l, const uint8_t *packet, uint32_t size)"
1.1 misho 392: .br
393: .ti -1c
1.1.1.2 ! misho 394: .RI "int \fBlibnet_write_raw_ipv6\fP (libnet_t *l, const uint8_t *packet, uint32_t size)"
1.1 misho 395: .br
396: .ti -1c
1.1.1.2 ! misho 397: .RI "int \fBlibnet_write_link\fP (libnet_t *l, const uint8_t *packet, uint32_t size)"
1.1 misho 398: .br
399: .ti -1c
400: .RI "int \fBlibnet_open_raw4\fP (libnet_t *l)"
401: .br
402: .ti -1c
403: .RI "int \fBlibnet_close_raw4\fP (libnet_t *l)"
404: .br
405: .ti -1c
406: .RI "int \fBlibnet_open_raw6\fP (libnet_t *l)"
407: .br
408: .ti -1c
409: .RI "int \fBlibnet_close_raw6\fP (libnet_t *l)"
410: .br
411: .ti -1c
412: .RI "int \fBlibnet_select_device\fP (libnet_t *l)"
413: .br
414: .ti -1c
415: .RI "int \fBlibnet_open_link\fP (libnet_t *l)"
416: .br
417: .ti -1c
418: .RI "int \fBlibnet_close_link\fP (libnet_t *l)"
419: .br
420: .ti -1c
1.1.1.2 ! misho 421: .RI "int \fBlibnet_do_checksum\fP (libnet_t *l, uint8_t *iphdr, int protocol, int h_len)"
1.1 misho 422: .br
423: .ti -1c
1.1.1.2 ! misho 424: .RI "int \fBlibnet_inet_checksum\fP (libnet_t *l, uint8_t *iphdr, int protocol, int h_len, const uint8_t *beg, const uint8_t *end)"
1.1 misho 425: .br
426: .ti -1c
1.1.1.2 ! misho 427: .RI "uint32_t \fBlibnet_compute_crc\fP (uint8_t *buf, uint32_t len)"
1.1 misho 428: .br
429: .ti -1c
1.1.1.2 ! misho 430: .RI "uint16_t \fBlibnet_ip_check\fP (uint16_t *addr, int len)"
1.1 misho 431: .br
432: .ti -1c
1.1.1.2 ! misho 433: .RI "int \fBlibnet_in_cksum\fP (uint16_t *addr, int len)"
1.1 misho 434: .br
435: .ti -1c
1.1.1.2 ! misho 436: .RI "libnet_pblock_t * \fBlibnet_pblock_probe\fP (libnet_t *l, libnet_ptag_t ptag, uint32_t b_len, uint8_t type)"
! 437: .br
! 438: .ti -1c
! 439: .RI "libnet_pblock_t * \fBlibnet_pblock_new\fP (libnet_t *l, uint32_t b_len)"
1.1 misho 440: .br
441: .ti -1c
442: .RI "int \fBlibnet_pblock_swap\fP (libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2)"
443: .br
444: .ti -1c
445: .RI "int \fBlibnet_pblock_insert_before\fP (libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2)"
446: .br
447: .ti -1c
448: .RI "void \fBlibnet_pblock_delete\fP (libnet_t *l, libnet_pblock_t *p)"
449: .br
450: .ti -1c
1.1.1.2 ! misho 451: .RI "libnet_ptag_t \fBlibnet_pblock_update\fP (libnet_t *l, libnet_pblock_t *p, uint32_t h, uint8_t type)"
1.1 misho 452: .br
453: .ti -1c
454: .RI "libnet_pblock_t * \fBlibnet_pblock_find\fP (libnet_t *l, libnet_ptag_t ptag)"
455: .br
456: .ti -1c
1.1.1.2 ! misho 457: .RI "int \fBlibnet_pblock_append\fP (libnet_t *l, libnet_pblock_t *p, const void *buf, uint32_t len)"
1.1 misho 458: .br
459: .ti -1c
1.1.1.2 ! misho 460: .RI "void \fBlibnet_pblock_setflags\fP (libnet_pblock_t *p, uint8_t flags)"
1.1 misho 461: .br
462: .ti -1c
1.1.1.2 ! misho 463: .RI "int \fBlibnet_pblock_p2p\fP (uint8_t type)"
1.1 misho 464: .br
465: .ti -1c
1.1.1.2 ! misho 466: .RI "int \fBlibnet_pblock_coalesce\fP (libnet_t *l, uint8_t **packet, uint32_t *size)"
1.1 misho 467: .br
468: .ti -1c
469: .RI "int \fBlibnet_check_iface\fP (libnet_t *l)"
470: .br
471: .in -1c
472: .SS "Variables"
473:
474: .in +1c
475: .ti -1c
1.1.1.2 ! misho 476: .RI "struct libnet_in6_addr \fBin6addr_error\fP"
1.1 misho 477: .br
478: .in -1c
479: .SH "Detailed Description"
480: .PP
481: libnet exported function prototypes
482:
483:
484: .SH "Function Documentation"
485: .PP
1.1.1.2 ! misho 486: .SS "char* libnet_addr2name4 (uint32_tin, uint8_tuse_name)"Takes a network byte ordered IPv4 address and returns a pointer to either a canonical DNS name (if it has one) or a string of dotted decimals. This may incur a DNS lookup if the hostname and mode is set to LIBNET_RESOLVE. If mode is set to LIBNET_DONT_RESOLVE, no DNS lookup will be performed and the function will return a pointer to a dotted decimal string. The function cannot fail -- if no canonical name exists, it will fall back on returning a dotted decimal string. This function is non-reentrant.
1.1 misho 487: .PP
488: \fBParameters:\fP
489: .RS 4
490: \fIin\fP network byte ordered IPv4 address
491: .br
492: \fIuse_name\fP LIBNET_RESOLVE or LIBNET_DONT_RESOLVE
493: .RE
494: .PP
495: \fBReturns:\fP
496: .RS 4
497: a pointer to presentation format string
498: .RE
499: .PP
500:
1.1.1.2 ! misho 501: .SS "void libnet_addr2name6_r (struct libnet_in6_addraddr, uint8_tuse_name, char *host_name, inthost_name_len)"Should document this baby right here.
! 502: .SS "int libnet_adv_cull_header (libnet_t *l, libnet_ptag_tptag, uint8_t **header, uint32_t *header_s)"[Advanced Interface] Pulls the header from the specified ptag from the given libnet context. This function is part of the advanced interface and is only available when libnet is initialized in advanced mode. If the function fails \fBlibnet_geterror()\fP can tell you why.
1.1 misho 503: .PP
504: \fBParameters:\fP
505: .RS 4
506: \fIl\fP pointer to a libnet context
507: .br
508: \fIptag\fP the ptag referencing the header to pull
509: .br
510: \fIheader\fP will contain the header
511: .br
512: \fIheader_s\fP will contain the header size
513: .RE
514: .PP
515: \fBReturns:\fP
516: .RS 4
517: 1 on success, -1 on failure
518: .RE
519: .PP
520:
1.1.1.2 ! misho 521: .SS "int libnet_adv_cull_packet (libnet_t *l, uint8_t **packet, uint32_t *packet_s)"[Advanced Interface] Yanks a prebuilt, wire-ready packet from the given libnet context. If libnet was configured to do so (which it is by default) the packet will have all checksums written in. This function is part of the advanced interface and is only available when libnet is initialized in advanced mode. It is important to note that the function performs an implicit malloc() and a corresponding call to \fBlibnet_adv_free_packet()\fP should be made to free the memory packet occupies. If the function fails \fBlibnet_geterror()\fP can tell you why.
1.1 misho 522: .PP
523: \fBParameters:\fP
524: .RS 4
525: \fIl\fP pointer to a libnet context
526: .br
527: \fIpacket\fP will contain the wire-ready packet
528: .br
529: \fIpacket_s\fP will contain the packet size
530: .RE
531: .PP
532: \fBReturns:\fP
533: .RS 4
534: 1 on success, -1 on failure
535: .RE
536: .PP
537:
1.1.1.2 ! misho 538: .SS "void libnet_adv_free_packet (libnet_t *l, uint8_t *packet)"[Advanced Interface] Frees the memory allocated when \fBlibnet_adv_cull_packet()\fP is called.
1.1 misho 539: .PP
540: \fBParameters:\fP
541: .RS 4
542: \fIl\fP pointer to a libnet context
543: .br
544: \fIpacket\fP a pointer to the packet to free
545: .RE
546: .PP
547:
1.1.1.2 ! misho 548: .SS "int libnet_adv_write_link (libnet_t *l, const uint8_t *packet, uint32_tpacket_s)"[Advanced Interface] Writes a packet the network at the link layer. This function is useful to write a packet that has been constructed by hand by the application programmer or, more commonly, to write a packet that has been returned by a call to \fBlibnet_adv_cull_packet()\fP. This function is part of the advanced interface and is only available when libnet is initialized in advanced mode. If the function fails \fBlibnet_geterror()\fP can tell you why.
1.1 misho 549: .PP
550: \fBParameters:\fP
551: .RS 4
552: \fIl\fP pointer to a libnet context
553: .br
554: \fIpacket\fP a pointer to the packet to inject
555: .br
556: \fIpacket_s\fP the size of the packet
557: .RE
558: .PP
559: \fBReturns:\fP
560: .RS 4
561: the number of bytes written, or -1 on failure
562: .RE
563: .PP
564:
1.1.1.2 ! misho 565: .SS "int libnet_adv_write_raw_ipv4 (libnet_t *l, const uint8_t *packet, uint32_tpacket_s)"[Advanced Interface] Writes a packet the network at the raw socket layer. This function is useful to write a packet that has been constructed by hand by the application programmer or, more commonly, to write a packet that has been returned by a call to \fBlibnet_adv_cull_packet()\fP. This function is part of the advanced interface and is only available when libnet is initialized in advanced mode. If the function fails \fBlibnet_geterror()\fP can tell you why.
! 566: .PP
! 567: \fBParameters:\fP
! 568: .RS 4
! 569: \fIl\fP pointer to a libnet context
! 570: .br
! 571: \fIpacket\fP a pointer to the packet to inject
! 572: .br
! 573: \fIpacket_s\fP the size of the packet
! 574: .RE
! 575: .PP
! 576: \fBReturns:\fP
! 577: .RS 4
! 578: the number of bytes written, or -1 on failure
! 579: .RE
1.1 misho 580: .PP
1.1.1.2 ! misho 581:
! 582: .SS "libnet_ptag_t libnet_autobuild_arp (uint16_top, const uint8_t *sha, const uint8_t *spa, const uint8_t *tha, uint8_t *tpa, libnet_t *l)"Autouilds an Address Resolution Protocol (ARP) header. Depending on the op value, the function builds one of several different types of RFC 826 or RFC 903 RARP packets.
1.1 misho 583: .PP
584: \fBParameters:\fP
585: .RS 4
586: \fIop\fP ARP operation type
587: .br
588: \fIsha\fP sender's hardware address
589: .br
590: \fIspa\fP sender's protocol address
591: .br
592: \fItha\fP target hardware address
593: .br
594: \fItpa\fP targer protocol address
595: .br
596: \fIl\fP pointer to a libnet context
597: .RE
598: .PP
599: \fBReturns:\fP
600: .RS 4
601: protocol tag value on success, -1 on error
602: .RE
603: .PP
604:
1.1.1.2 ! misho 605: .SS "libnet_ptag_t libnet_autobuild_ethernet (const uint8_t *dst, uint16_ttype, libnet_t *l)"Autobuilds an Ethernet header. The RFC 894 Ethernet II header is almost identical to the IEEE 802.3 header, with the exception that the field immediately following the source address holds the layer 3 protocol (as opposed to frame's length). You should only use this function when libnet is initialized with the LIBNET_LINK interface.
1.1 misho 606: .PP
607: \fBParameters:\fP
608: .RS 4
609: \fIdst\fP destination ethernet address
610: .br
611: \fItype\fP upper layer protocol type
612: .br
613: \fIl\fP pointer to a libnet context
614: .RE
615: .PP
616: \fBReturns:\fP
617: .RS 4
618: protocol tag value on success, -1 on error
619: .RE
620: .PP
621:
1.1.1.2 ! misho 622: .SS "libnet_ptag_t libnet_autobuild_fddi (uint8_tfc, const uint8_t *dst, uint8_tdsap, uint8_tssap, uint8_tcf, const uint8_t *oui, uint16_ttype, libnet_t *l)"Autobuilds a Fiber Distributed Data Interface (FDDI) header.
1.1 misho 623: .PP
624: \fBParameters:\fP
625: .RS 4
1.1.1.2 ! misho 626: \fIfc\fP class format and priority
! 627: .br
! 628: \fIdst\fP destination fddi address
1.1 misho 629: .br
630: \fIdsap\fP destination service access point
631: .br
632: \fIssap\fP source service access point
633: .br
634: \fIcf\fP cf
635: .br
1.1.1.2 ! misho 636: \fIoui\fP IEEE organizational code
1.1 misho 637: .br
638: \fItype\fP upper layer protocol
639: .br
640: \fIl\fP pointer to a libnet context
641: .RE
642: .PP
643: \fBReturns:\fP
644: .RS 4
645: protocol tag value on success, -1 on error
646: .RE
647: .PP
648:
1.1.1.2 ! misho 649: .SS "libnet_ptag_t libnet_autobuild_ipv4 (uint16_tlen, uint8_tprot, uint32_tdst, libnet_t *l)"Autobuilds a version 4 Internet Protocol (IP) header. The function is useful to build an IP header quickly when you do not need a granular level of control. The function takes the same len, prot, and dst arguments as \fBlibnet_build_ipv4()\fP. The function does not accept a ptag argument, but it does return a ptag. In other words, you can use it to build a new IP header but not to modify an existing one.
1.1 misho 650: .PP
651: \fBParameters:\fP
652: .RS 4
653: \fIlen\fP total length of the IP packet including all subsequent data
654: .br
655: \fIprot\fP upper layer protocol
656: .br
657: \fIdst\fP destination IPv4 address (little endian)
658: .br
659: \fIl\fP pointer to a libnet context
660: .RE
661: .PP
662: \fBReturns:\fP
663: .RS 4
664: protocol tag value on success, -1 on error
665: .RE
666: .PP
667:
1.1.1.2 ! misho 668: .SS "libnet_ptag_t libnet_autobuild_ipv6 (uint16_tlen, uint8_tnh, struct libnet_in6_addrdst, libnet_t *l, libnet_ptag_tptag)"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.
1.1 misho 669: .PP
670: \fBParameters:\fP
671: .RS 4
672: \fIlen\fP length
673: .br
674: \fInh\fP next header
675: .br
676: \fIdst\fP destination IPv6 address
677: .br
678: \fIl\fP pointer to a libnet context
679: .br
680: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
681: .RE
682: .PP
683: \fBReturns:\fP
684: .RS 4
685: protocol tag value on success, -1 on error
686: .RE
687: .PP
688:
1.1.1.2 ! misho 689: .SS "libnet_ptag_t libnet_autobuild_link (const uint8_t *dst, const uint8_t *oui, uint16_ttype, libnet_t *l)"Automatically builds a link layer header for an initialized l. The function determines the proper link layer header format from how l was initialized. The function current supports Ethernet and Token Ring link layers.
1.1 misho 690: .PP
691: \fBParameters:\fP
692: .RS 4
693: \fIdst\fP the destination MAC address
694: .br
695: \fIoui\fP Organizationally Unique Identifier (unused for Ethernet)
696: .br
697: \fItype\fP the 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, -1 on error
705: .RE
706: .PP
707:
1.1.1.2 ! misho 708: .SS "libnet_ptag_t libnet_autobuild_token_ring (uint8_tac, uint8_tfc, const uint8_t *dst, uint8_tdsap, uint8_tssap, uint8_tcf, const uint8_t *oui, uint16_ttype, libnet_t *l)"Auto-builds a token ring header.
1.1 misho 709: .PP
710: \fBParameters:\fP
711: .RS 4
712: \fIac\fP access control
713: .br
714: \fIfc\fP frame control
715: .br
716: \fIdst\fP destination address
717: .br
718: \fIdsap\fP destination service access point
719: .br
720: \fIssap\fP source service access point
721: .br
722: \fIcf\fP control field
723: .br
724: \fIoui\fP Organizationally Unique Identifier
725: .br
726: \fItype\fP upper layer protocol type
727: .br
728: \fIl\fP pointer to a libnet context
729: .RE
730: .PP
731: \fBReturns:\fP
732: .RS 4
733: protocol tag value on success, -1 on error
734: .RE
735: .PP
736:
1.1.1.2 ! misho 737: .SS "libnet_ptag_t libnet_build_802_1q (const uint8_t *dst, const uint8_t *src, uint16_ttpi, uint8_tpriority, uint8_tcfi, uint16_tvlan_id, uint16_tlen_proto, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)".SH "Packet Builder Functions"
1.1 misho 738: .PP
1.1.1.2 ! misho 739: 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: 1. \fBlibnet_build_ntp()\fP 2. \fBlibnet_build_udp()\fP 3. \fBlibnet_build_ipv4()\fP 4. \fBlibnet_build_ethernet()\fP This ordering is essential for libnet 1.1.x to properly link together the packet internally (previous libnet versions did not have the requirement).
! 740: .SS "The Payload Interface"
! 741: 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:
! 742: .IP "\(bu" 2
! 743: Including additional or arbitrary protocol header information that is not available from a libnet interface
! 744: .IP "\(bu" 2
! 745: Including a packet payload (data segment)
! 746: .IP "\(bu" 2
! 747: 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.
! 748: .PP
! 749: .PP
! 750: 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.
! 751: .SS "Protocol Tags and Packet Builder Return Values"
! 752: 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.
1.1 misho 753: .PP
754: \fBParameters:\fP
755: .RS 4
756: \fIdst\fP pointer to a six byte source ethernet address
757: .br
758: \fIsrc\fP pointer to a six byte destination ethernet address
759: .br
760: \fItpi\fP tag protocol identifier
761: .br
762: \fIpriority\fP priority
763: .br
764: \fIcfi\fP canonical format indicator
765: .br
766: \fIvlan_id\fP vlan identifier
767: .br
768: \fIlen_proto\fP length (802.3) protocol (Ethernet II)
769: .br
770: \fIpayload\fP optional payload or NULL
771: .br
772: \fIpayload_s\fP payload length or 0
773: .br
774: \fIl\fP pointer to a libnet context
775: .br
776: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
777: .RE
778: .PP
779: \fBReturns:\fP
780: .RS 4
781: protocol tag value on success, -1 on error
782: .RE
783: .PP
784:
1.1.1.2 ! misho 785: .SS "libnet_ptag_t libnet_build_802_1x (uint8_teap_ver, uint8_teap_type, uint16_tlength, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Builds an IEEE 802.1x extended authentication protocol header.
1.1 misho 786: .PP
787: \fBParameters:\fP
788: .RS 4
789: \fIeap_ver\fP the EAP version
790: .br
791: \fIeap_type\fP the EAP type
792: .br
793: \fIlength\fP frame length
794: .br
795: \fIpayload\fP optional payload or NULL
796: .br
797: \fIpayload_s\fP payload length or 0
798: .br
799: \fIl\fP pointer to a libnet context
800: .br
801: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
802: .RE
803: .PP
804: \fBReturns:\fP
805: .RS 4
806: protocol tag value on success, -1 on error
807: .RE
808: .PP
809:
1.1.1.2 ! misho 810: .SS "libnet_ptag_t libnet_build_802_2 (uint8_tdsap, uint8_tssap, uint8_tcontrol, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Builds an IEEE 802.2 LLC header.
1.1 misho 811: .PP
812: \fBParameters:\fP
813: .RS 4
814: \fIdsap\fP destination service access point
815: .br
816: \fIssap\fP source service access point
817: .br
818: \fIcontrol\fP control field
819: .br
820: \fIpayload\fP optional payload or NULL
821: .br
822: \fIpayload_s\fP payload length or 0
823: .br
824: \fIl\fP pointer to a libnet context
825: .br
826: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
827: .RE
828: .PP
829: \fBReturns:\fP
830: .RS 4
831: protocol tag value on success, -1 on error
832: .RE
833: .PP
834:
1.1.1.2 ! misho 835: .SS "libnet_ptag_t libnet_build_802_2snap (uint8_tdsap, uint8_tssap, uint8_tcontrol, uint8_t *oui, uint16_ttype, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Builds an IEEE 802.2 LLC SNAP header.
1.1 misho 836: .PP
837: \fBParameters:\fP
838: .RS 4
839: \fIdsap\fP destination service access point
840: .br
841: \fIssap\fP source service access point
842: .br
843: \fIcontrol\fP control field
844: .br
845: \fIoui\fP Organizationally Unique Identifier
846: .br
847: \fItype\fP upper layer protocol
848: .br
849: \fIpayload\fP optional payload or NULL
850: .br
851: \fIpayload_s\fP payload length or 0
852: .br
853: \fIl\fP pointer to a libnet context
854: .br
855: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
856: .RE
857: .PP
858: \fBReturns:\fP
859: .RS 4
860: protocol tag value on success, -1 on error
861: .RE
862: .PP
863:
1.1.1.2 ! misho 864: .SS "libnet_ptag_t libnet_build_802_3 (const uint8_t *dst, const uint8_t *src, uint16_tlen, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"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.
1.1 misho 865: .PP
866: \fBParameters:\fP
867: .RS 4
868: \fIdst\fP destination ethernet address
869: .br
870: \fIsrc\fP source ethernet address
871: .br
872: \fIlen\fP frame length sans header
873: .br
874: \fIpayload\fP optional payload or NULL
875: .br
876: \fIpayload_s\fP payload length or 0
877: .br
878: \fIl\fP pointer to a libnet context
879: .br
880: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
881: .RE
882: .PP
883: \fBReturns:\fP
884: .RS 4
885: protocol tag value on success, -1 on error
886: .RE
887: .PP
888:
1.1.1.2 ! misho 889: .SS "libnet_ptag_t libnet_build_arp (uint16_thrd, uint16_tpro, uint8_thln, uint8_tpln, uint16_top, const uint8_t *sha, const uint8_t *spa, const uint8_t *tha, const uint8_t *tpa, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"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.
1.1 misho 890: .PP
891: \fBParameters:\fP
892: .RS 4
893: \fIhrd\fP hardware address format
894: .br
895: \fIpro\fP protocol address format
896: .br
897: \fIhln\fP hardware address length
898: .br
899: \fIpln\fP protocol address length
900: .br
901: \fIop\fP ARP operation type
902: .br
903: \fIsha\fP sender's hardware address
904: .br
905: \fIspa\fP sender's protocol address
906: .br
907: \fItha\fP target hardware address
908: .br
909: \fItpa\fP targer protocol address
910: .br
911: \fIpayload\fP optional payload or NULL
912: .br
913: \fIpayload_s\fP payload length or 0
914: .br
915: \fIl\fP pointer to a libnet context
916: .br
917: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
918: .RE
919: .PP
920: \fBReturns:\fP
921: .RS 4
922: protocol tag value on success, -1 on error
923: .RE
924: .PP
925:
1.1.1.2 ! misho 926: .SS "libnet_ptag_t libnet_build_bgp4_header (uint8_tmarker[LIBNET_BGP4_MARKER_SIZE], uint16_tlen, uint8_ttype, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"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.
1.1 misho 927: .PP
928: \fBParameters:\fP
929: .RS 4
930: \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)
931: .br
932: \fIlen\fP total length of the BGP message, including the header
933: .br
934: \fItype\fP type code of the message (OPEN, UPDATE, NOTIFICATION or KEEPALIVE)
935: .br
936: \fIpayload\fP optional payload or NULL
937: .br
938: \fIpayload_s\fP payload length or 0
939: .br
940: \fIl\fP pointer to a libnet context
941: .br
942: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
943: .RE
944: .PP
945: \fBReturns:\fP
946: .RS 4
947: protocol tag value on success, -1 on error
948: .RE
949: .PP
950:
1.1.1.2 ! misho 951: .SS "libnet_ptag_t libnet_build_bgp4_notification (uint8_terr_code, uint8_terr_subcode, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"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.
1.1 misho 952: .PP
953: \fBParameters:\fP
954: .RS 4
955: \fIerr_code\fP type of notification
956: .br
957: \fIerr_subcode\fP more specific information about the reported error.
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, -1 on error
971: .RE
972: .PP
973:
1.1.1.2 ! misho 974: .SS "libnet_ptag_t libnet_build_bgp4_open (uint8_tversion, uint16_tsrc_as, uint16_thold_time, uint32_tbgp_id, uint8_topt_len, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"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).
1.1 misho 975: .PP
976: \fBParameters:\fP
977: .RS 4
978: \fIversion\fP protocol version (should be set to 4)
979: .br
980: \fIsrc_as\fP Autonomous System of the sender
981: .br
982: \fIhold_time\fP used to compute the maximum allowed time between the receipt of KEEPALIVE, and/or UPDATE messages by the sender
983: .br
984: \fIbgp_id\fP BGP identifier of the sender
985: .br
986: \fIopt_len\fP total length of the optional parameters field in bytes
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, -1 on error
1000: .RE
1001: .PP
1002:
1.1.1.2 ! misho 1003: .SS "libnet_ptag_t libnet_build_bgp4_update (uint16_tunfeasible_rt_len, const uint8_t *withdrawn_rt, uint16_ttotal_path_attr_len, const uint8_t *path_attributes, uint16_tinfo_len, uint8_t *reachability_info, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) update header. Update messages are used to transfer routing information between BGP peers.
1.1 misho 1004: .PP
1005: \fBParameters:\fP
1006: .RS 4
1007: \fIunfeasible_rt_len\fP indicates the length of the (next) 'withdrawn routes' field in bytes
1008: .br
1009: \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)>
1010: .br
1011: \fItotal_path_attr_len\fP indicates the length of the (next) 'path attributes' field in bytes
1012: .br
1013: \fIpath_attributes\fP each attribute is a 3-tuple <type (2 bytes), length, value>
1014: .br
1015: \fIinfo_len\fP indicates the length of the (next) 'network layer reachability information' field in bytes (needed for internal memory size calculation)
1016: .br
1017: \fIreachability_info\fP 2-tuples <length (1 byte), prefix (variable)>.
1018: .br
1019: \fIpayload\fP optional payload or NULL
1020: .br
1021: \fIpayload_s\fP payload length or 0
1022: .br
1023: \fIl\fP pointer to a libnet context
1024: .br
1025: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1026: .RE
1027: .PP
1028: \fBReturns:\fP
1029: .RS 4
1030: protocol tag value on success, -1 on error
1031: .RE
1032: .PP
1033:
1.1.1.2 ! misho 1034: .SS "libnet_ptag_t libnet_build_bootpv4 (uint8_topcode, uint8_thtype, uint8_thlen, uint8_thopcount, uint32_txid, uint16_tsecs, uint16_tflags, uint32_tcip, uint32_tyip, uint32_tsip, uint32_tgip, const uint8_t *chaddr, const char *sname, const char *file, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"\fBParameters:\fP
1.1 misho 1035: .RS 4
1.1.1.2 ! misho 1036: \fIopcode\fP
! 1037: .br
! 1038: \fIhtype\fP
! 1039: .br
! 1040: \fIhlen\fP
! 1041: .br
! 1042: \fIhopcount\fP
! 1043: .br
! 1044: \fIxid\fP
! 1045: .br
! 1046: \fIsecs\fP
! 1047: .br
! 1048: \fIflags\fP
! 1049: .br
! 1050: \fIcip\fP
! 1051: .br
! 1052: \fIyip\fP
! 1053: .br
! 1054: \fIsip\fP
! 1055: .br
! 1056: \fIgip\fP
! 1057: .br
! 1058: \fIchaddr\fP client hardware address, length is hlen
! 1059: .br
! 1060: \fIsname\fP server host name, a null terminated string
! 1061: .br
! 1062: \fIfile\fP boot file name, a null terminated string
! 1063: .br
1.1 misho 1064: \fIpayload\fP optional payload or NULL
1065: .br
1066: \fIpayload_s\fP payload length or 0
1067: .br
1068: \fIl\fP pointer to a libnet context
1069: .br
1070: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1071: .RE
1072: .PP
1073: \fBReturns:\fP
1074: .RS 4
1075: protocol tag value on success, -1 on error
1076: .RE
1077: .PP
1078:
1.1.1.2 ! misho 1079: .SS "libnet_ptag_t libnet_build_cdp (uint8_tversion, uint8_tttl, uint16_tsum, uint16_ttype, uint16_tvalue_s, const uint8_t *value, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"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.
1.1 misho 1080: .PP
1081: \fBParameters:\fP
1082: .RS 4
1083: \fIversion\fP CDP version
1084: .br
1085: \fIttl\fP time to live (time information should be cached by recipient)
1086: .br
1087: \fIsum\fP checksum (0 for libnet to autofill)
1088: .br
1089: \fItype\fP type of data contained in value
1090: .br
1.1.1.2 ! misho 1091: \fIvalue_s\fP length of value argument
1.1 misho 1092: .br
1093: \fIvalue\fP the CDP information string
1094: .br
1095: \fIpayload\fP optional payload or NULL
1096: .br
1097: \fIpayload_s\fP payload length or 0
1098: .br
1099: \fIl\fP pointer to a libnet context
1100: .br
1101: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1102: .RE
1103: .PP
1104: \fBReturns:\fP
1105: .RS 4
1106: protocol tag value on success, -1 on error
1107: .RE
1108: .PP
1109:
1.1.1.2 ! misho 1110: .SS "libnet_ptag_t libnet_build_data (const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"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).
1.1 misho 1111: .PP
1112: \fBParameters:\fP
1113: .RS 4
1114: \fIpayload\fP optional payload or NULL
1115: .br
1116: \fIpayload_s\fP payload length or 0
1117: .br
1118: \fIl\fP pointer to a libnet context
1119: .br
1120: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1121: .RE
1122: .PP
1123: \fBReturns:\fP
1124: .RS 4
1125: protocol tag value on success, -1 on error
1126: .RE
1127: .PP
1128:
1.1.1.2 ! misho 1129: .SS "libnet_ptag_t libnet_build_dhcpv4 (uint8_topcode, uint8_thtype, uint8_thlen, uint8_thopcount, uint32_txid, uint16_tsecs, uint16_tflags, uint32_tcip, uint32_tyip, uint32_tsip, uint32_tgip, const uint8_t *chaddr, const char *sname, const char *file, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"\fBParameters:\fP
1.1 misho 1130: .RS 4
1.1.1.2 ! misho 1131: \fIopcode\fP
! 1132: .br
! 1133: \fIhtype\fP
! 1134: .br
! 1135: \fIhlen\fP
! 1136: .br
! 1137: \fIhopcount\fP
! 1138: .br
! 1139: \fIxid\fP
! 1140: .br
! 1141: \fIsecs\fP
! 1142: .br
! 1143: \fIflags\fP
! 1144: .br
! 1145: \fIcip\fP
! 1146: .br
! 1147: \fIyip\fP
! 1148: .br
! 1149: \fIsip\fP
! 1150: .br
! 1151: \fIgip\fP
! 1152: .br
! 1153: \fIchaddr\fP client hardware address, length is hlen
! 1154: .br
! 1155: \fIsname\fP server host name, a null terminated string
! 1156: .br
! 1157: \fIfile\fP boot file name, a null terminated string
! 1158: .br
1.1 misho 1159: \fIpayload\fP optional payload or NULL
1160: .br
1161: \fIpayload_s\fP payload length or 0
1162: .br
1163: \fIl\fP pointer to a libnet context
1164: .br
1165: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1166: .RE
1167: .PP
1168: \fBReturns:\fP
1169: .RS 4
1170: protocol tag value on success, -1 on error
1171: .RE
1172: .PP
1173:
1.1.1.2 ! misho 1174: .SS "libnet_ptag_t libnet_build_dnsv4 (uint16_th_len, uint16_tid, uint16_tflags, uint16_tnum_q, uint16_tnum_anws_rr, uint16_tnum_auth_rr, uint16_tnum_addi_rr, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Builds an RFC 1035 version 4 DNS header. Additional DNS payload information should be specified using the payload interface.
1.1 misho 1175: .PP
1176: \fBParameters:\fP
1177: .RS 4
1.1.1.2 ! misho 1178: \fIh_len\fP
! 1179: .br
1.1 misho 1180: \fIid\fP DNS packet id
1181: .br
1182: \fIflags\fP control flags
1183: .br
1184: \fInum_q\fP number of questions
1185: .br
1186: \fInum_anws_rr\fP number of answer resource records
1187: .br
1188: \fInum_auth_rr\fP number of authority resource records
1189: .br
1190: \fInum_addi_rr\fP number of additional resource records
1191: .br
1192: \fIpayload\fP optional payload or NULL
1193: .br
1194: \fIpayload_s\fP payload length or 0
1195: .br
1196: \fIl\fP pointer to a libnet context
1197: .br
1198: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1199: .RE
1200: .PP
1201: \fBReturns:\fP
1202: .RS 4
1203: protocol tag value on success, -1 on error
1204: .RE
1205: .PP
1206:
1.1.1.2 ! misho 1207: .SS "libnet_ptag_t libnet_build_egre (uint16_tfv, uint16_ttype, uint16_tsum, uint16_toffset, uint32_tkey, uint32_tseq, uint16_tlen, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Generic Routing Encapsulation (GRE - RFC 1701) is used to encapsulate any protocol. Hence, the IP part of the packet is usually referred as 'delivery
! 1208: 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.
1.1 misho 1209: .PP
1210: \fBParameters:\fP
1211: .RS 4
1212: \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.
1213: .br
1214: \fItype\fP which protocol is encapsulated (PPP, IP, ...)
1215: .br
1216: \fIsum\fP checksum (0 for libnet to autofill).
1217: .br
1218: \fIoffset\fP byte offset from the start of the routing field to the first byte of the SRE
1219: .br
1220: \fIkey\fP inserted by the encapsulator to authenticate the source
1221: .br
1222: \fIseq\fP sequence number used by the receiver to sort the packets
1223: .br
1224: \fIlen\fP size of the GRE packet
1225: .br
1.1.1.2 ! misho 1226: \fIpayload\fP optional payload or NULL
! 1227: .br
1.1 misho 1228: \fIpayload_s\fP payload length or 0
1229: .br
1230: \fIl\fP pointer to a libnet context
1231: .br
1232: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1233: .RE
1234: .PP
1235: \fBReturns:\fP
1236: .RS 4
1237: protocol tag value on success, -1 on error
1238: .RE
1239: .PP
1240:
1.1.1.2 ! misho 1241: .SS "libnet_ptag_t libnet_build_ethernet (const uint8_t *dst, const uint8_t *src, uint16_ttype, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"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.
1.1 misho 1242: .PP
1243: \fBParameters:\fP
1244: .RS 4
1245: \fIdst\fP destination ethernet address
1246: .br
1247: \fIsrc\fP source ethernet address
1248: .br
1249: \fItype\fP upper layer protocol type
1250: .br
1251: \fIpayload\fP optional payload or NULL
1252: .br
1253: \fIpayload_s\fP payload length or 0
1254: .br
1255: \fIl\fP pointer to a libnet context
1256: .br
1257: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1258: .RE
1259: .PP
1260: \fBReturns:\fP
1261: .RS 4
1262: protocol tag value on success, -1 on error
1263: .RE
1264: .PP
1265:
1.1.1.2 ! misho 1266: .SS "libnet_ptag_t libnet_build_fddi (uint8_tfc, const uint8_t *dst, const uint8_t *src, uint8_tdsap, uint8_tssap, uint8_tcf, const uint8_t *oui, uint16_ttype, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Builds a Fiber Distributed Data Interface (FDDI) header.
1.1 misho 1267: .PP
1268: \fBParameters:\fP
1269: .RS 4
1.1.1.2 ! misho 1270: \fIfc\fP class format and priority
! 1271: .br
! 1272: \fIdst\fP destination fddi address
! 1273: .br
! 1274: \fIsrc\fP source fddi address
1.1 misho 1275: .br
1276: \fIdsap\fP destination service access point
1277: .br
1278: \fIssap\fP source service access point
1279: .br
1280: \fIcf\fP cf
1281: .br
1.1.1.2 ! misho 1282: \fIoui\fP 3 byte IEEE organizational code
1.1 misho 1283: .br
1284: \fItype\fP upper layer protocol
1285: .br
1286: \fIpayload\fP optional payload or NULL
1287: .br
1288: \fIpayload_s\fP payload length or 0
1289: .br
1290: \fIl\fP pointer to a libnet context
1291: .br
1292: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1293: .RE
1294: .PP
1295: \fBReturns:\fP
1296: .RS 4
1297: protocol tag value on success, -1 on error
1298: .RE
1299: .PP
1300:
1.1.1.2 ! misho 1301: .SS "libnet_ptag_t libnet_build_gre (uint16_tfv, uint16_ttype, uint16_tsum, uint16_toffset, uint32_tkey, uint32_tseq, uint16_tlen, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Generic Routing Encapsulation (GRE - RFC 1701) is used to encapsulate any protocol. Hence, the IP part of the packet is usually referred as 'delivery
! 1302: 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.
1.1 misho 1303: .PP
1304: \fBParameters:\fP
1305: .RS 4
1306: \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.
1307: .br
1308: \fItype\fP which protocol is encapsulated (PPP, IP, ...)
1309: .br
1310: \fIsum\fP checksum (0 for libnet to autofill).
1311: .br
1312: \fIoffset\fP byte offset from the start of the routing field to the first byte of the SRE
1313: .br
1314: \fIkey\fP inserted by the encapsulator to authenticate the source
1315: .br
1316: \fIseq\fP sequence number used by the receiver to sort the packets
1317: .br
1318: \fIlen\fP size of the GRE packet
1319: .br
1.1.1.2 ! misho 1320: \fIpayload\fP
! 1321: .br
1.1 misho 1322: \fIpayload_s\fP payload length or 0
1323: .br
1324: \fIl\fP pointer to a libnet context
1325: .br
1326: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1327: .RE
1328: .PP
1329: \fBReturns:\fP
1330: .RS 4
1331: protocol tag value on success, -1 on error
1332: .RE
1333: .PP
1334:
1.1.1.2 ! misho 1335: .SS "libnet_ptag_t libnet_build_gre_last_sre (libnet_t *l, libnet_ptag_tptag)"\fBParameters:\fP
! 1336: .RS 4
! 1337: \fIl\fP pointer to a libnet context
! 1338: .br
! 1339: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
! 1340: .RE
1.1 misho 1341: .PP
1.1.1.2 ! misho 1342: \fBReturns:\fP
1.1 misho 1343: .RS 4
1.1.1.2 ! misho 1344: protocol tag value on success, -1 on error
! 1345: .RE
! 1346: .PP
! 1347:
! 1348: .SS "libnet_ptag_t libnet_build_gre_sre (uint16_taf, uint8_toffset, uint8_tlength, uint8_t *routing, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"\fBParameters:\fP
! 1349: .RS 4
! 1350: \fIaf\fP
! 1351: .br
! 1352: \fIoffset\fP
! 1353: .br
! 1354: \fIlength\fP
! 1355: .br
! 1356: \fIrouting\fP
! 1357: .br
1.1 misho 1358: \fIpayload\fP optional payload or NULL
1359: .br
1360: \fIpayload_s\fP payload length or 0
1361: .br
1362: \fIl\fP pointer to a libnet context
1363: .br
1364: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1365: .RE
1366: .PP
1367: \fBReturns:\fP
1368: .RS 4
1369: protocol tag value on success, -1 on error
1370: .RE
1371: .PP
1372:
1.1.1.2 ! misho 1373: .SS "libnet_ptag_t libnet_build_hsrp (uint8_tversion, uint8_topcode, uint8_tstate, uint8_thello_time, uint8_thold_time, uint8_tpriority, uint8_tgroup, uint8_treserved, uint8_tauthdata[HSRP_AUTHDATA_LENGTH], uint32_tvirtual_ip, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Builds a HSRP header. HSRP is a Cisco propietary protocol defined in RFC 2281
1.1 misho 1374: .PP
1375: \fBParameters:\fP
1376: .RS 4
1.1.1.2 ! misho 1377: \fIversion\fP version of the HSRP messages
! 1378: .br
! 1379: \fIopcode\fP type of message
! 1380: .br
! 1381: \fIstate\fP current state of the router
! 1382: .br
! 1383: \fIhello_time\fP period in seconds between hello messages
! 1384: .br
! 1385: \fIhold_time\fP seconds that the current hello message is valid
! 1386: .br
! 1387: \fIpriority\fP priority for the election proccess
! 1388: .br
! 1389: \fIgroup\fP standby group
! 1390: .br
! 1391: \fIreserved\fP reserved field
! 1392: .br
! 1393: \fIauthdata\fP password
! 1394: .br
! 1395: \fIvirtual_ip\fP virtual ip address
! 1396: .br
1.1 misho 1397: \fIpayload\fP optional payload or NULL
1398: .br
1399: \fIpayload_s\fP payload length or 0
1400: .br
1401: \fIl\fP pointer to a libnet context
1402: .br
1403: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1404: .RE
1405: .PP
1406: \fBReturns:\fP
1407: .RS 4
1408: protocol tag value on success, -1 on error
1409: .RE
1410: .PP
1411:
1.1.1.2 ! misho 1412: .SS "libnet_ptag_t libnet_build_icmpv4_echo (uint8_ttype, uint8_tcode, uint16_tsum, uint16_tid, uint16_tseq, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) echo request/reply header
1.1 misho 1413: .PP
1414: \fBParameters:\fP
1415: .RS 4
1416: \fItype\fP type of ICMP packet (should be ICMP_ECHOREPLY or ICMP_ECHO)
1417: .br
1418: \fIcode\fP code of ICMP packet (should be 0)
1419: .br
1420: \fIsum\fP checksum (0 for libnet to autofill)
1421: .br
1422: \fIid\fP identification number
1423: .br
1424: \fIseq\fP packet sequence number
1425: .br
1426: \fIpayload\fP optional payload or NULL
1427: .br
1428: \fIpayload_s\fP payload length or 0
1429: .br
1430: \fIl\fP pointer to a libnet context
1431: .br
1432: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1433: .RE
1434: .PP
1435: \fBReturns:\fP
1436: .RS 4
1437: protocol tag value on success, -1 on error
1438: .RE
1439: .PP
1440:
1.1.1.2 ! misho 1441: .SS "libnet_ptag_t libnet_build_icmpv4_mask (uint8_ttype, uint8_tcode, uint16_tsum, uint16_tid, uint16_tseq, uint32_tmask, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) IP netmask request/reply header.
1.1 misho 1442: .PP
1443: \fBParameters:\fP
1444: .RS 4
1445: \fItype\fP type of ICMP packet (should be ICMP_MASKREQ or ICMP_MASKREPLY)
1446: .br
1447: \fIcode\fP code of ICMP packet (should be 0)
1448: .br
1449: \fIsum\fP checksum (0 for libnet to autofill)
1450: .br
1451: \fIid\fP identification number
1452: .br
1453: \fIseq\fP packet sequence number
1454: .br
1455: \fImask\fP subnet mask
1456: .br
1457: \fIpayload\fP optional payload or NULL
1458: .br
1459: \fIpayload_s\fP payload length or 0
1460: .br
1461: \fIl\fP pointer to a libnet context
1462: .br
1463: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1464: .RE
1465: .PP
1466: \fBReturns:\fP
1467: .RS 4
1468: protocol tag value on success, -1 on error
1469: .RE
1470: .PP
1471:
1.1.1.2 ! misho 1472: .SS "libnet_ptag_t libnet_build_icmpv4_redirect (uint8_ttype, uint8_tcode, uint16_tsum, uint32_tgateway, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"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.
1.1 misho 1473: .PP
1474: \fBParameters:\fP
1475: .RS 4
1476: \fItype\fP type of ICMP packet (should be ICMP_REDIRECT)
1477: .br
1478: \fIcode\fP code of ICMP packet (should be one of the four redirect codes)
1479: .br
1480: \fIsum\fP checksum (0 for libnet to autofill)
1481: .br
1.1.1.2 ! misho 1482: \fIgateway\fP
1.1 misho 1483: .br
1484: \fIpayload\fP optional payload or NULL
1485: .br
1486: \fIpayload_s\fP payload length or 0
1487: .br
1488: \fIl\fP pointer to a libnet context
1489: .br
1490: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1491: .RE
1492: .PP
1493: \fBReturns:\fP
1494: .RS 4
1495: protocol tag value on success, -1 on error
1496: .RE
1497: .PP
1498:
1.1.1.2 ! misho 1499: .SS "libnet_ptag_t libnet_build_icmpv4_timeexceed (uint8_ttype, uint8_tcode, uint16_tsum, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"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.
1.1 misho 1500: .PP
1501: \fBParameters:\fP
1502: .RS 4
1503: \fItype\fP type of ICMP packet (should be ICMP_TIMXCEED)
1504: .br
1505: \fIcode\fP code of ICMP packet (ICMP_TIMXCEED_INTRANS / ICMP_TIMXCEED_REASS)
1506: .br
1507: \fIsum\fP checksum (0 for libnet to autofill)
1508: .br
1509: \fIpayload\fP optional payload or NULL
1510: .br
1511: \fIpayload\fP optional payload or NULL
1512: .br
1513: \fIpayload_s\fP payload length or 0
1514: .br
1515: \fIl\fP pointer to a libnet context
1516: .br
1517: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1518: .RE
1519: .PP
1520: \fBReturns:\fP
1521: .RS 4
1522: protocol tag value on success, -1 on error
1523: .RE
1524: .PP
1525:
1.1.1.2 ! misho 1526: .SS "libnet_ptag_t libnet_build_icmpv4_timestamp (uint8_ttype, uint8_tcode, uint16_tsum, uint16_tid, uint16_tseq, uint32_totime, uint32_trtime, uint32_tttime, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) timestamp request/reply header.
1.1 misho 1527: .PP
1528: \fBParameters:\fP
1529: .RS 4
1530: \fItype\fP type of ICMP packet (should be ICMP_TSTAMP or ICMP_TSTAMPREPLY)
1531: .br
1532: \fIcode\fP code of ICMP packet (should be 0)
1533: .br
1534: \fIsum\fP checksum (0 for libnet to autofill)
1535: .br
1536: \fIid\fP identification number
1537: .br
1538: \fIseq\fP sequence number
1539: .br
1540: \fIotime\fP originate timestamp
1541: .br
1542: \fIrtime\fP receive timestamp
1543: .br
1544: \fIttime\fP transmit timestamp
1545: .br
1546: \fIpayload\fP optional payload or NULL
1547: .br
1548: \fIpayload_s\fP payload length or 0
1549: .br
1550: \fIl\fP pointer to a libnet context
1551: .br
1552: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1553: .RE
1554: .PP
1555: \fBReturns:\fP
1556: .RS 4
1557: protocol tag value on success, -1 on error
1558: .RE
1559: .PP
1560:
1.1.1.2 ! misho 1561: .SS "libnet_ptag_t libnet_build_icmpv4_unreach (uint8_ttype, uint8_tcode, uint16_tsum, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"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.
1.1 misho 1562: .PP
1563: \fBParameters:\fP
1564: .RS 4
1565: \fItype\fP type of ICMP packet (should be ICMP_UNREACH)
1566: .br
1567: \fIcode\fP code of ICMP packet (should be one of the 16 unreachable codes)
1568: .br
1569: \fIsum\fP checksum (0 for libnet to autofill)
1570: .br
1.1.1.2 ! misho 1571: \fIpayload\fP optional payload or NULL
! 1572: .br
! 1573: \fIpayload_s\fP payload length or 0
1.1 misho 1574: .br
1.1.1.2 ! misho 1575: \fIl\fP pointer to a libnet context
1.1 misho 1576: .br
1.1.1.2 ! misho 1577: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
! 1578: .RE
! 1579: .PP
! 1580: \fBReturns:\fP
! 1581: .RS 4
! 1582: protocol tag value on success, -1 on error
! 1583: .RE
! 1584: .PP
! 1585:
! 1586: .SS "libnet_ptag_t libnet_build_icmpv6_echo (uint8_ttype, uint8_tcode, uint16_tsum, uint16_tid, uint16_tseq, uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Builds an IP version 6 RFC 4443 Internet Control Message Protocol (ICMP) echo or echo reply header.
! 1587: .PP
! 1588: \fBParameters:\fP
! 1589: .RS 4
! 1590: \fItype\fP type of ICMP packet (should be ICMP6_ECHO_REQUEST or ICMP6_ECHO_REPLY)
1.1 misho 1591: .br
1.1.1.2 ! misho 1592: \fIcode\fP code of ICMP packet (should be zero)
1.1 misho 1593: .br
1.1.1.2 ! misho 1594: \fIsum\fP checksum (0 for libnet to autofill)
1.1 misho 1595: .br
1.1.1.2 ! misho 1596: \fIid\fP echo id number
1.1 misho 1597: .br
1.1.1.2 ! misho 1598: \fIseq\fP echo sequence number
1.1 misho 1599: .br
1600: \fIpayload\fP optional payload or NULL
1601: .br
1602: \fIpayload_s\fP payload length or 0
1603: .br
1604: \fIl\fP pointer to a libnet context
1605: .br
1606: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1607: .RE
1608: .PP
1609: \fBReturns:\fP
1610: .RS 4
1611: protocol tag value on success, -1 on error
1612: .RE
1613: .PP
1614:
1.1.1.2 ! misho 1615: .SS "libnet_ptag_t libnet_build_icmpv6_ndp_nadv (uint8_ttype, uint8_tcode, uint16_tsum, uint32_tflags, struct libnet_in6_addrtarget, uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"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.
! 1616: .PP
! 1617: \fBParameters:\fP
! 1618: .RS 4
! 1619: \fItype\fP type of ICMP packet (should be ND_NEIGHBOR_ADVERT)
! 1620: .br
! 1621: \fIcode\fP code of ICMP packet (should be zero)
! 1622: .br
! 1623: \fIsum\fP checksum (0 for libnet to autofill)
! 1624: .br
! 1625: \fIflags\fP should be a bitwise or of any applicable ND_NA_FLAG_* flags
! 1626: .br
! 1627: \fItarget\fP target ipv6 address
! 1628: .br
! 1629: \fIpayload\fP optional payload or NULL
! 1630: .br
! 1631: \fIpayload_s\fP payload length or 0
! 1632: .br
! 1633: \fIl\fP pointer to a libnet context
! 1634: .br
! 1635: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
! 1636: .RE
! 1637: .PP
! 1638: \fBReturns:\fP
! 1639: .RS 4
! 1640: protocol tag value on success, -1 on error
! 1641: .RE
1.1 misho 1642: .PP
1.1.1.2 ! misho 1643:
! 1644: .SS "libnet_ptag_t libnet_build_icmpv6_ndp_nsol (uint8_ttype, uint8_tcode, uint16_tsum, struct libnet_in6_addrtarget, uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"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.
1.1 misho 1645: .PP
1646: \fBParameters:\fP
1647: .RS 4
1.1.1.2 ! misho 1648: \fItype\fP type of ICMP packet (should be ND_NEIGHBOR_SOLICIT)
1.1 misho 1649: .br
1.1.1.2 ! misho 1650: \fIcode\fP code of ICMP packet (should be zero)
1.1 misho 1651: .br
1652: \fIsum\fP checksum (0 for libnet to autofill)
1653: .br
1.1.1.2 ! misho 1654: \fItarget\fP target ipv6 address
1.1 misho 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, -1 on error
1668: .RE
1669: .PP
1670:
1.1.1.2 ! misho 1671: .SS "libnet_ptag_t libnet_build_icmpv6_ndp_opt (uint8_ttype, uint8_t *option, uint32_toption_s, libnet_t *l, libnet_ptag_tptag)"Builds ICMPv6 NDP options.
1.1 misho 1672: .PP
1.1.1.2 ! misho 1673: \fBParameters:\fP
! 1674: .RS 4
! 1675: \fItype\fP one of ND_OPT_* types
! 1676: .br
! 1677: \fIoption\fP option data
! 1678: .br
! 1679: \fIoption_s\fP size of option data (will be padded out to an 8-byte boundary)
! 1680: .br
! 1681: \fIl\fP pointer to a libnet context
! 1682: .br
! 1683: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
! 1684: .RE
! 1685: .PP
! 1686: \fBReturns:\fP
! 1687: .RS 4
! 1688: protocol tag value on success, -1 on error
! 1689: .RE
! 1690: .PP
! 1691:
! 1692: .SS "libnet_ptag_t libnet_build_icmpv6_unreach (uint8_ttype, uint8_tcode, uint16_tsum, uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"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.
! 1693: .PP
! 1694: \fBParameters:\fP
! 1695: .RS 4
! 1696: \fItype\fP type of ICMP packet (should be ICMP6_DST_UNREACH)
! 1697: .br
! 1698: \fIcode\fP code of ICMP packet (should be one of the 5 ICMP6_DST_UNREACH_* codes)
! 1699: .br
! 1700: \fIsum\fP checksum (0 for libnet to autofill)
! 1701: .br
! 1702: \fIpayload\fP optional payload or NULL
! 1703: .br
! 1704: \fIpayload_s\fP payload length or 0
! 1705: .br
! 1706: \fIl\fP pointer to a libnet context
! 1707: .br
! 1708: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
! 1709: .RE
! 1710: .PP
! 1711: \fBReturns:\fP
! 1712: .RS 4
! 1713: protocol tag value on success, -1 on error
! 1714: .RE
! 1715: .PP
! 1716:
! 1717: .SS "libnet_ptag_t libnet_build_igmp (uint8_ttype, uint8_treserved, uint16_tsum, uint32_tip, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Builds an RFC 1112 Internet Group Memebership Protocol (IGMP) header.
! 1718: .PP
! 1719: \fBParameters:\fP
! 1720: .RS 4
! 1721: \fItype\fP packet type
! 1722: .br
! 1723: \fIreserved\fP (should be 0 for IGMPv1)
! 1724: .br
! 1725: \fIsum\fP checksum (0 for libnet to autofill)
! 1726: .br
! 1727: \fIip\fP IPv4 address (in standard/network byte order)
! 1728: .br
! 1729: \fIpayload\fP optional payload or NULL
! 1730: .br
! 1731: \fIpayload_s\fP payload length or 0
! 1732: .br
! 1733: \fIl\fP pointer to a libnet context
! 1734: .br
! 1735: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
! 1736: .RE
! 1737: .PP
! 1738: \fBReturns:\fP
! 1739: .RS 4
! 1740: protocol tag value on success, -1 on error
! 1741: .RE
! 1742: .PP
! 1743: \fBNote:\fP
! 1744: .RS 4
! 1745: 'reserved' was previously called 'code', which it is not, in any IGMP version.
! 1746: .RE
! 1747: .PP
! 1748:
! 1749: .SS "libnet_ptag_t libnet_build_ipsec_ah (uint8_tnh, uint8_tlen, uint16_tres, uint32_tspi, uint32_tseq, uint32_tauth, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Builds an Internet Protocol Security Authentication header.
1.1 misho 1750: .PP
1751: \fBParameters:\fP
1752: .RS 4
1753: \fInh\fP next header
1754: .br
1755: \fIlen\fP payload length
1756: .br
1757: \fIres\fP reserved
1758: .br
1759: \fIspi\fP security parameter index
1760: .br
1761: \fIseq\fP sequence number
1762: .br
1763: \fIauth\fP authentication data
1764: .br
1765: \fIpayload\fP optional payload or NULL
1766: .br
1767: \fIpayload_s\fP payload length or 0
1768: .br
1769: \fIl\fP pointer to a libnet context
1770: .br
1771: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1772: .RE
1773: .PP
1774: \fBReturns:\fP
1775: .RS 4
1776: protocol tag value on success, -1 on error
1777: .RE
1778: .PP
1779:
1.1.1.2 ! misho 1780: .SS "libnet_ptag_t libnet_build_ipsec_esp_ftr (uint8_tlen, uint8_tnh, int8_t *auth, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Builds an Internet Protocol Security Encapsulating Security Payload footer.
1.1 misho 1781: .PP
1782: \fBParameters:\fP
1783: .RS 4
1784: \fIlen\fP padding length
1785: .br
1786: \fInh\fP next header
1787: .br
1788: \fIauth\fP authentication data
1789: .br
1790: \fIpayload\fP optional payload or NULL
1791: .br
1792: \fIpayload_s\fP payload length or 0
1793: .br
1794: \fIl\fP pointer to a libnet context
1795: .br
1796: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1797: .RE
1798: .PP
1799: \fBReturns:\fP
1800: .RS 4
1801: protocol tag value on success, -1 on error
1802: .RE
1803: .PP
1804:
1.1.1.2 ! misho 1805: .SS "libnet_ptag_t libnet_build_ipsec_esp_hdr (uint32_tspi, uint32_tseq, uint32_tiv, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Builds an Internet Protocol Security Encapsulating Security Payload header.
1.1 misho 1806: .PP
1807: \fBParameters:\fP
1808: .RS 4
1809: \fIspi\fP security parameter index
1810: .br
1811: \fIseq\fP ESP sequence number
1812: .br
1813: \fIiv\fP initialization vector
1814: .br
1815: \fIpayload\fP optional payload or NULL
1816: .br
1817: \fIpayload_s\fP payload length or 0
1818: .br
1819: \fIl\fP pointer to a libnet context
1820: .br
1821: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1822: .RE
1823: .PP
1824: \fBReturns:\fP
1825: .RS 4
1826: protocol tag value on success, -1 on error
1827: .RE
1828: .PP
1829:
1.1.1.2 ! misho 1830: .SS "libnet_ptag_t libnet_build_ipv4 (uint16_tip_len, uint8_ttos, uint16_tid, uint16_tfrag, uint8_tttl, uint8_tprot, uint16_tsum, uint32_tsrc, uint32_tdst, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Builds a version 4 RFC 791 Internet Protocol (IP) header.
1.1 misho 1831: .PP
1832: \fBParameters:\fP
1833: .RS 4
1.1.1.2 ! misho 1834: \fIip_len\fP total length of the IP packet including all subsequent data (subsequent data includes any IP options and IP options padding)
1.1 misho 1835: .br
1836: \fItos\fP type of service bits
1837: .br
1838: \fIid\fP IP identification number
1839: .br
1840: \fIfrag\fP fragmentation bits and offset
1841: .br
1842: \fIttl\fP time to live in the network
1843: .br
1844: \fIprot\fP upper layer protocol
1845: .br
1846: \fIsum\fP checksum (0 for libnet to autofill)
1847: .br
1848: \fIsrc\fP source IPv4 address (little endian)
1849: .br
1850: \fIdst\fP destination IPv4 address (little endian)
1851: .br
1852: \fIpayload\fP optional payload or NULL
1853: .br
1854: \fIpayload_s\fP payload length or 0
1855: .br
1856: \fIl\fP pointer to a libnet context
1857: .br
1858: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1859: .RE
1860: .PP
1861: \fBReturns:\fP
1862: .RS 4
1863: protocol tag value on success, -1 on error
1864: .RE
1865: .PP
1866:
1.1.1.2 ! misho 1867: .SS "libnet_ptag_t libnet_build_ipv4_options (const uint8_t *options, uint32_toptions_s, libnet_t *l, libnet_ptag_tptag)"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).
1.1 misho 1868: .PP
1.1.1.2 ! misho 1869: When building a chain, the options must be built, then the IPv4 header.
! 1870: .PP
! 1871: 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.
1.1 misho 1872: .PP
1873: \fBParameters:\fP
1874: .RS 4
1.1.1.2 ! misho 1875: \fIoptions\fP byte string of IP options (it will be padded up to be an integral multiple of 32-bit words).
1.1 misho 1876: .br
1877: \fIoptions_s\fP length of options string
1878: .br
1879: \fIl\fP pointer to a libnet context
1880: .br
1881: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1882: .RE
1883: .PP
1884: \fBReturns:\fP
1885: .RS 4
1886: protocol tag value on success, -1 on error
1887: .RE
1888: .PP
1889:
1.1.1.2 ! misho 1890: .SS "libnet_ptag_t libnet_build_ipv6 (uint8_ttc, uint32_tfl, uint16_tlen, uint8_tnh, uint8_thl, struct libnet_in6_addrsrc, struct libnet_in6_addrdst, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Builds a version 6 RFC 2460 Internet Protocol (IP) header.
1.1 misho 1891: .PP
1892: \fBParameters:\fP
1893: .RS 4
1894: \fItc\fP traffic class
1895: .br
1896: \fIfl\fP flow label
1897: .br
1898: \fIlen\fP total length of the IP packet
1899: .br
1900: \fInh\fP next header
1901: .br
1902: \fIhl\fP hop limit
1903: .br
1904: \fIsrc\fP source IPv6 address
1905: .br
1906: \fIdst\fP destination IPv6 address
1907: .br
1908: \fIpayload\fP optional payload or NULL
1909: .br
1910: \fIpayload_s\fP payload length or 0
1911: .br
1912: \fIl\fP pointer to a libnet context
1913: .br
1914: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1915: .RE
1916: .PP
1917: \fBReturns:\fP
1918: .RS 4
1919: protocol tag value on success, -1 on error
1920: .RE
1921: .PP
1922:
1.1.1.2 ! misho 1923: .SS "libnet_ptag_t libnet_build_ipv6_destopts (uint8_tnh, uint8_tlen, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"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.
1.1 misho 1924: .PP
1925: \fBParameters:\fP
1926: .RS 4
1927: \fInh\fP next header
1928: .br
1929: \fIlen\fP length of the header in 8-byte octets not including the first 8 octets
1930: .br
1931: \fIpayload\fP options payload
1932: .br
1933: \fIpayload_s\fP payload length
1934: .br
1935: \fIl\fP pointer to a libnet context
1936: .br
1937: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1938: .RE
1939: .PP
1940: \fBReturns:\fP
1941: .RS 4
1942: protocol tag value on success, -1 on error
1943: .RE
1944: .PP
1945:
1.1.1.2 ! misho 1946: .SS "libnet_ptag_t libnet_build_ipv6_frag (uint8_tnh, uint8_treserved, uint16_tfrag, uint32_tid, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Builds a version 6 RFC 2460 Internet Protocol (IP) fragmentation header.
1.1 misho 1947: .PP
1948: \fBParameters:\fP
1949: .RS 4
1950: \fInh\fP next header
1951: .br
1952: \fIreserved\fP unused value... OR IS IT!
1953: .br
1954: \fIfrag\fP fragmentation bits (ala ipv4)
1955: .br
1956: \fIid\fP packet identification
1957: .br
1958: \fIpayload\fP optional payload or NULL
1959: .br
1960: \fIpayload_s\fP payload length or 0
1961: .br
1962: \fIl\fP pointer to a libnet context
1963: .br
1964: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1965: .RE
1966: .PP
1967: \fBReturns:\fP
1968: .RS 4
1969: protocol tag value on success, -1 on error
1970: .RE
1971: .PP
1972:
1.1.1.2 ! misho 1973: .SS "libnet_ptag_t libnet_build_ipv6_hbhopts (uint8_tnh, uint8_tlen, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"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.
1.1 misho 1974: .PP
1975: \fBParameters:\fP
1976: .RS 4
1977: \fInh\fP next header
1978: .br
1979: \fIlen\fP length of the header in 8-byte octets not including the first 8 octets
1980: .br
1981: \fIpayload\fP options payload
1982: .br
1983: \fIpayload_s\fP payload length
1984: .br
1985: \fIl\fP pointer to a libnet context
1986: .br
1987: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
1988: .RE
1989: .PP
1990: \fBReturns:\fP
1991: .RS 4
1992: protocol tag value on success, -1 on error
1993: .RE
1994: .PP
1995:
1.1.1.2 ! misho 1996: .SS "libnet_ptag_t libnet_build_ipv6_routing (uint8_tnh, uint8_tlen, uint8_trtype, uint8_tsegments, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"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.
1.1 misho 1997: .PP
1998: \fBParameters:\fP
1999: .RS 4
2000: \fInh\fP next header
2001: .br
1.1.1.2 ! misho 2002: \fIlen\fP length of the header in 8-byte octets not including the first 8 octets
! 2003: .br
! 2004: \fIrtype\fP routing header type
1.1 misho 2005: .br
2006: \fIsegments\fP number of routing segments that follow
2007: .br
2008: \fIpayload\fP optional payload of routing information
2009: .br
2010: \fIpayload_s\fP payload length
2011: .br
2012: \fIl\fP pointer to a libnet context
2013: .br
2014: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2015: .RE
2016: .PP
2017: \fBReturns:\fP
2018: .RS 4
2019: protocol tag value on success, -1 on error
2020: .RE
2021: .PP
2022:
1.1.1.2 ! misho 2023: .SS "libnet_ptag_t libnet_build_isl (uint8_t *dhost, uint8_ttype, uint8_tuser, uint8_t *shost, uint16_tlen, const uint8_t *snap, uint16_tvid, uint16_tportindex, uint16_treserved, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Builds a Cisco Inter-Switch Link (ISL) header.
1.1 misho 2024: .PP
2025: \fBParameters:\fP
2026: .RS 4
2027: \fIdhost\fP destination address (should be 01:00:0c:00:00)
2028: .br
2029: \fItype\fP type of frame
2030: .br
2031: \fIuser\fP user defined data
2032: .br
2033: \fIshost\fP source mac address
2034: .br
2035: \fIlen\fP total length of the encapuslated packet less 18 bytes
2036: .br
2037: \fIsnap\fP SNAP information (0xaaaa03 + vendor code)
2038: .br
2039: \fIvid\fP 15 bit VLAN ID, 1 bit BPDU or CDP indicator
2040: .br
1.1.1.2 ! misho 2041: \fIportindex\fP port index
1.1 misho 2042: .br
2043: \fIreserved\fP used for FDDI and token ring
2044: .br
2045: \fIpayload\fP optional payload or NULL
2046: .br
2047: \fIpayload_s\fP payload length or 0
2048: .br
2049: \fIl\fP pointer to a libnet context
2050: .br
2051: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2052: .RE
2053: .PP
2054: \fBReturns:\fP
2055: .RS 4
2056: protocol tag value on success, -1 on error
2057: .RE
2058: .PP
2059:
1.1.1.2 ! misho 2060: .SS "libnet_ptag_t libnet_build_link (const uint8_t *dst, const uint8_t *src, const uint8_t *oui, uint16_ttype, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"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.
1.1 misho 2061: .PP
2062: \fBParameters:\fP
2063: .RS 4
2064: \fIdst\fP the destination MAC address
2065: .br
2066: \fIsrc\fP the source MAC address
2067: .br
2068: \fIoui\fP Organizationally Unique Identifier (unused for Ethernet)
2069: .br
2070: \fItype\fP the upper layer protocol type
2071: .br
2072: \fIpayload\fP optional payload or NULL
2073: .br
2074: \fIpayload_s\fP payload length or 0
2075: .br
2076: \fIl\fP pointer to a libnet context
2077: .br
2078: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2079: .RE
2080: .PP
2081: \fBReturns:\fP
2082: .RS 4
2083: protocol tag value on success, -1 on error
2084: .RE
2085: .PP
2086:
1.1.1.2 ! misho 2087: .SS "libnet_ptag_t libnet_build_mpls (uint32_tlabel, uint8_texperimental, uint8_tbos, uint8_tttl, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Builds an RFC 3032 Multi-Protocol Label Switching (MPLS) header.
1.1 misho 2088: .PP
2089: \fBParameters:\fP
2090: .RS 4
2091: \fIlabel\fP 20-bit label value
2092: .br
2093: \fIexperimental\fP 3-bit reserved field
2094: .br
2095: \fIbos\fP 1-bit bottom of stack identifier
2096: .br
2097: \fIttl\fP time to live
2098: .br
2099: \fIpayload\fP optional payload or NULL
2100: .br
2101: \fIpayload_s\fP payload length or 0
2102: .br
2103: \fIl\fP pointer to a libnet context
2104: .br
2105: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2106: .RE
2107: .PP
2108: \fBReturns:\fP
2109: .RS 4
2110: protocol tag value on success, -1 on error
2111: .RE
2112: .PP
2113:
1.1.1.2 ! misho 2114: .SS "libnet_ptag_t libnet_build_ntp (uint8_tleap_indicator, uint8_tversion, uint8_tmode, uint8_tstratum, uint8_tpoll, uint8_tprecision, uint16_tdelay_int, uint16_tdelay_frac, uint16_tdispersion_int, uint16_tdispersion_frac, uint32_treference_id, uint32_tref_ts_int, uint32_tref_ts_frac, uint32_torig_ts_int, uint32_torig_ts_frac, uint32_trec_ts_int, uint32_trec_ts_frac, uint32_txmt_ts_int, uint32_txmt_ts_frac, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Builds an RFC 958 Network Time Protocol (NTP) header.
1.1 misho 2115: .PP
2116: \fBParameters:\fP
2117: .RS 4
2118: \fIleap_indicator\fP the leap indicator
2119: .br
2120: \fIversion\fP NTP protocol version
2121: .br
2122: \fImode\fP NTP mode
2123: .br
2124: \fIstratum\fP stratum
2125: .br
2126: \fIpoll\fP polling interval
2127: .br
2128: \fIprecision\fP precision
2129: .br
1.1.1.2 ! misho 2130: \fIdelay_int\fP delay interval
1.1 misho 2131: .br
2132: \fIdelay_frac\fP delay fraction
2133: .br
2134: \fIdispersion_int\fP dispersion interval
2135: .br
2136: \fIdispersion_frac\fP dispersion fraction
2137: .br
2138: \fIreference_id\fP reference id
2139: .br
2140: \fIref_ts_int\fP reference timestamp integer
2141: .br
2142: \fIref_ts_frac\fP reference timestamp fraction
2143: .br
2144: \fIorig_ts_int\fP original timestamp integer
2145: .br
2146: \fIorig_ts_frac\fP original timestamp fraction
2147: .br
2148: \fIrec_ts_int\fP receiver timestamp integer
2149: .br
2150: \fIrec_ts_frac\fP reciever timestamp fraction
2151: .br
2152: \fIxmt_ts_int\fP transmit timestamp integer
2153: .br
2154: \fIxmt_ts_frac\fP transmit timestamp integer
2155: .br
2156: \fIpayload\fP optional payload or NULL
2157: .br
2158: \fIpayload_s\fP payload length or 0
2159: .br
2160: \fIl\fP pointer to a libnet context
2161: .br
2162: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2163: .RE
2164: .PP
2165: \fBReturns:\fP
2166: .RS 4
2167: protocol tag value on success, -1 on error
2168: .RE
2169: .PP
2170:
1.1.1.2 ! misho 2171: .SS "libnet_ptag_t libnet_build_ospfv2 (uint16_tlen, uint8_ttype, uint32_trtr_id, uint32_tarea_id, uint16_tsum, uint16_tautype, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"\fBParameters:\fP
1.1 misho 2172: .RS 4
1.1.1.2 ! misho 2173: \fIlen\fP
! 2174: .br
! 2175: \fItype\fP
! 2176: .br
! 2177: \fIrtr_id\fP
! 2178: .br
! 2179: \fIarea_id\fP
! 2180: .br
! 2181: \fIsum\fP
! 2182: .br
! 2183: \fIautype\fP
! 2184: .br
1.1 misho 2185: \fIpayload\fP optional payload or NULL
2186: .br
2187: \fIpayload_s\fP payload length or 0
2188: .br
2189: \fIl\fP pointer to a libnet context
2190: .br
2191: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2192: .RE
2193: .PP
2194: \fBReturns:\fP
2195: .RS 4
2196: protocol tag value on success, -1 on error
2197: .RE
2198: .PP
2199:
1.1.1.2 ! misho 2200: .SS "libnet_ptag_t libnet_build_ospfv2_dbd (uint16_tdgram_len, uint8_topts, uint8_ttype, uintseqnum, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"\fBParameters:\fP
1.1 misho 2201: .RS 4
1.1.1.2 ! misho 2202: \fIdgram_len\fP
! 2203: .br
! 2204: \fIopts\fP
! 2205: .br
! 2206: \fItype\fP
! 2207: .br
! 2208: \fIseqnum\fP
! 2209: .br
1.1 misho 2210: \fIpayload\fP optional payload or NULL
2211: .br
2212: \fIpayload_s\fP payload length or 0
2213: .br
2214: \fIl\fP pointer to a libnet context
2215: .br
2216: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2217: .RE
2218: .PP
2219: \fBReturns:\fP
2220: .RS 4
2221: protocol tag value on success, -1 on error
2222: .RE
2223: .PP
2224:
1.1.1.2 ! misho 2225: .SS "libnet_ptag_t libnet_build_ospfv2_hello (uint32_tnetmask, uint16_tinterval, uint8_topts, uint8_tpriority, uintdead_int, uint32_tdes_rtr, uint32_tbkup_rtr, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"\fBParameters:\fP
1.1 misho 2226: .RS 4
1.1.1.2 ! misho 2227: \fInetmask\fP
! 2228: .br
! 2229: \fIinterval\fP
! 2230: .br
! 2231: \fIopts\fP
! 2232: .br
! 2233: \fIpriority\fP
! 2234: .br
! 2235: \fIdead_int\fP
! 2236: .br
! 2237: \fIdes_rtr\fP
! 2238: .br
! 2239: \fIbkup_rtr\fP
! 2240: .br
1.1 misho 2241: \fIpayload\fP optional payload or NULL
2242: .br
2243: \fIpayload_s\fP payload length or 0
2244: .br
2245: \fIl\fP pointer to a libnet context
2246: .br
2247: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2248: .RE
2249: .PP
2250: \fBReturns:\fP
2251: .RS 4
2252: protocol tag value on success, -1 on error
2253: .RE
2254: .PP
2255:
1.1.1.2 ! misho 2256: .SS "libnet_ptag_t libnet_build_ospfv2_lsa (uint16_tage, uint8_topts, uint8_ttype, uintlsid, uint32_tadvrtr, uintseqnum, uint16_tsum, uint16_tlen, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"\fBParameters:\fP
1.1 misho 2257: .RS 4
1.1.1.2 ! misho 2258: \fIage\fP
! 2259: .br
! 2260: \fIopts\fP
! 2261: .br
! 2262: \fItype\fP
! 2263: .br
! 2264: \fIlsid\fP
! 2265: .br
! 2266: \fIadvrtr\fP
! 2267: .br
! 2268: \fIseqnum\fP
! 2269: .br
! 2270: \fIsum\fP
! 2271: .br
! 2272: \fIlen\fP
! 2273: .br
1.1 misho 2274: \fIpayload\fP optional payload or NULL
2275: .br
2276: \fIpayload_s\fP payload length or 0
2277: .br
2278: \fIl\fP pointer to a libnet context
2279: .br
2280: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2281: .RE
2282: .PP
2283: \fBReturns:\fP
2284: .RS 4
2285: protocol tag value on success, -1 on error
2286: .RE
2287: .PP
2288:
1.1.1.2 ! misho 2289: .SS "libnet_ptag_t libnet_build_ospfv2_lsa_as (uint32_tnmask, uintmetric, uint32_tfwdaddr, uinttag, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"\fBParameters:\fP
1.1 misho 2290: .RS 4
1.1.1.2 ! misho 2291: \fInmask\fP
! 2292: .br
! 2293: \fImetric\fP
! 2294: .br
! 2295: \fIfwdaddr\fP
! 2296: .br
! 2297: \fItag\fP
! 2298: .br
1.1 misho 2299: \fIpayload\fP optional payload or NULL
2300: .br
2301: \fIpayload_s\fP payload length or 0
2302: .br
2303: \fIl\fP pointer to a libnet context
2304: .br
2305: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2306: .RE
2307: .PP
2308: \fBReturns:\fP
2309: .RS 4
2310: protocol tag value on success, -1 on error
2311: .RE
2312: .PP
2313:
1.1.1.2 ! misho 2314: .SS "libnet_ptag_t libnet_build_ospfv2_lsa_net (uint32_tnmask, uintrtrid, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"\fBParameters:\fP
1.1 misho 2315: .RS 4
1.1.1.2 ! misho 2316: \fInmask\fP
! 2317: .br
! 2318: \fIrtrid\fP
! 2319: .br
1.1 misho 2320: \fIpayload\fP optional payload or NULL
2321: .br
2322: \fIpayload_s\fP payload length or 0
2323: .br
2324: \fIl\fP pointer to a libnet context
2325: .br
2326: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2327: .RE
2328: .PP
2329: \fBReturns:\fP
2330: .RS 4
2331: protocol tag value on success, -1 on error
2332: .RE
2333: .PP
2334:
1.1.1.2 ! misho 2335: .SS "libnet_ptag_t libnet_build_ospfv2_lsa_rtr (uint16_tflags, uint16_tnum, uintid, uintdata, uint8_ttype, uint8_ttos, uint16_tmetric, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"\fBParameters:\fP
1.1 misho 2336: .RS 4
1.1.1.2 ! misho 2337: \fIflags\fP
! 2338: .br
! 2339: \fInum\fP
! 2340: .br
! 2341: \fIid\fP
! 2342: .br
! 2343: \fIdata\fP
! 2344: .br
! 2345: \fItype\fP
! 2346: .br
! 2347: \fItos\fP
! 2348: .br
! 2349: \fImetric\fP
! 2350: .br
1.1 misho 2351: \fIpayload\fP optional payload or NULL
2352: .br
2353: \fIpayload_s\fP payload length or 0
2354: .br
2355: \fIl\fP pointer to a libnet context
2356: .br
2357: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2358: .RE
2359: .PP
2360: \fBReturns:\fP
2361: .RS 4
2362: protocol tag value on success, -1 on error
2363: .RE
2364: .PP
2365:
1.1.1.2 ! misho 2366: .SS "libnet_ptag_t libnet_build_ospfv2_lsa_sum (uint32_tnmask, uintmetric, uinttos, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"\fBParameters:\fP
1.1 misho 2367: .RS 4
1.1.1.2 ! misho 2368: \fInmask\fP
! 2369: .br
! 2370: \fImetric\fP
! 2371: .br
! 2372: \fItos\fP
! 2373: .br
1.1 misho 2374: \fIpayload\fP optional payload or NULL
2375: .br
2376: \fIpayload_s\fP payload length or 0
2377: .br
2378: \fIl\fP pointer to a libnet context
2379: .br
2380: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2381: .RE
2382: .PP
2383: \fBReturns:\fP
2384: .RS 4
2385: protocol tag value on success, -1 on error
2386: .RE
2387: .PP
2388:
1.1.1.2 ! misho 2389: .SS "libnet_ptag_t libnet_build_ospfv2_lsr (uinttype, uintlsid, uint32_tadvrtr, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"\fBParameters:\fP
1.1 misho 2390: .RS 4
1.1.1.2 ! misho 2391: \fItype\fP
! 2392: .br
! 2393: \fIlsid\fP
! 2394: .br
! 2395: \fIadvrtr\fP
! 2396: .br
1.1 misho 2397: \fIpayload\fP optional payload or NULL
2398: .br
2399: \fIpayload_s\fP payload length or 0
2400: .br
2401: \fIl\fP pointer to a libnet context
2402: .br
2403: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2404: .RE
2405: .PP
2406: \fBReturns:\fP
2407: .RS 4
2408: protocol tag value on success, -1 on error
2409: .RE
2410: .PP
2411:
1.1.1.2 ! misho 2412: .SS "libnet_ptag_t libnet_build_ospfv2_lsu (uintnum, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"\fBParameters:\fP
1.1 misho 2413: .RS 4
1.1.1.2 ! misho 2414: \fInum\fP
! 2415: .br
1.1 misho 2416: \fIpayload\fP optional payload or NULL
2417: .br
2418: \fIpayload_s\fP payload length or 0
2419: .br
2420: \fIl\fP pointer to a libnet context
2421: .br
2422: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2423: .RE
2424: .PP
2425: \fBReturns:\fP
2426: .RS 4
2427: protocol tag value on success, -1 on error
2428: .RE
2429: .PP
2430:
1.1.1.2 ! misho 2431: .SS "libnet_ptag_t libnet_build_rip (uint8_tcmd, uint8_tversion, uint16_trd, uint16_taf, uint16_trt, uint32_taddr, uint32_tmask, uint32_tnext_hop, uint32_tmetric, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Builds a Routing Information Protocol header (RFCs 1058 and 2453).
1.1 misho 2432: .PP
2433: \fBParameters:\fP
2434: .RS 4
2435: \fIcmd\fP command
2436: .br
2437: \fIversion\fP protocol version
2438: .br
2439: \fIrd\fP version one: 0, version two: routing domain
2440: .br
2441: \fIaf\fP address family
2442: .br
2443: \fIrt\fP version one: 0, version two: route tag
2444: .br
2445: \fIaddr\fP IPv4 address
2446: .br
2447: \fImask\fP version one: 0, version two: subnet mask
2448: .br
2449: \fInext_hop\fP version one: 0, version two: next hop address
2450: .br
2451: \fImetric\fP routing metric
2452: .br
2453: \fIpayload\fP optional payload or NULL
2454: .br
2455: \fIpayload_s\fP payload length or 0
2456: .br
2457: \fIl\fP pointer to a libnet context
2458: .br
2459: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2460: .RE
2461: .PP
2462: \fBReturns:\fP
2463: .RS 4
2464: protocol tag value on success, -1 on error
2465: .RE
2466: .PP
2467:
1.1.1.2 ! misho 2468: .SS "libnet_ptag_t libnet_build_rpc_call (uint32_trm, uint32_txid, uint32_tprog_num, uint32_tprog_vers, uint32_tprocedure, uint32_tcflavor, uint32_tclength, uint8_t *cdata, uint32_tvflavor, uint32_tvlength, const uint8_t *vdata, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"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).
1.1 misho 2469: .PP
2470: \fBParameters:\fP
2471: .RS 4
2472: \fIrm\fP record marking indicating the position in a stream, 0 otherwise
2473: .br
2474: \fIxid\fP transaction identifier used to link calls and replies
2475: .br
2476: \fIprog_num\fP remote program specification typically between 0 - 1fffffff
2477: .br
2478: \fIprog_vers\fP remote program version specification
2479: .br
2480: \fIprocedure\fP procedure to be performed by remote program
2481: .br
2482: \fIcflavor\fP authentication credential type
2483: .br
2484: \fIclength\fP credential length (should be 0)
2485: .br
2486: \fIcdata\fP opaque credential data (currently unused)
2487: .br
2488: \fIvflavor\fP authentication verifier type
2489: .br
2490: \fIvlength\fP verifier length (should be 0)
2491: .br
2492: \fIvdata\fP opaque verifier data (currently unused)
2493: .br
2494: \fIpayload\fP optional payload or NULL
2495: .br
2496: \fIpayload_s\fP payload length or 0
2497: .br
2498: \fIl\fP pointer to a libnet context
2499: .br
2500: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2501: .RE
2502: .PP
2503: \fBReturns:\fP
2504: .RS 4
2505: protocol tag value on success, -1 on error
2506: .RE
2507: .PP
2508:
1.1.1.2 ! misho 2509: .SS "libnet_ptag_t libnet_build_sebek (uint32_tmagic, uint16_tversion, uint16_ttype, uint32_tcounter, uint32_ttime_sec, uint32_ttime_usec, uint32_tpid, uint32_tuid, uint32_tfd, uint8_tcmd[SEBEK_CMD_LENGTH], uint32_tlength, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"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.
1.1 misho 2510: .PP
2511: \fBParameters:\fP
2512: .RS 4
2513: \fImagic\fP identify packets that should be hidden
2514: .br
2515: \fIversion\fP protocol version, currently 1
2516: .br
2517: \fItype\fP type of record (read data is type 0, write data is type 1)
2518: .br
2519: \fIcounter\fP PDU counter used to identify when packet are lost
2520: .br
2521: \fItime_sec\fP seconds since EPOCH according to the honeypot
2522: .br
2523: \fItime_usec\fP residual microseconds
2524: .br
2525: \fIpid\fP PID
2526: .br
2527: \fIuid\fP UID
2528: .br
2529: \fIfd\fP FD
2530: .br
1.1.1.2 ! misho 2531: \fIcmd\fP 12 first characters of the command
1.1 misho 2532: .br
2533: \fIlength\fP length in bytes of the PDU's body
2534: .br
2535: \fIpayload\fP optional payload or NULL
2536: .br
2537: \fIpayload_s\fP payload length or 0
2538: .br
2539: \fIl\fP pointer to a libnet context
2540: .br
2541: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2542: .RE
2543: .PP
2544: \fBReturns:\fP
2545: .RS 4
2546: protocol tag value on success, -1 on error
2547: .RE
2548: .PP
2549:
1.1.1.2 ! misho 2550: .SS "libnet_ptag_t libnet_build_stp_conf (uint16_tid, uint8_tversion, uint8_tbpdu_type, uint8_tflags, const uint8_t *root_id, uint32_troot_pc, const uint8_t *bridge_id, uint16_tport_id, uint16_tmessage_age, uint16_tmax_age, uint16_thello_time, uint16_tf_delay, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"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.
1.1 misho 2551: .PP
2552: \fBParameters:\fP
2553: .RS 4
2554: \fIid\fP protocol id
2555: .br
2556: \fIversion\fP protocol version
2557: .br
2558: \fIbpdu_type\fP bridge protocol data unit type
2559: .br
2560: \fIflags\fP flags
2561: .br
2562: \fIroot_id\fP root id
2563: .br
2564: \fIroot_pc\fP root path cost
2565: .br
2566: \fIbridge_id\fP bridge id
2567: .br
2568: \fIport_id\fP port id
2569: .br
2570: \fImessage_age\fP message age
2571: .br
2572: \fImax_age\fP max age
2573: .br
2574: \fIhello_time\fP hello time
2575: .br
2576: \fIf_delay\fP forward delay
2577: .br
2578: \fIpayload\fP optional payload or NULL
2579: .br
2580: \fIpayload_s\fP payload length or 0
2581: .br
2582: \fIl\fP pointer to a libnet context
2583: .br
2584: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2585: .RE
2586: .PP
2587: \fBReturns:\fP
2588: .RS 4
2589: protocol tag value on success, -1 on error
2590: .RE
2591: .PP
2592:
1.1.1.2 ! misho 2593: .SS "libnet_ptag_t libnet_build_stp_tcn (uint16_tid, uint8_tversion, uint8_tbpdu_type, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"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.
1.1 misho 2594: .PP
2595: \fBParameters:\fP
2596: .RS 4
2597: \fIid\fP protocol id
2598: .br
2599: \fIversion\fP protocol version
2600: .br
2601: \fIbpdu_type\fP bridge protocol data unit type
2602: .br
2603: \fIpayload\fP optional payload or NULL
2604: .br
2605: \fIpayload_s\fP payload length or 0
2606: .br
2607: \fIl\fP pointer to a libnet context
2608: .br
2609: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2610: .RE
2611: .PP
2612: \fBReturns:\fP
2613: .RS 4
2614: protocol tag value on success, -1 on error
2615: .RE
2616: .PP
2617:
1.1.1.2 ! misho 2618: .SS "libnet_ptag_t libnet_build_tcp (uint16_tsp, uint16_tdp, uint32_tseq, uint32_tack, uint8_tcontrol, uint16_twin, uint16_tsum, uint16_turg, uint16_tlen, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Builds an RFC 793 Transmission Control Protocol (TCP) header.
1.1 misho 2619: .PP
2620: \fBParameters:\fP
2621: .RS 4
2622: \fIsp\fP source port
2623: .br
2624: \fIdp\fP destination port
2625: .br
2626: \fIseq\fP sequence number
2627: .br
2628: \fIack\fP acknowledgement number
2629: .br
2630: \fIcontrol\fP control flags
2631: .br
2632: \fIwin\fP window size
2633: .br
2634: \fIsum\fP checksum (0 for libnet to autofill)
2635: .br
1.1.1.2 ! misho 2636: \fIurg\fP urgent pointer
! 2637: .br
! 2638: \fIlen\fP total length of the TCP packet (for checksum calculation)
! 2639: .br
! 2640: \fIpayload\fP
1.1 misho 2641: .br
2642: \fIpayload_s\fP payload length or 0
2643: .br
2644: \fIl\fP pointer to a libnet context
2645: .br
2646: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2647: .RE
2648: .PP
2649: \fBReturns:\fP
2650: .RS 4
2651: protocol tag value on success, -1 on error
2652: .RE
2653: .PP
2654:
1.1.1.2 ! misho 2655: .SS "libnet_ptag_t libnet_build_tcp_options (const uint8_t *options, uint32_toptions_s, libnet_t *l, libnet_ptag_tptag)"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.
1.1 misho 2656: .PP
2657: \fBParameters:\fP
2658: .RS 4
2659: \fIoptions\fP byte string of TCP options
2660: .br
2661: \fIoptions_s\fP length of options string
2662: .br
2663: \fIl\fP pointer to a libnet context
2664: .br
2665: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2666: .RE
2667: .PP
2668: \fBReturns:\fP
2669: .RS 4
2670: protocol tag value on success, -1 on error
2671: .RE
2672: .PP
2673:
1.1.1.2 ! misho 2674: .SS "libnet_ptag_t libnet_build_token_ring (uint8_tac, uint8_tfc, const uint8_t *dst, const uint8_t *src, uint8_tdsap, uint8_tssap, uint8_tcf, const uint8_t *oui, uint16_ttype, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Builds a token ring header.
1.1 misho 2675: .PP
2676: \fBParameters:\fP
2677: .RS 4
2678: \fIac\fP access control
2679: .br
2680: \fIfc\fP frame control
2681: .br
2682: \fIdst\fP destination address
2683: .br
2684: \fIsrc\fP source address
2685: .br
2686: \fIdsap\fP destination service access point
2687: .br
2688: \fIssap\fP source service access point
2689: .br
2690: \fIcf\fP control field
2691: .br
2692: \fIoui\fP Organizationally Unique Identifier
2693: .br
2694: \fItype\fP upper layer protocol type
2695: .br
2696: \fIpayload\fP optional payload or NULL
2697: .br
2698: \fIpayload_s\fP payload length or 0
2699: .br
2700: \fIl\fP pointer to a libnet context
2701: .br
2702: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2703: .RE
2704: .PP
2705: \fBReturns:\fP
2706: .RS 4
2707: protocol tag value on success, -1 on error
2708: .RE
2709: .PP
2710:
1.1.1.2 ! misho 2711: .SS "libnet_ptag_t libnet_build_udp (uint16_tsp, uint16_tdp, uint16_tlen, uint16_tsum, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Builds an RFC 768 User Datagram Protocol (UDP) header.
1.1 misho 2712: .PP
2713: \fBParameters:\fP
2714: .RS 4
2715: \fIsp\fP source port
2716: .br
2717: \fIdp\fP destination port
2718: .br
2719: \fIlen\fP total length of the UDP packet
2720: .br
2721: \fIsum\fP checksum (0 for libnet to autofill)
2722: .br
2723: \fIpayload\fP optional payload or NULL
2724: .br
2725: \fIpayload_s\fP payload length or 0
2726: .br
2727: \fIl\fP pointer to a libnet context
2728: .br
2729: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2730: .RE
2731: .PP
2732: \fBReturns:\fP
2733: .RS 4
2734: protocol tag value on success, -1 on error
2735: .RE
2736: .PP
2737:
1.1.1.2 ! misho 2738: .SS "libnet_ptag_t libnet_build_vrrp (uint8_tversion, uint8_ttype, uint8_tvrouter_id, uint8_tpriority, uint8_tip_count, uint8_tauth_type, uint8_tadvert_int, uint16_tsum, const uint8_t *payload, uint32_tpayload_s, libnet_t *l, libnet_ptag_tptag)"Builds an RFC 2338 Virtual Router Redundacy Protool (VRRP) header. Use the payload interface to specify address and autthentication 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.
1.1 misho 2739: .PP
2740: \fBParameters:\fP
2741: .RS 4
2742: \fIversion\fP VRRP version (should be 2)
2743: .br
2744: \fItype\fP VRRP packet type (should be 1 -- ADVERTISEMENT)
2745: .br
2746: \fIvrouter_id\fP virtual router identification
2747: .br
2748: \fIpriority\fP priority (higher numbers indicate higher priority)
2749: .br
2750: \fIip_count\fP number of IPv4 addresses contained in this advertisement
2751: .br
2752: \fIauth_type\fP type of authentication (0, 1, 2 -- see RFC)
2753: .br
2754: \fIadvert_int\fP interval between advertisements
2755: .br
2756: \fIsum\fP checksum (0 for libnet to autofill)
2757: .br
2758: \fIpayload\fP optional payload or NULL
2759: .br
2760: \fIpayload_s\fP payload length or 0
2761: .br
2762: \fIl\fP pointer to a libnet context
2763: .br
2764: \fIptag\fP protocol tag to modify an existing header, 0 to build a new one
2765: .RE
2766: .PP
2767: \fBReturns:\fP
2768: .RS 4
2769: protocol tag value on success, -1 on error
2770: .RE
2771: .PP
2772:
1.1.1.2 ! misho 2773: .SS "void libnet_clear_packet (libnet_t *l)"Clears the current packet referenced and frees all pblocks. Should be called when the programmer want to send a completely new packet of a different type using the same context.
1.1 misho 2774: .PP
2775: \fBParameters:\fP
2776: .RS 4
2777: \fIl\fP pointer to a libnet context
2778: .RE
2779: .PP
2780:
1.1.1.2 ! misho 2781: .SS "int libnet_cq_add (libnet_t *l, char *label)"[Context Queue] Adds a new context to the libnet context queue. If no queue exists, this function will create the queue and add the specified libnet context as the first entry on the list. The functions checks to ensure niether l nor label are NULL, and that label doesn't refer to an existing context already in the queue. Additionally, l should refer to a libnet context previously initialized with a call to \fBlibnet_init()\fP. If the context queue in write locked, this function will fail.
1.1 misho 2782: .PP
2783: \fBParameters:\fP
2784: .RS 4
2785: \fIl\fP pointer to a libnet context
2786: .br
2787: \fIlabel\fP a canonical name given to recognize the new context, no longer than LIBNET_LABEL_SIZE
2788: .RE
2789: .PP
2790: \fBReturns:\fP
2791: .RS 4
2792: 1 on success, -1 on failure
2793: .RE
2794: .PP
2795:
1.1.1.2 ! misho 2796: .SS "void libnet_cq_destroy (void)"[Context Queue] Destroys the entire context queue, calling \fBlibnet_destroy()\fP on each member context.
! 2797: .SS "uint32_t libnet_cq_end_loop (void)"[Context Queue]
! 2798: .SS "libnet_t* libnet_cq_find_by_label (char *label)"[Context Queue] Locates a libnet context from the queue, indexed by a canonical label.
1.1 misho 2799: .PP
2800: \fBParameters:\fP
2801: .RS 4
2802: \fIlabel\fP canonical label of the libnet context to retrieve
2803: .RE
2804: .PP
2805: \fBReturns:\fP
2806: .RS 4
2807: the expected libnet context, NULL on failure
2808: .RE
2809: .PP
2810:
1.1.1.2 ! misho 2811: .SS "const char* libnet_cq_getlabel (libnet_t *l)"[Context Queue] Returns the canonical label associated with the context.
1.1 misho 2812: .PP
2813: \fBParameters:\fP
2814: .RS 4
2815: \fIl\fP pointer to a libnet context
2816: .RE
2817: .PP
2818: \fBReturns:\fP
2819: .RS 4
2820: pointer to the libnet context's label
2821: .RE
2822: .PP
2823:
1.1.1.2 ! misho 2824: .SS "libnet_t* libnet_cq_head (void)"[Context Queue] Intiailizes the interator interface and set a write lock on the entire queue. This function is intended to be called just prior to interating through the entire list of contexts (with the probable intent of inject a series of packets in rapid succession). This function is often used as per the following:
1.1 misho 2825: .PP
2826: for (l = \fBlibnet_cq_head()\fP; \fBlibnet_cq_last()\fP; l = \fBlibnet_cq_next()\fP) { ... }
2827: .PP
2828: 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.
2829: .PP
2830: \fBReturns:\fP
2831: .RS 4
2832: the head of the context queue
2833: .RE
2834: .PP
2835:
1.1.1.2 ! misho 2836: .SS "int libnet_cq_last (void)"[Context Queue] Check whether the iterator is at the last context in the queue.
1.1 misho 2837: .PP
2838: \fBReturns:\fP
2839: .RS 4
2840: 1 if at the end of the context queue, 0 otherwise
2841: .RE
2842: .PP
2843:
1.1.1.2 ! misho 2844: .SS "libnet_t* libnet_cq_next (void)"[Context Queue] Get next context from the context queue.
1.1 misho 2845: .PP
1.1.1.2 ! misho 2846: \fBReturns:\fP
! 2847: .RS 4
! 2848: the next context from the context queue
! 2849: .RE
1.1 misho 2850: .PP
1.1.1.2 ! misho 2851:
! 2852: .SS "libnet_t* libnet_cq_remove (libnet_t *l)"[Context Queue] Removes a specified context from the libnet context queue by specifying the libnet context pointer. Note the function will remove the specified context from the context queue and cleanup internal memory from the queue, it is up to the application programmer to free the returned libnet context with a call to \fBlibnet_destroy()\fP. Also, as it is not necessary to keep the libnet context pointer when initially adding it to the context queue, most application programmers will prefer to refer to entries on the context queue by canonical name and would use \fBlibnet_cq_remove_by_label()\fP. If the context queue is write locked, this function will fail.
1.1 misho 2853: .PP
2854: \fBParameters:\fP
2855: .RS 4
2856: \fIl\fP pointer to a libnet context
2857: .RE
2858: .PP
2859: \fBReturns:\fP
2860: .RS 4
2861: the pointer to the removed libnet context, NULL on failure
2862: .RE
2863: .PP
2864:
1.1.1.2 ! misho 2865: .SS "libnet_t* libnet_cq_remove_by_label (char *label)"[Context Queue] Removes a specified context from the libnet context queue by specifying the canonical name. Note the function will remove the specified context from the context queue and cleanup internal memory from the queue, it is up to the application programmer to free the returned libnet context with a call to \fBlibnet_destroy()\fP. If the context queue is write locked, this function will fail.
1.1 misho 2866: .PP
2867: \fBParameters:\fP
2868: .RS 4
2869: \fIlabel\fP canonical name of the context to remove
2870: .RE
2871: .PP
2872: \fBReturns:\fP
2873: .RS 4
2874: the pointer to the removed libnet context, NULL on failure
2875: .RE
2876: .PP
2877:
1.1.1.2 ! misho 2878: .SS "uint32_t libnet_cq_size (void)"[Context Queue] Function returns the number of libnet contexts that are in the queue.
1.1 misho 2879: .PP
2880: \fBReturns:\fP
2881: .RS 4
2882: the number of libnet contexts currently in the queue
2883: .RE
2884: .PP
2885:
1.1.1.2 ! misho 2886: .SS "void libnet_destroy (libnet_t *l)"Shuts down the libnet session referenced by l. It closes the network interface and frees all internal memory structures associated with l.
1.1 misho 2887: .PP
2888: \fBParameters:\fP
2889: .RS 4
2890: \fIl\fP pointer to a libnet context
2891: .RE
2892: .PP
2893:
1.1.1.2 ! misho 2894: .SS "void libnet_diag_dump_context (libnet_t *l)"[Diagnostic] Prints the contents of the given context.
1.1 misho 2895: .PP
2896: \fBParameters:\fP
2897: .RS 4
2898: \fIl\fP pointer to a libnet context
2899: .RE
2900: .PP
2901:
1.1.1.2 ! misho 2902: .SS "void libnet_diag_dump_hex (const uint8_t *packet, uint32_tlen, intswap, FILE *stream)"[Diagnostic] Function prints the contents of the supplied buffer to the supplied stream pointer. Will swap endianness based disposition of mode variable. Useful to be used in conjunction with the advanced interface and a culled packet.
1.1 misho 2903: .PP
2904: \fBParameters:\fP
2905: .RS 4
2906: \fIpacket\fP the packet to print
2907: .br
2908: \fIlen\fP length of the packet in bytes
2909: .br
1.1.1.2 ! misho 2910: \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).
1.1 misho 2911: .br
2912: \fIstream\fP a stream pointer to print to
2913: .RE
2914: .PP
2915:
1.1.1.2 ! misho 2916: .SS "void libnet_diag_dump_pblock (libnet_t *l)"[Diagnostic] Prints the contents of every pblock.
1.1 misho 2917: .PP
2918: \fBParameters:\fP
2919: .RS 4
2920: \fIl\fP pointer to a libnet context
2921: .RE
2922: .PP
2923:
1.1.1.2 ! misho 2924: .SS "char* libnet_diag_dump_pblock_type (uint8_ttype)"[Diagnostic] Returns the canonical name of the pblock type.
1.1 misho 2925: .PP
2926: \fBParameters:\fP
2927: .RS 4
2928: \fItype\fP pblock type
2929: .RE
2930: .PP
2931: \fBReturns:\fP
2932: .RS 4
2933: a string representing the pblock type type or 'unknown' for an unknown value
2934: .RE
2935: .PP
2936:
1.1.1.2 ! misho 2937: .SS "struct libnet_ether_addr* libnet_get_hwaddr (libnet_t *l)\fC [read]\fP"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.
1.1 misho 2938: .PP
2939: \fBParameters:\fP
2940: .RS 4
2941: \fIl\fP pointer to a libnet context
2942: .RE
2943: .PP
2944: \fBReturns:\fP
2945: .RS 4
2946: a pointer to the MAC address or NULL
2947: .RE
2948: .PP
2949:
1.1.1.2 ! misho 2950: .SS "uint32_t libnet_get_ipaddr4 (libnet_t *l)"Returns the IP address for the device libnet was initialized with. If libnet was initialized without a device (in raw socket mode) the function will attempt to find one. If the function fails and returns -1 a call to libnet_geterrror() will tell you why.
1.1 misho 2951: .PP
2952: \fBParameters:\fP
2953: .RS 4
2954: \fIl\fP pointer to a libnet context
2955: .RE
2956: .PP
2957: \fBReturns:\fP
2958: .RS 4
2959: a big endian IP address suitable for use in a libnet_build function or -1
2960: .RE
2961: .PP
2962:
1.1.1.2 ! misho 2963: .SS "struct libnet_in6_addr libnet_get_ipaddr6 (libnet_t *l)\fC [read]\fP"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.
1.1 misho 2964: .PP
2965: \fBParameters:\fP
2966: .RS 4
2967: \fIl\fP pointer to a libnet context
2968: .RE
2969: .PP
2970: \fBReturns:\fP
2971: .RS 4
2972: well, nothing yet
2973: .RE
2974: .PP
2975:
1.1.1.2 ! misho 2976: .SS "uint32_t libnet_get_prand (intmod)"Generates an unsigned psuedo-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
1.1 misho 2977: .PP
2978: \fBParameters:\fP
2979: .RS 4
2980: \fImod\fP one the of LIBNET_PR* constants
2981: .RE
2982: .PP
2983: \fBReturns:\fP
2984: .RS 4
2985: 1 on success, -1 on failure
2986: .RE
2987: .PP
2988:
1.1.1.2 ! misho 2989: .SS "const char* libnet_getdevice (libnet_t *l)"Returns the canonical name of the device used for packet injection.
1.1 misho 2990: .PP
2991: \fBParameters:\fP
2992: .RS 4
2993: \fIl\fP pointer to a libnet context
2994: .RE
2995: .PP
2996: \fBReturns:\fP
2997: .RS 4
2998: the canonical name of the device used for packet injection. Note it can be NULL without being an error.
2999: .RE
3000: .PP
3001:
1.1.1.2 ! misho 3002: .SS "char* libnet_geterror (libnet_t *l)"Returns the last error set inside of the referenced libnet context. This function should be called anytime a function fails or an error condition is detected inside of libnet.
1.1 misho 3003: .PP
3004: \fBParameters:\fP
3005: .RS 4
3006: \fIl\fP pointer to a libnet context
3007: .RE
3008: .PP
3009: \fBReturns:\fP
3010: .RS 4
3011: an error string or NULL if no error has occured
3012: .RE
3013: .PP
3014:
1.1.1.2 ! misho 3015: .SS "int libnet_getfd (libnet_t *l)"Returns the FILENO of the file descriptor used for packet injection.
1.1 misho 3016: .PP
3017: \fBParameters:\fP
3018: .RS 4
3019: \fIl\fP pointer to a libnet context
3020: .RE
3021: .PP
3022: \fBReturns:\fP
3023: .RS 4
3024: the file number of the file descriptor used for packet injection
3025: .RE
3026: .PP
3027:
1.1.1.2 ! misho 3028: .SS "uint32_t libnet_getgre_length (uint16_tfv)"\fBParameters:\fP
1.1 misho 3029: .RS 4
1.1.1.2 ! misho 3030: \fIfv\fP see \fBlibnet_build_gre()\fP.
1.1 misho 3031: .RE
3032: .PP
3033: \fBReturns:\fP
3034: .RS 4
1.1.1.2 ! misho 3035: size, see \fBlibnet_build_gre()\fP.
1.1 misho 3036: .RE
3037: .PP
3038:
1.1.1.2 ! misho 3039: .SS "uint32_t libnet_getpacket_size (libnet_t *l)"Returns the sum of the size of all of the pblocks inside of l (this should be the resuling packet size).
1.1 misho 3040: .PP
3041: \fBParameters:\fP
3042: .RS 4
3043: \fIl\fP pointer to a libnet context
3044: .RE
3045: .PP
3046: \fBReturns:\fP
3047: .RS 4
3048: the size of the packet in l
3049: .RE
3050: .PP
3051:
1.1.1.2 ! misho 3052: .SS "uint8_t* libnet_getpbuf (libnet_t *l, libnet_ptag_tptag)"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.
1.1 misho 3053: .PP
3054: \fBParameters:\fP
3055: .RS 4
3056: \fIl\fP pointer to a libnet context
3057: .br
3058: \fIptag\fP the ptag reference number
3059: .RE
3060: .PP
3061: \fBReturns:\fP
3062: .RS 4
3063: a pointer to the pblock buffer or NULL on error
3064: .RE
3065: .PP
3066:
1.1.1.2 ! misho 3067: .SS "uint32_t libnet_getpbuf_size (libnet_t *l, libnet_ptag_tptag)"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.
1.1 misho 3068: .PP
3069: \fBParameters:\fP
3070: .RS 4
3071: \fIl\fP pointer to a libnet context
3072: .br
3073: \fIptag\fP the ptag reference number
3074: .RE
3075: .PP
3076: \fBReturns:\fP
3077: .RS 4
3078: the size of the pblock buffer
3079: .RE
3080: .PP
3081:
1.1.1.2 ! misho 3082: .SS "uint8_t* libnet_hex_aton (const char *s, int *len)"Takes a colon separated hexidecimal address (from the command line) and returns a bytestring suitable for use in a libnet_build function. Note this function performs an implicit malloc and the return value should be freed after its use.
1.1 misho 3083: .PP
3084: \fBParameters:\fP
3085: .RS 4
3086: \fIs\fP the string to be parsed
3087: .br
3088: \fIlen\fP the resulting size of the returned byte string
3089: .RE
3090: .PP
3091: \fBReturns:\fP
3092: .RS 4
3093: a byte string or NULL on failure
3094: .RE
3095: .PP
3096:
1.1.1.2 ! misho 3097: .SS "int libnet_in6_is_error (struct libnet_in6_addraddr)"Check a libnet_in6_addr structure for identity with in6addr_error.
1.1 misho 3098: .PP
1.1.1.2 ! misho 3099: \fBParameters:\fP
! 3100: .RS 4
! 3101: \fIaddr\fP address to check
! 3102: .RE
! 3103: .PP
! 3104: \fBReturns:\fP
! 3105: .RS 4
! 3106: 1 if addr is in6addr_error, 0 if it is not
! 3107: .RE
! 3108: .PP
! 3109:
! 3110: .SS "libnet_t* libnet_init (intinjection_type, const char *device, char *err_buf)"Creates the libnet environment. It initializes the library and returns a libnet context. If the injection_type is LIBNET_LINK or LIBNET_LINK_ADV, the function initializes the injection primitives for the link-layer interface enabling the application programmer to build packets starting at the data-link layer (which also provides more granular control over the IP layer). If libnet uses the link-layer and the device argument is non-NULL, the function attempts to use the specified network device for packet injection. This is either a canonical string that references the device (such as 'eth0' for a 100MB Ethernet card on Linux or 'fxp0' for a 100MB Ethernet card on OpenBSD) or the dots and decimals representation of the device's IP address (192.168.0.1). If device is NULL, libnet attempts to find a suitable device to use. If the injection_type is LIBNET_RAW4 or LIBNET_RAW4_ADV, the function initializes the injection primitives for the IPv4 raw socket interface. The final argument, err_buf, should be a buffer of size LIBNET_ERRBUF_SIZE and holds an error message if the function fails. This function requires root privileges to execute successfully. Upon success, the function returns a valid libnet context for use in later function calls; upon failure, the function returns NULL.
1.1 misho 3111: .PP
3112: \fBParameters:\fP
3113: .RS 4
3114: \fIinjection_type\fP packet injection type (LIBNET_LINK, LIBNET_LINK_ADV, LIBNET_RAW4, LIBNET_RAW4_ADV, LIBNET_RAW6, LIBNET_RAW6_ADV)
3115: .br
3116: \fIdevice\fP the interface to use (NULL and libnet will choose one)
3117: .br
3118: \fIerr_buf\fP will contain an error message on failure
3119: .RE
3120: .PP
3121: \fBReturns:\fP
3122: .RS 4
3123: libnet context ready for use or NULL on error.
3124: .RE
3125: .PP
3126:
1.1.1.2 ! misho 3127: .SS "uint32_t libnet_name2addr4 (libnet_t *l, char *host_name, uint8_tuse_name)"Takes a dotted decimal string or a canonical DNS name and returns a network byte ordered IPv4 address. This may incur a DNS lookup if mode is set to LIBNET_RESOLVE and host_name refers to a canonical DNS name. If mode is set to LIBNET_DONT_RESOLVE no DNS lookup will occur. The function can fail if DNS lookup fails or if mode is set to LIBNET_DONT_RESOLVE and host_name refers to a canonical DNS name.
1.1 misho 3128: .PP
3129: \fBParameters:\fP
3130: .RS 4
3131: \fIl\fP pointer to a libnet context
3132: .br
3133: \fIhost_name\fP pointer to a string containing a presentation format host name
3134: .br
3135: \fIuse_name\fP LIBNET_RESOLVE or LIBNET_DONT_RESOLVE
3136: .RE
3137: .PP
3138: \fBReturns:\fP
3139: .RS 4
3140: network byte ordered IPv4 address or -1 (2^32 - 1) on error
3141: .RE
3142: .PP
3143:
1.1.1.2 ! misho 3144: .SS "struct libnet_in6_addr libnet_name2addr6 (libnet_t *l, const char *host_name, uint8_tuse_name)\fC [read]\fP"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.
1.1 misho 3145: .PP
3146: \fBParameters:\fP
3147: .RS 4
3148: \fIl\fP pointer to a libnet context
3149: .br
3150: \fIhost_name\fP pointer to a string containing a presentation format host name
3151: .br
3152: \fIuse_name\fP LIBNET_RESOLVE or LIBNET_DONT_RESOLVE
3153: .RE
3154: .PP
3155: \fBReturns:\fP
3156: .RS 4
3157: network byte ordered IPv6 address structure
3158: .RE
3159: .PP
3160:
1.1.1.2 ! misho 3161: .SS "int libnet_plist_chain_dump (libnet_plist_t *plist)"Runs through the port list and prints the contents of the port list chain list to stdout.
1.1 misho 3162: .PP
3163: \fBParameters:\fP
3164: .RS 4
3165: \fIplist\fP previously created portlist
3166: .RE
3167: .PP
3168: \fBReturns:\fP
3169: .RS 4
3170: 1 on success, -1 on failure
3171: .RE
3172: .PP
3173:
1.1.1.2 ! misho 3174: .SS "char* libnet_plist_chain_dump_string (libnet_plist_t *plist)"Runs through the port list and prints the contents of the port list chain list to string. This function uses strdup and is not re-entrant. It also has a memory leak and should not really be used.
1.1 misho 3175: .PP
3176: \fBParameters:\fP
3177: .RS 4
3178: \fIplist\fP previously created portlist
3179: .RE
3180: .PP
3181: \fBReturns:\fP
3182: .RS 4
3183: a printable string containing the port list contents on success NULL on error
3184: .RE
3185: .PP
3186:
1.1.1.2 ! misho 3187: .SS "int libnet_plist_chain_free (libnet_plist_t *plist)"Frees all memory associated with port list chain.
1.1 misho 3188: .PP
3189: \fBParameters:\fP
3190: .RS 4
3191: \fIplist\fP previously created portlist
3192: .RE
3193: .PP
3194: \fBReturns:\fP
3195: .RS 4
3196: 1 on success, -1 on failure
3197: .RE
3198: .PP
3199:
1.1.1.2 ! misho 3200: .SS "int libnet_plist_chain_new (libnet_t *l, libnet_plist_t **plist, char *token_list)"Creates a new port list. Port list chains are useful for TCP and UDP-based applications that need to send packets to a range of ports (contiguous or otherwise). The port list chain, which token_list points to, should contain a series of int8_tacters from the following list: '0123456789,-' of the general format 'x - y, z', where 'xyz' are port numbers between 0 and 65,535. plist points to the front of the port list chain list for use in further libnet_plist_chain() functions. Upon success, the function returns 1. Upon failure, the function returns -1 and \fBlibnet_geterror()\fP can tell you why.
1.1 misho 3201: .PP
3202: \fBParameters:\fP
3203: .RS 4
3204: \fIl\fP pointer to a libnet context
3205: .br
3206: \fIplist\fP if successful, will refer to the portlist, if not, NULL
3207: .br
3208: \fItoken_list\fP string containing the port list primitive
3209: .RE
3210: .PP
3211: \fBReturns:\fP
3212: .RS 4
3213: 1 on success, -1 on failure
3214: .RE
3215: .PP
3216:
1.1.1.2 ! misho 3217: .SS "int libnet_plist_chain_next_pair (libnet_plist_t *plist, uint16_t *bport, uint16_t *eport)"Returns the next port list chain pair from the port list chain plist. bport and eport contain the starting port number and ending port number, respectively. Upon success, the function returns 1 and fills in the port variables; however, if the list is empty, the function returns 0 and sets both port variables to 0. Upon failure, the function returns -1.
1.1 misho 3218: .PP
3219: \fBParameters:\fP
3220: .RS 4
3221: \fIplist\fP previously created portlist
3222: .br
3223: \fIbport\fP will contain the beginning port number or 0
3224: .br
3225: \fIeport\fP will contain the ending port number or 0
3226: .RE
3227: .PP
3228: \fBReturns:\fP
3229: .RS 4
3230: 1 on success, 0 if empty, -1 on failure
3231: .RE
3232: .PP
3233:
1.1.1.2 ! misho 3234: .SS "int libnet_seed_prand (libnet_t *l)"Seeds the psuedo-random number generator.
1.1 misho 3235: .PP
3236: \fBParameters:\fP
3237: .RS 4
3238: \fIl\fP pointer to a libnet context
3239: .RE
3240: .PP
3241: \fBReturns:\fP
3242: .RS 4
3243: 1 on success, -1 on failure
3244: .RE
3245: .PP
3246:
1.1.1.2 ! misho 3247: .SS "void libnet_stats (libnet_t *l, struct libnet_stats *ls)"Fills in a libnet_stats structure with packet injection statistics (packets written, bytes written, packet sending errors).
1.1 misho 3248: .PP
3249: \fBParameters:\fP
3250: .RS 4
3251: \fIl\fP pointer to a libnet context
3252: .br
3253: \fIls\fP pointer to a libnet statistics structure
3254: .RE
3255: .PP
3256:
1.1.1.2 ! misho 3257: .SS "int libnet_toggle_checksum (libnet_t *l, libnet_ptag_tptag, intmode)"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 specificed 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.
1.1 misho 3258: .PP
3259: \fBParameters:\fP
3260: .RS 4
3261: \fIl\fP pointer to a libnet context
3262: .br
3263: \fIptag\fP the ptag reference number
3264: .br
3265: \fImode\fP LIBNET_ON or LIBNET_OFF
3266: .RE
3267: .PP
3268: \fBReturns:\fP
3269: .RS 4
3270: 1 on success, -1 on failure
3271: .RE
3272: .PP
3273:
1.1.1.2 ! misho 3274: .SS "const char* libnet_version (void)"Returns the version of libnet.
! 3275: .PP
! 3276: \fBReturns:\fP
! 3277: .RS 4
! 3278: the libnet version
! 3279: .RE
1.1 misho 3280: .PP
1.1.1.2 ! misho 3281:
! 3282: .SS "int libnet_write (libnet_t *l)"Writes a prebuilt packet to the network. The function assumes that l was previously initialized (via a call to \fBlibnet_init()\fP) and that a previously constructed packet has been built inside this context (via one or more calls to the libnet_build* family of functions) and is ready to go. Depending on how libnet was initialized, the function will write the packet to the wire either via the raw or link layer interface. The function will also bump up the internal libnet stat counters which are retrievable via \fBlibnet_stats()\fP.
1.1 misho 3283: .PP
3284: \fBParameters:\fP
3285: .RS 4
3286: \fIl\fP pointer to a libnet context
3287: .RE
3288: .PP
3289: \fBReturns:\fP
3290: .RS 4
3291: the number of bytes written, -1 on error
3292: .RE
3293: .PP
3294:
3295: .SH "Author"
3296: .PP
3297: Generated automatically by Doxygen for libnet from the source code.
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>