--- embedaddon/libnet/doc/html/libnet-functions_8h.html 2012/02/21 22:14:23 1.1.1.1 +++ embedaddon/libnet/doc/html/libnet-functions_8h.html 2013/07/22 11:54:41 1.1.1.2 @@ -1,8844 +1,8185 @@ - - + + + + libnet: libnet-functions.h File Reference - - - -
Main Page | Data Structures | File List | Data Fields | Globals
-

libnet-functions.h File Reference

libnet exported function prototypes -More... -

+ + + + + +

+
+ + + + + + +
+
libnet 1.1
+
+
+ + +
+
+
+Functions | +Variables
+
+
libnet-functions.h File Reference
+
+
-

-Go to the source code of this file. - - - +

libnet exported function prototypes +More...

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +

Go to the source code of this file.

+

Functions

libnet_t * libnet_init (int injection_type, char *device, char *err_buf)
void libnet_destroy (libnet_t *l)
void libnet_clear_packet (libnet_t *l)
void libnet_stats (libnet_t *l, struct libnet_stats *ls)
int libnet_getfd (libnet_t *l)
int8_t * libnet_getdevice (libnet_t *l)
u_int8_t * libnet_getpbuf (libnet_t *l, libnet_ptag_t ptag)
u_int32_t libnet_getpbuf_size (libnet_t *l, libnet_ptag_t ptag)
char * libnet_geterror (libnet_t *l)
u_int32_t libnet_getpacket_size (libnet_t *l)
int libnet_seed_prand (libnet_t *l)
u_int32_t libnet_get_prand (int mod)
int libnet_toggle_checksum (libnet_t *l, libnet_ptag_t ptag, int mode)
char * libnet_addr2name4 (u_int32_t in, u_int8_t use_name)
u_int32_t libnet_name2addr4 (libnet_t *l, char *host_name, u_int8_t use_name)
libnet_in6_addr libnet_name2addr6 (libnet_t *l, char *host_name, u_int8_t use_name)
void libnet_addr2name6_r (struct libnet_in6_addr addr, u_int8_t use_name, char *host_name, int host_name_len)
int libnet_plist_chain_new (libnet_t *l, libnet_plist_t **plist, char *token_list)
int libnet_plist_chain_next_pair (libnet_plist_t *plist, u_int16_t *bport, u_int16_t *eport)
int libnet_plist_chain_dump (libnet_plist_t *plist)
char * libnet_plist_chain_dump_string (libnet_plist_t *plist)
int libnet_plist_chain_free (libnet_plist_t *plist)
libnet_ptag_t libnet_build_802_1q (u_int8_t *dst, u_int8_t *src, u_int16_t tpi, u_int8_t priority, u_int8_t cfi, u_int16_t vlan_id, u_int16_t len_proto, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_802_1x (u_int8_t eap_ver, u_int8_t eap_type, u_int16_t length, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_802_2 (u_int8_t dsap, u_int8_t ssap, u_int8_t control, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_802_2snap (u_int8_t dsap, u_int8_t ssap, u_int8_t control, u_int8_t *oui, u_int16_t type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_802_3 (u_int8_t *dst, u_int8_t *src, u_int16_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ethernet (u_int8_t *dst, u_int8_t *src, u_int16_t type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_autobuild_ethernet (u_int8_t *dst, u_int16_t type, libnet_t *l)
libnet_ptag_t libnet_build_fddi (u_int8_t fc, u_int8_t *dst, u_int8_t *src, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *org, u_int16_t type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_autobuild_fddi (u_int8_t fc, u_int8_t *dst, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *org, u_int16_t type, libnet_t *l)
libnet_ptag_t libnet_build_arp (u_int16_t hrd, u_int16_t pro, u_int8_t hln, u_int8_t pln, u_int16_t op, u_int8_t *sha, u_int8_t *spa, u_int8_t *tha, u_int8_t *tpa, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_autobuild_arp (u_int16_t op, u_int8_t *sha, u_int8_t *spa, u_int8_t *tha, u_int8_t *tpa, libnet_t *l)
libnet_ptag_t libnet_build_tcp (u_int16_t sp, u_int16_t dp, u_int32_t seq, u_int32_t ack, u_int8_t control, u_int16_t win, u_int16_t sum, u_int16_t urg, u_int16_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_tcp_options (u_int8_t *options, u_int32_t options_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_udp (u_int16_t sp, u_int16_t dp, u_int16_t len, u_int16_t sum, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_cdp (u_int8_t version, u_int8_t ttl, u_int16_t sum, u_int16_t type, u_int16_t len, u_int8_t *value, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_icmpv4_echo (u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t id, u_int16_t seq, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_icmpv4_mask (u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t id, u_int16_t seq, u_int32_t mask, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_icmpv4_unreach (u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t orig_len, u_int8_t orig_tos, u_int16_t orig_id, u_int16_t orig_frag, u_int8_t orig_ttl, u_int8_t orig_prot, u_int16_t orig_check, u_int32_t orig_src, u_int32_t orig_dst, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_icmpv4_redirect (u_int8_t type, u_int8_t code, u_int16_t sum, u_int32_t gateway, u_int16_t orig_len, u_int8_t orig_tos, u_int16_t orig_id, u_int16_t orig_frag, u_int8_t orig_ttl, u_int8_t orig_prot, u_int16_t orig_check, u_int32_t orig_src, u_int32_t orig_dst, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_icmpv4_timeexceed (u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t orig_len, u_int8_t orig_tos, u_int16_t orig_id, u_int16_t orig_frag, u_int8_t orig_ttl, u_int8_t orig_prot, u_int16_t orig_check, u_int32_t orig_src, u_int32_t orig_dst, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_icmpv4_timestamp (u_int8_t type, u_int8_t code, u_int16_t sum, u_int16_t id, u_int16_t seq, n_time otime, n_time rtime, n_time ttime, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_igmp (u_int8_t type, u_int8_t code, u_int16_t sum, u_int32_t ip, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ipv4 (u_int16_t len, u_int8_t tos, u_int16_t id, u_int16_t frag, u_int8_t ttl, u_int8_t prot, u_int16_t sum, u_int32_t src, u_int32_t dst, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ipv4_options (u_int8_t *options, u_int32_t options_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_autobuild_ipv4 (u_int16_t len, u_int8_t prot, u_int32_t dst, libnet_t *l)
libnet_ptag_t libnet_build_ipv6 (u_int8_t tc, u_int32_t fl, u_int16_t len, u_int8_t nh, u_int8_t hl, struct libnet_in6_addr src, struct libnet_in6_addr dst, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ipv6_frag (u_int8_t nh, u_int8_t reserved, u_int16_t frag, u_int32_t id, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ipv6_routing (u_int8_t nh, u_int8_t len, u_int8_t rtype, u_int8_t segments, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ipv6_destopts (u_int8_t nh, u_int8_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ipv6_hbhopts (u_int8_t nh, u_int8_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_autobuild_ipv6 (u_int16_t len, u_int8_t nh, struct libnet_in6_addr dst, libnet_t *l)
libnet_ptag_t libnet_build_isl (u_int8_t *dhost, u_int8_t type, u_int8_t user, u_int8_t *shost, u_int16_t len, u_int8_t *snap, u_int16_t vid, u_int16_t index, u_int16_t reserved, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ipsec_esp_hdr (u_int32_t spi, u_int32_t seq, u_int32_t iv, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ipsec_esp_ftr (u_int8_t len, u_int8_t nh, int8_t *auth, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ipsec_ah (u_int8_t nh, u_int8_t len, u_int16_t res, u_int32_t spi, u_int32_t seq, u_int32_t auth, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_dnsv4 (u_int16_t h_len, u_int16_t id, u_int16_t flags, u_int16_t num_q, u_int16_t num_anws_rr, u_int16_t num_auth_rr, u_int16_t num_addi_rr, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_rip (u_int8_t cmd, u_int8_t version, u_int16_t rd, u_int16_t af, u_int16_t rt, u_int32_t addr, u_int32_t mask, u_int32_t next_hop, u_int32_t metric, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_rpc_call (u_int32_t rm, u_int32_t xid, u_int32_t prog_num, u_int32_t prog_vers, u_int32_t procedure, u_int32_t cflavor, u_int32_t clength, u_int8_t *cdata, u_int32_t vflavor, u_int32_t vlength, u_int8_t *vdata, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_stp_conf (u_int16_t id, u_int8_t version, u_int8_t bpdu_type, u_int8_t flags, u_int8_t *root_id, u_int32_t root_pc, u_int8_t *bridge_id, u_int16_t port_id, u_int16_t message_age, u_int16_t max_age, u_int16_t hello_time, u_int16_t f_delay, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_stp_tcn (u_int16_t id, u_int8_t version, u_int8_t bpdu_type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_token_ring (u_int8_t ac, u_int8_t fc, u_int8_t *dst, u_int8_t *src, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *org, u_int16_t type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_autobuild_token_ring (u_int8_t ac, u_int8_t fc, u_int8_t *dst, u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *org, u_int16_t type, libnet_t *l)
libnet_ptag_t libnet_build_vrrp (u_int8_t version, u_int8_t type, u_int8_t vrouter_id, u_int8_t priority, u_int8_t ip_count, u_int8_t auth_type, u_int8_t advert_int, u_int16_t sum, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_mpls (u_int32_t label, u_int8_t experimental, u_int8_t bos, u_int8_t ttl, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ntp (u_int8_t leap_indicator, u_int8_t version, u_int8_t mode, u_int8_t stratum, u_int8_t poll, u_int8_t precision, u_int16_t delay_int, u_int16_t delay_frac, u_int16_t dispersion_int, u_int16_t dispersion_frac, u_int32_t reference_id, u_int32_t ref_ts_int, u_int32_t ref_ts_frac, u_int32_t orig_ts_int, u_int32_t orig_ts_frac, u_int32_t rec_ts_int, u_int32_t rec_ts_frac, u_int32_t xmt_ts_int, u_int32_t xmt_ts_frac, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ospfv2 (u_int16_t len, u_int8_t type, u_int32_t rtr_id, u_int32_t area_id, u_int16_t sum, u_int16_t autype, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ospfv2_hello (u_int32_t netmask, u_int16_t interval, u_int8_t opts, u_int8_t priority, u_int dead_int, u_int32_t des_rtr, u_int32_t bkup_rtr, u_int32_t neighbor, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ospfv2_dbd (u_int16_t dgram_len, u_int8_t opts, u_int8_t type, u_int seqnum, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ospfv2_lsr (u_int type, u_int lsid, u_int32_t advrtr, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ospfv2_lsu (u_int num, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ospfv2_lsa (u_int16_t age, u_int8_t opts, u_int8_t type, u_int lsid, u_int32_t advrtr, u_int seqnum, u_int16_t sum, u_int16_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ospfv2_lsa_rtr (u_int16_t flags, u_int16_t num, u_int id, u_int data, u_int8_t type, u_int8_t tos, u_int16_t metric, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ospfv2_lsa_net (u_int32_t nmask, u_int rtrid, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ospfv2_lsa_sum (u_int32_t nmask, u_int metric, u_int tos, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ospfv2_lsa_as (u_int32_t nmask, u_int metric, u_int32_t fwdaddr, u_int tag, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_data (u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_dhcpv4 (u_int8_t opcode, u_int8_t htype, u_int8_t hlen, u_int8_t hopcount, u_int32_t xid, u_int16_t secs, u_int16_t flags, u_int32_t cip, u_int32_t yip, u_int32_t sip, u_int32_t gip, u_int8_t *chaddr, u_int8_t *sname, u_int8_t *file, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_bootpv4 (u_int8_t opcode, u_int8_t htype, u_int8_t hlen, u_int8_t hopcount, u_int32_t xid, u_int16_t secs, u_int16_t flags, u_int32_t cip, u_int32_t yip, u_int32_t sip, u_int32_t gip, u_int8_t *chaddr, u_int8_t *sname, u_int8_t *file, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
u_int32_t libnet_getgre_length (u_int16_t fv)
libnet_ptag_t libnet_build_gre (u_int16_t fv, u_int16_t type, u_int16_t sum, u_int16_t offset, u_int32_t key, u_int32_t seq, u_int16_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_egre (u_int16_t fv, u_int16_t type, u_int16_t sum, u_int16_t offset, u_int32_t key, u_int32_t seq, u_int16_t len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_gre_sre (u_int16_t af, u_int8_t offset, u_int8_t length, u_int8_t *routing, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_gre_last_sre (libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_bgp4_header (u_int8_t marker[LIBNET_BGP4_MARKER_SIZE], u_int16_t len, u_int8_t type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_bgp4_open (u_int8_t version, u_int16_t src_as, u_int16_t hold_time, u_int32_t bgp_id, u_int8_t opt_len, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_bgp4_update (u_int16_t unfeasible_rt_len, u_int8_t *withdrawn_rt, u_int16_t total_path_attr_len, u_int8_t *path_attributes, u_int16_t info_len, u_int8_t *reachability_info, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_bgp4_notification (u_int8_t err_code, u_int8_t err_subcode, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_sebek (u_int32_t magic, u_int16_t version, u_int16_t type, u_int32_t counter, u_int32_t time_sec, u_int32_t time_usec, u_int32_t pid, u_int32_t uid, u_int32_t fd, u_int8_t cmd[SEBEK_CMD_LENGTH], u_int32_t length, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_link (u_int8_t *dst, u_int8_t *src, u_int8_t *oui, u_int16_t type, u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_autobuild_link (u_int8_t *dst, u_int8_t *oui, u_int16_t type, libnet_t *l)
int libnet_write (libnet_t *l)
u_int32_t libnet_get_ipaddr4 (libnet_t *l)
libnet_in6_addr libnet_get_ipaddr6 (libnet_t *l)
libnet_ether_addr * libnet_get_hwaddr (libnet_t *l)
u_int8_t * libnet_hex_aton (int8_t *s, int *len)
int libnet_adv_cull_packet (libnet_t *l, u_int8_t **packet, u_int32_t *packet_s)
int libnet_adv_cull_header (libnet_t *l, libnet_ptag_t ptag, u_int8_t **header, u_int32_t *header_s)
int libnet_adv_write_link (libnet_t *l, u_int8_t *packet, u_int32_t packet_s)
void libnet_adv_free_packet (libnet_t *l, u_int8_t *packet)
int libnet_cq_add (libnet_t *l, char *label)
libnet_t * libnet_cq_remove (libnet_t *l)
libnet_t * libnet_cq_remove_by_label (char *label)
int8_t * libnet_cq_getlabel (libnet_t *l)
libnet_t * libnet_cq_find_by_label (char *label)
void libnet_cq_destroy ()
libnet_t * libnet_cq_head ()
int libnet_cq_last ()
libnet_t * libnet_cq_next ()
u_int32_t libnet_cq_size ()
void libnet_diag_dump_context (libnet_t *l)
void libnet_diag_dump_pblock (libnet_t *l)
char * libnet_diag_dump_pblock_type (u_int8_t type)
void libnet_diag_dump_hex (u_int8_t *packet, u_int32_t len, int swap, FILE *stream)
-int libnet_write_raw_ipv4 (libnet_t *l, u_int8_t *packet, u_int32_t size)
-int libnet_write_raw_ipv6 (libnet_t *l, u_int8_t *packet, u_int32_t size)
-int libnet_write_link (libnet_t *l, u_int8_t *packet, u_int32_t size)
-int libnet_open_raw4 (libnet_t *l)
-int libnet_close_raw4 (libnet_t *l)
-int libnet_open_raw6 (libnet_t *l)
-int libnet_close_raw6 (libnet_t *l)
-int libnet_select_device (libnet_t *l)
-int libnet_open_link (libnet_t *l)
-int libnet_close_link (libnet_t *l)
-int libnet_do_checksum (libnet_t *l, u_int8_t *packet, int protocol, int len)
-u_int32_t libnet_compute_crc (u_int8_t *buf, u_int32_t len)
-u_int16_t libnet_ip_check (u_int16_t *addr, int len)
-int libnet_in_cksum (u_int16_t *addr, int len)
-libnet_pblock_t * libnet_pblock_probe (libnet_t *l, libnet_ptag_t ptag, u_int32_t n, u_int8_t type)
-libnet_pblock_t * libnet_pblock_new (libnet_t *l, u_int32_t size)
-int libnet_pblock_swap (libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2)
-int libnet_pblock_insert_before (libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2)
-void libnet_pblock_delete (libnet_t *l, libnet_pblock_t *p)
-libnet_ptag_t libnet_pblock_update (libnet_t *l, libnet_pblock_t *p, u_int32_t h, u_int8_t type)
-libnet_pblock_t * libnet_pblock_find (libnet_t *l, libnet_ptag_t ptag)
-int libnet_pblock_append (libnet_t *l, libnet_pblock_t *p, u_int8_t *buf, u_int32_t len)
-void libnet_pblock_setflags (libnet_pblock_t *p, u_int8_t flags)
-int libnet_pblock_p2p (u_int8_t type)
-int libnet_pblock_coalesce (libnet_t *l, u_int8_t **packet, u_int32_t *size)
-int libnet_check_iface (libnet_t *l)

Variables

-const struct libnet_in6_addr in6addr_error
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

libnet_t * libnet_init (int injection_type, const char *device, char *err_buf)
void libnet_destroy (libnet_t *l)
void libnet_clear_packet (libnet_t *l)
void libnet_stats (libnet_t *l, struct libnet_stats *ls)
int libnet_getfd (libnet_t *l)
const char * libnet_getdevice (libnet_t *l)
uint8_t * libnet_getpbuf (libnet_t *l, libnet_ptag_t ptag)
uint32_t libnet_getpbuf_size (libnet_t *l, libnet_ptag_t ptag)
char * libnet_geterror (libnet_t *l)
uint32_t libnet_getpacket_size (libnet_t *l)
int libnet_seed_prand (libnet_t *l)
uint32_t libnet_get_prand (int mod)
int libnet_toggle_checksum (libnet_t *l, libnet_ptag_t ptag, int mode)
char * libnet_addr2name4 (uint32_t in, uint8_t use_name)
uint32_t libnet_name2addr4 (libnet_t *l, char *host_name, uint8_t use_name)
int libnet_in6_is_error (struct libnet_in6_addr addr)
struct libnet_in6_addr libnet_name2addr6 (libnet_t *l, const char *host_name, uint8_t use_name)
void libnet_addr2name6_r (struct libnet_in6_addr addr, uint8_t use_name, char *host_name, int host_name_len)
int libnet_plist_chain_new (libnet_t *l, libnet_plist_t **plist, char *token_list)
int libnet_plist_chain_next_pair (libnet_plist_t *plist, uint16_t *bport, uint16_t *eport)
int libnet_plist_chain_dump (libnet_plist_t *plist)
char * libnet_plist_chain_dump_string (libnet_plist_t *plist)
int libnet_plist_chain_free (libnet_plist_t *plist)
libnet_ptag_t libnet_build_802_1q (const uint8_t *dst, const uint8_t *src, uint16_t tpi, uint8_t priority, uint8_t cfi, uint16_t vlan_id, uint16_t len_proto, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_802_1x (uint8_t eap_ver, uint8_t eap_type, uint16_t length, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_802_2 (uint8_t dsap, uint8_t ssap, uint8_t control, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_802_2snap (uint8_t dsap, uint8_t ssap, uint8_t control, uint8_t *oui, uint16_t type, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_802_3 (const uint8_t *dst, const uint8_t *src, uint16_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ethernet (const uint8_t *dst, const uint8_t *src, uint16_t type, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_autobuild_ethernet (const uint8_t *dst, uint16_t type, libnet_t *l)
libnet_ptag_t libnet_build_fddi (uint8_t fc, const uint8_t *dst, const uint8_t *src, uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t *oui, uint16_t type, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_autobuild_fddi (uint8_t fc, const uint8_t *dst, uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t *oui, uint16_t type, libnet_t *l)
libnet_ptag_t libnet_build_arp (uint16_t hrd, uint16_t pro, uint8_t hln, uint8_t pln, uint16_t op, const uint8_t *sha, const uint8_t *spa, const uint8_t *tha, const uint8_t *tpa, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_autobuild_arp (uint16_t op, const uint8_t *sha, const uint8_t *spa, const uint8_t *tha, uint8_t *tpa, libnet_t *l)
libnet_ptag_t libnet_build_tcp (uint16_t sp, uint16_t dp, uint32_t seq, uint32_t ack, uint8_t control, uint16_t win, uint16_t sum, uint16_t urg, uint16_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_tcp_options (const uint8_t *options, uint32_t options_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_udp (uint16_t sp, uint16_t dp, uint16_t len, uint16_t sum, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_cdp (uint8_t version, uint8_t ttl, uint16_t sum, uint16_t type, uint16_t value_s, const uint8_t *value, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_icmpv4_echo (uint8_t type, uint8_t code, uint16_t sum, uint16_t id, uint16_t seq, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_icmpv4_mask (uint8_t type, uint8_t code, uint16_t sum, uint16_t id, uint16_t seq, uint32_t mask, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_icmpv4_unreach (uint8_t type, uint8_t code, uint16_t sum, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_icmpv4_redirect (uint8_t type, uint8_t code, uint16_t sum, uint32_t gateway, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_icmpv4_timeexceed (uint8_t type, uint8_t code, uint16_t sum, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_icmpv4_timestamp (uint8_t type, uint8_t code, uint16_t sum, uint16_t id, uint16_t seq, uint32_t otime, uint32_t rtime, uint32_t ttime, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_icmpv6_echo (uint8_t type, uint8_t code, uint16_t sum, uint16_t id, uint16_t seq, uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_icmpv6_unreach (uint8_t type, uint8_t code, uint16_t sum, uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_icmpv6_ndp_nsol (uint8_t type, uint8_t code, uint16_t sum, struct libnet_in6_addr target, uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_icmpv6_ndp_nadv (uint8_t type, uint8_t code, uint16_t sum, uint32_t flags, struct libnet_in6_addr target, uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_icmpv6_ndp_opt (uint8_t type, uint8_t *option, uint32_t option_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_igmp (uint8_t type, uint8_t reserved, uint16_t sum, uint32_t ip, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ipv4 (uint16_t ip_len, uint8_t tos, uint16_t id, uint16_t frag, uint8_t ttl, uint8_t prot, uint16_t sum, uint32_t src, uint32_t dst, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ipv4_options (const uint8_t *options, uint32_t options_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_autobuild_ipv4 (uint16_t len, uint8_t prot, uint32_t dst, libnet_t *l)
libnet_ptag_t libnet_build_ipv6 (uint8_t tc, uint32_t fl, uint16_t len, uint8_t nh, uint8_t hl, struct libnet_in6_addr src, struct libnet_in6_addr dst, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ipv6_frag (uint8_t nh, uint8_t reserved, uint16_t frag, uint32_t id, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ipv6_routing (uint8_t nh, uint8_t len, uint8_t rtype, uint8_t segments, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ipv6_destopts (uint8_t nh, uint8_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ipv6_hbhopts (uint8_t nh, uint8_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_autobuild_ipv6 (uint16_t len, uint8_t nh, struct libnet_in6_addr dst, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_isl (uint8_t *dhost, uint8_t type, uint8_t user, uint8_t *shost, uint16_t len, const uint8_t *snap, uint16_t vid, uint16_t portindex, uint16_t reserved, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ipsec_esp_hdr (uint32_t spi, uint32_t seq, uint32_t iv, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ipsec_esp_ftr (uint8_t len, uint8_t nh, int8_t *auth, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ipsec_ah (uint8_t nh, uint8_t len, uint16_t res, uint32_t spi, uint32_t seq, uint32_t auth, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_dnsv4 (uint16_t h_len, uint16_t id, uint16_t flags, uint16_t num_q, uint16_t num_anws_rr, uint16_t num_auth_rr, uint16_t num_addi_rr, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_rip (uint8_t cmd, uint8_t version, uint16_t rd, uint16_t af, uint16_t rt, uint32_t addr, uint32_t mask, uint32_t next_hop, uint32_t metric, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_rpc_call (uint32_t rm, uint32_t xid, uint32_t prog_num, uint32_t prog_vers, uint32_t procedure, uint32_t cflavor, uint32_t clength, uint8_t *cdata, uint32_t vflavor, uint32_t vlength, const uint8_t *vdata, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_stp_conf (uint16_t id, uint8_t version, uint8_t bpdu_type, uint8_t flags, const uint8_t *root_id, uint32_t root_pc, const uint8_t *bridge_id, uint16_t port_id, uint16_t message_age, uint16_t max_age, uint16_t hello_time, uint16_t f_delay, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_stp_tcn (uint16_t id, uint8_t version, uint8_t bpdu_type, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_token_ring (uint8_t ac, uint8_t fc, const uint8_t *dst, const uint8_t *src, uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t *oui, uint16_t type, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_autobuild_token_ring (uint8_t ac, uint8_t fc, const uint8_t *dst, uint8_t dsap, uint8_t ssap, uint8_t cf, const uint8_t *oui, uint16_t type, libnet_t *l)
libnet_ptag_t libnet_build_vrrp (uint8_t version, uint8_t type, uint8_t vrouter_id, uint8_t priority, uint8_t ip_count, uint8_t auth_type, uint8_t advert_int, uint16_t sum, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_mpls (uint32_t label, uint8_t experimental, uint8_t bos, uint8_t ttl, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ntp (uint8_t leap_indicator, uint8_t version, uint8_t mode, uint8_t stratum, uint8_t poll, uint8_t precision, uint16_t delay_int, uint16_t delay_frac, uint16_t dispersion_int, uint16_t dispersion_frac, uint32_t reference_id, uint32_t ref_ts_int, uint32_t ref_ts_frac, uint32_t orig_ts_int, uint32_t orig_ts_frac, uint32_t rec_ts_int, uint32_t rec_ts_frac, uint32_t xmt_ts_int, uint32_t xmt_ts_frac, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ospfv2 (uint16_t len, uint8_t type, uint32_t rtr_id, uint32_t area_id, uint16_t sum, uint16_t autype, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ospfv2_hello (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)
libnet_ptag_t libnet_build_ospfv2_dbd (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)
libnet_ptag_t libnet_build_ospfv2_lsr (uint type, uint lsid, uint32_t advrtr, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ospfv2_lsu (uint num, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ospfv2_lsa (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)
libnet_ptag_t libnet_build_ospfv2_lsa_rtr (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)
libnet_ptag_t libnet_build_ospfv2_lsa_net (uint32_t nmask, uint rtrid, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ospfv2_lsa_sum (uint32_t nmask, uint metric, uint tos, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_ospfv2_lsa_as (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)
libnet_ptag_t libnet_build_data (const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_dhcpv4 (uint8_t opcode, uint8_t htype, uint8_t hlen, uint8_t hopcount, uint32_t xid, uint16_t secs, uint16_t flags, uint32_t cip, uint32_t yip, uint32_t sip, uint32_t gip, const uint8_t *chaddr, const char *sname, const char *file, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_bootpv4 (uint8_t opcode, uint8_t htype, uint8_t hlen, uint8_t hopcount, uint32_t xid, uint16_t secs, uint16_t flags, uint32_t cip, uint32_t yip, uint32_t sip, uint32_t gip, const uint8_t *chaddr, const char *sname, const char *file, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
uint32_t libnet_getgre_length (uint16_t fv)
libnet_ptag_t libnet_build_gre (uint16_t fv, uint16_t type, uint16_t sum, uint16_t offset, uint32_t key, uint32_t seq, uint16_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_egre (uint16_t fv, uint16_t type, uint16_t sum, uint16_t offset, uint32_t key, uint32_t seq, uint16_t len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_gre_sre (uint16_t af, uint8_t offset, uint8_t length, uint8_t *routing, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_gre_last_sre (libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_bgp4_header (uint8_t marker[LIBNET_BGP4_MARKER_SIZE], uint16_t len, uint8_t type, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_bgp4_open (uint8_t version, uint16_t src_as, uint16_t hold_time, uint32_t bgp_id, uint8_t opt_len, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_bgp4_update (uint16_t unfeasible_rt_len, const uint8_t *withdrawn_rt, uint16_t total_path_attr_len, const uint8_t *path_attributes, uint16_t info_len, uint8_t *reachability_info, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_bgp4_notification (uint8_t err_code, uint8_t err_subcode, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_sebek (uint32_t magic, uint16_t version, uint16_t type, uint32_t counter, uint32_t time_sec, uint32_t time_usec, uint32_t pid, uint32_t uid, uint32_t fd, uint8_t cmd[SEBEK_CMD_LENGTH], uint32_t length, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_hsrp (uint8_t version, uint8_t opcode, uint8_t state, uint8_t hello_time, uint8_t hold_time, uint8_t priority, uint8_t group, uint8_t reserved, uint8_t authdata[HSRP_AUTHDATA_LENGTH], uint32_t virtual_ip, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_build_link (const uint8_t *dst, const uint8_t *src, const uint8_t *oui, uint16_t type, const uint8_t *payload, uint32_t payload_s, libnet_t *l, libnet_ptag_t ptag)
libnet_ptag_t libnet_autobuild_link (const uint8_t *dst, const uint8_t *oui, uint16_t type, libnet_t *l)
int libnet_write (libnet_t *l)
uint32_t libnet_get_ipaddr4 (libnet_t *l)
struct libnet_in6_addr libnet_get_ipaddr6 (libnet_t *l)
struct libnet_ether_addr * libnet_get_hwaddr (libnet_t *l)
uint8_t * libnet_hex_aton (const char *s, int *len)
const char * libnet_version (void)
int libnet_adv_cull_packet (libnet_t *l, uint8_t **packet, uint32_t *packet_s)
int libnet_adv_cull_header (libnet_t *l, libnet_ptag_t ptag, uint8_t **header, uint32_t *header_s)
int libnet_adv_write_link (libnet_t *l, const uint8_t *packet, uint32_t packet_s)
int libnet_adv_write_raw_ipv4 (libnet_t *l, const uint8_t *packet, uint32_t packet_s)
void libnet_adv_free_packet (libnet_t *l, uint8_t *packet)
int libnet_cq_add (libnet_t *l, char *label)
libnet_t * libnet_cq_remove (libnet_t *l)
libnet_t * libnet_cq_remove_by_label (char *label)
const char * libnet_cq_getlabel (libnet_t *l)
libnet_t * libnet_cq_find_by_label (char *label)
void libnet_cq_destroy (void)
libnet_t * libnet_cq_head (void)
int libnet_cq_last (void)
libnet_t * libnet_cq_next (void)
uint32_t libnet_cq_size (void)
uint32_t libnet_cq_end_loop (void)
void libnet_diag_dump_context (libnet_t *l)
void libnet_diag_dump_pblock (libnet_t *l)
char * libnet_diag_dump_pblock_type (uint8_t type)
void libnet_diag_dump_hex (const uint8_t *packet, uint32_t len, int swap, FILE *stream)
+int libnet_write_raw_ipv4 (libnet_t *l, const uint8_t *packet, uint32_t size)
+int libnet_write_raw_ipv6 (libnet_t *l, const uint8_t *packet, uint32_t size)
+int libnet_write_link (libnet_t *l, const uint8_t *packet, uint32_t size)
+int libnet_open_raw4 (libnet_t *l)
+int libnet_close_raw4 (libnet_t *l)
+int libnet_open_raw6 (libnet_t *l)
+int libnet_close_raw6 (libnet_t *l)
+int libnet_select_device (libnet_t *l)
+int libnet_open_link (libnet_t *l)
+int libnet_close_link (libnet_t *l)
+int libnet_do_checksum (libnet_t *l, uint8_t *iphdr, int protocol, int h_len)
+int libnet_inet_checksum (libnet_t *l, uint8_t *iphdr, int protocol, int h_len, const uint8_t *beg, const uint8_t *end)
+uint32_t libnet_compute_crc (uint8_t *buf, uint32_t len)
+uint16_t libnet_ip_check (uint16_t *addr, int len)
+int libnet_in_cksum (uint16_t *addr, int len)
+libnet_pblock_t * libnet_pblock_probe (libnet_t *l, libnet_ptag_t ptag, uint32_t b_len, uint8_t type)
+libnet_pblock_t * libnet_pblock_new (libnet_t *l, uint32_t b_len)
+int libnet_pblock_swap (libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2)
+int libnet_pblock_insert_before (libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2)
+void libnet_pblock_delete (libnet_t *l, libnet_pblock_t *p)
+libnet_ptag_t libnet_pblock_update (libnet_t *l, libnet_pblock_t *p, uint32_t h, uint8_t type)
+libnet_pblock_t * libnet_pblock_find (libnet_t *l, libnet_ptag_t ptag)
+int libnet_pblock_append (libnet_t *l, libnet_pblock_t *p, const void *buf, uint32_t len)
+void libnet_pblock_setflags (libnet_pblock_t *p, uint8_t flags)
+int libnet_pblock_p2p (uint8_t type)
+int libnet_pblock_coalesce (libnet_t *l, uint8_t **packet, uint32_t *size)
+int libnet_check_iface (libnet_t *l)

+Variables

+struct libnet_in6_addr in6addr_error
-


Detailed Description

-libnet exported function prototypes -

-


Function Documentation

-

- - - - -
- +

Detailed Description

+

libnet exported function prototypes

+

Function Documentation

+ +
+
+
- - - - + + + + + - - - + + - - + + -
char* libnet_addr2name4 u_int32_t  in, char* libnet_addr2name4 (uint32_t in,
u_int8_t  use_nameuint8_t use_name 
)
-
- - - - - -
-   - - -

-Takes a network byte ordered IPv4 address and returns a pointer to either a canonical DNS name (if it has one) or a string of dotted decimals. This may incur a DNS lookup if the hostname and mode is set to LIBNET_RESOLVE. If mode is set to LIBNET_DONT_RESOLVE, no DNS lookup will be performed and the function will return a pointer to a dotted decimal string. The function cannot fail -- if no canonical name exists, it will fall back on returning a dotted decimal string. This function is non-reentrant.

Parameters:
- - - + +
+

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.

+
Parameters:
+
in network byte ordered IPv4 address
use_name LIBNET_RESOLVE or LIBNET_DONT_RESOLVE
+ +
innetwork byte ordered IPv4 address
use_nameLIBNET_RESOLVE or LIBNET_DONT_RESOLVE
+
-
Returns:
a pointer to presentation format string
-
-

- - - - -
- +
Returns:
a pointer to presentation format string
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + - - + + -
void libnet_addr2name6_r struct libnet_in6_addr  addr, void libnet_addr2name6_r (struct libnet_in6_addr addr,
u_int8_t  use_name, uint8_t use_name,
char *  host_name, char * host_name,
int  host_name_lenint host_name_len 
)
-
- - - - - -
-   - + +
+

Should document this baby right here.

-

-Should document this baby right here.

-

- - - - -
- + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + - - + + -
int libnet_adv_cull_header libnet_t *  l, int libnet_adv_cull_header (libnet_t * l,
libnet_ptag_t  ptag, libnet_ptag_t ptag,
u_int8_t **  header, uint8_t ** header,
u_int32_t *  header_suint32_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 libnet_geterror() can tell you why.

Parameters:
- - - - - + +
+

[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 libnet_geterror() can tell you why.

+
Parameters:
+
l pointer to a libnet context
ptag the ptag referencing the header to pull
header will contain the header
header_s will contain the header size
+ + + +
lpointer to a libnet context
ptagthe ptag referencing the header to pull
headerwill contain the header
header_swill contain the header size
+
-
Returns:
1 on success, -1 on failure
-
-

- - - - -
- +
Returns:
1 on success, -1 on failure
+ + + + +
+
+
- - - - + + + + + + + + + + - - + + + + + +
int libnet_adv_cull_packet libnet_t *  l, int libnet_adv_cull_packet (libnet_t * l,
uint8_t ** packet,
u_int8_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 libnet_adv_free_packet() should be made to free the memory packet occupies. If the function fails libnet_geterror() can tell you why.

+
Parameters:
+ + + + +
lpointer to a libnet context
packetwill contain the wire-ready packet
packet_swill contain the packet size
+
+
+
Returns:
1 on success, -1 on failure
+ +
+ + +
+
+ + + + + + + + + - - + + - - + + -
void libnet_adv_free_packet (libnet_t * l,
u_int32_t *  packet_suint8_t * packet 
)
-
- - - - - -
-   - - -

-[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 libnet_adv_free_packet() should be made to free the memory packet occupies. If the function fails libnet_geterror() can tell you why.

Parameters:
- - - - + +
+

[Advanced Interface] Frees the memory allocated when libnet_adv_cull_packet() is called.

+
Parameters:
+
l pointer to a libnet context
packet will contain the wire-ready packet
packet_s will contain the packet size
+ +
lpointer to a libnet context
packeta pointer to the packet to free
+
-
Returns:
1 on success, -1 on failure
-
-

- - - - -
- + + + + +
+
+
- - - - + + + + + + + + + + - - + + - - + + -
void libnet_adv_free_packet libnet_t *  l, int libnet_adv_write_link (libnet_t * l,
const uint8_t * packet,
u_int8_t *  packetuint32_t packet_s 
)
-
- - - - - -
-   - - -

-[Advanced Interface] Frees the memory allocated when libnet_adv_cull_packet() is called.

Parameters:
- - - + +
+

[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 libnet_adv_cull_packet(). This function is part of the advanced interface and is only available when libnet is initialized in advanced mode. If the function fails libnet_geterror() can tell you why.

+
Parameters:
+
l pointer to a libnet context
packet a pointer to the packet to free
+ + +
lpointer to a libnet context
packeta pointer to the packet to inject
packet_sthe size of the packet
+
-
-

- - - - -
- +
Returns:
the number of bytes written, or -1 on failure
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + - - + + -
int libnet_adv_write_link libnet_t *  l, int libnet_adv_write_raw_ipv4 (libnet_t * l,
u_int8_t *  packet, const uint8_t * packet,
u_int32_t  packet_suint32_t packet_s 
)
-
- - - - - -
-   - - -

-[Advanced Interface] Writes a packet the network at the link layer. This function is useful to write a packet that has been constructed by hand by the application programmer or, more commonly, to write a packet that has been returned by a call to libnet_adv_cull_packet(). This function is part of the advanced interface and is only available when libnet is initialized in advanced mode. If the function fails libnet_geterror() can tell you why.

Parameters:
- - - - + +
+

[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 libnet_adv_cull_packet(). This function is part of the advanced interface and is only available when libnet is initialized in advanced mode. If the function fails libnet_geterror() can tell you why.

+
Parameters:
+
l pointer to a libnet context
packet a pointer to the packet to inject
packet_s the size of the packet
+ + +
lpointer to a libnet context
packeta pointer to the packet to inject
packet_sthe size of the packet
+
-
Returns:
the number of bytes written, or -1 on failure
-
-

- - - - -
- +
Returns:
the number of bytes written, or -1 on failure
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_autobuild_arp u_int16_t  op, libnet_ptag_t libnet_autobuild_arp (uint16_t op,
u_int8_t *  sha, const uint8_t * sha,
u_int8_t *  spa, const uint8_t * spa,
u_int8_t *  tha, const uint8_t * tha,
u_int8_t *  tpa, uint8_t * tpa,
libnet_t *  llibnet_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.

Parameters:
- - - - - - - + +
+

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.

+
Parameters:
+
op ARP operation type
sha sender's hardware address
spa sender's protocol address
tha target hardware address
tpa targer protocol address
l pointer to a libnet context
+ + + + + +
opARP operation type
shasender's hardware address
spasender's protocol address
thatarget hardware address
tpatarger protocol address
lpointer to a libnet context
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_autobuild_ethernet u_int8_t *  dst, libnet_ptag_t libnet_autobuild_ethernet (const uint8_t * dst,
u_int16_t  type, uint16_t type,
libnet_t *  llibnet_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.

Parameters:
- - - - + +
+

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.

+
Parameters:
+
dst destination ethernet address
type upper layer protocol type
l pointer to a libnet context
+ + +
dstdestination ethernet address
typeupper layer protocol type
lpointer to a libnet context
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_autobuild_fddi u_int8_t  fc, libnet_ptag_t libnet_autobuild_fddi (uint8_t fc,
u_int8_t *  dst, const uint8_t * dst,
u_int8_t  dsap, uint8_t dsap,
u_int8_t  ssap, uint8_t ssap,
u_int8_t  cf, uint8_t cf,
u_int8_t *  org, const uint8_t * oui,
u_int16_t  type, uint16_t type,
libnet_t *  llibnet_t * l 
)
-
- - - - - -
-   - - -

-Autobuilds a Fiber Distributed Data Interface (FDDI) header.

Parameters:
- - - - - - - - + +
+

Autobuilds a Fiber Distributed Data Interface (FDDI) header.

+
Parameters:
+
fc class format and priority dst destination fddi address
dsap destination service access point
ssap source service access point
cf cf
org IEEE organizational code
type upper layer protocol
l pointer to a libnet context
+ + + + + + + +
fcclass format and priority
dstdestination fddi address
dsapdestination service access point
ssapsource service access point
cfcf
ouiIEEE organizational code
typeupper layer protocol
lpointer to a libnet context
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_autobuild_ipv4 u_int16_t  len, libnet_ptag_t libnet_autobuild_ipv4 (uint16_t len,
u_int8_t  prot, uint8_t prot,
u_int32_t  dst, uint32_t dst,
libnet_t *  llibnet_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 libnet_build_ipv4(). 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.

Parameters:
- - - - - + +
+

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 libnet_build_ipv4(). 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.

+
Parameters:
+
len total length of the IP packet including all subsequent data
prot upper layer protocol
dst destination IPv4 address (little endian)
l pointer to a libnet context
+ + + +
lentotal length of the IP packet including all subsequent data
protupper layer protocol
dstdestination IPv4 address (little endian)
lpointer to a libnet context
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + + + + + + - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_autobuild_ipv6 u_int16_t  len, libnet_ptag_t libnet_autobuild_ipv6 (uint16_t len,
uint8_t nh,
u_int8_t  nh, struct libnet_in6_addr dst,
struct libnet_in6_addr  dst, libnet_t * l,
libnet_t *  llibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-This function is not yet implement and is a NONOP.

Parameters:
- - - - - - - - + +
+

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 libnet_build_ipv4(). 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 libnet_get_ipaddr6(), which is not yet implemented for Win32 platforms.

+
Parameters:
+
len length
nh next header
dst destination IPv6 address
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + +
lenlength
nhnext header
dstdestination IPv6 address
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_autobuild_link u_int8_t *  dst, libnet_ptag_t libnet_autobuild_link (const uint8_t * dst,
u_int8_t *  oui, const uint8_t * oui,
u_int16_t  type, uint16_t type,
libnet_t *  llibnet_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.

Parameters:
- - - - - + +
+

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.

+
Parameters:
+
dst the destination MAC address
oui Organizationally Unique Identifier (unused for Ethernet)
type the upper layer protocol type
l pointer to a libnet context
+ + + +
dstthe destination MAC address
ouiOrganizationally Unique Identifier (unused for Ethernet)
typethe upper layer protocol type
lpointer to a libnet context
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_autobuild_token_ring u_int8_t  ac, libnet_ptag_t libnet_autobuild_token_ring (uint8_t ac,
u_int8_t  fc, uint8_t fc,
u_int8_t *  dst, const uint8_t * dst,
u_int8_t  dsap, uint8_t dsap,
u_int8_t  ssap, uint8_t ssap,
u_int8_t  cf, uint8_t cf,
u_int8_t *  org, const uint8_t * oui,
u_int16_t  type, uint16_t type,
libnet_t *  llibnet_t * l 
)
-
- - - - - -
-   - - -

-Auto-builds a token ring header.

Parameters:
- - - - - - - - - - + +
+

Auto-builds a token ring header.

+
Parameters:
+
ac access control
fc frame control
dst destination address
dsap destination service access point
ssap source service access point
cf control field
oui Organizationally Unique Identifier
type upper layer protocol type
l pointer to a libnet context
+ + + + + + + + +
acaccess control
fcframe control
dstdestination address
dsapdestination service access point
ssapsource service access point
cfcontrol field
ouiOrganizationally Unique Identifier
typeupper layer protocol type
lpointer to a libnet context
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_802_1q u_int8_t *  dst, libnet_ptag_t libnet_build_802_1q (const uint8_t * dst,
u_int8_t *  src, const uint8_t * src,
u_int16_t  tpi, uint16_t tpi,
u_int8_t  priority, uint8_t priority,
u_int8_t  cfi, uint8_t cfi,
u_int16_t  vlan_id, uint16_t vlan_id,
u_int16_t  len_proto, uint16_t len_proto,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-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.

Parameters:
- - - - - - - - - - - - + +
+

+Packet Builder Functions

+

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. libnet_build_ntp() 2. libnet_build_udp() 3. libnet_build_ipv4() 4. libnet_build_ethernet() This ordering is essential for libnet 1.1.x to properly link together the packet internally (previous libnet versions did not have the requirement).

+

+The Payload Interface

+

The payload interface specifies an optional way to include data directly after the protocol header in question. You can use this function for a variety of purposes, including the following:

+
    +
  • Including additional or arbitrary protocol header information that is not available from a libnet interface
  • +
  • Including a packet payload (data segment)
  • +
  • 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.
  • +
+

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.

+

+Protocol Tags and Packet Builder Return Values

+

Libnet uses the protocol tag (ptag) to identify individual pieces of a packet after being created. A new ptag results every time a libnet_build() function with an empty (0) ptag argument completes successfully. This new ptag now refers to the packet piece just created. The application programmer's responsibility is to save this value if he or she plans to modify this particular portion later on in the program. If the application programmer needs to modify some portion of that particular packet piece again, he or she calls the same libnet_build() function specifying the saved ptag argument. Libnet then searches for that packet piece and modifies it rather than creating a new one. Upon failure for any reason, libnet_build() functions return -1; libnet_geterror() 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.

+
Parameters:
+
dst pointer to a six byte source ethernet address
src pointer to a six byte destination ethernet address
tpi tag protocol identifier
priority priority
cfi canonical format indicator
vlan_id vlan identifier
len_proto length (802.3) protocol (Ethernet II)
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + + +
dstpointer to a six byte source ethernet address
srcpointer to a six byte destination ethernet address
tpitag protocol identifier
prioritypriority
cficanonical format indicator
vlan_idvlan identifier
len_protolength (802.3) protocol (Ethernet II)
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_802_1x u_int8_t  eap_ver, libnet_ptag_t libnet_build_802_1x (uint8_t eap_ver,
u_int8_t  eap_type, uint8_t eap_type,
u_int16_t  length, uint16_t length,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an IEEE 802.1x extended authentication protocol header.

Parameters:
- - - - - - - - + +
+

Builds an IEEE 802.1x extended authentication protocol header.

+
Parameters:
+
eap_ver the EAP version
eap_type the EAP type
length frame length
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + +
eap_verthe EAP version
eap_typethe EAP type
lengthframe length
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_802_2 u_int8_t  dsap, libnet_ptag_t libnet_build_802_2 (uint8_t dsap,
u_int8_t  ssap, uint8_t ssap,
u_int8_t  control, uint8_t control,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an IEEE 802.2 LLC header.

Parameters:
- - - - - - - - + +
+

Builds an IEEE 802.2 LLC header.

+
Parameters:
+
dsap destination service access point
ssap source service access point
control control field
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + +
dsapdestination service access point
ssapsource service access point
controlcontrol field
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_802_2snap u_int8_t  dsap, libnet_ptag_t libnet_build_802_2snap (uint8_t dsap,
u_int8_t  ssap, uint8_t ssap,
u_int8_t  control, uint8_t control,
u_int8_t *  oui, uint8_t * oui,
u_int16_t  type, uint16_t type,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an IEEE 802.2 LLC SNAP header.

Parameters:
- - - - - - - - - - + +
+

Builds an IEEE 802.2 LLC SNAP header.

+
Parameters:
+
dsap destination service access point
ssap source service access point
control control field
oui Organizationally Unique Identifier
type upper layer protocol
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + +
dsapdestination service access point
ssapsource service access point
controlcontrol field
ouiOrganizationally Unique Identifier
typeupper layer protocol
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_802_3 u_int8_t *  dst, libnet_ptag_t libnet_build_802_3 (const uint8_t * dst,
u_int8_t *  src, const uint8_t * src,
u_int16_t  len, uint16_t len,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an IEEE 802.3 header. The 802.3 header is almost identical to the RFC 894 Ethernet II header, the exception being that the field immediately following the source address holds the frame's length (as opposed to the layer 3 protocol). You should only use this function when libnet is initialized with the LIBNET_LINK interface.

Parameters:
- - - - - - - - + +
+

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.

+
Parameters:
+
dst destination ethernet address
src source ethernet address
len frame length sans header
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + +
dstdestination ethernet address
srcsource ethernet address
lenframe length sans header
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_arp u_int16_t  hrd, libnet_ptag_t libnet_build_arp (uint16_t hrd,
u_int16_t  pro, uint16_t pro,
u_int8_t  hln, uint8_t hln,
u_int8_t  pln, uint8_t pln,
u_int16_t  op, uint16_t op,
u_int8_t *  sha, const uint8_t * sha,
u_int8_t *  spa, const uint8_t * spa,
u_int8_t *  tha, const uint8_t * tha,
u_int8_t *  tpa, const uint8_t * tpa,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an Address Resolution Protocol (ARP) header. Depending on the op value, the function builds one of several different types of RFC 826 or RFC 903 RARP packets.

Parameters:
- - - - - - - - - - - - - - + +
+

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.

+
Parameters:
+
hrd hardware address format
pro protocol address format
hln hardware address length
pln protocol address length
op ARP operation type
sha sender's hardware address
spa sender's protocol address
tha target hardware address
tpa targer protocol address
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + + + + +
hrdhardware address format
proprotocol address format
hlnhardware address length
plnprotocol address length
opARP operation type
shasender's hardware address
spasender's protocol address
thatarget hardware address
tpatarger protocol address
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_bgp4_header u_int8_t  marker[LIBNET_BGP4_MARKER_SIZE], libnet_ptag_t libnet_build_bgp4_header (uint8_t marker[LIBNET_BGP4_MARKER_SIZE],
u_int16_t  len, uint16_t len,
u_int8_t  type, uint8_t type,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) header. The primary function of a BGP speaking system is to exchange network reachability information with other BGP systems. This network reachability information includes information on the list of Autonomous Systems (ASs) that reachability information traverses. This information is sufficient to construct a graph of AS connectivity from which routing loops may be pruned and some policy decisions at the AS level may be enforced. This function builds the base BGP header which is used as a preamble before any other BGP header. For example, a BGP KEEPALIVE message may be built with only this function, while an error notification requires a subsequent call to libnet_build_bgp4_notification.

Parameters:
- - - - - - - - + +
+

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.

+
Parameters:
+
marker 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)
len total length of the BGP message, including the header
type type code of the message (OPEN, UPDATE, NOTIFICATION or KEEPALIVE)
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + +
markera 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)
lentotal length of the BGP message, including the header
typetype code of the message (OPEN, UPDATE, NOTIFICATION or KEEPALIVE)
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_bgp4_notification u_int8_t  err_code, libnet_ptag_t libnet_build_bgp4_notification (uint8_t err_code,
u_int8_t  err_subcode, uint8_t err_subcode,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) notification header. A NOTIFICATION message is sent when an error condition is detected. Specific error information may be passed through the payload interface.

Parameters:
- - - - - - - + +
+

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.

+
Parameters:
+
err_code type of notification
err_subcode more specific information about the reported error.
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + +
err_codetype of notification
err_subcodemore specific information about the reported error.
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_bgp4_open u_int8_t  version, libnet_ptag_t libnet_build_bgp4_open (uint8_t version,
u_int16_t  src_as, uint16_t src_as,
u_int16_t  hold_time, uint16_t hold_time,
u_int32_t  bgp_id, uint32_t bgp_id,
u_int8_t  opt_len, uint8_t opt_len,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) OPEN header. This is the first message sent by each side of a BGP connection. The optional parameters options should be constructed using the payload interface (see RFC 1771 for the options structures).

Parameters:
- - - - - - - - - - + +
+

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).

+
Parameters:
+
version protocol version (should be set to 4)
src_as Autonomous System of the sender
hold_time used to compute the maximum allowed time between the receipt of KEEPALIVE, and/or UPDATE messages by the sender
bgp_id BGP identifier of the sender
opt_len total length of the optional parameters field in bytes
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + +
versionprotocol version (should be set to 4)
src_asAutonomous System of the sender
hold_timeused to compute the maximum allowed time between the receipt of KEEPALIVE, and/or UPDATE messages by the sender
bgp_idBGP identifier of the sender
opt_lentotal length of the optional parameters field in bytes
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_bgp4_update u_int16_t  unfeasible_rt_len, libnet_ptag_t libnet_build_bgp4_update (uint16_t unfeasible_rt_len,
u_int8_t *  withdrawn_rt, const uint8_t * withdrawn_rt,
u_int16_t  total_path_attr_len, uint16_t total_path_attr_len,
u_int8_t *  path_attributes, const uint8_t * path_attributes,
u_int16_t  info_len, uint16_t info_len,
u_int8_t *  reachability_info, uint8_t * reachability_info,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) update header. Update messages are used to transfer routing information between BGP peers.

Parameters:
- - - - - - - - - - - + +
+

Builds an RFC 1771 Border Gateway Protocol 4 (BGP-4) update header. Update messages are used to transfer routing information between BGP peers.

+
Parameters:
+
unfeasible_rt_len indicates the length of the (next) "withdrawn routes" field in bytes
withdrawn_rt 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)>
total_path_attr_len indicates the length of the (next) "path attributes" field in bytes
path_attributes each attribute is a 3-tuple <type (2 bytes), length, value>
info_len indicates the length of the (next) "network layer reachability information" field in bytes (needed for internal memory size calculation)
reachability_info 2-tuples <length (1 byte), prefix (variable)>.
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + +
unfeasible_rt_lenindicates the length of the (next) "withdrawn routes" field in bytes
withdrawn_rtlist 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)>
total_path_attr_lenindicates the length of the (next) "path attributes" field in bytes
path_attributeseach attribute is a 3-tuple <type (2 bytes), length, value>
info_lenindicates the length of the (next) "network layer reachability information" field in bytes (needed for internal memory size calculation)
reachability_info2-tuples <length (1 byte), prefix (variable)>.
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_bootpv4 u_int8_t  opcode, libnet_ptag_t libnet_build_bootpv4 (uint8_t opcode,
u_int8_t  htype, uint8_t htype,
u_int8_t  hlen, uint8_t hlen,
u_int8_t  hopcount, uint8_t hopcount,
u_int32_t  xid, uint32_t xid,
u_int16_t  secs, uint16_t secs,
u_int16_t  flags, uint16_t flags,
u_int32_t  cip, uint32_t cip,
u_int32_t  yip, uint32_t yip,
u_int32_t  sip, uint32_t sip,
u_int32_t  gip, uint32_t gip,
u_int8_t *  chaddr, const uint8_t * chaddr,
u_int8_t *  sname, const char * sname,
u_int8_t *  file, const char * file,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-

Parameters:
- - - - - + +
+
Parameters:
+
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + + + + + + + + + +
opcode
htype
hlen
hopcount
xid
secs
flags
cip
yip
sip
gip
chaddrclient hardware address, length is hlen
snameserver host name, a null terminated string
fileboot file name, a null terminated string
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_cdp u_int8_t  version, libnet_ptag_t libnet_build_cdp (uint8_t version,
u_int8_t  ttl, uint8_t ttl,
u_int16_t  sum, uint16_t sum,
u_int16_t  type, uint16_t type,
u_int16_t  len, uint16_t value_s,
u_int8_t *  value, const uint8_t * value,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds a Cisco Discovery Protocol (CDP) header. Cisco Systems designed CDP to aid in the network management of adjacent Cisco devices. The CDP protocol specifies data by using a type/length/value (TLV) setup. The first TLV can specified by using the functions type, length, and value arguments. To specify additional TLVs, the programmer could either use the payload interface or libnet_build_data() to construct them.

Parameters:
- - - - - - - - - - - + +
+

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 libnet_build_data() to construct them.

+
Parameters:
+
version CDP version
ttl time to live (time information should be cached by recipient)
sum checksum (0 for libnet to autofill)
type type of data contained in value
len length of value arugment
value the CDP information string
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + +
versionCDP version
ttltime to live (time information should be cached by recipient)
sumchecksum (0 for libnet to autofill)
typetype of data contained in value
value_slength of value argument
valuethe CDP information string
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_data u_int8_t *  payload, libnet_ptag_t libnet_build_data (const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds a generic libnet protocol header. This is useful for including an optional payload to a packet that might need to change repeatedly inside of a loop.

Parameters:
- - - - - + +
+

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).

+
Parameters:
+
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + +
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_dhcpv4 u_int8_t  opcode, libnet_ptag_t libnet_build_dhcpv4 (uint8_t opcode,
u_int8_t  htype, uint8_t htype,
u_int8_t  hlen, uint8_t hlen,
u_int8_t  hopcount, uint8_t hopcount,
u_int32_t  xid, uint32_t xid,
u_int16_t  secs, uint16_t secs,
u_int16_t  flags, uint16_t flags,
u_int32_t  cip, uint32_t cip,
u_int32_t  yip, uint32_t yip,
u_int32_t  sip, uint32_t sip,
u_int32_t  gip, uint32_t gip,
u_int8_t *  chaddr, const uint8_t * chaddr,
u_int8_t *  sname, const char * sname,
u_int8_t *  file, const char * file,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-

Parameters:
- - - - - + +
+
Parameters:
+
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + + + + + + + + + +
opcode
htype
hlen
hopcount
xid
secs
flags
cip
yip
sip
gip
chaddrclient hardware address, length is hlen
snameserver host name, a null terminated string
fileboot file name, a null terminated string
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_dnsv4 u_int16_t  h_len, libnet_ptag_t libnet_build_dnsv4 (uint16_t h_len,
u_int16_t  id, uint16_t id,
u_int16_t  flags, uint16_t flags,
u_int16_t  num_q, uint16_t num_q,
u_int16_t  num_anws_rr, uint16_t num_anws_rr,
u_int16_t  num_auth_rr, uint16_t num_auth_rr,
u_int16_t  num_addi_rr, uint16_t num_addi_rr,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an RFC 1035 version 4 DNS header. Additional DNS payload information should be specified using the payload interface.

Parameters:
- - - - - - - - - - - + +
+

Builds an RFC 1035 version 4 DNS header. Additional DNS payload information should be specified using the payload interface.

+
Parameters:
+
id DNS packet id
flags control flags
num_q number of questions
num_anws_rr number of answer resource records
num_auth_rr number of authority resource records
num_addi_rr number of additional resource records
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + + +
h_len
idDNS packet id
flagscontrol flags
num_qnumber of questions
num_anws_rrnumber of answer resource records
num_auth_rrnumber of authority resource records
num_addi_rrnumber of additional resource records
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_egre u_int16_t  fv, libnet_ptag_t libnet_build_egre (uint16_t fv,
u_int16_t  type, uint16_t type,
u_int16_t  sum, uint16_t sum,
u_int16_t  offset, uint16_t offset,
u_int32_t  key, uint32_t key,
u_int32_t  seq, uint32_t seq,
u_int16_t  len, uint16_t len,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Generic Routing Encapsulation (GRE - RFC 1701) is used to encapsulate any protocol. Hence, the IP part of the packet is usually referred as "delivery header". It is then followed by the GRE header and finally the encapsulated packet (IP or whatever). As GRE is very modular, the first GRE header describes the structure of the header, using bits and flag to specify which fields will be present in the header.

Parameters:
- - - - - - - - - - - - + +
+

Generic Routing Encapsulation (GRE - RFC 1701) is used to encapsulate any protocol. Hence, the IP part of the packet is usually referred as "delivery + header". It is then followed by the GRE header and finally the encapsulated packet (IP or whatever). As GRE is very modular, the first GRE header describes the structure of the header, using bits and flag to specify which fields will be present in the header.

+
Parameters:
+
fv 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.
payload optional payload or NULL
type which protocol is encapsulated (PPP, IP, ...)
sum checksum (0 for libnet to autofill).
offset byte offset from the start of the routing field to the first byte of the SRE
key inserted by the encapsulator to authenticate the source
seq sequence number used by the receiver to sort the packets
len size of the GRE packet
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + + +
fvthe 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.
typewhich protocol is encapsulated (PPP, IP, ...)
sumchecksum (0 for libnet to autofill).
offsetbyte offset from the start of the routing field to the first byte of the SRE
keyinserted by the encapsulator to authenticate the source
seqsequence number used by the receiver to sort the packets
lensize of the GRE packet
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_ethernet u_int8_t *  dst, libnet_ptag_t libnet_build_ethernet (const uint8_t * dst,
u_int8_t *  src, const uint8_t * src,
u_int16_t  type, uint16_t type,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an Ethernet header. The RFC 894 Ethernet II header is almost identical to the IEEE 802.3 header, with the exception that the field immediately following the source address holds the layer 3 protocol (as opposed to frame's length). You should only use this function when libnet is initialized with the LIBNET_LINK interface.

Parameters:
- - - - - - - - + +
+

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.

+
Parameters:
+
dst destination ethernet address
src source ethernet address
type upper layer protocol type
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + +
dstdestination ethernet address
srcsource ethernet address
typeupper layer protocol type
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_fddi u_int8_t  fc, libnet_ptag_t libnet_build_fddi (uint8_t fc,
u_int8_t *  dst, const uint8_t * dst,
u_int8_t *  src, const uint8_t * src,
u_int8_t  dsap, uint8_t dsap,
u_int8_t  ssap, uint8_t ssap,
u_int8_t  cf, uint8_t cf,
u_int8_t *  org, const uint8_t * oui,
u_int16_t  type, uint16_t type,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds a Fiber Distributed Data Interface (FDDI) header.

Parameters:
- - - - - - - - - - - + +
+

Builds a Fiber Distributed Data Interface (FDDI) header.

+
Parameters:
+
fc class format and priority dst destination fddi address src source fddi address
dsap destination service access point
ssap source service access point
cf cf
org 3 byte IEEE organizational code
type upper layer protocol
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + + + +
fcclass format and priority
dstdestination fddi address
srcsource fddi address
dsapdestination service access point
ssapsource service access point
cfcf
oui3 byte IEEE organizational code
typeupper layer protocol
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_gre u_int16_t  fv, libnet_ptag_t libnet_build_gre (uint16_t fv,
u_int16_t  type, uint16_t type,
u_int16_t  sum, uint16_t sum,
u_int16_t  offset, uint16_t offset,
u_int32_t  key, uint32_t key,
u_int32_t  seq, uint32_t seq,
u_int16_t  len, uint16_t len,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Generic Routing Encapsulation (GRE - RFC 1701) is used to encapsulate any protocol. Hence, the IP part of the packet is usually referred as "delivery header". It is then followed by the GRE header and finally the encapsulated packet (IP or whatever). As GRE is very modular, the first GRE header describes the structure of the header, using bits and flag to specify which fields will be present in the header.

Parameters:
- - - - - - - - - - - - + +
+

Generic Routing Encapsulation (GRE - RFC 1701) is used to encapsulate any protocol. Hence, the IP part of the packet is usually referred as "delivery + header". It is then followed by the GRE header and finally the encapsulated packet (IP or whatever). As GRE is very modular, the first GRE header describes the structure of the header, using bits and flag to specify which fields will be present in the header.

+
Parameters:
+
fv 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.
payload optional payload or NULL
type which protocol is encapsulated (PPP, IP, ...)
sum checksum (0 for libnet to autofill).
offset byte offset from the start of the routing field to the first byte of the SRE
key inserted by the encapsulator to authenticate the source
seq sequence number used by the receiver to sort the packets
len size of the GRE packet
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + + +
fvthe 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.
typewhich protocol is encapsulated (PPP, IP, ...)
sumchecksum (0 for libnet to autofill).
offsetbyte offset from the start of the routing field to the first byte of the SRE
keyinserted by the encapsulator to authenticate the source
seqsequence number used by the receiver to sort the packets
lensize of the GRE packet
payload
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + - - + + -
libnet_ptag_t libnet_build_gre_last_sre libnet_t *  l, libnet_ptag_t libnet_build_gre_last_sre (libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-

Parameters:
- - - - - + +
+
Parameters:
+
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ +
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_gre_sre u_int16_t  af, libnet_ptag_t libnet_build_gre_sre (uint16_t af,
u_int8_t  offset, uint8_t offset,
u_int8_t  length, uint8_t length,
u_int8_t *  routing, uint8_t * routing,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-

Parameters:
- - - - - + +
+
Parameters:
+
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + +
af
offset
length
routing
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + + + + + + - - + + + + + + + + - - + + + + + + + + - - + + + + + + + + - - + + + + + + + + - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_icmpv4_echo u_int8_t  type, libnet_ptag_t libnet_build_hsrp (uint8_t version,
uint8_t opcode,
u_int8_t  code, uint8_t state,
uint8_t hello_time,
u_int16_t  sum, uint8_t hold_time,
uint8_t priority,
u_int16_t  id, uint8_t group,
uint8_t reserved,
u_int16_t  seq, uint8_t authdata[HSRP_AUTHDATA_LENGTH],
uint32_t virtual_ip,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) echo request/reply header

Parameters:
- - - - - - - - - - + +
+

Builds a HSRP header. HSRP is a Cisco propietary protocol defined in RFC 2281

+
Parameters:
+
type type of ICMP packet (should be ICMP_ECHOREPLY or ICMP_ECHO)
code code of ICMP packet (should be 0)
sum checksum (0 for libnet to autofill)
id identification number
seq packet sequence number
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + + + + + +
versionversion of the HSRP messages
opcodetype of message
statecurrent state of the router
hello_timeperiod in seconds between hello messages
hold_timeseconds that the current hello message is valid
prioritypriority for the election proccess
groupstandby group
reservedreserved field
authdatapassword
virtual_ipvirtual ip address
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + + + + + + - - + + + + + + + + - - + + + + + + + + - - + + + + + + + + - - + + + + + +
libnet_ptag_t libnet_build_icmpv4_mask u_int8_t  type, libnet_ptag_t libnet_build_icmpv4_echo (uint8_t type,
uint8_t code,
u_int8_t  code, uint16_t sum,
uint16_t id,
u_int16_t  sum, uint16_t seq,
const uint8_t * payload,
u_int16_t  id, uint32_t payload_s,
libnet_t * l,
u_int16_t  seq, libnet_ptag_t ptag 
)
+ +
+

Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) echo request/reply header

+
Parameters:
+ + + + + + + + + + +
typetype of ICMP packet (should be ICMP_ECHOREPLY or ICMP_ECHO)
codecode of ICMP packet (should be 0)
sumchecksum (0 for libnet to autofill)
ididentification number
seqpacket sequence number
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
+
+
Returns:
protocol tag value on success, -1 on error
+ +
+ + +
+
+ + + + + + + + + - - + + + + + + + + - - + + + + + + + + - - + + + + + + + + - - + + + + + + + + - - + + - - + + -
libnet_ptag_t libnet_build_icmpv4_mask (uint8_t type,
u_int32_t  mask, uint8_t code,
uint16_t sum,
u_int8_t *  payload, uint16_t id,
uint16_t seq,
u_int32_t  payload_s, uint32_t mask,
const uint8_t * payload,
libnet_t *  l, uint32_t payload_s,
libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) IP netmask request/reply header.

Parameters:
- - - - - - - - - - - + +
+

Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) IP netmask request/reply header.

+
Parameters:
+
type type of ICMP packet (should be ICMP_MASKREQ or ICMP_MASKREPLY)
code code of ICMP packet (should be 0)
sum checksum (0 for libnet to autofill)
id identification number
seq packet sequence number
mask subnet mask
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + +
typetype of ICMP packet (should be ICMP_MASKREQ or ICMP_MASKREPLY)
codecode of ICMP packet (should be 0)
sumchecksum (0 for libnet to autofill)
ididentification number
seqpacket sequence number
masksubnet mask
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - - + + +
libnet_ptag_t libnet_build_icmpv4_redirect u_int8_t  type, libnet_ptag_t libnet_build_icmpv4_redirect (uint8_t type,
u_int8_t  code, uint8_t code,
u_int16_t  sum, uint16_t sum,
u_int32_t  gateway, uint32_t gateway,
u_int16_t  orig_len, const uint8_t * payload,
u_int8_t  orig_tos, uint32_t payload_s,
u_int16_t  orig_id, libnet_t * l,
u_int16_t  orig_frag, libnet_ptag_t ptag 
u_int8_t  orig_ttl, )
+ +
+

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 libnet_build_ipv4().

+
Parameters:
+ + + + + + + + + +
typetype of ICMP packet (should be ICMP_REDIRECT)
codecode of ICMP packet (should be one of the four redirect codes)
sumchecksum (0 for libnet to autofill)
gateway
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
+
+
Returns:
protocol tag value on success, -1 on error
+ +
+ + +
+
+ - - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - - + + - - - - - -
u_int8_t  orig_prot, libnet_ptag_t libnet_build_icmpv4_timeexceed (uint8_t type,
u_int16_t  orig_check, uint8_t code,
u_int32_t  orig_src, uint16_t sum,
u_int32_t  orig_dst, const uint8_t * payload,
u_int8_t *  payload, uint32_t payload_s,
u_int32_t  payload_s, libnet_t * l,
libnet_t *  l, libnet_ptag_t ptag 
libnet_ptag_t  ptag)
-
- - - - - -
-   - - -

-Builds an IP version 4 RFC 792 Internet Message Control Protocol (ICMP) redirect header. The additional arguments enable the application programmer to easily specify the original IP header values (the IP header of the packet that supposedly caused the ICMP redirect message in the first place).

Parameters:
- - - - - - - - - - - - - - - + +
+

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 libnet_build_ipv4().

+
Parameters:
+
type type of ICMP packet (should be ICMP_REDIRECT)
code code of ICMP packet (should be one of the four redirect codes)
sum checksum (0 for libnet to autofill)
orig_id original IP header identification
orig_frag original IP header fragmentation information
orig_ttl orginal IP header time to live
orig_prot original IP header protocol
orig_check original IP header checksum
orig_src original IP header source address
orig_dst original IP header destination address
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + +
typetype of ICMP packet (should be ICMP_TIMXCEED)
codecode of ICMP packet (ICMP_TIMXCEED_INTRANS / ICMP_TIMXCEED_REASS)
sumchecksum (0 for libnet to autofill)
payloadoptional payload or NULL
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + + + + + + - - + + + + + + + + - - + + + + + + + + - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - - + + +
libnet_ptag_t libnet_build_icmpv4_timeexceed u_int8_t  type, libnet_ptag_t libnet_build_icmpv4_timestamp (uint8_t type,
uint8_t code,
u_int8_t  code, uint16_t sum,
uint16_t id,
u_int16_t  sum, uint16_t seq,
uint32_t otime,
u_int16_t  orig_len, uint32_t rtime,
u_int8_t  orig_tos, uint32_t ttime,
u_int16_t  orig_id, const uint8_t * payload,
u_int16_t  orig_frag, uint32_t payload_s,
u_int8_t  orig_ttl, libnet_t * l,
u_int8_t  orig_prot, libnet_ptag_t ptag 
u_int16_t  orig_check, )
+ +
+

Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) timestamp request/reply header.

+
Parameters:
+ + + + + + + + + + + + + +
typetype of ICMP packet (should be ICMP_TSTAMP or ICMP_TSTAMPREPLY)
codecode of ICMP packet (should be 0)
sumchecksum (0 for libnet to autofill)
ididentification number
seqsequence number
otimeoriginate timestamp
rtimereceive timestamp
ttimetransmit timestamp
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
+
+
Returns:
protocol tag value on success, -1 on error
+ +
+ + +
+
+ + + + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_icmpv4_unreach (uint8_t type,
u_int32_t  orig_src, uint8_t code,
u_int32_t  orig_dst, uint16_t sum,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) time exceeded header. The additional arguments enable the application programmer to easily specify the original IPv4 header values (the IP header of the packet that supposedly caused the ICMP time exceeded message in the first place).

Parameters:
- - - - - - - - - - - - - - - - + +
+

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 libnet_build_ipv4().

+
Parameters:
+
type type of ICMP packet (should be ICMP_TIMXCEED)
code code of ICMP packet (ICMP_TIMXCEED_INTRANS / ICMP_TIMXCEED_REASS)
sum checksum (0 for libnet to autofill)
orig_id original IP header identification
orig_frag original IP header fragmentation information
orig_ttl orginal IP header time to live
orig_prot original IP header protocol
orig_check original IP header checksum
orig_src original IP header source address
orig_dst original IP header destination address
payload optional payload or NULL
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + +
typetype of ICMP packet (should be ICMP_UNREACH)
codecode of ICMP packet (should be one of the 16 unreachable codes)
sumchecksum (0 for libnet to autofill)
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + + + + + + - - + + + + + + + + - - + + + + + + + + - - + + + + + + + + - - + + + + + +
libnet_ptag_t libnet_build_icmpv4_timestamp u_int8_t  type, libnet_ptag_t libnet_build_icmpv6_echo (uint8_t type,
uint8_t code,
u_int8_t  code, uint16_t sum,
uint16_t id,
u_int16_t  sum, uint16_t seq,
uint8_t * payload,
u_int16_t  id, uint32_t payload_s,
libnet_t * l,
u_int16_t  seq, libnet_ptag_t ptag 
)
+ +
+

Builds an IP version 6 RFC 4443 Internet Control Message Protocol (ICMP) echo or echo reply header.

+
Parameters:
+ + + + + + + + + + +
typetype of ICMP packet (should be ICMP6_ECHO_REQUEST or ICMP6_ECHO_REPLY)
codecode of ICMP packet (should be zero)
sumchecksum (0 for libnet to autofill)
idecho id number
seqecho sequence number
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
+
+
Returns:
protocol tag value on success, -1 on error
+ +
+ + +
+
+ + + + + + + + + - - + + + + + + + + - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_icmpv6_ndp_nadv (uint8_t type,
n_time  otime, uint8_t code,
uint16_t sum,
n_time  rtime, uint32_t flags,
n_time  ttime, struct libnet_in6_addr target,
u_int8_t *  payload, uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) timestamp request/reply header.

Parameters:
- - - - - - - - - - - - - + +
+

Builds an IP version 6 RFC 2461 Internet Control Message Protocol (ICMP) NDP neighbour advertisement header. Could be used with libnet_build_icmpv6_ndp_opt() and ND_OPT_TARGET_LINKADDR.

+
Parameters:
+
type type of ICMP packet (should be ICMP_TSTAMP or ICMP_TSTAMPREPLY)
code code of ICMP packet (should be 0)
sum checksum (0 for libnet to autofill)
id identification number
seq sequence number
otime originate timestamp
rtime receive timestamp
ttime transmit timestamp
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + +
typetype of ICMP packet (should be ND_NEIGHBOR_ADVERT)
codecode of ICMP packet (should be zero)
sumchecksum (0 for libnet to autofill)
flagsshould be a bitwise or of any applicable ND_NA_FLAG_* flags
targettarget ipv6 address
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + + + + + + - - + + + + + + + + - - + + + + + + + + - - + + + + + + + - - + + +
libnet_ptag_t libnet_build_icmpv4_unreach u_int8_t  type, libnet_ptag_t libnet_build_icmpv6_ndp_nsol (uint8_t type,
uint8_t code,
u_int8_t  code, uint16_t sum,
struct libnet_in6_addr target,
u_int16_t  sum, uint8_t * payload,
uint32_t payload_s,
u_int16_t  orig_len, libnet_t * l,
libnet_ptag_t ptag 
u_int8_t  orig_tos, )
+ +
+

Builds an IP version 6 RFC 2461 Internet Control Message Protocol (ICMP) NDP neighbour solicitation header. Could be used with libnet_build_icmpv6_ndp_opt() and ICMPV6_NDP_OPT_SLLA.

+
Parameters:
+ + + + + + + + + +
typetype of ICMP packet (should be ND_NEIGHBOR_SOLICIT)
codecode of ICMP packet (should be zero)
sumchecksum (0 for libnet to autofill)
targettarget ipv6 address
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
+
+
Returns:
protocol tag value on success, -1 on error
+ +
+ + +
+
+ + + + + + + + - - - + + + - - - + + + - - - + + + - - - + + - - - + + +
libnet_ptag_t libnet_build_icmpv6_ndp_opt (uint8_t type,
u_int16_t  orig_id, uint8_t * option,
u_int16_t  orig_frag, uint32_t option_s,
u_int8_t  orig_ttl, libnet_t * l,
u_int8_t  orig_prot, libnet_ptag_t ptag 
u_int16_t  orig_check, )
+
+
+

Builds ICMPv6 NDP options.

+
Parameters:
+ + + + + + +
typeone of ND_OPT_* types
optionoption data
option_ssize of option data (will be padded out to an 8-byte boundary)
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
+
+
Returns:
protocol tag value on success, -1 on error
+ +
+
+ +
+
+ + + + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_icmpv6_unreach (uint8_t type,
u_int32_t  orig_src, uint8_t code,
u_int32_t  orig_dst, uint16_t sum,
u_int8_t *  payload, uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an IP version 4 RFC 792 Internet Control Message Protocol (ICMP) unreachable header. The additional arguments enable the application programmer to easily specify the original IPv4 header values (the IP header of the packet that supposedly caused the ICMP unreachable message in the first place).

Parameters:
- - - - - - - - - - - - - - - + +
+

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 libnet_build_ipv6().

+
Parameters:
+
type type of ICMP packet (should be ICMP_UNREACH)
code code of ICMP packet (should be one of the 16 unreachable codes)
sum checksum (0 for libnet to autofill)
orig_id original IP header identification
orig_frag original IP header fragmentation information
orig_ttl orginal IP header time to live
orig_prot original IP header protocol
orig_check original IP header checksum
orig_src original IP header source address
orig_dst original IP header destination address
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + +
typetype of ICMP packet (should be ICMP6_DST_UNREACH)
codecode of ICMP packet (should be one of the 5 ICMP6_DST_UNREACH_* codes)
sumchecksum (0 for libnet to autofill)
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_igmp u_int8_t  type, libnet_ptag_t libnet_build_igmp (uint8_t type,
u_int8_t  code, uint8_t reserved,
u_int16_t  sum, uint16_t sum,
u_int32_t  ip, uint32_t ip,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an RFC 1112 Internet Group Memebership Protocol (IGMP) header.

Parameters:
- - - - - - - - - + +
+

Builds an RFC 1112 Internet Group Memebership Protocol (IGMP) header.

+
Parameters:
+
type packet type
code packet code (should be 0)
sum checksum (0 for libnet to autofill)
ip IPv4 address
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + +
typepacket type
reserved(should be 0 for IGMPv1)
sumchecksum (0 for libnet to autofill)
ipIPv4 address (in standard/network byte order)
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+
Note:
'reserved' was previously called 'code', which it is not, in any IGMP version.
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_ipsec_ah u_int8_t  nh, libnet_ptag_t libnet_build_ipsec_ah (uint8_t nh,
u_int8_t  len, uint8_t len,
u_int16_t  res, uint16_t res,
u_int32_t  spi, uint32_t spi,
u_int32_t  seq, uint32_t seq,
u_int32_t  auth, uint32_t auth,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an Internet Protocol Security Authentication header.

Parameters:
- - - - - - - - - - - + +
+

Builds an Internet Protocol Security Authentication header.

+
Parameters:
+
nh next header
len payload length
res reserved
spi security parameter index
seq sequence number
auth authentication data
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + +
nhnext header
lenpayload length
resreserved
spisecurity parameter index
seqsequence number
authauthentication data
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_ipsec_esp_ftr u_int8_t  len, libnet_ptag_t libnet_build_ipsec_esp_ftr (uint8_t len,
u_int8_t  nh, uint8_t nh,
int8_t *  auth, int8_t * auth,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an Internet Protocol Security Encapsulating Security Payload footer.

Parameters:
- - - - - - - - + +
+

Builds an Internet Protocol Security Encapsulating Security Payload footer.

+
Parameters:
+
len padding length
nh next header
auth authentication data
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + +
lenpadding length
nhnext header
authauthentication data
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_ipsec_esp_hdr u_int32_t  spi, libnet_ptag_t libnet_build_ipsec_esp_hdr (uint32_t spi,
u_int32_t  seq, uint32_t seq,
u_int32_t  iv, uint32_t iv,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an Internet Protocol Security Encapsulating Security Payload header.

Parameters:
- - - - - - - - + +
+

Builds an Internet Protocol Security Encapsulating Security Payload header.

+
Parameters:
+
spi security parameter index
seq ESP sequence number
iv initialization vector
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + +
spisecurity parameter index
seqESP sequence number
ivinitialization vector
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_ipv4 u_int16_t  len, libnet_ptag_t libnet_build_ipv4 (uint16_t ip_len,
u_int8_t  tos, uint8_t tos,
u_int16_t  id, uint16_t id,
u_int16_t  frag, uint16_t frag,
u_int8_t  ttl, uint8_t ttl,
u_int8_t  prot, uint8_t prot,
u_int16_t  sum, uint16_t sum,
u_int32_t  src, uint32_t src,
u_int32_t  dst, uint32_t dst,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds a version 4 RFC 791 Internet Protocol (IP) header.

Parameters:
- - - - - - - - - - - - - - + +
+

Builds a version 4 RFC 791 Internet Protocol (IP) header.

+
Parameters:
+
len total length of the IP packet including all subsequent data
tos type of service bits
id IP identification number
frag fragmentation bits and offset
ttl time to live in the network
prot upper layer protocol
sum checksum (0 for libnet to autofill)
src source IPv4 address (little endian)
dst destination IPv4 address (little endian)
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + + + + +
ip_lentotal length of the IP packet including all subsequent data (subsequent data includes any IP options and IP options padding)
tostype of service bits
idIP identification number
fragfragmentation bits and offset
ttltime to live in the network
protupper layer protocol
sumchecksum (0 for libnet to autofill)
srcsource IPv4 address (little endian)
dstdestination IPv4 address (little endian)
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_ipv4_options u_int8_t *  options, libnet_ptag_t libnet_build_ipv4_options (const uint8_t * options,
u_int32_t  options_s, uint32_t options_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an version 4 Internet Protocol (IP) options header. The function expects options to be a valid IP options string of size options_s, no larger than 40 bytes (the maximum size of an options string). The function checks to make sure that the preceding header is an IPv4 header and that 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 IP header length value as necessary.

Parameters:
- - - - - + +
+

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).

+

When building a chain, the options must be built, then the IPv4 header.

+

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.

+
Parameters:
+
options byte string of IP options
options_s length of options string
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + +
optionsbyte string of IP options (it will be padded up to be an integral multiple of 32-bit words).
options_slength of options string
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_ipv6 u_int8_t  tc, libnet_ptag_t libnet_build_ipv6 (uint8_t tc,
u_int32_t  fl, uint32_t fl,
u_int16_t  len, uint16_t len,
u_int8_t  nh, uint8_t nh,
u_int8_t  hl, uint8_t hl,
struct libnet_in6_addr  src, struct libnet_in6_addr src,
struct libnet_in6_addr  dst, struct libnet_in6_addr dst,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds a version 6 RFC 2460 Internet Protocol (IP) header.

Parameters:
- - - - - - - - - - - - + +
+

Builds a version 6 RFC 2460 Internet Protocol (IP) header.

+
Parameters:
+
tc traffic class
fl flow label
len total length of the IP packet
nh next header
hl hop limit
src source IPv6 address
dst destination IPv6 address
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + + +
tctraffic class
flflow label
lentotal length of the IP packet
nhnext header
hlhop limit
srcsource IPv6 address
dstdestination IPv6 address
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_ipv6_destopts u_int8_t  nh, libnet_ptag_t libnet_build_ipv6_destopts (uint8_t nh,
u_int8_t  len, uint8_t len,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds a version 6 RFC 2460 Internet Protocol (IP) destination options header. This function is special in that it uses the payload interface to include the options data. The application programmer will build an IPv6 options byte string and pass it to the function using the payload interface.

Parameters:
- - - - - - - + +
+

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.

+
Parameters:
+
nh next header
len length of the header in 8-byte octets not including the first 8 octets
payload options payload
payload_s payload length
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + +
nhnext header
lenlength of the header in 8-byte octets not including the first 8 octets
payloadoptions payload
payload_spayload length
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_ipv6_frag u_int8_t  nh, libnet_ptag_t libnet_build_ipv6_frag (uint8_t nh,
u_int8_t  reserved, uint8_t reserved,
u_int16_t  frag, uint16_t frag,
u_int32_t  id, uint32_t id,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds a version 6 RFC 2460 Internet Protocol (IP) fragmentation header.

Parameters:
- - - - - - - - - + +
+

Builds a version 6 RFC 2460 Internet Protocol (IP) fragmentation header.

+
Parameters:
+
nh next header
reserved unused value... OR IS IT!
frag fragmentation bits (ala ipv4)
id packet identification
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + +
nhnext header
reservedunused value... OR IS IT!
fragfragmentation bits (ala ipv4)
idpacket identification
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_ipv6_hbhopts u_int8_t  nh, libnet_ptag_t libnet_build_ipv6_hbhopts (uint8_t nh,
u_int8_t  len, uint8_t len,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds a version 6 RFC 2460 Internet Protocol (IP) hop by hop options header. This function is special in that it uses the payload interface to include the options data. The application programmer will build an IPv6 hop by hop options byte string and pass it to the function using the payload interface.

Parameters:
- - - - - - - + +
+

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.

+
Parameters:
+
nh next header
len length of the header in 8-byte octets not including the first 8 octets
payload options payload
payload_s payload length
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + +
nhnext header
lenlength of the header in 8-byte octets not including the first 8 octets
payloadoptions payload
payload_spayload length
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_ipv6_routing u_int8_t  nh, libnet_ptag_t libnet_build_ipv6_routing (uint8_t nh,
u_int8_t  len, uint8_t len,
u_int8_t  rtype, uint8_t rtype,
u_int8_t  segments, uint8_t segments,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds a version 6 RFC 2460 Internet Protocol (IP) routing header. This function is special in that it uses the payload interface to include the "type-specific data"; that is the routing information. Most often this will be a number of 128-bit IPv6 addresses. The application programmer will build a byte string of IPv6 address and pass them to the function using the payload interface.

Parameters:
- - - - - - - - + +
+

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.

+
Parameters:
+
nh next header
len length of the header in 8-byte octets not including the first 8 octets routing header type
segments number of routing segments that follow
payload optional payload of routing information
payload_s payload length
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + +
nhnext header
lenlength of the header in 8-byte octets not including the first 8 octets
rtyperouting header type
segmentsnumber of routing segments that follow
payloadoptional payload of routing information
payload_spayload length
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_isl u_int8_t *  dhost, libnet_ptag_t libnet_build_isl (uint8_t * dhost,
u_int8_t  type, uint8_t type,
u_int8_t  user, uint8_t user,
u_int8_t *  shost, uint8_t * shost,
u_int16_t  len, uint16_t len,
u_int8_t *  snap, const uint8_t * snap,
u_int16_t  vid, uint16_t vid,
u_int16_t  index, uint16_t portindex,
u_int16_t  reserved, uint16_t reserved,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds a Cisco Inter-Switch Link (ISL) header.

Parameters:
- - - - - - - - - - - - - - + +
+

Builds a Cisco Inter-Switch Link (ISL) header.

+
Parameters:
+
dhost destination address (should be 01:00:0c:00:00)
type type of frame
user user defined data
shost source mac address
len total length of the encapuslated packet less 18 bytes
snap SNAP information (0xaaaa03 + vendor code)
vid 15 bit VLAN ID, 1 bit BPDU or CDP indicator
index port index
reserved used for FDDI and token ring
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + + + + +
dhostdestination address (should be 01:00:0c:00:00)
typetype of frame
useruser defined data
shostsource mac address
lentotal length of the encapuslated packet less 18 bytes
snapSNAP information (0xaaaa03 + vendor code)
vid15 bit VLAN ID, 1 bit BPDU or CDP indicator
portindexport index
reservedused for FDDI and token ring
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_link u_int8_t *  dst, libnet_ptag_t libnet_build_link (const uint8_t * dst,
u_int8_t *  src, const uint8_t * src,
u_int8_t *  oui, const uint8_t * oui,
u_int16_t  type, uint16_t type,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds a link layer header for an initialized l. The function determines the proper link layer header format from how l was initialized. The function current supports Ethernet and Token Ring link layers.

Parameters:
- - - - - - - - - + +
+

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.

+
Parameters:
+
dst the destination MAC address
src the source MAC address
oui Organizationally Unique Identifier (unused for Ethernet)
type the upper layer protocol type
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + +
dstthe destination MAC address
srcthe source MAC address
ouiOrganizationally Unique Identifier (unused for Ethernet)
typethe upper layer protocol type
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_mpls u_int32_t  label, libnet_ptag_t libnet_build_mpls (uint32_t label,
u_int8_t  experimental, uint8_t experimental,
u_int8_t  bos, uint8_t bos,
u_int8_t  ttl, uint8_t ttl,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an RFC 3032 Multi-Protocol Label Switching (MPLS) header.

Parameters:
- - - - - - - - - + +
+

Builds an RFC 3032 Multi-Protocol Label Switching (MPLS) header.

+
Parameters:
+
label 20-bit label value
experimental 3-bit reserved field
bos 1-bit bottom of stack identifier
ttl time to live
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + +
label20-bit label value
experimental3-bit reserved field
bos1-bit bottom of stack identifier
ttltime to live
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_ntp u_int8_t  leap_indicator, libnet_ptag_t libnet_build_ntp (uint8_t leap_indicator,
u_int8_t  version, uint8_t version,
u_int8_t  mode, uint8_t mode,
u_int8_t  stratum, uint8_t stratum,
u_int8_t  poll, uint8_t poll,
u_int8_t  precision, uint8_t precision,
u_int16_t  delay_int, uint16_t delay_int,
u_int16_t  delay_frac, uint16_t delay_frac,
u_int16_t  dispersion_int, uint16_t dispersion_int,
u_int16_t  dispersion_frac, uint16_t dispersion_frac,
u_int32_t  reference_id, uint32_t reference_id,
u_int32_t  ref_ts_int, uint32_t ref_ts_int,
u_int32_t  ref_ts_frac, uint32_t ref_ts_frac,
u_int32_t  orig_ts_int, uint32_t orig_ts_int,
u_int32_t  orig_ts_frac, uint32_t orig_ts_frac,
u_int32_t  rec_ts_int, uint32_t rec_ts_int,
u_int32_t  rec_ts_frac, uint32_t rec_ts_frac,
u_int32_t  xmt_ts_int, uint32_t xmt_ts_int,
u_int32_t  xmt_ts_frac, uint32_t xmt_ts_frac,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an RFC 958 Network Time Protocol (NTP) header.

Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - + +
+

Builds an RFC 958 Network Time Protocol (NTP) header.

+
Parameters:
+
leap_indicator the leap indicator
version NTP protocol version
mode NTP mode
stratum stratum
poll polling interval
precision precision
delay_interval delay interval
delay_frac delay fraction
dispersion_int dispersion interval
dispersion_frac dispersion fraction
reference_id reference id
ref_ts_int reference timestamp integer
ref_ts_frac reference timestamp fraction
orig_ts_int original timestamp integer
orig_ts_frac original timestamp fraction
rec_ts_int receiver timestamp integer
rec_ts_frac reciever timestamp fraction
xmt_ts_int transmit timestamp integer
xmt_ts_frac transmit timestamp integer
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + + + + + + + + + + + + + + +
leap_indicatorthe leap indicator
versionNTP protocol version
modeNTP mode
stratumstratum
pollpolling interval
precisionprecision
delay_intdelay interval
delay_fracdelay fraction
dispersion_intdispersion interval
dispersion_fracdispersion fraction
reference_idreference id
ref_ts_intreference timestamp integer
ref_ts_fracreference timestamp fraction
orig_ts_intoriginal timestamp integer
orig_ts_fracoriginal timestamp fraction
rec_ts_intreceiver timestamp integer
rec_ts_fracreciever timestamp fraction
xmt_ts_inttransmit timestamp integer
xmt_ts_fractransmit timestamp integer
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_ospfv2 u_int16_t  len, libnet_ptag_t libnet_build_ospfv2 (uint16_t len,
u_int8_t  type, uint8_t type,
u_int32_t  rtr_id, uint32_t rtr_id,
u_int32_t  area_id, uint32_t area_id,
u_int16_t  sum, uint16_t sum,
u_int16_t  autype, uint16_t autype,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-

Parameters:
- - - - - + +
+
Parameters:
+
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + +
len
type
rtr_id
area_id
sum
autype
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_ospfv2_dbd u_int16_t  dgram_len, libnet_ptag_t libnet_build_ospfv2_dbd (uint16_t dgram_len,
u_int8_t  opts, uint8_t opts,
u_int8_t  type, uint8_t type,
u_int  seqnum, uint seqnum,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-

Parameters:
- - - - - + +
+
Parameters:
+
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + +
dgram_len
opts
type
seqnum
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - - + + - - - - - -
libnet_ptag_t libnet_build_ospfv2_hello u_int32_t  netmask, libnet_ptag_t libnet_build_ospfv2_hello (uint32_t netmask,
u_int16_t  interval, uint16_t interval,
u_int8_t  opts, uint8_t opts,
u_int8_t  priority, uint8_t priority,
u_int  dead_int, uint dead_int,
u_int32_t  des_rtr, uint32_t des_rtr,
u_int32_t  bkup_rtr, uint32_t bkup_rtr,
u_int32_t  neighbor, const uint8_t * payload,
u_int8_t *  payload, uint32_t payload_s,
u_int32_t  payload_s, libnet_t * l,
libnet_t *  l, libnet_ptag_t ptag 
libnet_ptag_t  ptag)
-
- - - - - -
-   - - -

-

Parameters:
- - - - - + +
+
Parameters:
+
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + + +
netmask
interval
opts
priority
dead_int
des_rtr
bkup_rtr
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_ospfv2_lsa u_int16_t  age, libnet_ptag_t libnet_build_ospfv2_lsa (uint16_t age,
u_int8_t  opts, uint8_t opts,
u_int8_t  type, uint8_t type,
u_int  lsid, uint lsid,
u_int32_t  advrtr, uint32_t advrtr,
u_int  seqnum, uint seqnum,
u_int16_t  sum, uint16_t sum,
u_int16_t  len, uint16_t len,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-

Parameters:
- - - - - + +
+
Parameters:
+
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + + + +
age
opts
type
lsid
advrtr
seqnum
sum
len
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_ospfv2_lsa_as u_int32_t  nmask, libnet_ptag_t libnet_build_ospfv2_lsa_as (uint32_t nmask,
u_int  metric, uint metric,
u_int32_t  fwdaddr, uint32_t fwdaddr,
u_int  tag, uint tag,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-

Parameters:
- - - - - + +
+
Parameters:
+
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + +
nmask
metric
fwdaddr
tag
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_ospfv2_lsa_net u_int32_t  nmask, libnet_ptag_t libnet_build_ospfv2_lsa_net (uint32_t nmask,
u_int  rtrid, uint rtrid,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-

Parameters:
- - - - - + +
+
Parameters:
+
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + +
nmask
rtrid
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_ospfv2_lsa_rtr u_int16_t  flags, libnet_ptag_t libnet_build_ospfv2_lsa_rtr (uint16_t flags,
u_int16_t  num, uint16_t num,
u_int  id, uint id,
u_int  data, uint data,
u_int8_t  type, uint8_t type,
u_int8_t  tos, uint8_t tos,
u_int16_t  metric, uint16_t metric,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-

Parameters:
- - - - - + +
+
Parameters:
+
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + + +
flags
num
id
data
type
tos
metric
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_ospfv2_lsa_sum u_int32_t  nmask, libnet_ptag_t libnet_build_ospfv2_lsa_sum (uint32_t nmask,
u_int  metric, uint metric,
u_int  tos, uint tos,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-

Parameters:
- - - - - + +
+
Parameters:
+
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + +
nmask
metric
tos
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_ospfv2_lsr u_int  type, libnet_ptag_t libnet_build_ospfv2_lsr (uint type,
u_int  lsid, uint lsid,
u_int32_t  advrtr, uint32_t advrtr,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-

Parameters:
- - - - - + +
+
Parameters:
+
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + +
type
lsid
advrtr
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_ospfv2_lsu u_int  num, libnet_ptag_t libnet_build_ospfv2_lsu (uint num,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-

Parameters:
- - - - - + +
+
Parameters:
+
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + +
num
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_rip u_int8_t  cmd, libnet_ptag_t libnet_build_rip (uint8_t cmd,
u_int8_t  version, uint8_t version,
u_int16_t  rd, uint16_t rd,
u_int16_t  af, uint16_t af,
u_int16_t  rt, uint16_t rt,
u_int32_t  addr, uint32_t addr,
u_int32_t  mask, uint32_t mask,
u_int32_t  next_hop, uint32_t next_hop,
u_int32_t  metric, uint32_t metric,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds a Routing Information Protocol header (RFCs 1058 and 2453).

Parameters:
- - - - - - - - - - - - - - + +
+

Builds a Routing Information Protocol header (RFCs 1058 and 2453).

+
Parameters:
+
cmd command
version protocol version
rd version one: 0, version two: routing domain
af address family
rt version one: 0, version two: route tag
addr IPv4 address
mask version one: 0, version two: subnet mask
next_hop version one: 0, version two: next hop address
metric routing metric
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + + + + +
cmdcommand
versionprotocol version
rdversion one: 0, version two: routing domain
afaddress family
rtversion one: 0, version two: route tag
addrIPv4 address
maskversion one: 0, version two: subnet mask
next_hopversion one: 0, version two: next hop address
metricrouting metric
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_rpc_call u_int32_t  rm, libnet_ptag_t libnet_build_rpc_call (uint32_t rm,
u_int32_t  xid, uint32_t xid,
u_int32_t  prog_num, uint32_t prog_num,
u_int32_t  prog_vers, uint32_t prog_vers,
u_int32_t  procedure, uint32_t procedure,
u_int32_t  cflavor, uint32_t cflavor,
u_int32_t  clength, uint32_t clength,
u_int8_t *  cdata, uint8_t * cdata,
u_int32_t  vflavor, uint32_t vflavor,
u_int32_t  vlength, uint32_t vlength,
u_int8_t *  vdata, const uint8_t * vdata,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an Remote Procedure Call (Version 2) Call message header as specified in RFC 1831. This builder provides the option for specifying the record marking which is required when used with streaming protocols (TCP).

Parameters:
- - - - - - - - - - - - - - - - + +
+

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).

+
Parameters:
+
rm record marking indicating the position in a stream, 0 otherwise
xid transaction identifier used to link calls and replies
prog_num remote program specification typically between 0 - 1fffffff
prog_vers remote program version specification
procedure procedure to be performed by remote program
cflavor authentication credential type
clength credential length (should be 0)
cdata opaque credential data (currently unused)
vflavor authentication verifier type
vlength verifier length (should be 0)
vdata opaque verifier data (currently unused)
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + + + + + + +
rmrecord marking indicating the position in a stream, 0 otherwise
xidtransaction identifier used to link calls and replies
prog_numremote program specification typically between 0 - 1fffffff
prog_versremote program version specification
procedureprocedure to be performed by remote program
cflavorauthentication credential type
clengthcredential length (should be 0)
cdataopaque credential data (currently unused)
vflavorauthentication verifier type
vlengthverifier length (should be 0)
vdataopaque verifier data (currently unused)
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_sebek u_int32_t  magic, libnet_ptag_t libnet_build_sebek (uint32_t magic,
u_int16_t  version, uint16_t version,
u_int16_t  type, uint16_t type,
u_int32_t  counter, uint32_t counter,
u_int32_t  time_sec, uint32_t time_sec,
u_int32_t  time_usec, uint32_t time_usec,
u_int32_t  pid, uint32_t pid,
u_int32_t  uid, uint32_t uid,
u_int32_t  fd, uint32_t fd,
u_int8_t  cmd[SEBEK_CMD_LENGTH], uint8_t cmd[SEBEK_CMD_LENGTH],
u_int32_t  length, uint32_t length,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds a Sebek header. The Sebek protocol was designed by the Honeynet Project as a transport mechanism for post-intrusion forensic data. More information may be found here: http://www.honeynet.org/papers/sebek.pdf.

-

Parameters:
- - - - - - - - - - - - - - - - + +
+

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.

+
Parameters:
+
magic identify packets that should be hidden
version protocol version, currently 1
type type of record (read data is type 0, write data is type 1)
counter PDU counter used to identify when packet are lost
time_sec seconds since EPOCH according to the honeypot
time_usec residual microseconds
pid PID
uid UID
fd FD
cmd[SEBEK_CMD_LENGTH] 12 first characters of the command
length length in bytes of the PDU's body
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + + + + + + +
magicidentify packets that should be hidden
versionprotocol version, currently 1
typetype of record (read data is type 0, write data is type 1)
counterPDU counter used to identify when packet are lost
time_secseconds since EPOCH according to the honeypot
time_usecresidual microseconds
pidPID
uidUID
fdFD
cmd12 first characters of the command
lengthlength in bytes of the PDU's body
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_stp_conf u_int16_t  id, libnet_ptag_t libnet_build_stp_conf (uint16_t id,
u_int8_t  version, uint8_t version,
u_int8_t  bpdu_type, uint8_t bpdu_type,
u_int8_t  flags, uint8_t flags,
u_int8_t *  root_id, const uint8_t * root_id,
u_int32_t  root_pc, uint32_t root_pc,
u_int8_t *  bridge_id, const uint8_t * bridge_id,
u_int16_t  port_id, uint16_t port_id,
u_int16_t  message_age, uint16_t message_age,
u_int16_t  max_age, uint16_t max_age,
u_int16_t  hello_time, uint16_t hello_time,
u_int16_t  f_delay, uint16_t f_delay,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an IEEE 802.1d Spanning Tree Protocol (STP) configuration header. STP frames are usually encapsulated inside of an 802.2 + 802.3 frame combination.

Parameters:
- - - - - - - - - - - - - - - - - + +
+

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.

+
Parameters:
+
id protocol id
version protocol version
bpdu_type bridge protocol data unit type
flags flags
root_id root id
root_pc root path cost
bridge_id bridge id
port_id port id
message_age message age
max_age max age
hello_time hello time
f_delay forward delay
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + + + + + + + +
idprotocol id
versionprotocol version
bpdu_typebridge protocol data unit type
flagsflags
root_idroot id
root_pcroot path cost
bridge_idbridge id
port_idport id
message_agemessage age
max_agemax age
hello_timehello time
f_delayforward delay
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_stp_tcn u_int16_t  id, libnet_ptag_t libnet_build_stp_tcn (uint16_t id,
u_int8_t  version, uint8_t version,
u_int8_t  bpdu_type, uint8_t bpdu_type,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an IEEE 802.1d Spanning Tree Protocol (STP) topology change notification header. STP frames are usually encapsulated inside of an 802.2 + 802.3 frame combination.

Parameters:
- - - - - - - - + +
+

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.

+
Parameters:
+
id protocol id
version protocol version
bpdu_type bridge protocol data unit type
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + +
idprotocol id
versionprotocol version
bpdu_typebridge protocol data unit type
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_tcp u_int16_t  sp, libnet_ptag_t libnet_build_tcp (uint16_t sp,
u_int16_t  dp, uint16_t dp,
u_int32_t  seq, uint32_t seq,
u_int32_t  ack, uint32_t ack,
u_int8_t  control, uint8_t control,
u_int16_t  win, uint16_t win,
u_int16_t  sum, uint16_t sum,
u_int16_t  urg, uint16_t urg,
u_int16_t  len, uint16_t len,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an RFC 793 Transmission Control Protocol (TCP) header.

Parameters:
- - - - - - - - - - - - + +
+

Builds an RFC 793 Transmission Control Protocol (TCP) header.

+
Parameters:
+
sp source port
dp destination port
seq sequence number
ack acknowledgement number
control control flags
win window size
sum checksum (0 for libnet to autofill)
urg urgent pointer len total length of the TCP packet (for checksum calculation)
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + + + + +
spsource port
dpdestination port
seqsequence number
ackacknowledgement number
controlcontrol flags
winwindow size
sumchecksum (0 for libnet to autofill)
urgurgent pointer
lentotal length of the TCP packet (for checksum calculation)
payload
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_tcp_options u_int8_t *  options, libnet_ptag_t libnet_build_tcp_options (const uint8_t * options,
u_int32_t  options_s, uint32_t options_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an RFC 793 Transmission Control Protocol (TCP) options header. The function expects options to be a valid TCP options string of size options_s, which is no larger than 40 bytes (the maximum size of an options string). The function checks to ensure that the packet consists of a TCP header preceded by an IPv4 header, and that the addition of the options string would not result in a packet larger than 65,535 bytes (IPMAXPACKET). The function counts up the number of 32-bit words in the options string and adjusts the TCP header length value as necessary.

Parameters:
- - - - - + +
+

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.

+
Parameters:
+
options byte string of TCP options
options_s length of options string
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + +
optionsbyte string of TCP options
options_slength of options string
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_token_ring u_int8_t  ac, libnet_ptag_t libnet_build_token_ring (uint8_t ac,
u_int8_t  fc, uint8_t fc,
u_int8_t *  dst, const uint8_t * dst,
u_int8_t *  src, const uint8_t * src,
u_int8_t  dsap, uint8_t dsap,
u_int8_t  ssap, uint8_t ssap,
u_int8_t  cf, uint8_t cf,
u_int8_t *  org, const uint8_t * oui,
u_int16_t  type, uint16_t type,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds a token ring header.

Parameters:
- - - - - - - - - - - - - - + +
+

Builds a token ring header.

+
Parameters:
+
ac access control
fc frame control
dst destination address
src source address
dsap destination service access point
ssap source service access point
cf control field
oui Organizationally Unique Identifier
type upper layer protocol type
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + + + + +
acaccess control
fcframe control
dstdestination address
srcsource address
dsapdestination service access point
ssapsource service access point
cfcontrol field
ouiOrganizationally Unique Identifier
typeupper layer protocol type
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_udp u_int16_t  sp, libnet_ptag_t libnet_build_udp (uint16_t sp,
u_int16_t  dp, uint16_t dp,
u_int16_t  len, uint16_t len,
u_int16_t  sum, uint16_t sum,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Builds an RFC 768 User Datagram Protocol (UDP) header.

Parameters:
- - - - - - - - - + +
+

Builds an RFC 768 User Datagram Protocol (UDP) header.

+
Parameters:
+
sp source port
dp destination port
len total length of the UDP packet
sum checksum (0 for libnet to autofill)
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + +
spsource port
dpdestination port
lentotal length of the UDP packet
sumchecksum (0 for libnet to autofill)
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - + + -
libnet_ptag_t libnet_build_vrrp u_int8_t  version, libnet_ptag_t libnet_build_vrrp (uint8_t version,
u_int8_t  type, uint8_t type,
u_int8_t  vrouter_id, uint8_t vrouter_id,
u_int8_t  priority, uint8_t priority,
u_int8_t  ip_count, uint8_t ip_count,
u_int8_t  auth_type, uint8_t auth_type,
u_int8_t  advert_int, uint8_t advert_int,
u_int16_t  sum, uint16_t sum,
u_int8_t *  payload, const uint8_t * payload,
u_int32_t  payload_s, uint32_t payload_s,
libnet_t *  l, libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-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.

Parameters:
- - - - - - - - - - - - - + +
+

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.

+
Parameters:
+
version VRRP version (should be 2)
type VRRP packet type (should be 1 -- ADVERTISEMENT)
vrouter_id virtual router identification
priority priority (higher numbers indicate higher priority)
ip_count number of IPv4 addresses contained in this advertisement
auth_type type of authentication (0, 1, 2 -- see RFC)
advert_int interval between advertisements
sum checksum (0 for libnet to autofill)
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+ + + + + + + + + + + +
versionVRRP version (should be 2)
typeVRRP packet type (should be 1 -- ADVERTISEMENT)
vrouter_idvirtual router identification
prioritypriority (higher numbers indicate higher priority)
ip_countnumber of IPv4 addresses contained in this advertisement
auth_typetype of authentication (0, 1, 2 -- see RFC)
advert_intinterval between advertisements
sumchecksum (0 for libnet to autofill)
payloadoptional payload or NULL
payload_spayload length or 0
lpointer to a libnet context
ptagprotocol tag to modify an existing header, 0 to build a new one
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
protocol tag value on success, -1 on error
+ + + + +
+
+
- - - - - - + + + + + -
void libnet_clear_packet libnet_t *  l  ) 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.

Parameters:
- - + +
+

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.

+
Parameters:
+
l pointer to a libnet context
+
lpointer to a libnet context
+
-
-

- - - - -
- + + + + +
+
+
- - - - + + + + + - - - + + - - + + -
int libnet_cq_add libnet_t *  l, int libnet_cq_add (libnet_t * l,
char *  labelchar * 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 libnet_init(). If the context queue in write locked, this function will fail.

Parameters:
- - - + +
+

[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 libnet_init(). If the context queue in write locked, this function will fail.

+
Parameters:
+
l pointer to a libnet context
label a canonical name given to recognize the new context, no longer than LIBNET_LABEL_SIZE
+ +
lpointer to a libnet context
labela canonical name given to recognize the new context, no longer than LIBNET_LABEL_SIZE
+
-
Returns:
1 on success, -1 on failure
-
-

- - - - -
- +
Returns:
1 on success, -1 on failure
+ + + + +
+
+
- - - - - + + + + + -
void libnet_cq_destroy  ) void libnet_cq_destroy (void )
-
- - - - - -
-   - + +
+

[Context Queue] Destroys the entire context queue, calling libnet_destroy() on each member context.

-

-[Context Queue] Destroys the entire context queue, calling libnet_destroy() on each member context.

-

- - - - -
- + + + +
+
+
- - - - - - + + + + + -
libnet_t* libnet_cq_find_by_label char *  label  ) uint32_t libnet_cq_end_loop (void )
-
- - - - - -
-   - + +
+

[Context Queue]

-

-[Context Queue] Locates a libnet context from the queue, indexed by a canonical label.

Parameters:
- - + + + +
+
+
label canonical label of the libnet context to retrieve
+ + + + + + + +
libnet_t* libnet_cq_find_by_label (char * label)
+
+
+

[Context Queue] Locates a libnet context from the queue, indexed by a canonical label.

+
Parameters:
+ +
labelcanonical label of the libnet context to retrieve
+
-
Returns:
the expected libnet context, NULL on failure
-
-

- - - - -
- +
Returns:
the expected libnet context, NULL on failure
+ + + + +
+
+
- - - - - - + + + + + -
int8_t* libnet_cq_getlabel libnet_t *  l  ) const char* libnet_cq_getlabel (libnet_t * l)
-
- - - - - -
-   - - -

-[Context Queue] Returns the canonical label associated with the context.

Parameters:
- - + +
+

[Context Queue] Returns the canonical label associated with the context.

+
Parameters:
+
l pointer to a libnet context
+
lpointer to a libnet context
+
-
Returns:
pointer to the libnet context's label
-
-

- - - - -
- +
Returns:
pointer to the libnet context's label
+ + + + +
+
+
- - - - - + + + + + -
libnet_t* libnet_cq_head  ) 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:

+

for (l = libnet_cq_head(); libnet_cq_last(); l = libnet_cq_next()) { ... }

+

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, for_each_context_in_cq(l). Warning: do not call the iterator more than once in a single loop.

+
Returns:
the head of the context queue
-

-[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:

-for (l = libnet_cq_head(); libnet_cq_last(); l = libnet_cq_next()) { ... }

-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, for_each_context_in_cq(l). Warning: do not call the iterator more than once in a single loop.

Returns:
the head of the context queue
-
-

- - - - -
- + + + +
+
+
- - - - - + + + + + -
int libnet_cq_last  ) int libnet_cq_last (void )
-
- - - - - -
-   - + +
+

[Context Queue] Check whether the iterator is at the last context in the queue.

+
Returns:
1 if at the end of the context queue, 0 otherwise
-

-[Context Queue] Check whether the iterator is at the last context in the queue.

Returns:
1 if at the end of the context queue, 0 otherwise
-
-

- - - - -
- + + + +
+
+
- - - - - + + + + + -
libnet_t* libnet_cq_next  ) libnet_t* libnet_cq_next (void )
-
- - - - - -
-   - + +
+

[Context Queue] Get next context from the context queue.

+
Returns:
the next context from the context queue
-

-[Context Queue] Get next context from the context queue. the next context from the context queue

-

- - - - -
- + + + +
+
+
- - - - - - + + + + + -
libnet_t* libnet_cq_remove libnet_t *  l  ) 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 libnet_destroy(). 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 libnet_cq_remove_by_label(). If the context queue is write locked, this function will fail.

Parameters:
- - + +
+

[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 libnet_destroy(). 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 libnet_cq_remove_by_label(). If the context queue is write locked, this function will fail.

+
Parameters:
+
l pointer to a libnet context
+
lpointer to a libnet context
+
-
Returns:
the pointer to the removed libnet context, NULL on failure
-
-

- - - - -
- +
Returns:
the pointer to the removed libnet context, NULL on failure
+ + + + +
+
+
- - - - - - + + + + + -
libnet_t* libnet_cq_remove_by_label char *  label  ) 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 libnet_destroy(). If the context queue is write locked, this function will fail.

Parameters:
- - + +
+

[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 libnet_destroy(). If the context queue is write locked, this function will fail.

+
Parameters:
+
label canonical name of the context to remove
+
labelcanonical name of the context to remove
+
-
Returns:
the pointer to the removed libnet context, NULL on failure
-
-

- - - - -
- +
Returns:
the pointer to the removed libnet context, NULL on failure
+ + + + +
+
+
- - - - - + + + + + -
u_int32_t libnet_cq_size  ) uint32_t libnet_cq_size (void )
-
- - - - - -
-   - + +
+

[Context Queue] Function returns the number of libnet contexts that are in the queue.

+
Returns:
the number of libnet contexts currently in the queue
-

-[Context Queue] Function returns the number of libnet contexts that are in the queue.

Returns:
the number of libnet contexts currently in the queue
-
-

- - - - -
- + + + +
+
+
- - - - - - + + + + + -
void libnet_destroy libnet_t *  l  ) 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.

Parameters:
- - + +
+

Shuts down the libnet session referenced by l. It closes the network interface and frees all internal memory structures associated with l.

+
Parameters:
+
l pointer to a libnet context
+
lpointer to a libnet context
+
-
-

- - - - -
- + + + + +
+
+
- - - - - - + + + + + -
void libnet_diag_dump_context libnet_t *  l  ) void libnet_diag_dump_context (libnet_t * l)
-
- - - - - -
-   - - -

-[Diagnostic] Prints the contents of the given context.

Parameters:
- - + +
+

[Diagnostic] Prints the contents of the given context.

+
Parameters:
+
l pointer to a libnet context
+
lpointer to a libnet context
+
-
-

- - - - -
- + + + + +
+
+
- - - - + + + + + - - - + + + - - - + + + - - - + + - - + + -
void libnet_diag_dump_hex u_int8_t *  packet, void libnet_diag_dump_hex (const uint8_t * packet,
u_int32_t  len, uint32_t len,
int  swap, int swap,
FILE *  streamFILE * 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.

Parameters:
- - - - - + +
+

[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.

+
Parameters:
+
packet the packet to print
len length of the packet in bytes
swap 1 to swap byte order, 0 to not
stream a stream pointer to print to
+ + + +
packetthe packet to print
lenlength of the packet in bytes
swap1 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).
streama stream pointer to print to
+
-
-

- - - - -
- + + + + +
+
+
- - - - - - + + + + + -
void libnet_diag_dump_pblock libnet_t *  l  ) void libnet_diag_dump_pblock (libnet_t * l)
-
- - - - - -
-   - - -

-[Diagnostic] Prints the contents of every pblock.

Parameters:
- - + +
+

[Diagnostic] Prints the contents of every pblock.

+
Parameters:
+
l pointer to a libnet context
+
lpointer to a libnet context
+
-
-

- - - - -
- + + + + +
+
+
- - - - - - + + + + + -
char* libnet_diag_dump_pblock_type u_int8_t  type  ) char* libnet_diag_dump_pblock_type (uint8_t type)
-
- - - - - -
-   - - -

-[Diagnostic] Returns the canonical name of the pblock type.

Parameters:
- - + +
+

[Diagnostic] Returns the canonical name of the pblock type.

+
Parameters:
+
type pblock type
+
typepblock type
+
-
Returns:
a string representing the pblock type type or "unknown" for an unknown value
-
-

- - - - -
- +
Returns:
a string representing the pblock type type or "unknown" for an unknown value
+ + + + +
+
+
- - - - - - + + + + + -
struct libnet_ether_addr* libnet_get_hwaddr libnet_t *  l  ) struct libnet_ether_addr* libnet_get_hwaddr (libnet_t * l) [read]
-
- - - - - -
-   - - -

-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 libnet_geterror() will tell you why.

Parameters:
- - + +
+

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 libnet_geterror() will tell you why.

+
Parameters:
+
l pointer to a libnet context
+
lpointer to a libnet context
+
-
Returns:
a pointer to the MAC address or NULL
-
-

- - - - -
- +
Returns:
a pointer to the MAC address or NULL
+ + + + +
+
+
- - - - - - + + + + + -
u_int32_t libnet_get_ipaddr4 libnet_t *  l  ) 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.

Parameters:
- - + +
+

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.

+
Parameters:
+
l pointer to a libnet context
+
lpointer to a libnet context
+
-
Returns:
a big endian IP address suitable for use in a libnet_build function or -1
-
-

- - - - -
- +
Returns:
a big endian IP address suitable for use in a libnet_build function or -1
+ + + + +
+
+
- - - - - - + + + + + -
struct libnet_in6_addr libnet_get_ipaddr6 libnet_t *  l  ) struct libnet_in6_addr libnet_get_ipaddr6 (libnet_t * l) [read]
-
- - - - - -
-   - - -

-This function is not yet implemented under IPv6.

Parameters:
- - + +
+

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.

+
Parameters:
+
l pointer to a libnet context
+
lpointer to a libnet context
+
-
Returns:
well, nothing yet
-
-

- - - - -
- +
Returns:
well, nothing yet
+ + + + +
+
+
- - - - - - + + + + + -
u_int32_t libnet_get_prand int  mod  ) uint32_t libnet_get_prand (int mod)
-
- - - - - -
-   - - -

-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

-

Parameters:
- - + +
+

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

+
Parameters:
+
mod one the of LIBNET_PR* constants
+
modone the of LIBNET_PR* constants
+
-
Returns:
1 on success, -1 on failure
-
-

- - - - -
- +
Returns:
1 on success, -1 on failure
+ + + + +
+
+
- - - - - - + + + + + -
int8_t* libnet_getdevice libnet_t *  l  ) const char* libnet_getdevice (libnet_t * l)
-
- - - - - -
-   - - -

-Returns the canonical name of the device used for packet injection.

Parameters:
- - + +
+

Returns the canonical name of the device used for packet injection.

+
Parameters:
+
l pointer to a libnet context
+
lpointer to a libnet context
+
-
Returns:
the canonical name of the device used for packet injection. Note it can be NULL without being an error.
-
-

- - - - -
- +
Returns:
the canonical name of the device used for packet injection. Note it can be NULL without being an error.
+ + + + +
+
+
- - - - - - + + + + + -
char* libnet_geterror libnet_t *  l  ) 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.

Parameters:
- - + +
+

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.

+
Parameters:
+
l pointer to a libnet context
+
lpointer to a libnet context
+
-
Returns:
an error string or NULL if no error has occured
-
-

- - - - -
- +
Returns:
an error string or NULL if no error has occured
+ + + + +
+
+
- - - - - - + + + + + -
int libnet_getfd libnet_t *  l  ) int libnet_getfd (libnet_t * l)
-
- - - - - -
-   - - -

-Returns the FILENO of the file descriptor used for packet injection.

Parameters:
- - + +
+

Returns the FILENO of the file descriptor used for packet injection.

+
Parameters:
+
l pointer to a libnet context
+
lpointer to a libnet context
+
-
Returns:
the file number of the file descriptor used for packet injection
-
-

- - - - -
- +
Returns:
the file number of the file descriptor used for packet injection
+ + + + +
+
+
- - - - - - + + + + + -
u_int32_t libnet_getgre_length u_int16_t  fv  )  [inline]uint32_t libnet_getgre_length (uint16_t fv)
-
- - - - - -
-   - - -

-

Parameters:
- - - - - + +
+
Parameters:
+
payload optional payload or NULL
payload_s payload length or 0
l pointer to a libnet context
ptag protocol tag to modify an existing header, 0 to build a new one
+
fvsee libnet_build_gre().
+
-
Returns:
protocol tag value on success, -1 on error
-
-

- - - - -
- +
Returns:
size, see libnet_build_gre().
+ + + + +
+
+
- - - - - - + + + + + -
u_int32_t libnet_getpacket_size libnet_t *  l  ) 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).

Parameters:
- - + +
+

Returns the sum of the size of all of the pblocks inside of l (this should be the resuling packet size).

+
Parameters:
+
l pointer to a libnet context
+
lpointer to a libnet context
+
-
Returns:
the size of the packet in l
-
-

- - - - -
- +
Returns:
the size of the packet in l
+ + + + +
+
+
- - - - + + + + + - - - + + - - + + -
u_int8_t* libnet_getpbuf libnet_t *  l, uint8_t* libnet_getpbuf (libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Returns the pblock buffer contents for the specified ptag; a subsequent call to libnet_getpbuf_size() should be made to determine the size of the buffer.

Parameters:
- - - + +
+

Returns the pblock buffer contents for the specified ptag; a subsequent call to libnet_getpbuf_size() should be made to determine the size of the buffer.

+
Parameters:
+
l pointer to a libnet context
ptag the ptag reference number
+ +
lpointer to a libnet context
ptagthe ptag reference number
+
-
Returns:
a pointer to the pblock buffer or NULL on error
-
-

- - - - -
- +
Returns:
a pointer to the pblock buffer or NULL on error
+ + + + +
+
+
- - - - + + + + + - - - + + - - + + -
u_int32_t libnet_getpbuf_size libnet_t *  l, uint32_t libnet_getpbuf_size (libnet_t * l,
libnet_ptag_t  ptaglibnet_ptag_t ptag 
)
-
- - - - - -
-   - - -

-Returns the pblock buffer size for the specified ptag; a previous call to libnet_getpbuf() should be made to pull the actual buffer contents.

Parameters:
- - - + +
+

Returns the pblock buffer size for the specified ptag; a previous call to libnet_getpbuf() should be made to pull the actual buffer contents.

+
Parameters:
+
l pointer to a libnet context
ptag the ptag reference number
+ +
lpointer to a libnet context
ptagthe ptag reference number
+
-
Returns:
the size of the pblock buffer
-
-

- - - - -
- +
Returns:
the size of the pblock buffer
+ + + + +
+
+
- - - - + + + + + - - - + + - - + + -
u_int8_t* libnet_hex_aton int8_t *  s, uint8_t* libnet_hex_aton (const char * s,
int *  lenint * 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.

+
Parameters:
+ + + +
sthe string to be parsed
lenthe resulting size of the returned byte string
+
+
+
Returns:
a byte string or NULL on failure
-

-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.

Parameters:
- - - + + + +
+
+
s the string to be parsed
len the resulting size of the returned byte string
+ + + + + + + +
int libnet_in6_is_error (struct libnet_in6_addr addr)
+
+
+

Check a libnet_in6_addr structure for identity with in6addr_error.

+
Parameters:
+ +
addraddress to check
+
-
Returns:
a byte string or NULL on failure
-
-

- - - - -
- +
Returns:
1 if addr is in6addr_error, 0 if it is not
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + - - + + -
libnet_t* libnet_init int  injection_type, libnet_t* libnet_init (int injection_type,
char *  device, const char * device,
char *  err_bufchar * 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.

Parameters:
- - - - + +
+

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.

+
Parameters:
+
injection_type packet injection type (LIBNET_LINK, LIBNET_LINK_ADV, LIBNET_RAW4, LIBNET_RAW4_ADV, LIBNET_RAW6, LIBNET_RAW6_ADV)
device the interface to use (NULL and libnet will choose one)
err_buf will contain an error message on failure
+ + +
injection_typepacket injection type (LIBNET_LINK, LIBNET_LINK_ADV, LIBNET_RAW4, LIBNET_RAW4_ADV, LIBNET_RAW6, LIBNET_RAW6_ADV)
devicethe interface to use (NULL and libnet will choose one)
err_bufwill contain an error message on failure
+
-
Returns:
libnet context ready for use or NULL on error.
-
-

- - - - -
- +
Returns:
libnet context ready for use or NULL on error.
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + - - + + -
u_int32_t libnet_name2addr4 libnet_t *  l, uint32_t libnet_name2addr4 (libnet_t * l,
char *  host_name, char * host_name,
u_int8_t  use_nameuint8_t use_name 
)
-
- - - - - -
-   - - -

-Takes a dotted decimal string or a canonical DNS name and returns a network byte ordered IPv4 address. This may incur a DNS lookup if mode is set to LIBNET_RESOLVE and host_name refers to a canonical DNS name. If mode is set to LIBNET_DONT_RESOLVE no DNS lookup will occur. The function can fail if DNS lookup fails or if mode is set to LIBNET_DONT_RESOLVE and host_name refers to a canonical DNS name.

Parameters:
- - - - + +
+

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.

+
Parameters:
+
l pointer to a libnet context
host_name pointer to a string containing a presentation format host name
use_name LIBNET_RESOLVE or LIBNET_DONT_RESOLVE
+ + +
lpointer to a libnet context
host_namepointer to a string containing a presentation format host name
use_nameLIBNET_RESOLVE or LIBNET_DONT_RESOLVE
+
-
Returns:
network byte ordered IPv4 address or -1 (2^32 - 1) on error
-
-

- - - - -
- +
Returns:
network byte ordered IPv4 address or -1 (2^32 - 1) on error
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + - - + + -
struct libnet_in6_addr libnet_name2addr6 libnet_t *  l, struct libnet_in6_addr libnet_name2addr6 (libnet_t * l,
char *  host_name, const char * host_name,
u_int8_t  use_nameuint8_t use_name 
) [read]
-
- - - - - -
-   - - -

-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.

Parameters:
- - - - + +
+

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.

+
Parameters:
+
l pointer to a libnet context
host_name pointer to a string containing a presentation format host name
use_name LIBNET_RESOLVE or LIBNET_DONT_RESOLVE
+ + +
lpointer to a libnet context
host_namepointer to a string containing a presentation format host name
use_nameLIBNET_RESOLVE or LIBNET_DONT_RESOLVE
+
-
Returns:
network byte ordered IPv6 address structure
-
-

- - - - -
- +
Returns:
network byte ordered IPv6 address structure
+ + + + +
+
+
- - - - - - + + + + + -
int libnet_plist_chain_dump libnet_plist_t *  plist  ) 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.

Parameters:
- - + +
+

Runs through the port list and prints the contents of the port list chain list to stdout.

+
Parameters:
+
plist previously created portlist
+
plistpreviously created portlist
+
-
Returns:
1 on success, -1 on failure
-
-

- - - - -
- +
Returns:
1 on success, -1 on failure
+ + + + +
+
+
- - - - - - + + + + + -
char* libnet_plist_chain_dump_string libnet_plist_t *  plist  ) 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.

Parameters:
- - + +
+

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.

+
Parameters:
+
plist previously created portlist
+
plistpreviously created portlist
+
-
Returns:
a printable string containing the port list contents on success NULL on error
-
-

- - - - -
- +
Returns:
a printable string containing the port list contents on success NULL on error
+ + + + +
+
+
- - - - - - + + + + + -
int libnet_plist_chain_free libnet_plist_t *  plist  ) int libnet_plist_chain_free (libnet_plist_t * plist)
-
- - - - - -
-   - - -

-Frees all memory associated with port list chain.

Parameters:
- - + +
+

Frees all memory associated with port list chain.

+
Parameters:
+
plist previously created portlist
+
plistpreviously created portlist
+
-
Returns:
1 on success, -1 on failure
-
-

- - - - -
- +
Returns:
1 on success, -1 on failure
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + - - + + -
int libnet_plist_chain_new libnet_t *  l, int libnet_plist_chain_new (libnet_t * l,
libnet_plist_t **  plist, libnet_plist_t ** plist,
char *  token_listchar * 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 libnet_geterror() can tell you why.

Parameters:
- - - - + +
+

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 libnet_geterror() can tell you why.

+
Parameters:
+
l pointer to a libnet context
plist if successful, will refer to the portlist, if not, NULL
token_list string containing the port list primitive
+ + +
lpointer to a libnet context
plistif successful, will refer to the portlist, if not, NULL
token_liststring containing the port list primitive
+
-
Returns:
1 on success, -1 on failure
-
-

- - - - -
- +
Returns:
1 on success, -1 on failure
+ + + + +
+
+
- - - - + + + + + - - - + + + - - - + + - - + + -
int libnet_plist_chain_next_pair libnet_plist_t *  plist, int libnet_plist_chain_next_pair (libnet_plist_t * plist,
u_int16_t *  bport, uint16_t * bport,
u_int16_t *  eportuint16_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.

Parameters:
- - - - + +
+

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.

+
Parameters:
+
plist previously created portlist
bport will contain the beginning port number or 0
eport will contain the ending port number or 0
+ + +
plistpreviously created portlist
bportwill contain the beginning port number or 0
eportwill contain the ending port number or 0
+
-
Returns:
1 on success, 0 if empty, -1 on failure
-
-

- - - - -
- +
Returns:
1 on success, 0 if empty, -1 on failure
+ + + + +
+
+
- - - - - - + + + + + -
int libnet_seed_prand libnet_t *  l  ) int libnet_seed_prand (libnet_t * l)
-
- - - - - -
-   - - -

-Seeds the psuedo-random number generator.

Parameters:
- - + +
+

Seeds the psuedo-random number generator.

+
Parameters:
+
l pointer to a libnet context
+
lpointer to a libnet context
+
-
Returns:
1 on success, -1 on failure
-
-

- - - - -
- +
Returns:
1 on success, -1 on failure
+ + + + +
+
+
- - - - + + + + + - - - + + - - + + -
void libnet_stats libnet_t *  l, void libnet_stats (libnet_t * l,
struct libnet_stats *  lsstruct libnet_stats * ls 
)
-
- - - - - -
-   - - -

-Fills in a libnet_stats structure with packet injection statistics (packets written, bytes written, packet sending errors).

Parameters:
- - - + +
+

Fills in a libnet_stats structure with packet injection statistics (packets written, bytes written, packet sending errors).

+
Parameters:
+
l pointer to a libnet context
ls pointer to a libnet statistics structure
+ +
lpointer to a libnet context
lspointer to a libnet statistics structure
+
-
-

- - - - -
- + + + + +
+
+
- - - - + + + + + - - - + + + - - - + + - - + + -
int libnet_toggle_checksum libnet_t *  l, int libnet_toggle_checksum (libnet_t * l,
libnet_ptag_t  ptag, libnet_ptag_t ptag,
int  modeint mode 
)
-
- - - - - -
-   - - -

-If a given protocol header is built with the checksum field set to "0", by default libnet will calculate the header checksum prior to injection. If the header is set to any other value, by default libnet will not calculate the header checksum. To over-ride this behavior, use libnet_toggle_checksum(). 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.

Parameters:
- - - - + +
+

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 libnet_toggle_checksum(). 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.

+
Parameters:
+
l pointer to a libnet context
ptag the ptag reference number
mode LIBNET_ON or LIBNET_OFF
+ + +
lpointer to a libnet context
ptagthe ptag reference number
modeLIBNET_ON or LIBNET_OFF
+
-
Returns:
1 on success, -1 on failure
-
-

- - - - -
- +
Returns:
1 on success, -1 on failure
+ + + + +
+
+
- - - - - - + + + + + -
int libnet_write libnet_t *  l  ) const char* libnet_version (void )
-
- - - - - -
-   - + +
+

Returns the version of libnet.

+
Returns:
the libnet version
-

-Writes a prebuilt packet to the network. The function assumes that l was previously initialized (via a call to libnet_init()) 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 libnet_stats().

Parameters:
- - + + + +
+
+
l pointer to a libnet context
+ + + + + + + +
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 libnet_init()) 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 libnet_stats().

+
Parameters:
+ +
lpointer to a libnet context
+
-
Returns:
the number of bytes written, -1 on error
-
-


Generated on Wed Mar 10 13:23:38 2004 for libnet by +
Returns:
the number of bytes written, -1 on error
+ +
+ + + +doxygen 1.7.4