Main Page | Data Structures | File List | Data Fields | Globals

libnet-functions.h

Go to the documentation of this file.
00001 /*
00002  *  $Id: libnet-functions_8h-source.html,v 1.1.1.1 2012/02/21 22:14:23 misho Exp $
00003  *
00004  *  libnet-functions.h - function prototypes
00005  *
00006  *  Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com>
00007  *  All rights reserved.
00008  *
00009  * Redistribution and use in source and binary forms, with or without
00010  * modification, are permitted provided that the following conditions
00011  * are met:
00012  * 1. Redistributions of source code must retain the above copyright
00013  *    notice, this list of conditions and the following disclaimer.
00014  * 2. Redistributions in binary form must reproduce the above copyright
00015  *    notice, this list of conditions and the following disclaimer in the
00016  *    documentation and/or other materials provided with the distribution.
00017  *
00018  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
00019  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00021  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
00022  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00023  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00024  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00025  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00026  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00027  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00028  * SUCH DAMAGE.
00029  *
00030  */
00031 
00032 #ifndef __LIBNET_FUNCTIONS_H
00033 #define __LIBNET_FUNCTIONS_H
00034 
00063 libnet_t *
00064 libnet_init(int injection_type, char *device, char *err_buf);
00065 
00071 void
00072 libnet_destroy(libnet_t *l);
00073 
00080 void
00081 libnet_clear_packet(libnet_t *l);
00082 
00089 void
00090 libnet_stats(libnet_t *l, struct libnet_stats *ls);
00091 
00097 int 
00098 libnet_getfd(libnet_t *l);
00099 
00106 int8_t *
00107 libnet_getdevice(libnet_t *l);
00108 
00117 u_int8_t *
00118 libnet_getpbuf(libnet_t *l, libnet_ptag_t ptag);
00119 
00128 u_int32_t
00129 libnet_getpbuf_size(libnet_t *l, libnet_ptag_t ptag);
00130 
00138 char *
00139 libnet_geterror(libnet_t *l);
00140 
00147 u_int32_t
00148 libnet_getpacket_size(libnet_t *l);
00149 
00155 int
00156 libnet_seed_prand(libnet_t *l);
00157 
00171 u_int32_t
00172 libnet_get_prand(int mod);
00173 
00195 int
00196 libnet_toggle_checksum(libnet_t *l, libnet_ptag_t ptag, int mode);
00197 
00210 char *
00211 libnet_addr2name4(u_int32_t in, u_int8_t use_name);
00212 
00226 u_int32_t
00227 libnet_name2addr4(libnet_t *l, char *host_name, u_int8_t use_name);
00228 
00229 extern const struct libnet_in6_addr in6addr_error;
00230 
00244 struct libnet_in6_addr
00245 libnet_name2addr6(libnet_t *l, char *host_name, u_int8_t use_name);
00246 
00250 void
00251 libnet_addr2name6_r(struct libnet_in6_addr addr, u_int8_t use_name,
00252 char *host_name, int host_name_len);
00253 
00269 int
00270 libnet_plist_chain_new(libnet_t *l, libnet_plist_t **plist, char *token_list);
00271 
00283 int
00284 libnet_plist_chain_next_pair(libnet_plist_t *plist, u_int16_t *bport, 
00285 u_int16_t *eport); 
00286 
00293 int
00294 libnet_plist_chain_dump(libnet_plist_t *plist);
00295 
00304 char *
00305 libnet_plist_chain_dump_string(libnet_plist_t *plist);
00306 
00312 int
00313 libnet_plist_chain_free(libnet_plist_t *plist);
00314 
00402 libnet_ptag_t
00403 libnet_build_802_1q(u_int8_t *dst, u_int8_t *src, u_int16_t tpi,
00404 u_int8_t priority, u_int8_t cfi, u_int16_t vlan_id, u_int16_t len_proto,
00405 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
00406 
00418 libnet_ptag_t
00419 libnet_build_802_1x(u_int8_t eap_ver, u_int8_t eap_type, u_int16_t length, 
00420 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
00421 
00433 libnet_ptag_t
00434 libnet_build_802_2(u_int8_t dsap, u_int8_t ssap, u_int8_t control,
00435 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
00436 
00450 libnet_ptag_t
00451 libnet_build_802_2snap(u_int8_t dsap, u_int8_t ssap, u_int8_t control, 
00452 u_int8_t *oui, u_int16_t type, u_int8_t *payload, u_int32_t payload_s,
00453 libnet_t *l, libnet_ptag_t ptag); 
00454 
00470 libnet_ptag_t
00471 libnet_build_802_3(u_int8_t *dst, u_int8_t *src, u_int16_t len, 
00472 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
00473 
00489 libnet_ptag_t
00490 libnet_build_ethernet(u_int8_t *dst, u_int8_t *src, u_int16_t type, 
00491 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
00492 
00504 libnet_ptag_t
00505 libnet_autobuild_ethernet(u_int8_t *dst, u_int16_t type, libnet_t *l);
00506 
00523 libnet_ptag_t
00524 libnet_build_fddi(u_int8_t fc, u_int8_t *dst, u_int8_t *src, u_int8_t dsap,
00525 u_int8_t ssap, u_int8_t cf, u_int8_t *org, u_int16_t type, u_int8_t *payload,
00526 u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
00527 
00540 libnet_ptag_t
00541 libnet_autobuild_fddi(u_int8_t fc, u_int8_t *dst, u_int8_t dsap, u_int8_t ssap,
00542 u_int8_t cf, u_int8_t *org, u_int16_t type, libnet_t *l);
00543 
00563 libnet_ptag_t
00564 libnet_build_arp(u_int16_t hrd, u_int16_t pro, u_int8_t hln, u_int8_t pln,
00565 u_int16_t op, u_int8_t *sha, u_int8_t *spa, u_int8_t *tha, u_int8_t *tpa,
00566 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
00567 
00580 libnet_ptag_t
00581 libnet_autobuild_arp(u_int16_t op, u_int8_t *sha, u_int8_t *spa, u_int8_t *tha,
00582 u_int8_t *tpa, libnet_t *l);
00583 
00600 libnet_ptag_t
00601 libnet_build_tcp(u_int16_t sp, u_int16_t dp, u_int32_t seq, u_int32_t ack,
00602 u_int8_t control, u_int16_t win, u_int16_t sum, u_int16_t urg, u_int16_t len, 
00603 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
00604 
00620 libnet_ptag_t
00621 libnet_build_tcp_options(u_int8_t *options, u_int32_t options_s, libnet_t *l,
00622 libnet_ptag_t ptag);
00623 
00636 libnet_ptag_t
00637 libnet_build_udp(u_int16_t sp, u_int16_t dp, u_int16_t len, u_int16_t sum,
00638 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
00639 
00659 libnet_ptag_t
00660 libnet_build_cdp(u_int8_t version, u_int8_t ttl, u_int16_t sum, u_int16_t type,
00661 u_int16_t len, u_int8_t *value, u_int8_t *payload, u_int32_t payload_s,
00662 libnet_t *l, libnet_ptag_t ptag);
00663 
00678 libnet_ptag_t
00679 libnet_build_icmpv4_echo(u_int8_t type, u_int8_t code, u_int16_t sum,
00680 u_int16_t id, u_int16_t seq, u_int8_t *payload, u_int32_t payload_s,
00681 libnet_t *l, libnet_ptag_t ptag);
00682 
00698 libnet_ptag_t
00699 libnet_build_icmpv4_mask(u_int8_t type, u_int8_t code, u_int16_t sum,
00700 u_int16_t id, u_int16_t seq, u_int32_t mask, u_int8_t *payload,
00701 u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
00702 
00725 libnet_ptag_t
00726 libnet_build_icmpv4_unreach(u_int8_t type, u_int8_t code, u_int16_t sum,
00727 u_int16_t orig_len, u_int8_t orig_tos, u_int16_t orig_id, u_int16_t orig_frag,
00728 u_int8_t orig_ttl, u_int8_t orig_prot,  u_int16_t orig_check, 
00729 u_int32_t orig_src, u_int32_t orig_dst, u_int8_t *payload, u_int32_t payload_s,
00730 libnet_t *l, libnet_ptag_t ptag);
00731 
00753 libnet_ptag_t
00754 libnet_build_icmpv4_redirect(u_int8_t type, u_int8_t code, u_int16_t sum,
00755 u_int32_t gateway, u_int16_t orig_len, u_int8_t orig_tos, u_int16_t orig_id,
00756 u_int16_t orig_frag, u_int8_t orig_ttl, u_int8_t orig_prot,
00757 u_int16_t orig_check, u_int32_t orig_src, u_int32_t orig_dst,
00758 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
00759 
00783 libnet_ptag_t
00784 libnet_build_icmpv4_timeexceed(u_int8_t type, u_int8_t code, u_int16_t sum,
00785 u_int16_t orig_len, u_int8_t orig_tos, u_int16_t orig_id, u_int16_t orig_frag,
00786 u_int8_t orig_ttl, u_int8_t orig_prot, u_int16_t orig_check,
00787 u_int32_t orig_src, u_int32_t orig_dst, u_int8_t *payload, u_int32_t payload_s,
00788 libnet_t *l, libnet_ptag_t ptag);
00789 
00807 libnet_ptag_t
00808 libnet_build_icmpv4_timestamp(u_int8_t type, u_int8_t code, u_int16_t sum,
00809 u_int16_t id, u_int16_t seq, n_time otime, n_time rtime, n_time ttime,
00810 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
00811 
00824 libnet_ptag_t
00825 libnet_build_igmp(u_int8_t type, u_int8_t code, u_int16_t sum, u_int32_t ip,
00826 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
00827 
00845 libnet_ptag_t 
00846 libnet_build_ipv4(u_int16_t len, u_int8_t tos, u_int16_t id, u_int16_t frag,
00847 u_int8_t ttl, u_int8_t prot, u_int16_t sum, u_int32_t src, u_int32_t dst,
00848 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
00849 
00864 libnet_ptag_t 
00865 libnet_build_ipv4_options(u_int8_t *options, u_int32_t options_s, libnet_t *l,
00866 libnet_ptag_t ptag);
00867 
00880 libnet_ptag_t
00881 libnet_autobuild_ipv4(u_int16_t len, u_int8_t prot, u_int32_t dst, libnet_t *l);
00882 
00898 libnet_ptag_t
00899 libnet_build_ipv6(u_int8_t tc, u_int32_t fl, u_int16_t len, u_int8_t nh,
00900 u_int8_t hl, struct libnet_in6_addr src, struct libnet_in6_addr dst, 
00901 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
00902 
00915 libnet_ptag_t
00916 libnet_build_ipv6_frag(u_int8_t nh, u_int8_t reserved, u_int16_t frag,
00917 u_int32_t id, u_int8_t *payload, u_int32_t payload_s, libnet_t *l,
00918 libnet_ptag_t ptag);
00919 
00937 libnet_ptag_t
00938 libnet_build_ipv6_routing(u_int8_t nh, u_int8_t len, u_int8_t rtype,
00939 u_int8_t segments, u_int8_t *payload, u_int32_t payload_s, libnet_t *l,
00940 libnet_ptag_t ptag);
00941 
00955 libnet_ptag_t
00956 libnet_build_ipv6_destopts(u_int8_t nh, u_int8_t len, u_int8_t *payload,
00957 u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
00958 
00973 libnet_ptag_t
00974 libnet_build_ipv6_hbhopts(u_int8_t nh, u_int8_t len, u_int8_t *payload,
00975 u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
00976 
00988 libnet_ptag_t
00989 libnet_autobuild_ipv6(u_int16_t len, u_int8_t nh, struct libnet_in6_addr dst,
00990 libnet_t *l);
00991 
01009 libnet_ptag_t
01010 libnet_build_isl(u_int8_t *dhost, u_int8_t type, u_int8_t user, u_int8_t *shost,
01011 u_int16_t len, u_int8_t *snap, u_int16_t vid, u_int16_t index,
01012 u_int16_t reserved, u_int8_t *payload, u_int32_t payload_s, libnet_t *l,
01013 libnet_ptag_t ptag);
01014 
01026 libnet_ptag_t
01027 libnet_build_ipsec_esp_hdr(u_int32_t spi, u_int32_t seq, u_int32_t iv,
01028 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
01029 
01041 libnet_ptag_t
01042 libnet_build_ipsec_esp_ftr(u_int8_t len, u_int8_t nh, int8_t *auth,
01043 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
01044 
01059 libnet_ptag_t
01060 libnet_build_ipsec_ah(u_int8_t nh, u_int8_t len, u_int16_t res,
01061 u_int32_t spi, u_int32_t seq, u_int32_t auth, u_int8_t *payload,
01062 u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
01063 
01079 libnet_ptag_t
01080 libnet_build_dnsv4(u_int16_t h_len, u_int16_t id, u_int16_t flags,
01081 u_int16_t num_q, u_int16_t num_anws_rr, u_int16_t num_auth_rr,
01082 u_int16_t num_addi_rr, u_int8_t *payload, u_int32_t payload_s, libnet_t *l,
01083 libnet_ptag_t ptag);
01084 
01102 libnet_ptag_t
01103 libnet_build_rip(u_int8_t cmd, u_int8_t version, u_int16_t rd, u_int16_t af,
01104 u_int16_t rt, u_int32_t addr, u_int32_t mask, u_int32_t next_hop,
01105 u_int32_t metric, u_int8_t *payload, u_int32_t payload_s, libnet_t *l,
01106 libnet_ptag_t ptag);
01107 
01130 libnet_ptag_t
01131 libnet_build_rpc_call(u_int32_t rm, u_int32_t xid, u_int32_t prog_num,
01132 u_int32_t prog_vers, u_int32_t procedure, u_int32_t cflavor, u_int32_t clength,
01133 u_int8_t *cdata, u_int32_t vflavor, u_int32_t vlength, u_int8_t *vdata,
01134 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
01135 
01158 libnet_ptag_t
01159 libnet_build_stp_conf(u_int16_t id, u_int8_t version, u_int8_t bpdu_type,
01160 u_int8_t flags, u_int8_t *root_id, u_int32_t root_pc, u_int8_t *bridge_id,
01161 u_int16_t port_id, u_int16_t message_age, u_int16_t max_age, 
01162 u_int16_t hello_time, u_int16_t f_delay, u_int8_t *payload,
01163 u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
01164 
01178 libnet_ptag_t
01179 libnet_build_stp_tcn(u_int16_t id, u_int8_t version, u_int8_t bpdu_type,
01180 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
01181 
01199 libnet_ptag_t
01200 libnet_build_token_ring(u_int8_t ac, u_int8_t fc, u_int8_t *dst, u_int8_t *src,
01201 u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *org, u_int16_t type,
01202 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
01203 
01217 libnet_ptag_t
01218 libnet_autobuild_token_ring(u_int8_t ac, u_int8_t fc, u_int8_t *dst, 
01219 u_int8_t dsap, u_int8_t ssap, u_int8_t cf, u_int8_t *org, u_int16_t type,
01220 libnet_t *l);
01221 
01241 libnet_ptag_t
01242 libnet_build_vrrp(u_int8_t version, u_int8_t type, u_int8_t vrouter_id,
01243 u_int8_t priority, u_int8_t ip_count, u_int8_t auth_type, u_int8_t advert_int,
01244 u_int16_t sum, u_int8_t *payload, u_int32_t payload_s, libnet_t *l,
01245 libnet_ptag_t ptag);
01246 
01259 libnet_ptag_t
01260 libnet_build_mpls(u_int32_t label, u_int8_t experimental, u_int8_t bos,
01261 u_int8_t ttl, u_int8_t *payload, u_int32_t payload_s, libnet_t *l,
01262 libnet_ptag_t ptag);
01263 
01291 libnet_ptag_t
01292 libnet_build_ntp(u_int8_t leap_indicator, u_int8_t version, u_int8_t mode,
01293 u_int8_t stratum, u_int8_t poll, u_int8_t precision, u_int16_t delay_int,
01294 u_int16_t delay_frac, u_int16_t dispersion_int, u_int16_t dispersion_frac,
01295 u_int32_t reference_id, u_int32_t ref_ts_int, u_int32_t ref_ts_frac,
01296 u_int32_t orig_ts_int, u_int32_t orig_ts_frac, u_int32_t rec_ts_int,
01297 u_int32_t rec_ts_frac, u_int32_t xmt_ts_int, u_int32_t xmt_ts_frac,
01298 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
01299 
01307 libnet_ptag_t
01308 libnet_build_ospfv2(u_int16_t len, u_int8_t type, u_int32_t rtr_id,
01309 u_int32_t area_id, u_int16_t sum, u_int16_t autype, u_int8_t *payload,
01310 u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
01311 
01319 libnet_ptag_t
01320 libnet_build_ospfv2_hello(u_int32_t netmask, u_int16_t interval, u_int8_t opts,
01321 u_int8_t priority, u_int dead_int, u_int32_t des_rtr, u_int32_t bkup_rtr,
01322 u_int32_t neighbor, u_int8_t *payload, u_int32_t payload_s, libnet_t *l,
01323 libnet_ptag_t ptag);
01324  
01332 libnet_ptag_t
01333 libnet_build_ospfv2_dbd(u_int16_t dgram_len, u_int8_t opts, u_int8_t type,
01334 u_int seqnum, u_int8_t *payload, u_int32_t payload_s, libnet_t *l,
01335 libnet_ptag_t ptag);
01336  
01344 libnet_ptag_t
01345 libnet_build_ospfv2_lsr(u_int type, u_int lsid, u_int32_t advrtr,
01346 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
01347  
01355 libnet_ptag_t
01356 libnet_build_ospfv2_lsu(u_int num, u_int8_t *payload, u_int32_t payload_s,
01357 libnet_t *l, libnet_ptag_t ptag);
01358 
01366 libnet_ptag_t
01367 libnet_build_ospfv2_lsa(u_int16_t age, u_int8_t opts, u_int8_t type,
01368 u_int lsid, u_int32_t advrtr, u_int seqnum, u_int16_t sum, u_int16_t len,
01369 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
01370  
01378 libnet_ptag_t
01379 libnet_build_ospfv2_lsa_rtr(u_int16_t flags, u_int16_t num, u_int id,
01380 u_int data, u_int8_t type, u_int8_t tos, u_int16_t metric, u_int8_t *payload,
01381 u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
01382  
01390 libnet_ptag_t
01391 libnet_build_ospfv2_lsa_net(u_int32_t nmask, u_int rtrid, u_int8_t *payload,
01392 u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
01393  
01401 libnet_ptag_t
01402 libnet_build_ospfv2_lsa_sum(u_int32_t nmask, u_int metric, u_int tos,
01403 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
01404  
01412 libnet_ptag_t
01413 libnet_build_ospfv2_lsa_as(u_int32_t nmask, u_int metric, u_int32_t fwdaddr,
01414 u_int tag, u_int8_t *payload, u_int32_t payload_s, libnet_t *l,
01415 libnet_ptag_t ptag);
01416 
01427 libnet_ptag_t
01428 libnet_build_data(u_int8_t *payload, u_int32_t payload_s, libnet_t *l,
01429 libnet_ptag_t ptag);
01430 
01438 libnet_ptag_t
01439 libnet_build_dhcpv4(u_int8_t opcode, u_int8_t htype, u_int8_t hlen,
01440 u_int8_t hopcount, u_int32_t xid, u_int16_t secs, u_int16_t flags,
01441 u_int32_t cip, u_int32_t yip,  u_int32_t sip, u_int32_t gip, u_int8_t *chaddr,
01442 u_int8_t *sname, u_int8_t *file, u_int8_t *payload, u_int32_t payload_s, 
01443 libnet_t *l, libnet_ptag_t ptag);
01444 
01452 libnet_ptag_t
01453 libnet_build_bootpv4(u_int8_t opcode, u_int8_t htype, u_int8_t hlen,
01454 u_int8_t hopcount, u_int32_t xid, u_int16_t secs, u_int16_t flags,
01455 u_int32_t cip, u_int32_t yip,  u_int32_t sip, u_int32_t gip, u_int8_t *chaddr,
01456 u_int8_t *sname, u_int8_t *file, u_int8_t *payload, u_int32_t payload_s, 
01457 libnet_t *l, libnet_ptag_t ptag);
01458 
01466 inline u_int32_t
01467 libnet_getgre_length(u_int16_t fv);
01468 
01490 libnet_ptag_t
01491 libnet_build_gre(u_int16_t fv, u_int16_t type, u_int16_t sum,
01492 u_int16_t offset, u_int32_t key, u_int32_t seq, u_int16_t len,
01493 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
01494 
01516 libnet_ptag_t
01517 libnet_build_egre(u_int16_t fv, u_int16_t type, u_int16_t sum,
01518 u_int16_t offset, u_int32_t key, u_int32_t seq, u_int16_t len,
01519 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
01520 
01528 libnet_ptag_t
01529 libnet_build_gre_sre(u_int16_t af, u_int8_t offset, u_int8_t length,
01530 u_int8_t *routing, u_int8_t *payload, u_int32_t payload_s, libnet_t *l,
01531 libnet_ptag_t ptag);
01532 
01540 libnet_ptag_t
01541 libnet_build_gre_last_sre(libnet_t *l, libnet_ptag_t ptag);
01542 
01564 libnet_ptag_t
01565 libnet_build_bgp4_header(u_int8_t marker[LIBNET_BGP4_MARKER_SIZE],
01566 u_int16_t len, u_int8_t type, u_int8_t *payload, u_int32_t payload_s,
01567 libnet_t *l, libnet_ptag_t ptag);
01568 
01585 libnet_ptag_t
01586 libnet_build_bgp4_open(u_int8_t version, u_int16_t src_as, u_int16_t hold_time,
01587 u_int32_t bgp_id, u_int8_t opt_len, u_int8_t *payload, u_int32_t payload_s,
01588 libnet_t *l, libnet_ptag_t ptag);
01589 
01605 libnet_ptag_t
01606 libnet_build_bgp4_update(u_int16_t unfeasible_rt_len, u_int8_t *withdrawn_rt,
01607 u_int16_t total_path_attr_len, u_int8_t *path_attributes, u_int16_t info_len,
01608 u_int8_t *reachability_info, u_int8_t *payload, u_int32_t payload_s,
01609 libnet_t *l, libnet_ptag_t ptag);
01610 
01623 libnet_ptag_t
01624 libnet_build_bgp4_notification(u_int8_t err_code, u_int8_t err_subcode,
01625 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
01626 
01649 libnet_ptag_t
01650 libnet_build_sebek(u_int32_t magic, u_int16_t version, u_int16_t type, 
01651 u_int32_t counter, u_int32_t time_sec, u_int32_t time_usec, u_int32_t pid,
01652 u_int32_t uid, u_int32_t fd, u_int8_t cmd[SEBEK_CMD_LENGTH], u_int32_t length, 
01653 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
01654 
01669 libnet_ptag_t
01670 libnet_build_link(u_int8_t *dst, u_int8_t *src, u_int8_t *oui, u_int16_t type, 
01671 u_int8_t *payload, u_int32_t payload_s, libnet_t *l, libnet_ptag_t ptag);
01672 
01683 libnet_ptag_t
01684 libnet_autobuild_link(u_int8_t *dst, u_int8_t *oui, u_int16_t type,
01685 libnet_t *l);
01686 
01699 int
01700 libnet_write(libnet_t *l);
01701 
01711 u_int32_t
01712 libnet_get_ipaddr4(libnet_t *l);
01713 
01719 struct libnet_in6_addr
01720 libnet_get_ipaddr6(libnet_t *l);
01721 
01730 struct libnet_ether_addr *
01731 libnet_get_hwaddr(libnet_t *l);
01732 
01742 u_int8_t *
01743 libnet_hex_aton(int8_t *s, int *len);
01744 
01760 int
01761 libnet_adv_cull_packet(libnet_t *l, u_int8_t **packet, u_int32_t *packet_s);
01762 
01775 int
01776 libnet_adv_cull_header(libnet_t *l, libnet_ptag_t ptag, u_int8_t **header,
01777 u_int32_t *header_s);
01778 
01792 int
01793 libnet_adv_write_link(libnet_t *l, u_int8_t *packet, u_int32_t packet_s);
01794 
01801 void
01802 libnet_adv_free_packet(libnet_t *l, u_int8_t *packet);
01803 
01817 int 
01818 libnet_cq_add(libnet_t *l, char *label);
01819 
01834 libnet_t *
01835 libnet_cq_remove(libnet_t *l);
01836 
01848 libnet_t *
01849 libnet_cq_remove_by_label(char *label);
01850  
01857 int8_t *
01858 libnet_cq_getlabel(libnet_t *l);
01859  
01866 libnet_t *
01867 libnet_cq_find_by_label(char *label);
01868   
01874 void
01875 libnet_cq_destroy();
01876 
01896 libnet_t *
01897 libnet_cq_head();
01898 
01904 int
01905 libnet_cq_last();
01906 
01912 libnet_t *
01913 libnet_cq_next();
01914 
01920 u_int32_t
01921 libnet_cq_size();
01922 
01928 void
01929 libnet_diag_dump_context(libnet_t *l);
01930 
01936 void
01937 libnet_diag_dump_pblock(libnet_t *l);
01938 
01945 char *
01946 libnet_diag_dump_pblock_type(u_int8_t type);
01947 
01959 void
01960 libnet_diag_dump_hex(u_int8_t *packet, u_int32_t len, int swap, FILE *stream);
01961 
01962 /*
01963  * [Internal] 
01964  */
01965 int
01966 libnet_write_raw_ipv4(libnet_t *l, u_int8_t *packet, u_int32_t size);
01967 
01968 /*
01969  * [Internal] 
01970  */
01971 int
01972 libnet_write_raw_ipv6(libnet_t *l, u_int8_t *packet, u_int32_t size);
01973 
01974 /*
01975  * [Internal] 
01976  */
01977 int
01978 libnet_write_link(libnet_t *l, u_int8_t *packet, u_int32_t size);
01979 
01980 #if ((__WIN32__) && !(__CYGWIN__))
01981 /*
01982  * [Internal] 
01983  */
01984 SOCKET
01985 libnet_open_raw4(libnet_t *l);
01986 #else
01987 /*
01988  * [Internal] 
01989  */
01990 int
01991 libnet_open_raw4(libnet_t *l);
01992 #endif
01993 
01994 /*
01995  * [Internal] 
01996  */
01997 int
01998 libnet_close_raw4(libnet_t *l);
01999 
02000 /*
02001  * [Internal] 
02002  */
02003 int
02004 libnet_open_raw6(libnet_t *l);
02005        
02006 /*
02007  * [Internal] 
02008  */
02009 int
02010 libnet_close_raw6(libnet_t *l);
02011 
02012 /*
02013  * [Internal] 
02014  */
02015 int
02016 libnet_select_device(libnet_t *l);
02017 
02018 /*
02019  * [Internal] 
02020  */
02021 int
02022 libnet_open_link(libnet_t *l);
02023 
02024 /*
02025  * [Internal] 
02026  */
02027 int
02028 libnet_close_link(libnet_t *l);
02029 
02030 /*
02031  * [Internal] 
02032  */
02033 int
02034 libnet_do_checksum(libnet_t *l, u_int8_t *packet, int protocol, int len);
02035 
02036 /*
02037  * [Internal] 
02038  */
02039 u_int32_t
02040 libnet_compute_crc(u_int8_t *buf, u_int32_t len);
02041 
02042 /*
02043  * [Internal] 
02044  */
02045 u_int16_t
02046 libnet_ip_check(u_int16_t *addr, int len);
02047 
02048 /*
02049  * [Internal] 
02050  */
02051 int
02052 libnet_in_cksum(u_int16_t *addr, int len);
02053 
02054 /*
02055  * [Internal] 
02056  * If ptag is 0, function will create a pblock for the protocol unit type,
02057  * append it to the list and return a pointer to it.  If ptag is not 0,
02058  * function will search the pblock list for the specified protocol block 
02059  * and return a pointer to it.
02060  */
02061 libnet_pblock_t *
02062 libnet_pblock_probe(libnet_t *l, libnet_ptag_t ptag, u_int32_t n, 
02063 u_int8_t type);
02064 
02065 /*
02066  * [Internal] 
02067  * Function creates the pblock list if l->protocol_blocks == NULL or appends
02068  * an entry to the doubly linked list.
02069  */
02070 libnet_pblock_t *
02071 libnet_pblock_new(libnet_t *l, u_int32_t size);
02072 
02073 /*
02074  * [Internal] 
02075  * Function swaps two pblocks in memory.
02076  */
02077 int
02078 libnet_pblock_swap(libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2);
02079 
02080 /*
02081  * [Internal] 
02082  * Function inserts a pblock into the doubly linked list.
02083  */
02084 int
02085 libnet_pblock_insert_before(libnet_t *l, libnet_ptag_t ptag1,
02086 libnet_ptag_t ptag2);
02087 
02088 /*
02089  * [Internal] 
02090  * Function removes a pblock from context 
02091  */
02092 void
02093 libnet_pblock_delete(libnet_t *l, libnet_pblock_t *p);
02094 
02095 /*
02096  * [Internal] 
02097  * Function updates the pblock meta-inforation.  Internally it updates the
02098  * ptag with a monotonically increasing variable kept in l.  This way each
02099  * pblock has a succesively increasing ptag identifier.
02100  */
02101 libnet_ptag_t
02102 libnet_pblock_update(libnet_t *l, libnet_pblock_t *p, u_int32_t h, 
02103 u_int8_t type);
02104 
02105 /*
02106  * [Internal] 
02107  * Function locates a given block by it's ptag. 
02108  */
02109 libnet_pblock_t *
02110 libnet_pblock_find(libnet_t *l, libnet_ptag_t ptag);
02111 
02112 /*
02113  * [Internal] 
02114  * Function copies protocol block data over.
02115  */
02116 int
02117 libnet_pblock_append(libnet_t *l, libnet_pblock_t *p, u_int8_t *buf,
02118 u_int32_t len);
02119 
02120 /*
02121  * [Internal] 
02122  * Function sets pblock flags.
02123  */
02124 void
02125 libnet_pblock_setflags(libnet_pblock_t *p, u_int8_t flags);
02126 
02127 /*
02128  * [Internal] 
02129  * Function returns the protocol number for the protocol block type.  If
02130  * the type is unknown, the function defaults to returning IPPROTO_IP.
02131  */
02132 int
02133 libnet_pblock_p2p(u_int8_t type);
02134 
02135 /*
02136  * [Internal] 
02137  * Function assembles the packet for subsequent writing.  Function makes two
02138  * passes through the pblock list:
02139  */
02140 int
02141 libnet_pblock_coalesce(libnet_t *l, u_int8_t **packet, u_int32_t *size);
02142 
02143 #if !(__WIN32__)
02144 /*
02145  * [Internal] 
02146  * By testing if we can retrieve the FLAGS of an iface
02147  * we can know if it exists or not and if it is up.
02148  */
02149 int
02150 libnet_check_iface(libnet_t *l);
02151 #endif
02152 
02153 #if defined(__WIN32__)
02154 /*
02155  * [Internal] 
02156  */
02157 BYTE *
02158 libnet_win32_get_remote_mac(libnet_t *l, DWORD IP);
02159 
02160 /*
02161  * [Internal] 
02162  */
02163 int
02164 libnet_close_link_interface(libnet_t *l);
02165 
02166 /*
02167  * [Internal] 
02168  */
02169 BYTE * 
02170 libnet_win32_read_arp_table(DWORD IP);
02171 #endif
02172 #endif  /* __LIBNET_FUNCTIONS_H */
02173 
02174 /* EOF */

Generated on Wed Mar 10 13:23:37 2004 for libnet by doxygen 1.3.4