File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / libnet / doc / html / libnet-functions_8h-source.html
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 22:14:23 2012 UTC (12 years, 10 months ago) by misho
Branches: libnet, MAIN
CVS tags: v1_1_2_1, HEAD
libnet

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>libnet: libnet-functions.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.4 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
<h1>libnet-functions.h</h1><a href="libnet-functions_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span>
00002 <span class="comment"> *  $Id: libnet-functions_8h-source.html,v 1.1.1.1 2012/02/21 22:14:23 misho Exp $</span>
00003 <span class="comment"> *</span>
00004 <span class="comment"> *  libnet-functions.h - function prototypes</span>
00005 <span class="comment"> *</span>
00006 <span class="comment"> *  Copyright (c) 1998 - 2004 Mike D. Schiffman &lt;mike@infonexus.com&gt;</span>
00007 <span class="comment"> *  All rights reserved.</span>
00008 <span class="comment"> *</span>
00009 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span>
00010 <span class="comment"> * modification, are permitted provided that the following conditions</span>
00011 <span class="comment"> * are met:</span>
00012 <span class="comment"> * 1. Redistributions of source code must retain the above copyright</span>
00013 <span class="comment"> *    notice, this list of conditions and the following disclaimer.</span>
00014 <span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span>
00015 <span class="comment"> *    notice, this list of conditions and the following disclaimer in the</span>
00016 <span class="comment"> *    documentation and/or other materials provided with the distribution.</span>
00017 <span class="comment"> *</span>
00018 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND</span>
00019 <span class="comment"> * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span>
00020 <span class="comment"> * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</span>
00021 <span class="comment"> * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE</span>
00022 <span class="comment"> * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL</span>
00023 <span class="comment"> * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS</span>
00024 <span class="comment"> * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)</span>
00025 <span class="comment"> * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT</span>
00026 <span class="comment"> * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY</span>
00027 <span class="comment"> * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</span>
00028 <span class="comment"> * SUCH DAMAGE.</span>
00029 <span class="comment"> *</span>
00030 <span class="comment"> */</span>
00031 
00032 <span class="preprocessor">#ifndef __LIBNET_FUNCTIONS_H</span>
00033 <span class="preprocessor"></span><span class="preprocessor">#define __LIBNET_FUNCTIONS_H</span>
00034 <span class="preprocessor"></span>
00063 libnet_t *
00064 libnet_init(<span class="keywordtype">int</span> injection_type, <span class="keywordtype">char</span> *device, <span class="keywordtype">char</span> *err_buf);
00065 
00071 <span class="keywordtype">void</span>
00072 libnet_destroy(libnet_t *l);
00073 
00080 <span class="keywordtype">void</span>
00081 libnet_clear_packet(libnet_t *l);
00082 
00089 <span class="keywordtype">void</span>
00090 libnet_stats(libnet_t *l, <span class="keyword">struct</span> libnet_stats *ls);
00091 
00097 <span class="keywordtype">int</span> 
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 <span class="keywordtype">char</span> *
00139 libnet_geterror(libnet_t *l);
00140 
00147 u_int32_t
00148 libnet_getpacket_size(libnet_t *l);
00149 
00155 <span class="keywordtype">int</span>
00156 libnet_seed_prand(libnet_t *l);
00157 
00171 u_int32_t
00172 libnet_get_prand(<span class="keywordtype">int</span> mod);
00173 
00195 <span class="keywordtype">int</span>
00196 libnet_toggle_checksum(libnet_t *l, libnet_ptag_t ptag, <span class="keywordtype">int</span> mode);
00197 
00210 <span class="keywordtype">char</span> *
00211 libnet_addr2name4(u_int32_t in, u_int8_t use_name);
00212 
00226 u_int32_t
00227 libnet_name2addr4(libnet_t *l, <span class="keywordtype">char</span> *host_name, u_int8_t use_name);
00228 
00229 <span class="keyword">extern</span> <span class="keyword">const</span> <span class="keyword">struct </span>libnet_in6_addr in6addr_error;
00230 
00244 <span class="keyword">struct </span>libnet_in6_addr
00245 libnet_name2addr6(libnet_t *l, <span class="keywordtype">char</span> *host_name, u_int8_t use_name);
00246 
00250 <span class="keywordtype">void</span>
00251 libnet_addr2name6_r(<span class="keyword">struct</span> libnet_in6_addr addr, u_int8_t use_name,
00252 <span class="keywordtype">char</span> *host_name, <span class="keywordtype">int</span> host_name_len);
00253 
00269 <span class="keywordtype">int</span>
00270 libnet_plist_chain_new(libnet_t *l, libnet_plist_t **plist, <span class="keywordtype">char</span> *token_list);
00271 
00283 <span class="keywordtype">int</span>
00284 libnet_plist_chain_next_pair(libnet_plist_t *plist, u_int16_t *bport, 
00285 u_int16_t *eport); 
00286 
00293 <span class="keywordtype">int</span>
00294 libnet_plist_chain_dump(libnet_plist_t *plist);
00295 
00304 <span class="keywordtype">char</span> *
00305 libnet_plist_chain_dump_string(libnet_plist_t *plist);
00306 
00312 <span class="keywordtype">int</span>
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, <span class="keyword">struct</span> libnet_in6_addr src, <span class="keyword">struct</span> 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, <span class="keyword">struct</span> 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 <a class="code" href="libnet-functions_8h.html#a69">libnet_build_ospfv2_hello</a>(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 <a class="code" href="libnet-functions_8h.html#a70">libnet_build_ospfv2_dbd</a>(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 <a class="code" href="libnet-functions_8h.html#a71">libnet_build_ospfv2_lsr</a>(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 <a class="code" href="libnet-functions_8h.html#a72">libnet_build_ospfv2_lsu</a>(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 <a class="code" href="libnet-functions_8h.html#a73">libnet_build_ospfv2_lsa</a>(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 <a class="code" href="libnet-functions_8h.html#a74">libnet_build_ospfv2_lsa_rtr</a>(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 <a class="code" href="libnet-functions_8h.html#a75">libnet_build_ospfv2_lsa_net</a>(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 <a class="code" href="libnet-functions_8h.html#a76">libnet_build_ospfv2_lsa_sum</a>(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 <a class="code" href="libnet-functions_8h.html#a77">libnet_build_ospfv2_lsa_as</a>(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 <span class="keyword">inline</span> 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 <span class="keywordtype">int</span>
01700 libnet_write(libnet_t *l);
01701 
01711 u_int32_t
01712 libnet_get_ipaddr4(libnet_t *l);
01713 
01719 <span class="keyword">struct </span>libnet_in6_addr
01720 libnet_get_ipaddr6(libnet_t *l);
01721 
01730 <span class="keyword">struct </span>libnet_ether_addr *
01731 libnet_get_hwaddr(libnet_t *l);
01732 
01742 u_int8_t *
01743 libnet_hex_aton(int8_t *s, <span class="keywordtype">int</span> *len);
01744 
01760 <span class="keywordtype">int</span>
01761 libnet_adv_cull_packet(libnet_t *l, u_int8_t **packet, u_int32_t *packet_s);
01762 
01775 <span class="keywordtype">int</span>
01776 libnet_adv_cull_header(libnet_t *l, libnet_ptag_t ptag, u_int8_t **header,
01777 u_int32_t *header_s);
01778 
01792 <span class="keywordtype">int</span>
01793 libnet_adv_write_link(libnet_t *l, u_int8_t *packet, u_int32_t packet_s);
01794 
01801 <span class="keywordtype">void</span>
01802 libnet_adv_free_packet(libnet_t *l, u_int8_t *packet);
01803 
01817 <span class="keywordtype">int</span> 
01818 libnet_cq_add(libnet_t *l, <span class="keywordtype">char</span> *label);
01819 
01834 libnet_t *
01835 libnet_cq_remove(libnet_t *l);
01836 
01848 libnet_t *
01849 libnet_cq_remove_by_label(<span class="keywordtype">char</span> *label);
01850  
01857 int8_t *
01858 libnet_cq_getlabel(libnet_t *l);
01859  
01866 libnet_t *
01867 libnet_cq_find_by_label(<span class="keywordtype">char</span> *label);
01868   
01874 <span class="keywordtype">void</span>
01875 libnet_cq_destroy();
01876 
01896 libnet_t *
01897 libnet_cq_head();
01898 
01904 <span class="keywordtype">int</span>
01905 libnet_cq_last();
01906 
01912 libnet_t *
01913 libnet_cq_next();
01914 
01920 u_int32_t
01921 libnet_cq_size();
01922 
01928 <span class="keywordtype">void</span>
01929 libnet_diag_dump_context(libnet_t *l);
01930 
01936 <span class="keywordtype">void</span>
01937 libnet_diag_dump_pblock(libnet_t *l);
01938 
01945 <span class="keywordtype">char</span> *
01946 libnet_diag_dump_pblock_type(u_int8_t type);
01947 
01959 <span class="keywordtype">void</span>
01960 libnet_diag_dump_hex(u_int8_t *packet, u_int32_t len, <span class="keywordtype">int</span> swap, FILE *stream);
01961 
01962 <span class="comment">/*</span>
01963 <span class="comment"> * [Internal] </span>
01964 <span class="comment"> */</span>
01965 <span class="keywordtype">int</span>
01966 libnet_write_raw_ipv4(libnet_t *l, u_int8_t *packet, u_int32_t size);
01967 
01968 <span class="comment">/*</span>
01969 <span class="comment"> * [Internal] </span>
01970 <span class="comment"> */</span>
01971 <span class="keywordtype">int</span>
01972 libnet_write_raw_ipv6(libnet_t *l, u_int8_t *packet, u_int32_t size);
01973 
01974 <span class="comment">/*</span>
01975 <span class="comment"> * [Internal] </span>
01976 <span class="comment"> */</span>
01977 <span class="keywordtype">int</span>
01978 libnet_write_link(libnet_t *l, u_int8_t *packet, u_int32_t size);
01979 
01980 <span class="preprocessor">#if ((__WIN32__) &amp;&amp; !(__CYGWIN__))</span>
01981 <span class="preprocessor"></span><span class="comment">/*</span>
01982 <span class="comment"> * [Internal] </span>
01983 <span class="comment"> */</span>
01984 SOCKET
01985 libnet_open_raw4(libnet_t *l);
01986 <span class="preprocessor">#else</span>
01987 <span class="preprocessor"></span><span class="comment">/*</span>
01988 <span class="comment"> * [Internal] </span>
01989 <span class="comment"> */</span>
01990 <span class="keywordtype">int</span>
01991 libnet_open_raw4(libnet_t *l);
01992 <span class="preprocessor">#endif</span>
01993 <span class="preprocessor"></span>
01994 <span class="comment">/*</span>
01995 <span class="comment"> * [Internal] </span>
01996 <span class="comment"> */</span>
01997 <span class="keywordtype">int</span>
01998 libnet_close_raw4(libnet_t *l);
01999 
02000 <span class="comment">/*</span>
02001 <span class="comment"> * [Internal] </span>
02002 <span class="comment"> */</span>
02003 <span class="keywordtype">int</span>
02004 libnet_open_raw6(libnet_t *l);
02005        
02006 <span class="comment">/*</span>
02007 <span class="comment"> * [Internal] </span>
02008 <span class="comment"> */</span>
02009 <span class="keywordtype">int</span>
02010 libnet_close_raw6(libnet_t *l);
02011 
02012 <span class="comment">/*</span>
02013 <span class="comment"> * [Internal] </span>
02014 <span class="comment"> */</span>
02015 <span class="keywordtype">int</span>
02016 libnet_select_device(libnet_t *l);
02017 
02018 <span class="comment">/*</span>
02019 <span class="comment"> * [Internal] </span>
02020 <span class="comment"> */</span>
02021 <span class="keywordtype">int</span>
02022 libnet_open_link(libnet_t *l);
02023 
02024 <span class="comment">/*</span>
02025 <span class="comment"> * [Internal] </span>
02026 <span class="comment"> */</span>
02027 <span class="keywordtype">int</span>
02028 libnet_close_link(libnet_t *l);
02029 
02030 <span class="comment">/*</span>
02031 <span class="comment"> * [Internal] </span>
02032 <span class="comment"> */</span>
02033 <span class="keywordtype">int</span>
02034 libnet_do_checksum(libnet_t *l, u_int8_t *packet, <span class="keywordtype">int</span> protocol, <span class="keywordtype">int</span> len);
02035 
02036 <span class="comment">/*</span>
02037 <span class="comment"> * [Internal] </span>
02038 <span class="comment"> */</span>
02039 u_int32_t
02040 libnet_compute_crc(u_int8_t *buf, u_int32_t len);
02041 
02042 <span class="comment">/*</span>
02043 <span class="comment"> * [Internal] </span>
02044 <span class="comment"> */</span>
02045 u_int16_t
02046 libnet_ip_check(u_int16_t *addr, <span class="keywordtype">int</span> len);
02047 
02048 <span class="comment">/*</span>
02049 <span class="comment"> * [Internal] </span>
02050 <span class="comment"> */</span>
02051 <span class="keywordtype">int</span>
02052 libnet_in_cksum(u_int16_t *addr, <span class="keywordtype">int</span> len);
02053 
02054 <span class="comment">/*</span>
02055 <span class="comment"> * [Internal] </span>
02056 <span class="comment"> * If ptag is 0, function will create a pblock for the protocol unit type,</span>
02057 <span class="comment"> * append it to the list and return a pointer to it.  If ptag is not 0,</span>
02058 <span class="comment"> * function will search the pblock list for the specified protocol block </span>
02059 <span class="comment"> * and return a pointer to it.</span>
02060 <span class="comment"> */</span>
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 <span class="comment">/*</span>
02066 <span class="comment"> * [Internal] </span>
02067 <span class="comment"> * Function creates the pblock list if l-&gt;protocol_blocks == NULL or appends</span>
02068 <span class="comment"> * an entry to the doubly linked list.</span>
02069 <span class="comment"> */</span>
02070 libnet_pblock_t *
02071 libnet_pblock_new(libnet_t *l, u_int32_t size);
02072 
02073 <span class="comment">/*</span>
02074 <span class="comment"> * [Internal] </span>
02075 <span class="comment"> * Function swaps two pblocks in memory.</span>
02076 <span class="comment"> */</span>
02077 <span class="keywordtype">int</span>
02078 libnet_pblock_swap(libnet_t *l, libnet_ptag_t ptag1, libnet_ptag_t ptag2);
02079 
02080 <span class="comment">/*</span>
02081 <span class="comment"> * [Internal] </span>
02082 <span class="comment"> * Function inserts a pblock into the doubly linked list.</span>
02083 <span class="comment"> */</span>
02084 <span class="keywordtype">int</span>
02085 libnet_pblock_insert_before(libnet_t *l, libnet_ptag_t ptag1,
02086 libnet_ptag_t ptag2);
02087 
02088 <span class="comment">/*</span>
02089 <span class="comment"> * [Internal] </span>
02090 <span class="comment"> * Function removes a pblock from context </span>
02091 <span class="comment"> */</span>
02092 <span class="keywordtype">void</span>
02093 libnet_pblock_delete(libnet_t *l, libnet_pblock_t *p);
02094 
02095 <span class="comment">/*</span>
02096 <span class="comment"> * [Internal] </span>
02097 <span class="comment"> * Function updates the pblock meta-inforation.  Internally it updates the</span>
02098 <span class="comment"> * ptag with a monotonically increasing variable kept in l.  This way each</span>
02099 <span class="comment"> * pblock has a succesively increasing ptag identifier.</span>
02100 <span class="comment"> */</span>
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 <span class="comment">/*</span>
02106 <span class="comment"> * [Internal] </span>
02107 <span class="comment"> * Function locates a given block by it's ptag. </span>
02108 <span class="comment"> */</span>
02109 libnet_pblock_t *
02110 libnet_pblock_find(libnet_t *l, libnet_ptag_t ptag);
02111 
02112 <span class="comment">/*</span>
02113 <span class="comment"> * [Internal] </span>
02114 <span class="comment"> * Function copies protocol block data over.</span>
02115 <span class="comment"> */</span>
02116 <span class="keywordtype">int</span>
02117 libnet_pblock_append(libnet_t *l, libnet_pblock_t *p, u_int8_t *buf,
02118 u_int32_t len);
02119 
02120 <span class="comment">/*</span>
02121 <span class="comment"> * [Internal] </span>
02122 <span class="comment"> * Function sets pblock flags.</span>
02123 <span class="comment"> */</span>
02124 <span class="keywordtype">void</span>
02125 libnet_pblock_setflags(libnet_pblock_t *p, u_int8_t flags);
02126 
02127 <span class="comment">/*</span>
02128 <span class="comment"> * [Internal] </span>
02129 <span class="comment"> * Function returns the protocol number for the protocol block type.  If</span>
02130 <span class="comment"> * the type is unknown, the function defaults to returning IPPROTO_IP.</span>
02131 <span class="comment"> */</span>
02132 <span class="keywordtype">int</span>
02133 libnet_pblock_p2p(u_int8_t type);
02134 
02135 <span class="comment">/*</span>
02136 <span class="comment"> * [Internal] </span>
02137 <span class="comment"> * Function assembles the packet for subsequent writing.  Function makes two</span>
02138 <span class="comment"> * passes through the pblock list:</span>
02139 <span class="comment"> */</span>
02140 <span class="keywordtype">int</span>
02141 libnet_pblock_coalesce(libnet_t *l, u_int8_t **packet, u_int32_t *size);
02142 
02143 <span class="preprocessor">#if !(__WIN32__)</span>
02144 <span class="preprocessor"></span><span class="comment">/*</span>
02145 <span class="comment"> * [Internal] </span>
02146 <span class="comment"> * By testing if we can retrieve the FLAGS of an iface</span>
02147 <span class="comment"> * we can know if it exists or not and if it is up.</span>
02148 <span class="comment"> */</span>
02149 <span class="keywordtype">int</span>
02150 libnet_check_iface(libnet_t *l);
02151 <span class="preprocessor">#endif</span>
02152 <span class="preprocessor"></span>
02153 <span class="preprocessor">#if defined(__WIN32__)</span>
02154 <span class="preprocessor"></span><span class="comment">/*</span>
02155 <span class="comment"> * [Internal] </span>
02156 <span class="comment"> */</span>
02157 BYTE *
02158 libnet_win32_get_remote_mac(libnet_t *l, DWORD IP);
02159 
02160 <span class="comment">/*</span>
02161 <span class="comment"> * [Internal] </span>
02162 <span class="comment"> */</span>
02163 <span class="keywordtype">int</span>
02164 libnet_close_link_interface(libnet_t *l);
02165 
02166 <span class="comment">/*</span>
02167 <span class="comment"> * [Internal] </span>
02168 <span class="comment"> */</span>
02169 BYTE * 
02170 libnet_win32_read_arp_table(DWORD IP);
02171 <span class="preprocessor">#endif</span>
02172 <span class="preprocessor"></span><span class="preprocessor">#endif  </span><span class="comment">/* __LIBNET_FUNCTIONS_H */</span>
02173 
02174 <span class="comment">/* EOF */</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Wed Mar 10 13:23:37 2004 for libnet by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 > 
</a>1.3.4 </small></address>
</body>
</html>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>