File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / libnet / doc / html / libnet-headers_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, 4 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-headers.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-headers.h</h1><a href="libnet-headers_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-headers_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-headers.h - Network routine library headers header file</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_HEADERS_H</span>
00033 <span class="preprocessor"></span><span class="preprocessor">#define __LIBNET_HEADERS_H</span>
00034 <span class="preprocessor"></span>
<a name="l00042"></a><a class="code" href="libnet-headers_8h.html#a0">00042</a> <span class="preprocessor">#define LIBNET_802_1Q_H         0x12    </span>
<a name="l00043"></a><a class="code" href="libnet-headers_8h.html#a1">00043</a> <span class="preprocessor">#define LIBNET_802_1X_H         0x04    </span>
<a name="l00044"></a><a class="code" href="libnet-headers_8h.html#a2">00044</a> <span class="preprocessor">#define LIBNET_802_2_H          0x03    </span>
<a name="l00045"></a><a class="code" href="libnet-headers_8h.html#a3">00045</a> <span class="preprocessor">#define LIBNET_802_2SNAP_H      0x08    </span>
<a name="l00046"></a><a class="code" href="libnet-headers_8h.html#a4">00046</a> <span class="preprocessor">#define LIBNET_802_3_H          0x0e    </span>
<a name="l00047"></a><a class="code" href="libnet-headers_8h.html#a5">00047</a> <span class="preprocessor">#define LIBNET_ARP_H            0x08    </span>
<a name="l00048"></a><a class="code" href="libnet-headers_8h.html#a6">00048</a> <span class="preprocessor">#define LIBNET_ARP_ETH_IP_H     0x1c    </span>
<a name="l00049"></a><a class="code" href="libnet-headers_8h.html#a7">00049</a> <span class="preprocessor">#define LIBNET_BGP4_HEADER_H    0x13    </span>
<a name="l00050"></a><a class="code" href="libnet-headers_8h.html#a8">00050</a> <span class="preprocessor">#define LIBNET_BGP4_OPEN_H      0x0a    </span>
<a name="l00051"></a><a class="code" href="libnet-headers_8h.html#a9">00051</a> <span class="preprocessor">#define LIBNET_BGP4_UPDATE_H    0x04    </span>
<a name="l00052"></a><a class="code" href="libnet-headers_8h.html#a10">00052</a> <span class="preprocessor">#define LIBNET_BGP4_NOTIFICATION_H 0x02 </span>
<a name="l00053"></a><a class="code" href="libnet-headers_8h.html#a11">00053</a> <span class="preprocessor">#define LIBNET_CDP_H            0x08    </span>
<a name="l00054"></a><a class="code" href="libnet-headers_8h.html#a12">00054</a> <span class="preprocessor">#define LIBNET_DHCPV4_H         0xf0    </span>
<a name="l00055"></a><a class="code" href="libnet-headers_8h.html#a13">00055</a> <span class="preprocessor">#define LIBNET_UDP_DNSV4_H      0x0c    </span>
<a name="l00056"></a><a class="code" href="libnet-headers_8h.html#a14">00056</a> <span class="preprocessor">#define LIBNET_TCP_DNSV4_H      0x0e    </span>
<a name="l00057"></a><a class="code" href="libnet-headers_8h.html#a15">00057</a> <span class="preprocessor">#define LIBNET_ETH_H            0x0e    </span>
<a name="l00058"></a><a class="code" href="libnet-headers_8h.html#a16">00058</a> <span class="preprocessor">#define LIBNET_FDDI_H           0x15    </span>
<a name="l00059"></a><a class="code" href="libnet-headers_8h.html#a17">00059</a> <span class="preprocessor">#define LIBNET_ICMPV4_H         0x04    </span>
<a name="l00060"></a><a class="code" href="libnet-headers_8h.html#a18">00060</a> <span class="preprocessor">#define LIBNET_ICMPV4_ECHO_H    0x08    </span>
<a name="l00061"></a><a class="code" href="libnet-headers_8h.html#a19">00061</a> <span class="preprocessor">#define LIBNET_ICMPV4_MASK_H    0x0c    </span>
<a name="l00062"></a><a class="code" href="libnet-headers_8h.html#a20">00062</a> <span class="preprocessor">#define LIBNET_ICMPV4_UNREACH_H  0x08   </span>
<a name="l00063"></a><a class="code" href="libnet-headers_8h.html#a21">00063</a> <span class="preprocessor">#define LIBNET_ICMPV4_TIMXCEED_H 0x08   </span>
<a name="l00064"></a><a class="code" href="libnet-headers_8h.html#a22">00064</a> <span class="preprocessor">#define LIBNET_ICMPV4_REDIRECT_H 0x08   </span>
<a name="l00065"></a><a class="code" href="libnet-headers_8h.html#a23">00065</a> <span class="preprocessor">#define LIBNET_ICMPV4_TS_H      0x14    </span>
<a name="l00066"></a><a class="code" href="libnet-headers_8h.html#a24">00066</a> <span class="preprocessor">#define LIBNET_ICMPV6_H         0x08    </span>
<a name="l00067"></a><a class="code" href="libnet-headers_8h.html#a25">00067</a> <span class="preprocessor">#define LIBNET_IGMP_H           0x08    </span>
<a name="l00068"></a><a class="code" href="libnet-headers_8h.html#a26">00068</a> <span class="preprocessor">#define LIBNET_IPV4_H           0x14    </span>
<a name="l00069"></a><a class="code" href="libnet-headers_8h.html#a27">00069</a> <span class="preprocessor">#define LIBNET_IPV6_H           0x28    </span>
<a name="l00070"></a><a class="code" href="libnet-headers_8h.html#a28">00070</a> <span class="preprocessor">#define LIBNET_IPV6_FRAG_H      0x08    </span>
<a name="l00071"></a><a class="code" href="libnet-headers_8h.html#a29">00071</a> <span class="preprocessor">#define LIBNET_IPV6_ROUTING_H   0x04    </span>
<a name="l00072"></a><a class="code" href="libnet-headers_8h.html#a30">00072</a> <span class="preprocessor">#define LIBNET_IPV6_DESTOPTS_H  0x02    </span>
<a name="l00073"></a><a class="code" href="libnet-headers_8h.html#a31">00073</a> <span class="preprocessor">#define LIBNET_IPV6_HBHOPTS_H   0x02    </span>
<a name="l00074"></a><a class="code" href="libnet-headers_8h.html#a32">00074</a> <span class="preprocessor">#define LIBNET_IPSEC_ESP_HDR_H  0x0c    </span>
<a name="l00075"></a><a class="code" href="libnet-headers_8h.html#a33">00075</a> <span class="preprocessor">#define LIBNET_IPSEC_ESP_FTR_H  0x02    </span>
<a name="l00076"></a><a class="code" href="libnet-headers_8h.html#a34">00076</a> <span class="preprocessor">#define LIBNET_IPSEC_AH_H       0x10    </span>
<a name="l00077"></a><a class="code" href="libnet-headers_8h.html#a35">00077</a> <span class="preprocessor">#define LIBNET_ISL_H            0x1a    </span>
<a name="l00078"></a><a class="code" href="libnet-headers_8h.html#a36">00078</a> <span class="preprocessor">#define LIBNET_GRE_H            0x04    </span>
<a name="l00079"></a><a class="code" href="libnet-headers_8h.html#a37">00079</a> <span class="preprocessor">#define LIBNET_GRE_SRE_H        0x04    </span>
<a name="l00080"></a><a class="code" href="libnet-headers_8h.html#a38">00080</a> <span class="preprocessor">#define LIBNET_MPLS_H           0x04    </span>
<a name="l00081"></a><a class="code" href="libnet-headers_8h.html#a39">00081</a> <span class="preprocessor">#define LIBNET_OSPF_H           0x10    </span>
<a name="l00082"></a><a class="code" href="libnet-headers_8h.html#a40">00082</a> <span class="preprocessor">#define LIBNET_OSPF_HELLO_H     0x18    </span>
<a name="l00083"></a><a class="code" href="libnet-headers_8h.html#a41">00083</a> <span class="preprocessor">#define LIBNET_OSPF_DBD_H       0x08    </span>
<a name="l00084"></a><a class="code" href="libnet-headers_8h.html#a42">00084</a> <span class="preprocessor">#define LIBNET_OSPF_LSR_H       0x0c    </span>
<a name="l00085"></a><a class="code" href="libnet-headers_8h.html#a43">00085</a> <span class="preprocessor">#define LIBNET_OSPF_LSU_H       0x04    </span>
<a name="l00086"></a><a class="code" href="libnet-headers_8h.html#a44">00086</a> <span class="preprocessor">#define LIBNET_OSPF_LSA_H       0x14    </span>
<a name="l00087"></a><a class="code" href="libnet-headers_8h.html#a45">00087</a> <span class="preprocessor">#define LIBNET_OSPF_AUTH_H      0x08    </span>
<a name="l00088"></a><a class="code" href="libnet-headers_8h.html#a46">00088</a> <span class="preprocessor">#define LIBNET_OSPF_CKSUM       0x10    </span>
<a name="l00089"></a><a class="code" href="libnet-headers_8h.html#a47">00089</a> <span class="preprocessor">#define LIBNET_OSPF_LS_RTR_H    0x10    </span>
<a name="l00090"></a><a class="code" href="libnet-headers_8h.html#a48">00090</a> <span class="preprocessor">#define LIBNET_OSPF_LS_NET_H    0x08    </span>
<a name="l00091"></a><a class="code" href="libnet-headers_8h.html#a49">00091</a> <span class="preprocessor">#define LIBNET_OSPF_LS_SUM_H    0x0c    </span>
<a name="l00092"></a><a class="code" href="libnet-headers_8h.html#a50">00092</a> <span class="preprocessor">#define LIBNET_OSPF_LS_AS_EXT_H 0x10    </span>
<a name="l00093"></a><a class="code" href="libnet-headers_8h.html#a51">00093</a> <span class="preprocessor">#define LIBNET_NTP_H            0x30    </span>
<a name="l00094"></a><a class="code" href="libnet-headers_8h.html#a52">00094</a> <span class="preprocessor">#define LIBNET_RIP_H            0x18    </span>
<a name="l00095"></a><a class="code" href="libnet-headers_8h.html#a53">00095</a> <span class="preprocessor">#define LIBNET_RPC_CALL_H       0x28    </span>
<a name="l00098"></a><a class="code" href="libnet-headers_8h.html#a54">00098</a> <span class="preprocessor">#define LIBNET_RPC_CALL_TCP_H   0x2c    </span>
00101 <span class="preprocessor">#define LIBNET_SEBEK_H          0x30    </span><span class="comment">/* sebek header:          48 bytes */</span>   
<a name="l00102"></a><a class="code" href="libnet-headers_8h.html#a56">00102</a> <span class="preprocessor">#define LIBNET_STP_CONF_H       0x23    </span>
<a name="l00103"></a><a class="code" href="libnet-headers_8h.html#a57">00103</a> <span class="preprocessor">#define LIBNET_STP_TCN_H        0x04    </span>
<a name="l00104"></a><a class="code" href="libnet-headers_8h.html#a58">00104</a> <span class="preprocessor">#define LIBNET_TOKEN_RING_H     0x16    </span>
<a name="l00105"></a><a class="code" href="libnet-headers_8h.html#a59">00105</a> <span class="preprocessor">#define LIBNET_TCP_H            0x14    </span>
<a name="l00106"></a><a class="code" href="libnet-headers_8h.html#a60">00106</a> <span class="preprocessor">#define LIBNET_UDP_H            0x08    </span>
<a name="l00107"></a><a class="code" href="libnet-headers_8h.html#a61">00107</a> <span class="preprocessor">#define LIBNET_VRRP_H           0x08    </span>
<a name="l00113"></a><a class="code" href="structlibnet__802__1q__hdr.html">00113</a> <span class="preprocessor">struct libnet_802_1q_hdr</span>
00114 <span class="preprocessor"></span>{
<a name="l00115"></a><a class="code" href="structlibnet__802__1q__hdr.html#o0">00115</a>     u_int8_t vlan_dhost[ETHER_ADDR_LEN];  
<a name="l00116"></a><a class="code" href="structlibnet__802__1q__hdr.html#o1">00116</a>     u_int8_t vlan_shost[ETHER_ADDR_LEN];  
<a name="l00117"></a><a class="code" href="structlibnet__802__1q__hdr.html#o2">00117</a>     u_int16_t vlan_tpi;                   
<a name="l00118"></a><a class="code" href="structlibnet__802__1q__hdr.html#o3">00118</a>     u_int16_t vlan_priority_c_vid;        
<a name="l00119"></a><a class="code" href="libnet-headers_8h.html#a62">00119</a> <span class="preprocessor">#define LIBNET_802_1Q_PRIMASK   0x0007    </span>
<a name="l00120"></a><a class="code" href="libnet-headers_8h.html#a63">00120</a> <span class="preprocessor">#define LIBNET_802_1Q_CFIMASK   0x0001    </span>
<a name="l00121"></a><a class="code" href="libnet-headers_8h.html#a64">00121</a> <span class="preprocessor">#define LIBNET_802_1Q_VIDMASK   0x0fff    </span>
<a name="l00122"></a><a class="code" href="structlibnet__802__1q__hdr.html#o4">00122</a> <span class="preprocessor">    u_int16_t vlan_len;                   </span>
00123 <span class="preprocessor">};  </span>
00124 <span class="preprocessor"></span>
<a name="l00129"></a><a class="code" href="structlibnet__802__1x__hdr.html">00129</a> <span class="keyword">struct </span><a class="code" href="structlibnet__802__1x__hdr.html">libnet_802_1x_hdr</a>
00130 {
<a name="l00131"></a><a class="code" href="structlibnet__802__1x__hdr.html#o0">00131</a>     u_int8_t <a class="code" href="structlibnet__802__1x__hdr.html#o0">dot1x_version</a>;               
<a name="l00132"></a><a class="code" href="structlibnet__802__1x__hdr.html#o1">00132</a>     u_int8_t <a class="code" href="structlibnet__802__1x__hdr.html#o1">dot1x_type</a>;                  
<a name="l00133"></a><a class="code" href="libnet-headers_8h.html#a65">00133</a> <span class="preprocessor">#define LIBNET_802_1X_PACKET    0x00      </span>
<a name="l00134"></a><a class="code" href="libnet-headers_8h.html#a66">00134</a> <span class="preprocessor">#define LIBNET_802_1X_START     0x01      </span>
<a name="l00135"></a><a class="code" href="libnet-headers_8h.html#a67">00135</a> <span class="preprocessor">#define LIBNET_802_1X_LOGOFF    0x02      </span>
<a name="l00136"></a><a class="code" href="libnet-headers_8h.html#a68">00136</a> <span class="preprocessor">#define LIBNET_802_1X_KEY       0x03      </span>
<a name="l00137"></a><a class="code" href="libnet-headers_8h.html#a69">00137</a> <span class="preprocessor">#define LIBNET_802_1X_ENCASFAL  0x04      </span>
<a name="l00138"></a><a class="code" href="structlibnet__802__1x__hdr.html#o2">00138</a> <span class="preprocessor">    u_int16_t dot1x_length;               </span>
00139 <span class="preprocessor">};  </span>
00140 <span class="preprocessor"></span>
00141 <span class="comment">/*</span>
00142 <span class="comment"> *  IEEE 802.2 LLC header</span>
00143 <span class="comment"> *  Link Layer Control</span>
00144 <span class="comment"> *  static header size: 3 bytes</span>
00145 <span class="comment"> */</span>
00146 <span class="keyword">struct </span>libnet_802_2_hdr
00147 {
00148     u_int8_t llc_dsap;            <span class="comment">/* destination service access point */</span>
00149     u_int8_t llc_ssap;            <span class="comment">/* source service access point */</span>
00150 <span class="preprocessor">#define LIBNET_SAP_STP          0x42</span>
00151 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_SAP_SNAP         0xaa</span>
00152 <span class="preprocessor"></span>    u_int8_t llc_control;         <span class="comment">/* control field */</span>
00153 };
00154 
00155 
00156 <span class="comment">/*</span>
00157 <span class="comment"> *  IEEE 802.2 LLC/SNAP header</span>
00158 <span class="comment"> *  SubNetwork Attachment Point</span>
00159 <span class="comment"> *  static header size: 8 bytes</span>
00160 <span class="comment"> */</span>
00161 <span class="keyword">struct </span>libnet_802_2snap_hdr
00162 {
00163     u_int8_t snap_dsap;           <span class="comment">/* destination service access point */</span>
00164     u_int8_t snap_ssap;           <span class="comment">/* destination service access point */</span>
00165     u_int8_t snap_control;        <span class="comment">/* control field */</span>
00166     u_int8_t snap_oui[3];         <span class="comment">/* OUI */</span>
00167     u_int16_t snap_type;          <span class="comment">/* type */</span>
00168 };
00169 
00170 
00171 <span class="comment">/*</span>
00172 <span class="comment"> *  802.3 header</span>
00173 <span class="comment"> *  IEEE Ethernet</span>
00174 <span class="comment"> *  Static header size: 14 bytes</span>
00175 <span class="comment"> */</span>
00176 <span class="keyword">struct </span>libnet_802_3_hdr
00177 {
00178     u_int8_t  _802_3_dhost[ETHER_ADDR_LEN];<span class="comment">/* destination ethernet address */</span>
00179     u_int8_t  _802_3_shost[ETHER_ADDR_LEN];<span class="comment">/* source ethernet address */</span>
00180     u_int16_t _802_3_len;                 <span class="comment">/* packet type ID */</span>
00181 };
00182 
00183 
00184 <span class="comment">/* </span>
00185 <span class="comment"> *  ARP header</span>
00186 <span class="comment"> *  Address Resolution Protocol</span>
00187 <span class="comment"> *  Base header size: 8 bytes</span>
00188 <span class="comment"> */</span>
00189 <span class="keyword">struct </span>libnet_arp_hdr
00190 {
00191     u_int16_t ar_hrd;         <span class="comment">/* format of hardware address */</span>
00192 <span class="preprocessor">#define ARPHRD_NETROM   0   </span><span class="comment">/* from KA9Q: NET/ROM pseudo */</span>
00193 <span class="preprocessor">#define ARPHRD_ETHER    1   </span><span class="comment">/* Ethernet 10Mbps */</span>
00194 <span class="preprocessor">#define ARPHRD_EETHER   2   </span><span class="comment">/* Experimental Ethernet */</span>
00195 <span class="preprocessor">#define ARPHRD_AX25     3   </span><span class="comment">/* AX.25 Level 2 */</span>
00196 <span class="preprocessor">#define ARPHRD_PRONET   4   </span><span class="comment">/* PROnet token ring */</span>
00197 <span class="preprocessor">#define ARPHRD_CHAOS    5   </span><span class="comment">/* Chaosnet */</span>
00198 <span class="preprocessor">#define ARPHRD_IEEE802  6   </span><span class="comment">/* IEEE 802.2 Ethernet/TR/TB */</span>
00199 <span class="preprocessor">#define ARPHRD_ARCNET   7   </span><span class="comment">/* ARCnet */</span>
00200 <span class="preprocessor">#define ARPHRD_APPLETLK 8   </span><span class="comment">/* APPLEtalk */</span>
00201 <span class="preprocessor">#define ARPHRD_LANSTAR  9   </span><span class="comment">/* Lanstar */</span>
00202 <span class="preprocessor">#define ARPHRD_DLCI     15  </span><span class="comment">/* Frame Relay DLCI */</span>
00203 <span class="preprocessor">#define ARPHRD_ATM      19  </span><span class="comment">/* ATM */</span>
00204 <span class="preprocessor">#define ARPHRD_METRICOM 23  </span><span class="comment">/* Metricom STRIP (new IANA id) */</span>
00205 <span class="preprocessor">#define ARPHRD_IPSEC    31  </span><span class="comment">/* IPsec tunnel */</span>
00206     u_int16_t ar_pro;         <span class="comment">/* format of protocol address */</span>
00207     u_int8_t  ar_hln;         <span class="comment">/* length of hardware address */</span>
00208     u_int8_t  ar_pln;         <span class="comment">/* length of protocol addres */</span>
00209     u_int16_t ar_op;          <span class="comment">/* operation type */</span>
00210 <span class="preprocessor">#define ARPOP_REQUEST    1  </span><span class="comment">/* req to resolve address */</span>
00211 <span class="preprocessor">#define ARPOP_REPLY      2  </span><span class="comment">/* resp to previous request */</span>
00212 <span class="preprocessor">#define ARPOP_REVREQUEST 3  </span><span class="comment">/* req protocol address given hardware */</span>
00213 <span class="preprocessor">#define ARPOP_REVREPLY   4  </span><span class="comment">/* resp giving protocol address */</span>
00214 <span class="preprocessor">#define ARPOP_INVREQUEST 8  </span><span class="comment">/* req to identify peer */</span>
00215 <span class="preprocessor">#define ARPOP_INVREPLY   9  </span><span class="comment">/* resp identifying peer */</span>
00216     <span class="comment">/* address information allocated dynamically */</span>
00217 };
00218 
00219 <span class="comment">/*</span>
00220 <span class="comment"> * BGP4 header</span>
00221 <span class="comment"> * Border Gateway Protocol 4</span>
00222 <span class="comment"> * Base header size : 19 bytes</span>
00223 <span class="comment"> */</span>
00224 <span class="keyword">struct </span>libnet_bgp4_header_hdr
00225 {
00226 <span class="preprocessor">#define LIBNET_BGP4_MARKER_SIZE   16</span>
00227 <span class="preprocessor"></span>    u_int8_t marker[LIBNET_BGP4_MARKER_SIZE];
00228     u_int16_t len;
00229     u_int8_t type;
00230 <span class="preprocessor">#define LIBNET_BGP4_OPEN          1</span>
00231 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_UPDATE        2</span>
00232 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_NOTIFICATION  3</span>
00233 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_KEEPALIVE     4</span>
00234 <span class="preprocessor"></span>};
00235 
00236 <span class="comment">/*</span>
00237 <span class="comment"> * BGP4 open header</span>
00238 <span class="comment"> * Border Gateway Protocol 4</span>
00239 <span class="comment"> * Base header size : 10 bytes</span>
00240 <span class="comment"> */</span>
00241 <span class="keyword">struct </span>libnet_bgp4_open_hdr
00242 {
00243     u_int8_t version;
00244     u_int16_t src_as;
00245     u_int16_t hold_time;
00246     u_int32_t bgp_id;
00247     u_int8_t opt_len;
00248 };
00249 
00250 <span class="comment">/*</span>
00251 <span class="comment"> * BGP4 notification message</span>
00252 <span class="comment"> *</span>
00253 <span class="comment"> * Border Gateway Protocol 4</span>
00254 <span class="comment"> * Base header size : 2 bytes</span>
00255 <span class="comment"> *</span>
00256 <span class="comment"> * Use payload if you need data</span>
00257 <span class="comment"> */</span>
00258 <span class="keyword">struct </span>libnet_bgp4_notification_hdr
00259 {
00260 <span class="preprocessor">#define LIBNET_BGP4_MESSAGE_HEADER_ERROR  1</span>
00261 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_OPEN_MESSAGE_ERROR    2</span>
00262 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_UPDATE_MESSAGE_ERROR  3</span>
00263 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_HOLD_TIMER_EXPIRED    4</span>
00264 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_FINITE_STATE__ERROR   5</span>
00265 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_CEASE                 6</span>
00266 <span class="preprocessor"></span>    u_int8_t err_code;
00267 
00268 <span class="comment">/* Message Header Error subcodes */</span>
00269 <span class="preprocessor">#define LIBNET_BGP4_CONNECTION_NOT_SYNCHRONIZED    1</span>
00270 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_BAD_MESSAGE_LENGTH             2</span>
00271 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_BAD_MESSAGE_TYPE               3</span>
00272 <span class="preprocessor"></span><span class="comment">/* OPEN Message Error subcodes */</span>
00273 <span class="preprocessor">#define LIBNET_BGP4_UNSUPPORTED_VERSION_NUMBER     1</span>
00274 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_BAD_PEER_AS                    2</span>
00275 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_BAD_BGP_IDENTIFIER             3</span>
00276 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_UNSUPPORTED_OPTIONAL_PARAMETER 4</span>
00277 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_AUTHENTICATION_FAILURE         5</span>
00278 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_UNACCEPTABLE_HOLD_TIME         6</span>
00279 <span class="preprocessor"></span><span class="comment">/* UPDATE Message Error subcodes */</span>
00280 <span class="preprocessor">#define LIBNET_BGP4_MALFORMED_ATTRIBUTE_LIST</span>
00281 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_UNRECOGNIZED_WELL_KNOWN_ATTRIBUTE</span>
00282 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_MISSING_WELL_KNOWN_ATTRIBUTE</span>
00283 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_ATTRIBUTE_FLAGS_ERROR</span>
00284 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_ATTRIBUTE_LENGTH_ERROR</span>
00285 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_INVALID_ORIGIN_ATTRIBUTE</span>
00286 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_AS_ROUTING_LOOP</span>
00287 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_INVALID_NEXT_HOP_ATTRIBUTE</span>
00288 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_OPTIONAL_ATTRIBUTE_ERROR</span>
00289 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_INVALID_NETWORK_FIELD</span>
00290 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_MALFORMED_AS_PATH</span>
00291 <span class="preprocessor"></span>    u_int8_t err_subcode;
00292 };
00293 
00294 
00295 
00296 <span class="comment">/*</span>
00297 <span class="comment"> *  CDP header</span>
00298 <span class="comment"> *  Cisco Discovery Protocol</span>
00299 <span class="comment"> *  Base header size: 8 bytes</span>
00300 <span class="comment"> */</span>
00301 
00302 <span class="comment">/*</span>
00303 <span class="comment"> *  For checksum stuff -- IANA says 135-254 is "unassigned" as of 12.2001.</span>
00304 <span class="comment"> *  Let's hope this one stays that way for a while!</span>
00305 <span class="comment"> */</span>
00306 <span class="preprocessor">#define LIBNET_PROTO_CDP    200</span>
00307 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_cdp_hdr
00308 {
00309     u_int8_t cdp_version;     <span class="comment">/* version (should always be 0x01) */</span>
00310     u_int8_t cdp_ttl;         <span class="comment">/* time reciever should hold info in this packet */</span>
00311     u_int16_t cdp_sum;        <span class="comment">/* checksum */</span>
00312     u_int16_t cdp_type;       <span class="comment">/* type */</span>
00313 <span class="preprocessor">#define LIBNET_CDP_DEVID    0x1 </span><span class="comment">/* device id */</span>
00314 <span class="preprocessor">#define LIBNET_CDP_ADDRESS  0x2 </span><span class="comment">/* address */</span>
00315 <span class="preprocessor">#define LIBNET_CDP_PORTID   0x3 </span><span class="comment">/* port id */</span>
00316 <span class="preprocessor">#define LIBNET_CDP_CAPABIL  0x4 </span><span class="comment">/* capabilities */</span>
00317 <span class="preprocessor">#define LIBNET_CDP_VERSION  0x5 </span><span class="comment">/* version */</span>
00318 <span class="preprocessor">#define LIBNET_CDP_PLATFORM 0x6 </span><span class="comment">/* platform */</span>
00319 <span class="preprocessor">#define LIBNET_CDP_IPPREFIX 0x7 </span><span class="comment">/* ip prefix */</span>
00320     u_int16_t cdp_len;        <span class="comment">/* type + length + value */</span>
00321     <span class="comment">/* value information done dynamically */</span>
00322 
00323 <span class="comment">/* CDP capabilities */</span>
00324 <span class="preprocessor">#define LIBNET_CDP_CAP_L3R  0x01</span><span class="comment">/* performs level 3 routing */</span>
00325 <span class="preprocessor">#define LIBNET_CDP_CAP_L2B  0x02</span><span class="comment">/* performs level 2 transparent bridging */</span>
00326 <span class="preprocessor">#define LIBNET_CDP_CAP_L2SRB 0x04</span><span class="comment">/* performs level 2 sourceroute bridging */</span>
00327 <span class="preprocessor">#define LIBNET_CDP_CAP_L2S  0x08</span><span class="comment">/* performs level 2 switching */</span>
00328 <span class="preprocessor">#define LIBNET_CDP_CAP_SR   0x10</span><span class="comment">/* sends and recieves packets on a network */</span>
00329 <span class="preprocessor">#define LIBNET_CDP_CAP_NOI  0x20</span><span class="comment">/* does not forward IGMP on non-router ports */</span>
00330 <span class="preprocessor">#define LIBNET_CDP_CAP_L1F  0x40</span><span class="comment">/* provides level 1 functionality */</span>
00331 };
00332 
00333 
00334 <span class="comment">/*</span>
00335 <span class="comment"> *  Used as an overlay for type/len/values</span>
00336 <span class="comment"> */</span>
00337 <span class="keyword">struct </span>libnet_cdp_value_hdr
00338 {
00339     u_int16_t cdp_type;
00340     u_int16_t cdp_len;
00341 };
00342 
00343 
00344 <span class="comment">/*</span>
00345 <span class="comment"> *  DHCP header</span>
00346 <span class="comment"> *  Dynamic Host Configuration Protocol</span>
00347 <span class="comment"> *  Static header size: f0 bytes</span>
00348 <span class="comment"> */</span>
00349 <span class="keyword">struct </span>libnet_dhcpv4_hdr
00350 {
00351     u_int8_t dhcp_opcode;     <span class="comment">/* opcode */</span>
00352 <span class="preprocessor">#define LIBNET_DHCP_REQUEST 0x1</span>
00353 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_REPLY   0x2</span>
00354 <span class="preprocessor"></span>    u_int8_t dhcp_htype;      <span class="comment">/* hardware address type */</span>
00355     u_int8_t dhcp_hlen;       <span class="comment">/* hardware address length */</span>
00356     u_int8_t dhcp_hopcount;   <span class="comment">/* used by proxy servers */</span>
00357     u_int32_t dhcp_xid;        <span class="comment">/* transaction ID */</span>
00358     u_int16_t dhcp_secs;      <span class="comment">/* number of seconds since trying to bootstrap */</span>
00359     u_int16_t dhcp_flags;     <span class="comment">/* flags for DHCP, unused for BOOTP */</span>
00360     u_int32_t dhcp_cip;        <span class="comment">/* client's IP */</span>
00361     u_int32_t dhcp_yip;        <span class="comment">/* your IP */</span>
00362     u_int32_t dhcp_sip;        <span class="comment">/* server's IP */</span>
00363     u_int32_t dhcp_gip;        <span class="comment">/* gateway IP */</span>
00364     u_int8_t dhcp_chaddr[16]; <span class="comment">/* client hardware address */</span>
00365     u_int8_t dhcp_sname[64];  <span class="comment">/* server host name */</span>
00366     u_int8_t dhcp_file[128];  <span class="comment">/* boot file name */</span>
00367     u_int32_t dhcp_magic;      <span class="comment">/* BOOTP magic header */</span>
00368 <span class="preprocessor">#define DHCP_MAGIC                  0x63825363</span>
00369 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BOOTP_MIN_LEN        0x12c</span>
00370 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_PAD             0x00</span>
00371 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_SUBNETMASK      0x01</span>
00372 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_TIMEOFFSET      0x02</span>
00373 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_ROUTER          0x03</span>
00374 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_TIMESERVER      0x04</span>
00375 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NAMESERVER      0x05</span>
00376 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_DNS             0x06</span>
00377 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_LOGSERV         0x07</span>
00378 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_COOKIESERV      0x08</span>
00379 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_LPRSERV         0x09</span>
00380 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_IMPSERV         0x0a</span>
00381 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_RESSERV         0x0b</span>
00382 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_HOSTNAME        0x0c</span>
00383 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_BOOTFILESIZE    0x0d</span>
00384 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_DUMPFILE        0x0e</span>
00385 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_DOMAINNAME      0x0f</span>
00386 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_SWAPSERV        0x10</span>
00387 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_ROOTPATH        0x11</span>
00388 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_EXTENPATH       0x12</span>
00389 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_IPFORWARD       0x13</span>
00390 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_SRCROUTE        0x14</span>
00391 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_POLICYFILTER    0x15</span>
00392 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MAXASMSIZE      0x16</span>
00393 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_IPTTL           0x17</span>
00394 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MTUTIMEOUT      0x18</span>
00395 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MTUTABLE        0x19</span>
00396 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MTUSIZE         0x1a</span>
00397 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_LOCALSUBNETS    0x1b</span>
00398 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_BROADCASTADDR   0x1c</span>
00399 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_DOMASKDISCOV    0x1d</span>
00400 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MASKSUPPLY      0x1e</span>
00401 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_DOROUTEDISC     0x1f</span>
00402 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_ROUTERSOLICIT   0x20</span>
00403 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_STATICROUTE     0x21</span>
00404 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_TRAILERENCAP    0x22</span>
00405 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_ARPTIMEOUT      0x23</span>
00406 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_ETHERENCAP      0x24</span>
00407 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_TCPTTL          0x25</span>
00408 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_TCPKEEPALIVE    0x26</span>
00409 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_TCPALIVEGARBAGE 0x27</span>
00410 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NISDOMAIN       0x28</span>
00411 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NISSERVERS      0x29</span>
00412 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NISTIMESERV     0x2a</span>
00413 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_VENDSPECIFIC    0x2b</span>
00414 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NBNS            0x2c</span>
00415 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NBDD            0x2d</span>
00416 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NBTCPIP         0x2e</span>
00417 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NBTCPSCOPE      0x2f</span>
00418 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_XFONT           0x30</span>
00419 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_XDISPLAYMGR     0x31</span>
00420 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_DISCOVERADDR    0x32</span>
00421 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_LEASETIME       0x33</span>
00422 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_OPTIONOVERLOAD  0x34</span>
00423 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MESSAGETYPE     0x35</span>
00424 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_SERVIDENT       0x36</span>
00425 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_PARAMREQUEST    0x37</span>
00426 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MESSAGE         0x38</span>
00427 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MAXMSGSIZE      0x39</span>
00428 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_RENEWTIME       0x3a</span>
00429 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_REBINDTIME      0x3b</span>
00430 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_CLASSSID        0x3c</span>
00431 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_CLIENTID        0x3d</span>
00432 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NISPLUSDOMAIN   0x40</span>
00433 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NISPLUSSERVERS  0x41</span>
00434 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MOBILEIPAGENT   0x44</span>
00435 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_SMTPSERVER      0x45</span>
00436 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_POP3SERVER      0x46</span>
00437 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NNTPSERVER      0x47</span>
00438 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_WWWSERVER       0x48</span>
00439 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_FINGERSERVER    0x49</span>
00440 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_IRCSERVER       0x4a</span>
00441 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_STSERVER        0x4b</span>
00442 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_STDASERVER      0x4c</span>
00443 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_END             0xff</span>
00444 <span class="preprocessor"></span>
00445 <span class="preprocessor">#define LIBNET_DHCP_MSGDISCOVER     0x01</span>
00446 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MSGOFFER        0x02</span>
00447 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MSGREQUEST      0x03</span>
00448 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MSGDECLINE      0x04</span>
00449 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MSGACK          0x05</span>
00450 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MSGNACK         0x06</span>
00451 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MSGRELEASE      0x07</span>
00452 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MSGINFORM       0x08</span>
00453 <span class="preprocessor"></span>};
00454 
00455 
00456 <span class="comment">/*</span>
00457 <span class="comment"> *  Base DNSv4 header</span>
00458 <span class="comment"> *  Domain Name System</span>
00459 <span class="comment"> *  Base header size: 12/14 bytes</span>
00460 <span class="comment"> */</span>
00461 <span class="comment">/* this little guy got left out in the cold */</span>
00462 <span class="preprocessor">#define LIBNET_DNS_H LIBNET_UDP_DNSV4_H</span>
00463 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_dnsv4_hdr
00464 {
00465     u_int16_t h_len;          <span class="comment">/* length of the packet - only used with TCP */</span>
00466     u_int16_t id;             <span class="comment">/* DNS packet ID */</span>
00467     u_int16_t flags;          <span class="comment">/* DNS flags */</span>
00468     u_int16_t num_q;          <span class="comment">/* Number of questions */</span>
00469     u_int16_t num_answ_rr;    <span class="comment">/* Number of answer resource records */</span>
00470     u_int16_t num_auth_rr;    <span class="comment">/* Number of authority resource records */</span>
00471     u_int16_t num_addi_rr;    <span class="comment">/* Number of additional resource records */</span>
00472 };
00473 
00474 
00475 <span class="comment">/*</span>
00476 <span class="comment"> *  Ethernet II header</span>
00477 <span class="comment"> *  Static header size: 14 bytes</span>
00478 <span class="comment"> */</span>
00479 <span class="keyword">struct </span>libnet_ethernet_hdr
00480 {
00481     u_int8_t  ether_dhost[ETHER_ADDR_LEN];<span class="comment">/* destination ethernet address */</span>
00482     u_int8_t  ether_shost[ETHER_ADDR_LEN];<span class="comment">/* source ethernet address */</span>
00483     u_int16_t ether_type;                 <span class="comment">/* protocol */</span>
00484 };
00485 
00486 <span class="preprocessor">#ifndef ETHERTYPE_PUP</span>
00487 <span class="preprocessor"></span><span class="preprocessor">#define ETHERTYPE_PUP           0x0200  </span><span class="comment">/* PUP protocol */</span>
00488 <span class="preprocessor">#endif</span>
00489 <span class="preprocessor"></span><span class="preprocessor">#ifndef ETHERTYPE_IP</span>
00490 <span class="preprocessor"></span><span class="preprocessor">#define ETHERTYPE_IP            0x0800  </span><span class="comment">/* IP protocol */</span>
00491 <span class="preprocessor">#endif</span>
00492 <span class="preprocessor"></span><span class="preprocessor">#ifndef ETHERTYPE_ARP</span>
00493 <span class="preprocessor"></span><span class="preprocessor">#define ETHERTYPE_ARP           0x0806  </span><span class="comment">/* addr. resolution protocol */</span>
00494 <span class="preprocessor">#endif</span>
00495 <span class="preprocessor"></span><span class="preprocessor">#ifndef ETHERTYPE_REVARP</span>
00496 <span class="preprocessor"></span><span class="preprocessor">#define ETHERTYPE_REVARP        0x8035  </span><span class="comment">/* reverse addr. resolution protocol */</span>
00497 <span class="preprocessor">#endif</span>
00498 <span class="preprocessor"></span><span class="preprocessor">#ifndef ETHERTYPE_VLAN</span>
00499 <span class="preprocessor"></span><span class="preprocessor">#define ETHERTYPE_VLAN          0x8100  </span><span class="comment">/* IEEE 802.1Q VLAN tagging */</span>
00500 <span class="preprocessor">#endif</span>
00501 <span class="preprocessor"></span><span class="preprocessor">#ifndef ETHERTYPE_EAP</span>
00502 <span class="preprocessor"></span><span class="preprocessor">#define ETHERTYPE_EAP           0x888e  </span><span class="comment">/* IEEE 802.1X EAP authentication */</span>
00503 <span class="preprocessor">#endif</span>
00504 <span class="preprocessor"></span><span class="preprocessor">#ifndef ETHERTYPE_MPLS</span>
00505 <span class="preprocessor"></span><span class="preprocessor">#define ETHERTYPE_MPLS          0x8847  </span><span class="comment">/* MPLS */</span>
00506 <span class="preprocessor">#endif</span>
00507 <span class="preprocessor"></span><span class="preprocessor">#ifndef ETHERTYPE_LOOPBACK</span>
00508 <span class="preprocessor"></span><span class="preprocessor">#define ETHERTYPE_LOOPBACK      0x9000  </span><span class="comment">/* used to test interfaces */</span>
00509 <span class="preprocessor">#endif</span>
00510 <span class="preprocessor"></span>
00511 <span class="keyword">struct </span>libnet_ether_addr
00512 {
00513     u_int8_t  ether_addr_octet[6];        <span class="comment">/* Ethernet address */</span>
00514 };
00515 
00516 <span class="comment">/*</span>
00517 <span class="comment"> *  Fiber Distributed Data Interface header</span>
00518 <span class="comment"> *</span>
00519 <span class="comment"> *  Static header size: 21 bytes (LLC and 48-bit address addr only)</span>
00520 <span class="comment"> *</span>
00521 <span class="comment"> *  Note: Organization field is 3 bytes which throws off the</span>
00522 <span class="comment"> *        alignment of type.  Therefore fddi_type (19 bytes in) </span>
00523 <span class="comment"> *        is specified as two u_int8_ts.</span>
00524 <span class="comment"> */</span>
00525 <span class="keyword">struct </span>libnet_fddi_hdr
00526 {
00527     u_int8_t  fddi_frame_control;                      <span class="comment">/* Class/Format/Priority */</span>
00528 <span class="preprocessor">#define LIBNET_FDDI_LLC_FRAME  0x10</span>
00529 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_FDDI_48BIT_ADDR 0x40</span>
00530 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_FDDI_FC_REQD    LIBNET_FDDI_LLC_FRAME | LIBNET_FDDI_48BIT_ADDR </span>
00531 <span class="preprocessor"></span>    u_int8_t  fddi_dhost[FDDI_ADDR_LEN];               <span class="comment">/* destination fddi address */</span>
00532     u_int8_t  fddi_shost[FDDI_ADDR_LEN];               <span class="comment">/* source fddi address */</span>
00533     u_int8_t  fddi_llc_dsap;                           <span class="comment">/* DSAP */</span>
00534     u_int8_t  fddi_llc_ssap;                           <span class="comment">/* SSAP */</span>
00535     u_int8_t  fddi_llc_control_field;                  <span class="comment">/* Class/Format/Priority */</span>
00536     u_int8_t  fddi_llc_org_code[LIBNET_ORG_CODE_SIZE]; <span class="comment">/* Organization Code 3-bytes */</span>
00537     u_int8_t  fddi_type;                               <span class="comment">/* Protocol Type */</span>
00538     u_int8_t  fddi_type1;                              <span class="comment">/* see note above. */</span>
00539 <span class="preprocessor">#define FDDI_TYPE_IP            0x0800  </span><span class="comment">/* IP protocol */</span>
00540 <span class="preprocessor">#define FDDI_TYPE_ARP           0x0806  </span><span class="comment">/* addr. resolution protocol */</span>
00541 <span class="preprocessor">#define FDDI_TYPE_REVARP        0x8035  </span><span class="comment">/* reverse addr. resolution protocol */</span>
00542 };
00543 
00544 
00545 <span class="keyword">struct </span>libnet_fddi_addr
00546 {
00547     u_int8_t  fddi_addr_octet[6];        <span class="comment">/* FDDI address */</span>
00548 };
00549 
00550 
00551 <span class="comment">/*</span>
00552 <span class="comment"> * GRE header - RFC 1701 &amp; 2637</span>
00553 <span class="comment"> * Generic Routing Encapsulation (GRE) </span>
00554 <span class="comment"> * Base header size: 4 bytes</span>
00555 <span class="comment"> */</span>
00556 <span class="keyword">struct </span>libnet_gre_hdr
00557 {
00558     u_int16_t flags_ver;
00559 <span class="preprocessor">#define GRE_CSUM                            0x8000</span>
00560 <span class="preprocessor"></span><span class="preprocessor">#define GRE_ROUTING                         0x4000</span>
00561 <span class="preprocessor"></span><span class="preprocessor">#define GRE_KEY                             0x2000</span>
00562 <span class="preprocessor"></span><span class="preprocessor">#define GRE_SEQ                             0x1000</span>
00563 <span class="preprocessor"></span><span class="preprocessor">#define GRE_STRICT                          0x0800</span>
00564 <span class="preprocessor"></span><span class="preprocessor">#define GRE_REC                             0x0700</span>
00565 <span class="preprocessor"></span><span class="preprocessor">#define GRE_ACK                             0x0080</span>
00566 <span class="preprocessor"></span>
00567 <span class="preprocessor">#define GRE_FLAGS_MASK                          0x00F8</span>
00568 <span class="preprocessor"></span><span class="preprocessor">#define GRE_VERSION_MASK                        0x0007</span>
00569 <span class="preprocessor"></span>
00570 <span class="preprocessor">#define GRE_VERSION_0                           0x0000</span>
00571 <span class="preprocessor"></span><span class="preprocessor">#define GRE_VERSION_1                           0x0001</span>
00572 <span class="preprocessor"></span>
00573     u_int16_t type;
00574 <span class="preprocessor">#define GRE_SNA                                 0x0004</span>
00575 <span class="preprocessor"></span><span class="preprocessor">#define GRE_OSI_NETWORK_LAYER                   0x00FE</span>
00576 <span class="preprocessor"></span><span class="preprocessor">#define GRE_PUP                                 0x0200</span>
00577 <span class="preprocessor"></span><span class="preprocessor">#define GRE_XNS                                 0x0600</span>
00578 <span class="preprocessor"></span><span class="preprocessor">#define GRE_IP                                  0x0800</span>
00579 <span class="preprocessor"></span><span class="preprocessor">#define GRE_CHAOS                               0x0804</span>
00580 <span class="preprocessor"></span><span class="preprocessor">#define GRE_RFC_826_ARP                         0x0806</span>
00581 <span class="preprocessor"></span><span class="preprocessor">#define GRE_FRAME_RELAY_ARP                     0x0808</span>
00582 <span class="preprocessor"></span><span class="preprocessor">#define GRE_VINES                               0x0BAD</span>
00583 <span class="preprocessor"></span><span class="preprocessor">#define GRE_VINES_ECHO                          0x0BAE</span>
00584 <span class="preprocessor"></span><span class="preprocessor">#define GRE_VINES_LOOPBACK                      0x0BAF</span>
00585 <span class="preprocessor"></span><span class="preprocessor">#define GRE_DECNET                              0x6003</span>
00586 <span class="preprocessor"></span><span class="preprocessor">#define GRE_TRANSPARENT_ETHERNET_BRIDGING       0x6558</span>
00587 <span class="preprocessor"></span><span class="preprocessor">#define GRE_RAW_FRAME_RELAY                     0x6559</span>
00588 <span class="preprocessor"></span><span class="preprocessor">#define GRE_APOLLO_DOMAIN                       0x8019</span>
00589 <span class="preprocessor"></span><span class="preprocessor">#define GRE_ETHERTALK                           0x809B</span>
00590 <span class="preprocessor"></span><span class="preprocessor">#define GRE_NOVELL_IPX                          0x8137</span>
00591 <span class="preprocessor"></span><span class="preprocessor">#define GRE_RFC_1144_TCP_IP_COMPRESSION         0x876B</span>
00592 <span class="preprocessor"></span><span class="preprocessor">#define GRE_IP_AUTONOMOUS_SYSTEMS               0x876C</span>
00593 <span class="preprocessor"></span><span class="preprocessor">#define GRE_SECURE_DATA                         0x876D</span>
00594 <span class="preprocessor"></span><span class="preprocessor">#define GRE_PPP                                 0x880b </span><span class="comment">/* taken from RFC 2637 */</span>
00595 
00596     <span class="keyword">union </span>{
00597     <span class="keyword">struct </span>{
00598         u_int16_t sum;  <span class="comment">/* optional */</span>
00599         u_int16_t offset;    <span class="comment">/* optional */</span>
00600         u_int32_t key;        <span class="comment">/* optional */</span>
00601         u_int32_t seq;        <span class="comment">/* optional */</span>
00602     } _gre;
00603 
00604     <span class="keyword">struct </span>{
00605         u_int16_t payload_s; <span class="comment">/* optional */</span>
00606         u_int16_t callID;    <span class="comment">/* optional */</span>
00607         u_int32_t seq;        <span class="comment">/* optional */</span>
00608         u_int32_t ack;        <span class="comment">/* optional */</span>
00609     } _egre;
00610     }_data;
00611 
00612 <span class="preprocessor">#define gre_sum _data._gre.sum</span>
00613 <span class="preprocessor"></span><span class="preprocessor">#define gre_offset _data._gre.offset</span>
00614 <span class="preprocessor"></span><span class="preprocessor">#define gre_key _data._gre.key</span>
00615 <span class="preprocessor"></span><span class="preprocessor">#define gre_seq _data._gre.seq</span>
00616 <span class="preprocessor"></span>
00617 <span class="preprocessor">#define egre_payload_s _data._egre.payload_s</span>
00618 <span class="preprocessor"></span><span class="preprocessor">#define egre_callID _data._egre.callID</span>
00619 <span class="preprocessor"></span><span class="preprocessor">#define egre_seq _data._egre.seq</span>
00620 <span class="preprocessor"></span><span class="preprocessor">#define egre_ack _data._egre.ack</span>
00621 <span class="preprocessor"></span>};
00622 
00623 
00624 <span class="preprocessor">#ifndef IPPROTO_GRE</span>
00625 <span class="preprocessor"></span><span class="preprocessor">#define IPPROTO_GRE 47</span>
00626 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00627 <span class="preprocessor"></span>
00628 <span class="comment">/*</span>
00629 <span class="comment"> * Source Route Entries (SRE)</span>
00630 <span class="comment"> * This is used for GRE as the Routing field is a list of SREs - RFC 1701</span>
00631 <span class="comment"> * Base header size: 4 bytes</span>
00632 <span class="comment"> */</span>
00633 <span class="keyword">struct </span>libnet_gre_sre_hdr
00634 {
00635     u_int16_t af;  <span class="comment">/* address familly */</span>
00636     u_int8_t sre_offset;
00637     u_int8_t sre_length;
00638     u_int8_t *routing;
00639 };
00640 
00641 
00642 <span class="comment">/*</span>
00643 <span class="comment"> *  IPv4 header</span>
00644 <span class="comment"> *  Internet Protocol, version 4</span>
00645 <span class="comment"> *  Static header size: 20 bytes</span>
00646 <span class="comment"> */</span>
00647 <span class="keyword">struct </span>libnet_ipv4_hdr
00648 {
00649 <span class="preprocessor">#if (LIBNET_LIL_ENDIAN)</span>
00650 <span class="preprocessor"></span>    u_int8_t ip_hl:4,      <span class="comment">/* header length */</span>
00651            ip_v:4;         <span class="comment">/* version */</span>
00652 <span class="preprocessor">#endif</span>
00653 <span class="preprocessor"></span><span class="preprocessor">#if (LIBNET_BIG_ENDIAN)</span>
00654 <span class="preprocessor"></span>    u_int8_t ip_v:4,       <span class="comment">/* version */</span>
00655            ip_hl:4;        <span class="comment">/* header length */</span>
00656 <span class="preprocessor">#endif</span>
00657 <span class="preprocessor"></span>    u_int8_t ip_tos;       <span class="comment">/* type of service */</span>
00658 <span class="preprocessor">#ifndef IPTOS_LOWDELAY</span>
00659 <span class="preprocessor"></span><span class="preprocessor">#define IPTOS_LOWDELAY      0x10</span>
00660 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00661 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPTOS_THROUGHPUT</span>
00662 <span class="preprocessor"></span><span class="preprocessor">#define IPTOS_THROUGHPUT    0x08</span>
00663 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00664 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPTOS_RELIABILITY</span>
00665 <span class="preprocessor"></span><span class="preprocessor">#define IPTOS_RELIABILITY   0x04</span>
00666 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00667 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPTOS_LOWCOST</span>
00668 <span class="preprocessor"></span><span class="preprocessor">#define IPTOS_LOWCOST       0x02</span>
00669 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00670 <span class="preprocessor"></span>    u_int16_t ip_len;         <span class="comment">/* total length */</span>
00671     u_int16_t ip_id;          <span class="comment">/* identification */</span>
00672     u_int16_t ip_off;
00673 <span class="preprocessor">#ifndef IP_RF</span>
00674 <span class="preprocessor"></span><span class="preprocessor">#define IP_RF 0x8000        </span><span class="comment">/* reserved fragment flag */</span>
00675 <span class="preprocessor">#endif</span>
00676 <span class="preprocessor"></span><span class="preprocessor">#ifndef IP_DF</span>
00677 <span class="preprocessor"></span><span class="preprocessor">#define IP_DF 0x4000        </span><span class="comment">/* dont fragment flag */</span>
00678 <span class="preprocessor">#endif</span>
00679 <span class="preprocessor"></span><span class="preprocessor">#ifndef IP_MF</span>
00680 <span class="preprocessor"></span><span class="preprocessor">#define IP_MF 0x2000        </span><span class="comment">/* more fragments flag */</span>
00681 <span class="preprocessor">#endif </span>
00682 <span class="preprocessor"></span><span class="preprocessor">#ifndef IP_OFFMASK</span>
00683 <span class="preprocessor"></span><span class="preprocessor">#define IP_OFFMASK 0x1fff   </span><span class="comment">/* mask for fragmenting bits */</span>
00684 <span class="preprocessor">#endif</span>
00685 <span class="preprocessor"></span>    u_int8_t ip_ttl;          <span class="comment">/* time to live */</span>
00686     u_int8_t ip_p;            <span class="comment">/* protocol */</span>
00687     u_int16_t ip_sum;         <span class="comment">/* checksum */</span>
00688     <span class="keyword">struct </span>in_addr ip_src, ip_dst; <span class="comment">/* source and dest address */</span>
00689 };
00690 
00691 <span class="comment">/*</span>
00692 <span class="comment"> *  IP options</span>
00693 <span class="comment"> */</span>
00694 <span class="preprocessor">#ifndef IPOPT_EOL</span>
00695 <span class="preprocessor"></span><span class="preprocessor">#define IPOPT_EOL       0   </span><span class="comment">/* end of option list */</span>
00696 <span class="preprocessor">#endif</span>
00697 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPOPT_NOP</span>
00698 <span class="preprocessor"></span><span class="preprocessor">#define IPOPT_NOP       1   </span><span class="comment">/* no operation */</span>
00699 <span class="preprocessor">#endif   </span>
00700 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPOPT_RR</span>
00701 <span class="preprocessor"></span><span class="preprocessor">#define IPOPT_RR        7   </span><span class="comment">/* record packet route */</span>
00702 <span class="preprocessor">#endif</span>
00703 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPOPT_TS</span>
00704 <span class="preprocessor"></span><span class="preprocessor">#define IPOPT_TS        68  </span><span class="comment">/* timestamp */</span>
00705 <span class="preprocessor">#endif</span>
00706 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPOPT_SECURITY</span>
00707 <span class="preprocessor"></span><span class="preprocessor">#define IPOPT_SECURITY  130 </span><span class="comment">/* provide s,c,h,tcc */</span>   
00708 <span class="preprocessor">#endif</span>
00709 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPOPT_LSRR</span>
00710 <span class="preprocessor"></span><span class="preprocessor">#define IPOPT_LSRR      131 </span><span class="comment">/* loose source route */</span>
00711 <span class="preprocessor">#endif</span>
00712 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPOPT_SATID</span>
00713 <span class="preprocessor"></span><span class="preprocessor">#define IPOPT_SATID     136 </span><span class="comment">/* satnet id */</span>
00714 <span class="preprocessor">#endif</span>
00715 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPOPT_SSRR</span>
00716 <span class="preprocessor"></span><span class="preprocessor">#define IPOPT_SSRR      137 </span><span class="comment">/* strict source route */</span>
00717 <span class="preprocessor">#endif</span>
00718 <span class="preprocessor"></span>
00719 <span class="keyword">struct </span>libnet_in6_addr
00720 {
00721     <span class="keyword">union</span>
00722 <span class="keyword">    </span>{
00723         u_int8_t   __u6_addr8[16];
00724         u_int16_t  __u6_addr16[8];
00725         u_int32_t  __u6_addr32[4];
00726     } __u6_addr;            <span class="comment">/* 128-bit IP6 address */</span>
00727 };
00728 <span class="preprocessor">#define libnet_s6_addr __u6_addr.__u6_addr8</span>
00729 <span class="preprocessor"></span>
00730 <span class="comment">/*</span>
00731 <span class="comment"> *  IPv6 header</span>
00732 <span class="comment"> *  Internet Protocol, version 6</span>
00733 <span class="comment"> *  Static header size: 40 bytes</span>
00734 <span class="comment"> */</span>
00735 <span class="keyword">struct </span>libnet_ipv6_hdr
00736 {
00737     u_int8_t ip_flags[4];     <span class="comment">/* version, traffic class, flow label */</span>
00738     u_int16_t ip_len;         <span class="comment">/* total length */</span>
00739     u_int8_t ip_nh;           <span class="comment">/* next header */</span>
00740     u_int8_t ip_hl;           <span class="comment">/* hop limit */</span>
00741     <span class="keyword">struct </span>libnet_in6_addr ip_src, ip_dst; <span class="comment">/* source and dest address */</span>
00742 
00743 };
00744 
00745 <span class="comment">/*</span>
00746 <span class="comment"> *  IPv6 frag header</span>
00747 <span class="comment"> *  Internet Protocol, version 6</span>
00748 <span class="comment"> *  Static header size: 8 bytes</span>
00749 <span class="comment"> */</span>
00750 <span class="preprocessor">#define LIBNET_IPV6_NH_FRAGMENT 44</span>
00751 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_ipv6_frag_hdr
00752 {
00753     u_int8_t ip_nh;          <span class="comment">/* next header */</span>
00754     u_int8_t ip_reserved;    <span class="comment">/* reserved */</span>
00755     u_int16_t ip_frag;       <span class="comment">/* fragmentation stuff */</span>
00756     u_int32_t ip_id;         <span class="comment">/* id */</span>
00757 };
00758 
00759 <span class="comment">/*</span>
00760 <span class="comment"> *  IPv6 routing header</span>
00761 <span class="comment"> *  Internet Protocol, version 6</span>
00762 <span class="comment"> *  Base header size: 4 bytes</span>
00763 <span class="comment"> */</span>
00764 <span class="preprocessor">#define LIBNET_IPV6_NH_ROUTING  43</span>
00765 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_ipv6_routing_hdr
00766 {
00767     u_int8_t ip_nh;          <span class="comment">/* next header */</span>
00768     u_int8_t ip_len;         <span class="comment">/* length of header in 8 octet units (sans 1st) */</span>
00769     u_int8_t ip_rtype;       <span class="comment">/* routing type */</span>
00770     u_int8_t ip_segments;    <span class="comment">/* segments left */</span>
00771     <span class="comment">/* routing information allocated dynamically */</span>
00772 };
00773 
00774 <span class="comment">/*</span>
00775 <span class="comment"> *  IPv6 destination options header</span>
00776 <span class="comment"> *  Internet Protocol, version 6</span>
00777 <span class="comment"> *  Base header size: 2 bytes</span>
00778 <span class="comment"> */</span>
00779 <span class="preprocessor">#define LIBNET_IPV6_NH_DESTOPTS 60</span>
00780 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_ipv6_destopts_hdr
00781 {
00782     u_int8_t ip_nh;          <span class="comment">/* next header */</span>
00783     u_int8_t ip_len;         <span class="comment">/* length of header in 8 octet units (sans 1st) */</span>
00784     <span class="comment">/* destination options information allocated dynamically */</span>
00785 };
00786 
00787 <span class="comment">/*</span>
00788 <span class="comment"> *  IPv6 hop by hop options header</span>
00789 <span class="comment"> *  Internet Protocol, version 6</span>
00790 <span class="comment"> *  Base header size: 2 bytes</span>
00791 <span class="comment"> */</span>
00792 <span class="preprocessor">#define LIBNET_IPV6_NH_HBH      0</span>
00793 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_ipv6_hbhopts_hdr
00794 {
00795     u_int8_t ip_nh;          <span class="comment">/* next header */</span>
00796     u_int8_t ip_len;         <span class="comment">/* length of header in 8 octet units (sans 1st) */</span>
00797     <span class="comment">/* destination options information allocated dynamically */</span>
00798 };
00799 
00800 <span class="comment">/*</span>
00801 <span class="comment"> *  ICMP6 header</span>
00802 <span class="comment"> *  Internet Control Message Protocol v6</span>
00803 <span class="comment"> *  Base header size: 8 bytes</span>
00804 <span class="comment"> */</span>
00805 <span class="preprocessor">#ifndef IPPROTO_ICMP6</span>
00806 <span class="preprocessor"></span><span class="preprocessor">#define IPPROTO_ICMP6   0x3a</span>
00807 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00808 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_icmpv6_hdr
00809 {
00810     u_int8_t icmp_type;       <span class="comment">/* ICMP type */</span>
00811 <span class="preprocessor">#ifndef ICMP6_ECHO</span>
00812 <span class="preprocessor"></span><span class="preprocessor">#define ICMP6_ECHO          128</span>
00813 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00814 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP6_ECHOREPLY</span>
00815 <span class="preprocessor"></span><span class="preprocessor">#define ICMP6_ECHOREPLY     129</span>
00816 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00817 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP6_UNREACH</span>
00818 <span class="preprocessor"></span><span class="preprocessor">#define ICMP6_UNREACH       1</span>
00819 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00820 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP6_PKTTOOBIG</span>
00821 <span class="preprocessor"></span><span class="preprocessor">#define ICMP6_PKTTOOBIG     2</span>
00822 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00823 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP6_TIMXCEED</span>
00824 <span class="preprocessor"></span><span class="preprocessor">#define ICMP6_TIMXCEED      3</span>
00825 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00826 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP6_PARAMPROB</span>
00827 <span class="preprocessor"></span><span class="preprocessor">#define ICMP6_PARAMPROB     4</span>
00828 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00829 <span class="preprocessor"></span>    u_int8_t icmp_code;       <span class="comment">/* ICMP code */</span>
00830     u_int16_t icmp_sum;       <span class="comment">/* ICMP Checksum */</span>
00831     u_int16_t id;             <span class="comment">/* ICMP id */</span>
00832     u_int16_t seq;            <span class="comment">/* ICMP sequence number */</span>
00833 };
00834 
00835 
00836 
00837 <span class="comment">/*</span>
00838 <span class="comment"> *  ICMP header</span>
00839 <span class="comment"> *  Internet Control Message Protocol</span>
00840 <span class="comment"> *  Base header size: 4 bytes</span>
00841 <span class="comment"> */</span>
00842 <span class="keyword">struct </span>libnet_icmpv4_hdr
00843 {
00844     u_int8_t icmp_type;       <span class="comment">/* ICMP type */</span>
00845 <span class="preprocessor">#ifndef     ICMP_ECHOREPLY</span>
00846 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_ECHOREPLY                  0</span>
00847 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00848 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_UNREACH</span>
00849 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_UNREACH                    3</span>
00850 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00851 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_SOURCEQUENCH</span>
00852 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_SOURCEQUENCH               4</span>
00853 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00854 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_REDIRECT</span>
00855 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_REDIRECT                   5</span>
00856 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00857 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_ECHO</span>
00858 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_ECHO                       8</span>
00859 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00860 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_ROUTERADVERT</span>
00861 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_ROUTERADVERT               9</span>
00862 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00863 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_ROUTERSOLICIT</span>
00864 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_ROUTERSOLICIT              10</span>
00865 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00866 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_TIMXCEED</span>
00867 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_TIMXCEED                   11</span>
00868 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00869 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_PARAMPROB</span>
00870 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_PARAMPROB                  12</span>
00871 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00872 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_TSTAMP</span>
00873 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_TSTAMP                     13</span>
00874 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00875 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_TSTAMPREPLY</span>
00876 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_TSTAMPREPLY                14</span>
00877 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00878 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_IREQ</span>
00879 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_IREQ                       15</span>
00880 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00881 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_IREQREPLY</span>
00882 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_IREQREPLY                  16</span>
00883 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00884 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_MASKREQ</span>
00885 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_MASKREQ                    17</span>
00886 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00887 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_MASKREPLY</span>
00888 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_MASKREPLY                  18</span>
00889 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00890 <span class="preprocessor"></span>    u_int8_t icmp_code;       <span class="comment">/* ICMP code */</span>
00891 <span class="preprocessor">#ifndef     ICMP_UNREACH_NET</span>
00892 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_UNREACH_NET                0</span>
00893 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00894 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_UNREACH_HOST</span>
00895 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_UNREACH_HOST               1</span>
00896 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00897 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_UNREACH_PROTOCOL</span>
00898 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_UNREACH_PROTOCOL           2</span>
00899 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00900 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_UNREACH_PORT</span>
00901 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_UNREACH_PORT               3</span>
00902 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00903 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_UNREACH_NEEDFRAG</span>
00904 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_UNREACH_NEEDFRAG           4</span>
00905 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00906 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_UNREACH_SRCFAIL</span>
00907 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_UNREACH_SRCFAIL            5</span>
00908 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00909 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_UNREACH_NET_UNKNOWN</span>
00910 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_UNREACH_NET_UNKNOWN        6</span>
00911 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00912 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_UNREACH_HOST_UNKNOWN</span>
00913 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_UNREACH_HOST_UNKNOWN       7</span>
00914 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00915 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_UNREACH_ISOLATED</span>
00916 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_UNREACH_ISOLATED           8</span>
00917 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00918 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_UNREACH_NET_PROHIB</span>
00919 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_UNREACH_NET_PROHIB         9</span>
00920 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00921 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_UNREACH_HOST_PROHIB</span>
00922 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_UNREACH_HOST_PROHIB        10</span>
00923 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00924 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_UNREACH_TOSNET</span>
00925 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_UNREACH_TOSNET             11</span>
00926 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00927 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_UNREACH_TOSHOST</span>
00928 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_UNREACH_TOSHOST            12</span>
00929 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00930 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_UNREACH_FILTER_PROHIB</span>
00931 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_UNREACH_FILTER_PROHIB      13</span>
00932 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00933 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_UNREACH_HOST_PRECEDENCE</span>
00934 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_UNREACH_HOST_PRECEDENCE    14</span>
00935 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00936 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_UNREACH_PRECEDENCE_CUTOFF</span>
00937 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_UNREACH_PRECEDENCE_CUTOFF  15</span>
00938 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00939 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_REDIRECT_NET</span>
00940 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_REDIRECT_NET               0</span>
00941 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00942 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_REDIRECT_HOST</span>
00943 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_REDIRECT_HOST              1</span>
00944 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00945 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_REDIRECT_TOSNET</span>
00946 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_REDIRECT_TOSNET            2</span>
00947 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00948 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_REDIRECT_TOSHOST</span>
00949 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_REDIRECT_TOSHOST           3</span>
00950 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00951 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_TIMXCEED_INTRANS</span>
00952 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_TIMXCEED_INTRANS           0</span>
00953 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00954 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_TIMXCEED_REASS</span>
00955 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_TIMXCEED_REASS             1</span>
00956 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00957 <span class="preprocessor"></span><span class="preprocessor">#ifndef     ICMP_PARAMPROB_OPTABSENT</span>
00958 <span class="preprocessor"></span><span class="preprocessor">#define     ICMP_PARAMPROB_OPTABSENT        1</span>
00959 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00960 <span class="preprocessor"></span>
00961     u_int16_t icmp_sum;   <span class="comment">/* ICMP Checksum */</span>
00962 
00963     <span class="keyword">union</span>
00964 <span class="keyword">    </span>{
00965         <span class="keyword">struct</span>
00966 <span class="keyword">        </span>{
00967             u_int16_t id; <span class="comment">/* ICMP id */</span>
00968             u_int16_t seq;<span class="comment">/* ICMP sequence number */</span>
00969         } echo;
00970 
00971 <span class="preprocessor">#undef icmp_id</span>
00972 <span class="preprocessor"></span><span class="preprocessor">#undef icmp_seq</span>
00973 <span class="preprocessor"></span><span class="preprocessor">#define icmp_id     hun.echo.id</span>
00974 <span class="preprocessor"></span><span class="preprocessor">#define icmp_seq    hun.echo.seq</span>
00975 <span class="preprocessor"></span> 
00976         u_int32_t gateway; <span class="comment">/* gateway host */</span>
00977         <span class="keyword">struct</span>
00978 <span class="keyword">        </span>{
00979             u_int16_t pad;<span class="comment">/* padding */</span>
00980             u_int16_t mtu;<span class="comment">/* MTU size */</span>
00981         } frag;
00982     } hun;
00983     <span class="keyword">union</span>
00984 <span class="keyword">    </span>{
00985         <span class="keyword">struct</span>
00986 <span class="keyword">        </span>{
00987             n_time its_otime;
00988             n_time its_rtime;
00989             n_time its_ttime;
00990         } ts;
00991         <span class="keyword">struct</span>
00992 <span class="keyword">        </span>{
00993             <span class="keyword">struct </span>libnet_ipv4_hdr idi_ip;
00994             <span class="comment">/* options and then 64 bits of data */</span>
00995         } ip;
00996         u_int32_t mask;
00997         int8_t data[1];
00998 
00999 <span class="preprocessor">#undef icmp_mask</span>
01000 <span class="preprocessor"></span><span class="preprocessor">#define icmp_mask    dun.mask</span>
01001 <span class="preprocessor"></span><span class="preprocessor">#undef icmp_data</span>
01002 <span class="preprocessor"></span><span class="preprocessor">#define icmp_data    dun.data</span>
01003 <span class="preprocessor"></span>
01004 <span class="preprocessor">#undef icmp_otime</span>
01005 <span class="preprocessor"></span><span class="preprocessor">#define icmp_otime   dun.ts.its_otime</span>
01006 <span class="preprocessor"></span><span class="preprocessor">#undef icmp_rtime</span>
01007 <span class="preprocessor"></span><span class="preprocessor">#define icmp_rtime   dun.ts.its_rtime</span>
01008 <span class="preprocessor"></span><span class="preprocessor">#undef icmp_ttime</span>
01009 <span class="preprocessor"></span><span class="preprocessor">#define icmp_ttime   dun.ts.its_ttime</span>
01010 <span class="preprocessor"></span>    }dun;
01011 };
01012 
01013 
01014 <span class="comment">/*</span>
01015 <span class="comment"> *  IGMP header</span>
01016 <span class="comment"> *  Internet Group Message Protocol</span>
01017 <span class="comment"> *  Static header size: 8 bytes</span>
01018 <span class="comment"> */</span>
01019 <span class="keyword">struct </span>libnet_igmp_hdr
01020 {
01021     u_int8_t igmp_type;       <span class="comment">/* IGMP type */</span>
01022 <span class="preprocessor">#ifndef IGMP_MEMBERSHIP_QUERY</span>
01023 <span class="preprocessor"></span><span class="preprocessor">#define IGMP_MEMBERSHIP_QUERY           0x11    </span><span class="comment">/* membership query */</span>
01024 <span class="preprocessor">#endif</span>
01025 <span class="preprocessor"></span><span class="preprocessor">#ifndef IGMP_V1_MEMBERSHIP_REPORT</span>
01026 <span class="preprocessor"></span><span class="preprocessor">#define IGMP_V1_MEMBERSHIP_REPORT       0x12    </span><span class="comment">/* Ver. 1 membership report */</span>
01027 <span class="preprocessor">#endif</span>
01028 <span class="preprocessor"></span><span class="preprocessor">#ifndef IGMP_V2_MEMBERSHIP_REPORT</span>
01029 <span class="preprocessor"></span><span class="preprocessor">#define IGMP_V2_MEMBERSHIP_REPORT       0x16    </span><span class="comment">/* Ver. 2 membership report */</span>
01030 <span class="preprocessor">#endif</span>
01031 <span class="preprocessor"></span><span class="preprocessor">#ifndef IGMP_LEAVE_GROUP</span>
01032 <span class="preprocessor"></span><span class="preprocessor">#define IGMP_LEAVE_GROUP                0x17    </span><span class="comment">/* Leave-group message */</span>
01033 <span class="preprocessor">#endif</span>
01034 <span class="preprocessor"></span>    u_int8_t igmp_code;       <span class="comment">/* IGMP code */</span>
01035     u_int16_t igmp_sum;       <span class="comment">/* IGMP checksum */</span>
01036     <span class="keyword">struct </span>in_addr igmp_group;<span class="comment">/* IGMP host IP */</span>
01037 };
01038 
01039 
01040 <span class="comment">/*</span>
01041 <span class="comment"> *  IPSEC header</span>
01042 <span class="comment"> *  Internet Protocol Security Protocol</span>
01043 <span class="comment"> *  Encapsulating Security Payload Header Static header size: 12 bytes</span>
01044 <span class="comment"> *  Encapsulating Security Payload Footer Base header size: 2 bytes</span>
01045 <span class="comment"> *  Authentication Header Static Size: 16 bytes</span>
01046 <span class="comment"> */</span>
01047 <span class="preprocessor">#ifndef IPPROTO_ESP</span>
01048 <span class="preprocessor"></span><span class="preprocessor">#define IPPROTO_ESP 50      </span><span class="comment">/* not everyone's got this */</span>
01049 <span class="preprocessor">#endif</span>
01050 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_esp_hdr
01051 {
01052    u_int32_t esp_spi;          <span class="comment">/* security parameter index */</span>
01053    u_int32_t esp_seq;          <span class="comment">/* ESP sequence number */</span>
01054    u_int32_t esp_iv;           <span class="comment">/* initialization vector */</span>
01055 };
01056 
01057 <span class="keyword">struct </span>libnet_esp_ftr
01058 {
01059     u_int8_t esp_pad_len;     <span class="comment">/* padding length */</span>
01060     u_int8_t esp_nh;     <span class="comment">/* next header pointer */</span>
01061     int8_t *esp_auth;         <span class="comment">/* authentication data */</span>
01062 };
01063  
01064 <span class="preprocessor">#ifndef IPPROTO_AH</span>
01065 <span class="preprocessor"></span><span class="preprocessor">#define IPPROTO_AH 51       </span><span class="comment">/* not everyone's got this */</span>
01066 <span class="preprocessor">#endif</span>
01067 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_ah_hdr
01068 {
01069     u_int8_t ah_nh;      <span class="comment">/* next header */</span>
01070     u_int8_t ah_len;          <span class="comment">/* payload length */</span>
01071     u_int16_t ah_res;         <span class="comment">/* reserved */</span>
01072     u_int32_t ah_spi;          <span class="comment">/* security parameter index  */</span>
01073     u_int32_t ah_seq;          <span class="comment">/* AH sequence number */</span>
01074     u_int32_t ah_auth;         <span class="comment">/* authentication data */</span>
01075 };
01076 
01077 
01078 <span class="comment">/*</span>
01079 <span class="comment"> *  ISL header</span>
01080 <span class="comment"> *  Cisco Inter-Switch Link</span>
01081 <span class="comment"> *  Static header size: 26 bytes</span>
01082 <span class="comment"> */</span>
01083 <span class="comment">/*</span>
01084 <span class="comment"> *  For checksum stuff -- IANA says 135-254 is "unassigned" as of 12.2001.</span>
01085 <span class="comment"> *  Let's hope this one stays that way for a while!</span>
01086 <span class="comment"> */</span>
01087 <span class="preprocessor">#define LIBNET_PROTO_ISL    201</span>
01088 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_isl_hdr
01089 {
01090     u_int8_t isl_dhost[5];    <span class="comment">/* destination address "01:00:0c:00:00" */</span>
01091 <span class="preprocessor">#if (LIBNET_LIL_ENDIAN)</span>
01092 <span class="preprocessor"></span>    u_int8_t isl_type:4,      <span class="comment">/* type of frame */</span>
01093            isl_user:4;      <span class="comment">/* user defined bits */</span>
01094 <span class="preprocessor">#endif</span>
01095 <span class="preprocessor"></span><span class="preprocessor">#if (LIBNET_BIG_ENDIAN)</span>
01096 <span class="preprocessor"></span>    u_int8_t isl_user:4,      <span class="comment">/* user defined bits */</span>
01097            isl_type:4;      <span class="comment">/* type of frame */</span>
01098 <span class="preprocessor">#endif</span>
01099 <span class="preprocessor"></span>    u_int8_t isl_shost[6];    <span class="comment">/* source address */</span>
01100     u_int16_t isl_len;        <span class="comment">/* total length of packet - 18 bytes */</span>
01101     u_int8_t isl_snap[6];     <span class="comment">/* 0xaaaa03 + vendor code */</span>
01102     u_int16_t isl_vid;        <span class="comment">/* 15 bit VLAN ID, 1 bit BPDU / CDP indicator */</span>
01103     u_int16_t isl_index;      <span class="comment">/* port index */</span>
01104     u_int16_t isl_reserved;   <span class="comment">/* used for FDDI and token ring */</span>
01105     <span class="comment">/* ethernet frame and 4 byte isl crc */</span>
01106 };
01107 
01108 <span class="preprocessor">#ifndef IPPROTO_OSPF</span>
01109 <span class="preprocessor"></span><span class="preprocessor">#define IPPROTO_OSPF    89  </span><span class="comment">/* not everyone's got this */</span>
01110 <span class="preprocessor">#endif</span>
01111 <span class="preprocessor"></span><span class="preprocessor">#define IPPROTO_OSPF_LSA    890     </span><span class="comment">/* made this up.  Hope it's unused */</span>
01112 <span class="preprocessor">#define LIBNET_MODX         4102    </span><span class="comment">/* used in LSA checksum */</span>
01113 
01114 <span class="comment">/*</span>
01115 <span class="comment"> *  Options used in multiple OSPF packets</span>
01116 <span class="comment"> *  More info can be found in section A.2 of RFC 2328.</span>
01117 <span class="comment"> */</span>
01118 <span class="preprocessor">#define LIBNET_OPT_EBIT  0x02 </span><span class="comment">/* describes the way AS-external-LSAs are flooded */</span>
01119 <span class="preprocessor">#define LIBNET_OPT_MCBIT 0x04 </span><span class="comment">/* whether or not IP multicast dgrams are fwdd */</span>
01120 <span class="preprocessor">#define LIBNET_OPT_NPBIT 0x08 </span><span class="comment">/* describes handling of type-7 LSAs */</span>
01121 <span class="preprocessor">#define LIBNET_OPT_EABIT 0x10 </span><span class="comment">/* rtr's willingness to send/recv EA-LSAs */</span>
01122 <span class="preprocessor">#define LIBNET_OPT_DCBIT 0x20 </span><span class="comment">/* describes handling of demand circuits */</span>
01123 
01124 
01125 <span class="comment">/*</span>
01126 <span class="comment"> *  MPLS header</span>
01127 <span class="comment"> *  Multi-Protocol Label Switching</span>
01128 <span class="comment"> *  Static header size: 4 bytes</span>
01129 <span class="comment"> */</span>
01130 <span class="keyword">struct </span>libnet_mpls_hdr
01131 {
01132     u_int32_t mpls_les;          <span class="comment">/* 20 bits label, 3 bits exp, 1 bit bos, ttl */</span>
01133 <span class="preprocessor">#define LIBNET_MPLS_BOS_ON    1</span>
01134 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_MPLS_BOS_OFF   0</span>
01135 <span class="preprocessor"></span>};
01136 
01137 <span class="comment">/*</span>
01138 <span class="comment"> *  NTP header</span>
01139 <span class="comment"> *  Network Time Protocol</span>
01140 <span class="comment"> *  Static header size: 48 bytes</span>
01141 <span class="comment"> */</span>
01142 <span class="keyword">struct </span>libnet_ntp_hdr_l_fp  <span class="comment">/* int32_t floating point (64-bit) */</span>
01143 {
01144     u_int32_t integer;         <span class="comment">/* integer */</span>
01145     u_int32_t fraction;        <span class="comment">/* fraction */</span>
01146 };
01147 
01148 <span class="keyword">struct </span>libnet_ntp_hdr_s_fp  <span class="comment">/* int16_t floating point (32-bit) */</span>
01149 {
01150     u_int16_t integer;        <span class="comment">/* integer */</span>
01151     u_int16_t fraction;       <span class="comment">/* fraction */</span>
01152 };
01153 
01154 
01155 <span class="keyword">struct </span>libnet_ntp_hdr
01156 {
01157     u_int8_t ntp_li_vn_mode;              <span class="comment">/* leap indicator, version, mode */</span>
01158 <span class="preprocessor">#define LIBNET_NTP_LI_NW    0x0         </span><span class="comment">/* no warning */</span>
01159 <span class="preprocessor">#define LIBNET_NTP_LI_AS    0x1         </span><span class="comment">/* last minute has 61 seconds */</span>
01160 <span class="preprocessor">#define LIBNET_NTP_LI_DS    0x2         </span><span class="comment">/* last minute has 59 seconds */</span>
01161 <span class="preprocessor">#define LIBNET_NTP_LI_AC    0x3         </span><span class="comment">/* alarm condition */</span>
01162 
01163 <span class="preprocessor">#define LIBNET_NTP_VN_2     0x2         </span><span class="comment">/* version 2 */</span>
01164 <span class="preprocessor">#define LIBNET_NTP_VN_3     0x3         </span><span class="comment">/* version 3 */</span>
01165 <span class="preprocessor">#define LIBNET_NTP_VN_4     0x4         </span><span class="comment">/* version 4 */</span>
01166 
01167 <span class="preprocessor">#define LIBNET_NTP_MODE_R   0x0         </span><span class="comment">/* reserved */</span>
01168 <span class="preprocessor">#define LIBNET_NTP_MODE_A   0x1         </span><span class="comment">/* symmetric active */</span>
01169 <span class="preprocessor">#define LIBNET_NTP_MODE_P   0x2         </span><span class="comment">/* symmetric passive */</span>
01170 <span class="preprocessor">#define LIBNET_NTP_MODE_C   0x3         </span><span class="comment">/* client */</span>
01171 <span class="preprocessor">#define LIBNET_NTP_MODE_S   0x4         </span><span class="comment">/* server */</span>
01172 <span class="preprocessor">#define LIBNET_NTP_MODE_B   0x5         </span><span class="comment">/* broadcast */</span>
01173 <span class="preprocessor">#define LIBNET_NTP_MODE_RC  0x6         </span><span class="comment">/* reserved for NTP control message */</span>
01174 <span class="preprocessor">#define LIBNET_NTP_MODE_RP  0x7         </span><span class="comment">/* reserved for private use */</span>
01175     u_int8_t ntp_stratum;                 <span class="comment">/* stratum */</span>
01176 <span class="preprocessor">#define LIBNET_NTP_STRATUM_UNAVAIL  0x0 </span><span class="comment">/* unspecified or unavailable */</span>
01177 <span class="preprocessor">#define LIBNET_NTP_STRATUM_PRIMARY  0x1 </span><span class="comment">/* primary reference (radio clock) */</span>
01178                                         <span class="comment">/* 2 - 15 is secondary */</span>
01179                                         <span class="comment">/* 16 - 255 is reserved */</span>
01180     u_int8_t ntp_poll;                    <span class="comment">/* poll interval (should be 4 - 12) */</span>
01181     u_int8_t ntp_precision;               <span class="comment">/* local clock precision */</span>
01182     <span class="keyword">struct </span>libnet_ntp_hdr_s_fp ntp_delay;       <span class="comment">/* roundtrip delay */</span>
01183     <span class="keyword">struct </span>libnet_ntp_hdr_s_fp ntp_dispersion;  <span class="comment">/* nominal error */</span>
01184     u_int32_t ntp_reference_id;                <span class="comment">/* reference source id */</span>
01185 <span class="preprocessor">#define LIBNET_NTP_REF_LOCAL    0x4c4f434c  </span><span class="comment">/* uncalibrated local clock */</span>
01186 <span class="preprocessor">#define LIBNET_NTP_REF_PPS      0x50505300  </span><span class="comment">/* atomic / pulse-per-second clock */</span>
01187 <span class="preprocessor">#define LIBNET_NTP_REF_ACTS     0x41435453  </span><span class="comment">/* NIST dialup modem */</span>
01188 <span class="preprocessor">#define LIBNET_NTP_REF_USNO     0x55534e4f  </span><span class="comment">/* USNO modem service */</span>
01189 <span class="preprocessor">#define LIBNET_NTP_REF_PTB      0x50544200  </span><span class="comment">/* PTB (German) modem service */</span> 
01190 <span class="preprocessor">#define LIBNET_NTP_REF_TDF      0x54444600  </span><span class="comment">/* Allouis (French) radio */</span>
01191 <span class="preprocessor">#define LIBNET_NTP_REF_DCF      0x44434600  </span><span class="comment">/* Mainflingen (German) radio */</span>
01192 <span class="preprocessor">#define LIBNET_NTP_REF_MSF      0x4d534600  </span><span class="comment">/* Rugby (UK) radio */</span>
01193 <span class="preprocessor">#define LIBNET_NTP_REF_WWV      0x57575600  </span><span class="comment">/* Ft Collins (US) radio */</span>
01194 <span class="preprocessor">#define LIBNET_NTP_REF_WWVB     0x57575642  </span><span class="comment">/* Boulder (US) radio */</span>
01195 <span class="preprocessor">#define LIBNET_NTP_REF_WWVH     0x57575648  </span><span class="comment">/* Kaui Hawaii (US) radio */</span>
01196 <span class="preprocessor">#define LIBNET_NTP_REF_CHU      0x43485500  </span><span class="comment">/* Ottaha (Canada) radio */</span>
01197 <span class="preprocessor">#define LIBNET_NTP_REF_LORC     0x4c4f5243  </span><span class="comment">/* LORAN-C radionavigation */</span>
01198 <span class="preprocessor">#define LIBNET_NTP_REF_OMEG     0x4f4d4547  </span><span class="comment">/* OMEGA radionavigation */</span>
01199 <span class="preprocessor">#define LIBNET_NTP_REF_GPS      0x47505300  </span><span class="comment">/* global positioning system */</span>
01200 <span class="preprocessor">#define LIBNET_NTP_REF_GOES     0x474f4553  </span><span class="comment">/* geostationary orbit env satellite */</span>
01201     <span class="keyword">struct </span>libnet_ntp_hdr_l_fp ntp_ref_ts;  <span class="comment">/* reference timestamp */</span> 
01202     <span class="keyword">struct </span>libnet_ntp_hdr_l_fp ntp_orig_ts; <span class="comment">/* originate timestamp */</span>
01203     <span class="keyword">struct </span>libnet_ntp_hdr_l_fp ntp_rec_ts;  <span class="comment">/* receive timestamp */</span>
01204     <span class="keyword">struct </span>libnet_ntp_hdr_l_fp ntp_xmt_ts;  <span class="comment">/* transmit timestamp */</span>
01205 };
01206 
01207 
01208 <span class="comment">/*</span>
01209 <span class="comment"> *  OSPFv2 header</span>
01210 <span class="comment"> *  Open Shortest Path First</span>
01211 <span class="comment"> *  Static header size: 16 bytes</span>
01212 <span class="comment"> */</span>
01213 <span class="keyword">struct </span>libnet_ospf_hdr
01214 {
01215     u_int8_t ospf_v;          <span class="comment">/* version */</span>
01216 <span class="preprocessor">#define OSPFVERSION         2</span>
01217 <span class="preprocessor"></span>    u_int8_t ospf_type;       <span class="comment">/* type */</span>
01218 <span class="preprocessor">#define  LIBNET_OSPF_UMD    0   </span><span class="comment">/* UMd monitoring packet */</span>
01219 <span class="preprocessor">#define  LIBNET_OSPF_HELLO  1   </span><span class="comment">/* HELLO packet */</span>
01220 <span class="preprocessor">#define  LIBNET_OSPF_DBD    2   </span><span class="comment">/* dataBase description packet */</span>
01221 <span class="preprocessor">#define  LIBNET_OSPF_LSR    3   </span><span class="comment">/* link state request packet */</span>
01222 <span class="preprocessor">#define  LIBNET_OSPF_LSU    4   </span><span class="comment">/* link state Update Packet */</span>
01223 <span class="preprocessor">#define  LIBNET_OSPF_LSA    5   </span><span class="comment">/* link state acknowledgement packet */</span>
01224     u_int16_t   ospf_len;     <span class="comment">/* length */</span>
01225     <span class="keyword">struct </span>in_addr ospf_rtr_id; <span class="comment">/* source router ID */</span>
01226     <span class="keyword">struct </span>in_addr ospf_area_id;<span class="comment">/* roam ID */</span>
01227     u_int16_t ospf_sum;         <span class="comment">/* checksum */</span>
01228     u_int16_t ospf_auth_type;     <span class="comment">/* authentication type */</span>
01229 <span class="preprocessor">#define LIBNET_OSPF_AUTH_NULL   0   </span><span class="comment">/* null password */</span>
01230 <span class="preprocessor">#define LIBNET_OSPF_AUTH_SIMPLE 1   </span><span class="comment">/* simple, plaintext, 8 int8_t password */</span>
01231 <span class="preprocessor">#define LIBNET_OSPF_AUTH_MD5    2   </span><span class="comment">/* MD5 */</span>
01232 };
01233 
01234 
01235 <span class="comment">/*</span>
01236 <span class="comment"> *  OSPF authentication header</span>
01237 <span class="comment"> *  Open Shortest Path First</span>
01238 <span class="comment"> *  Static header size: 8 bytes</span>
01239 <span class="comment"> */</span>
01240 <span class="keyword">struct </span>libnet_auth_hdr
01241 {
01242     u_int16_t ospf_auth_null; <span class="comment">/* NULL */</span>
01243     u_int8_t ospf_auth_keyid; <span class="comment">/* authentication key ID */</span>
01244     u_int8_t ospf_auth_len;   <span class="comment">/* auth data length */</span>
01245     u_int ospf_auth_seq;    <span class="comment">/* cryptographic sequence number */</span>
01246 };
01247 
01248 
01249 <span class="comment">/*</span>
01250 <span class="comment"> *  OSPF hello header</span>
01251 <span class="comment"> *  Open Shortest Path First</span>
01252 <span class="comment"> *  Static header size: 28 bytes</span>
01253 <span class="comment"> */</span>
01254 <span class="keyword">struct </span>libnet_ospf_hello_hdr
01255 {
01256     <span class="keyword">struct </span>in_addr hello_nmask; <span class="comment">/* netmask associated with the interface */</span>
01257     u_int16_t hello_intrvl;       <span class="comment">/* num of seconds between routers last packet */</span>
01258     u_int8_t hello_opts;          <span class="comment">/* Options for HELLO packets (look above) */</span>
01259     u_int8_t hello_rtr_pri;       <span class="comment">/* router's priority (if 0, can't be backup) */</span>
01260     u_int hello_dead_intvl;     <span class="comment">/* # of secs a router is silent till deemed down */</span>
01261     <span class="keyword">struct </span>in_addr hello_des_rtr;   <span class="comment">/* Designated router on the network */</span>
01262     <span class="keyword">struct </span>in_addr hello_bkup_rtr;  <span class="comment">/* Backup router */</span>
01263     <span class="keyword">struct </span>in_addr hello_nbr;       <span class="comment">/* neighbor router, memcpy more as needed */</span>
01264 };
01265 
01266 
01267 <span class="comment">/*</span>
01268 <span class="comment"> *  Database Description header.</span>
01269 <span class="comment"> */</span>
01270 <span class="keyword">struct </span>libnet_dbd_hdr
01271 {
01272     u_int16_t dbd_mtu_len;    <span class="comment">/* max length of IP dgram that this 'if' can use */</span>
01273     u_int8_t dbd_opts;        <span class="comment">/* DBD packet options (from above) */</span>
01274     u_int8_t dbd_type;        <span class="comment">/* type of exchange occurring */</span>
01275 <span class="preprocessor">#define LIBNET_DBD_IBI      0x01    </span><span class="comment">/* init */</span>
01276 <span class="preprocessor">#define LIBNET_DBD_MBIT     0x02    </span><span class="comment">/* more DBD packets are to come */</span>
01277 <span class="preprocessor">#define LIBNET_DBD_MSBIT    0x04    </span><span class="comment">/* If 1, sender is the master in the exchange */</span>
01278     u_int  dbd_seq;         <span class="comment">/* DBD sequence number */</span>
01279 };
01280 
01281 
01282 <span class="comment">/*</span>
01283 <span class="comment"> *  used for the LS type field in all LS* headers</span>
01284 <span class="comment"> */</span>
01285 <span class="preprocessor">#define LIBNET_LS_TYPE_RTR      1   </span><span class="comment">/* router-LSA */</span>
01286 <span class="preprocessor">#define LIBNET_LS_TYPE_NET      2   </span><span class="comment">/* network-LSA */</span>
01287 <span class="preprocessor">#define LIBNET_LS_TYPE_IP       3   </span><span class="comment">/* summary-LSA (IP Network) */</span>
01288 <span class="preprocessor">#define LIBNET_LS_TYPE_ASBR     4   </span><span class="comment">/* summary-LSA (ASBR) */</span>
01289 <span class="preprocessor">#define LIBNET_LS_TYPE_ASEXT    5   </span><span class="comment">/* AS-external-LSA */</span>
01290 
01291 
01292 <span class="comment">/*</span>
01293 <span class="comment"> *  Link State Request header</span>
01294 <span class="comment"> */</span>
01295 <span class="keyword">struct </span>libnet_lsr_hdr
01296 {
01297     u_int lsr_type;             <span class="comment">/* type of LS being requested */</span>
01298     u_int lsr_lsid;             <span class="comment">/* link state ID */</span>
01299     <span class="keyword">struct </span>in_addr lsr_adrtr;   <span class="comment">/* advertising router (memcpy more as needed) */</span>
01300 };
01301 
01302 
01303 <span class="comment">/*</span>
01304 <span class="comment"> *  Link State Update header</span>
01305 <span class="comment"> */</span>
01306 <span class="keyword">struct </span>libnet_lsu_hdr
01307 {
01308     u_int lsu_num;              <span class="comment">/* number of LSAs that will be broadcasted */</span>
01309 };
01310 
01311 
01312 <span class="comment">/*</span>
01313 <span class="comment"> *  Link State Acknowledgement header.</span>
01314 <span class="comment"> */</span>
01315 <span class="keyword">struct </span>libnet_lsa_hdr
01316 {
01317     u_int16_t lsa_age;        <span class="comment">/* time in seconds since the LSA was originated */</span>
01318     u_int8_t lsa_opts;        <span class="comment">/* look above for OPTS_* */</span>
01319     u_int8_t lsa_type;        <span class="comment">/* look below for LS_TYPE_* */</span>
01320     u_int lsa_id;           <span class="comment">/* link State ID */</span>
01321     <span class="keyword">struct </span>in_addr lsa_adv; <span class="comment">/* router ID of Advertising router */</span>
01322     u_int lsa_seq;          <span class="comment">/* LSA sequence number to detect old/bad ones */</span>
01323     u_int16_t lsa_sum;      <span class="comment">/* "Fletcher Checksum" of all fields minus age */</span>
01324     u_int16_t lsa_len;        <span class="comment">/* length in bytes including the 20 byte header */</span>
01325 };
01326 
01327 
01328 <span class="comment">/*</span>
01329 <span class="comment"> *  Router LSA data format</span>
01330 <span class="comment"> *</span>
01331 <span class="comment"> *  Other stuff for TOS can be added for backward compatability, for this</span>
01332 <span class="comment"> *  version, only OSPFv2 is being FULLY supported.</span>
01333 <span class="comment"> */</span>
01334 <span class="keyword">struct </span>libnet_rtr_lsa_hdr
01335 {
01336     u_int16_t rtr_flags;      <span class="comment">/* set to help describe packet */</span>
01337 <span class="preprocessor">#define LIBNET_RTR_FLAGS_W  0x0100  </span><span class="comment">/* W bit */</span>
01338 <span class="preprocessor">#define LIBNET_RTR_FLAGS_E  0x0200  </span><span class="comment">/* E bit */</span>
01339 <span class="preprocessor">#define LIBNET_RTR_FLAGS_B  0x0400  </span><span class="comment">/* B bit */</span>
01340     u_int16_t rtr_num;        <span class="comment">/* number of links within that packet */</span>
01341     u_int rtr_link_id;      <span class="comment">/* describes link_data (look below) */</span>
01342 <span class="preprocessor">#define LIBNET_LINK_ID_NBR_ID   1   </span><span class="comment">/* Neighbors router ID, also can be 4 */</span>
01343 <span class="preprocessor">#define LIBNET_LINK_ID_IP_DES   2   </span><span class="comment">/* IP address of designated router */</span>
01344 <span class="preprocessor">#define LIBNET_LINK_ID_SUB      3   </span><span class="comment">/* IP subnet number */</span>
01345     u_int rtr_link_data;    <span class="comment">/* Depending on link_id, info is here */</span>
01346     u_int8_t rtr_type;        <span class="comment">/* Description of router link */</span>
01347 <span class="preprocessor">#define LIBNET_RTR_TYPE_PTP     1   </span><span class="comment">/* Point-To-Point */</span>
01348 <span class="preprocessor">#define LIBNET_RTR_TYPE_TRANS   2   </span><span class="comment">/* Connection to a "transit network" */</span>
01349 <span class="preprocessor">#define LIBNET_RTR_TYPE_STUB    3   </span><span class="comment">/* Connectin to a "stub network" */</span>
01350 <span class="preprocessor">#define RTR_TYPE_VRTL   4   </span><span class="comment">/* connects to a "virtual link" */</span>
01351     u_int8_t rtr_tos_num;     <span class="comment">/* number of different TOS metrics for this link */</span>
01352     u_int16_t rtr_metric;     <span class="comment">/* the "cost" of using this link */</span>
01353 };
01354 
01355 
01356 <span class="comment">/*</span>
01357 <span class="comment"> *  Network LSA data format.</span>
01358 <span class="comment"> */</span>
01359 <span class="keyword">struct </span>libnet_net_lsa_hdr
01360 {
01361     <span class="keyword">struct </span>in_addr net_nmask;   <span class="comment">/* Netmask for that network */</span>
01362     u_int  net_rtr_id;          <span class="comment">/* ID of router attached to that network */</span>
01363 };
01364  
01365  
01366 <span class="comment">/*</span>
01367 <span class="comment"> *  Summary LSA data format.</span>
01368 <span class="comment"> */</span>
01369 <span class="keyword">struct </span>libnet_sum_lsa_hdr
01370 {
01371     <span class="keyword">struct </span>in_addr sum_nmask;   <span class="comment">/* Netmask of destination IP address */</span>
01372     u_int  sum_metric;          <span class="comment">/* Same as in rtr_lsa (&amp;0xfff to use last 24bit */</span>
01373     u_int  sum_tos_metric;      <span class="comment">/* first 8bits are TOS, 24bits are TOS Metric */</span>
01374 };
01375  
01376  
01377 <span class="comment">/*</span>
01378 <span class="comment"> *  AS External LSA data format.</span>
01379 <span class="comment"> *  &amp; 0xfff logic operator for as_metric to get last 24bits.</span>
01380 <span class="comment"> */</span>
01381 <span class="keyword">struct </span>libnet_as_lsa_hdr
01382 {
01383     <span class="keyword">struct </span>in_addr as_nmask;    <span class="comment">/* Netmask for advertised destination */</span>
01384     u_int  as_metric;           <span class="comment">/* May have to set E bit in first 8bits */</span>
01385 <span class="preprocessor">#define LIBNET_AS_E_BIT_ON 0x80000000  </span><span class="comment">/* as_metric */</span>
01386     <span class="keyword">struct </span>in_addr as_fwd_addr; <span class="comment">/* Forwarding address */</span>
01387     u_int  as_rte_tag;          <span class="comment">/* External route tag */</span>
01388 };
01389 
01390 
01391 <span class="comment">/*</span>
01392 <span class="comment"> *  Base RIP header</span>
01393 <span class="comment"> *  Routing Information Protocol</span>
01394 <span class="comment"> *  Base header size: 24 bytes</span>
01395 <span class="comment"> */</span>
01396 <span class="keyword">struct </span>libnet_rip_hdr
01397 {
01398     u_int8_t rip_cmd;         <span class="comment">/* RIP command */</span>
01399 <span class="preprocessor">#define RIPCMD_REQUEST   1  </span><span class="comment">/* want info */</span>
01400 <span class="preprocessor">#define RIPCMD_RESPONSE  2  </span><span class="comment">/* responding to request */</span>
01401 <span class="preprocessor">#define RIPCMD_TRACEON   3  </span><span class="comment">/* turn tracing on */</span>
01402 <span class="preprocessor">#define RIPCMD_TRACEOFF  4  </span><span class="comment">/* turn it off */</span>
01403 <span class="preprocessor">#define RIPCMD_POLL      5  </span><span class="comment">/* like request, but anyone answers */</span>
01404 <span class="preprocessor">#define RIPCMD_POLLENTRY 6  </span><span class="comment">/* like poll, but for entire entry */</span>
01405 <span class="preprocessor">#define RIPCMD_MAX       7  </span><span class="comment">/* ? command */</span>
01406     u_int8_t rip_ver;         <span class="comment">/* RIP version */</span>
01407 <span class="preprocessor">#define RIPVER_0         0</span>
01408 <span class="preprocessor"></span><span class="preprocessor">#define RIPVER_1         1</span>
01409 <span class="preprocessor"></span><span class="preprocessor">#define RIPVER_2         2</span>
01410 <span class="preprocessor"></span>    u_int16_t rip_rd;         <span class="comment">/* Zero (v1) or Routing Domain (v2) */</span>
01411     u_int16_t rip_af;         <span class="comment">/* Address family */</span>
01412     u_int16_t rip_rt;         <span class="comment">/* Zero (v1) or Route Tag (v2) */</span>
01413     u_int32_t rip_addr;        <span class="comment">/* IP address */</span>
01414     u_int32_t rip_mask;        <span class="comment">/* Zero (v1) or Subnet Mask (v2) */</span>
01415     u_int32_t rip_next_hop;    <span class="comment">/* Zero (v1) or Next hop IP address (v2) */</span>
01416     u_int32_t rip_metric;      <span class="comment">/* Metric */</span>
01417 };
01418 
01419 <span class="comment">/*</span>
01420 <span class="comment"> *  RPC headers</span>
01421 <span class="comment"> *  Remote Procedure Call</span>
01422 <span class="comment"> */</span>
01423 <span class="preprocessor">#define LIBNET_RPC_CALL  0</span>
01424 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_RPC_REPLY 1</span>
01425 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_RPC_VERS  2</span>
01426 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_RPC_LAST_FRAG 0x80000000</span>
01427 <span class="preprocessor"></span>
01428 <span class="comment">/*</span>
01429 <span class="comment"> *  Portmap defines</span>
01430 <span class="comment"> */</span>
01431 <span class="preprocessor">#define LIBNET_PMAP_PROGRAM          100000</span>
01432 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_NULL        0</span>
01433 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_SET         1</span>
01434 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_UNSET       2</span>
01435 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_GETADDR     3</span>
01436 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_DUMP        4</span>
01437 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_CALLIT      5</span>
01438 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_BCAST       5 </span><span class="comment">/* Not a typo */</span>
01439 <span class="preprocessor">#define LIBNET_PMAP_PROC_GETTIME     6</span>
01440 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_UADDR2TADDR 7</span>
01441 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_TADDR2UADDR 8</span>
01442 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_GETVERSADDR 9</span>
01443 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_INDIRECT    10</span>
01444 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_GETADDRLIST 11</span>
01445 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_GETSTAT     12</span>
01446 <span class="preprocessor"></span>
01447 <span class="comment">/* There will be more to add... */</span>
01448 
01449 <span class="keyword">struct </span>libnet_rpc_opaque_auth
01450 {
01451     u_int32_t rpc_auth_flavor;
01452     u_int32_t rpc_auth_length;
01453 <span class="comment">//    u_int8_t *rpc_auth_data;</span>
01454 };
01455 
01456 <span class="keyword">struct </span>libnet_rpc_call
01457 {
01458     u_int32_t rpc_rpcvers;   <span class="comment">/* RPC version - must be 2 */</span>
01459     u_int32_t rpc_prognum;   <span class="comment">/* Program Number */</span>
01460     u_int32_t rpc_vers;      <span class="comment">/* Program Version */</span>
01461     u_int32_t rpc_procedure; <span class="comment">/* RPC procedure */</span>
01462     <span class="keyword">struct </span>libnet_rpc_opaque_auth rpc_credentials;
01463     <span class="keyword">struct </span>libnet_rpc_opaque_auth rpc_verifier;
01464 };
01465 
01466 <span class="keyword">struct </span>libnet_rpc_call_hdr
01467 {
01468     u_int32_t rpc_xid;  <span class="comment">/* xid (transaction identifier) */</span>
01469     u_int32_t rpc_type;
01470     <span class="keyword">struct </span>libnet_rpc_call  rpc_call;
01471 };
01472 
01473 <span class="keyword">struct </span>libnet_rpc_call_tcp_hdr
01474 {
01475     u_int32_t rpc_record_marking; <span class="comment">/* used with byte stream protocols */</span>
01476     <span class="keyword">struct </span>libnet_rpc_call_hdr rpc_common;
01477 };
01478 
01479 <span class="comment">/*</span>
01480 <span class="comment"> *  STP configuration header</span>
01481 <span class="comment"> *  Spanning Tree Protocol</span>
01482 <span class="comment"> *  Static header size: 35 bytes</span>
01483 <span class="comment"> */</span>
01484 <span class="keyword">struct </span>libnet_stp_conf_hdr
01485 {
01486     u_int16_t stp_id;         <span class="comment">/* protocol id */</span>
01487     u_int8_t stp_version;     <span class="comment">/* protocol version */</span>
01488     u_int8_t stp_bpdu_type;   <span class="comment">/* bridge protocol data unit type */</span>
01489     u_int8_t stp_flags;       <span class="comment">/* control flags */</span>
01490     u_int8_t stp_rootid[8];   <span class="comment">/* root id */</span>
01491     u_int32_t stp_rootpc;      <span class="comment">/* root path cost */</span>
01492     u_int8_t stp_bridgeid[8]; <span class="comment">/* bridge id */</span>
01493     u_int16_t stp_portid;     <span class="comment">/* port id */</span>
01494     u_int16_t stp_mage;       <span class="comment">/* message age */</span>
01495     u_int16_t stp_maxage;     <span class="comment">/* max age */</span>
01496     u_int16_t stp_hellot;     <span class="comment">/* hello time */</span>
01497     u_int16_t stp_fdelay;     <span class="comment">/* forward delay */</span>
01498 };
01499 
01500 
01501 <span class="comment">/*</span>
01502 <span class="comment"> *  STP topology change notification header</span>
01503 <span class="comment"> *  Spanning Tree Protocol</span>
01504 <span class="comment"> *  Static header size: 4 bytes</span>
01505 <span class="comment"> */</span>
01506 <span class="keyword">struct </span>libnet_stp_tcn_hdr
01507 {
01508     u_int16_t stp_id;         <span class="comment">/* protocol id */</span>
01509     u_int8_t stp_version;     <span class="comment">/* protocol version */</span>
01510     u_int8_t stp_bpdu_type;   <span class="comment">/* bridge protocol data unit type */</span>
01511 };
01512 
01513 
01514 <span class="comment">/*</span>
01515 <span class="comment"> *  TCP header</span>
01516 <span class="comment"> *  Transmission Control Protocol</span>
01517 <span class="comment"> *  Static header size: 20 bytes</span>
01518 <span class="comment"> */</span>
01519 <span class="keyword">struct </span>libnet_tcp_hdr
01520 {
01521     u_int16_t th_sport;       <span class="comment">/* source port */</span>
01522     u_int16_t th_dport;       <span class="comment">/* destination port */</span>
01523     u_int32_t th_seq;          <span class="comment">/* sequence number */</span>
01524     u_int32_t th_ack;          <span class="comment">/* acknowledgement number */</span>
01525 <span class="preprocessor">#if (LIBNET_LIL_ENDIAN)</span>
01526 <span class="preprocessor"></span>    u_int8_t th_x2:4,         <span class="comment">/* (unused) */</span>
01527            th_off:4;        <span class="comment">/* data offset */</span>
01528 <span class="preprocessor">#endif</span>
01529 <span class="preprocessor"></span><span class="preprocessor">#if (LIBNET_BIG_ENDIAN)</span>
01530 <span class="preprocessor"></span>    u_int8_t th_off:4,        <span class="comment">/* data offset */</span>
01531            th_x2:4;         <span class="comment">/* (unused) */</span>
01532 <span class="preprocessor">#endif</span>
01533 <span class="preprocessor"></span>    u_int8_t  th_flags;       <span class="comment">/* control flags */</span>
01534 <span class="preprocessor">#ifndef TH_FIN</span>
01535 <span class="preprocessor"></span><span class="preprocessor">#define TH_FIN    0x01      </span><span class="comment">/* finished send data */</span>
01536 <span class="preprocessor">#endif</span>
01537 <span class="preprocessor"></span><span class="preprocessor">#ifndef TH_SYN</span>
01538 <span class="preprocessor"></span><span class="preprocessor">#define TH_SYN    0x02      </span><span class="comment">/* synchronize sequence numbers */</span>
01539 <span class="preprocessor">#endif</span>
01540 <span class="preprocessor"></span><span class="preprocessor">#ifndef TH_RST</span>
01541 <span class="preprocessor"></span><span class="preprocessor">#define TH_RST    0x04      </span><span class="comment">/* reset the connection */</span>
01542 <span class="preprocessor">#endif</span>
01543 <span class="preprocessor"></span><span class="preprocessor">#ifndef TH_PUSH</span>
01544 <span class="preprocessor"></span><span class="preprocessor">#define TH_PUSH   0x08      </span><span class="comment">/* push data to the app layer */</span>
01545 <span class="preprocessor">#endif</span>
01546 <span class="preprocessor"></span><span class="preprocessor">#ifndef TH_ACK</span>
01547 <span class="preprocessor"></span><span class="preprocessor">#define TH_ACK    0x10      </span><span class="comment">/* acknowledge */</span>
01548 <span class="preprocessor">#endif</span>
01549 <span class="preprocessor"></span><span class="preprocessor">#ifndef TH_URG</span>
01550 <span class="preprocessor"></span><span class="preprocessor">#define TH_URG    0x20      </span><span class="comment">/* urgent! */</span>
01551 <span class="preprocessor">#endif</span>
01552 <span class="preprocessor"></span><span class="preprocessor">#ifndef TH_ECE</span>
01553 <span class="preprocessor"></span><span class="preprocessor">#define TH_ECE    0x40</span>
01554 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
01555 <span class="preprocessor"></span><span class="preprocessor">#ifndef TH_CWR   </span>
01556 <span class="preprocessor"></span><span class="preprocessor">#define TH_CWR    0x80</span>
01557 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
01558 <span class="preprocessor"></span>    u_int16_t th_win;         <span class="comment">/* window */</span>
01559     u_int16_t th_sum;         <span class="comment">/* checksum */</span>
01560     u_int16_t th_urp;         <span class="comment">/* urgent pointer */</span>
01561 };
01562 
01563 <span class="comment">/*</span>
01564 <span class="comment"> *  Token Ring Header</span>
01565 <span class="comment"> */</span>
01566 <span class="keyword">struct </span>libnet_token_ring_hdr
01567 {
01568     u_int8_t  token_ring_access_control;
01569 <span class="preprocessor">#define LIBNET_TOKEN_RING_FRAME  0x10</span>
01570 <span class="preprocessor"></span>    u_int8_t  token_ring_frame_control;
01571 <span class="preprocessor">#define LIBNET_TOKEN_RING_LLC_FRAME  0x40</span>
01572 <span class="preprocessor"></span>    u_int8_t  token_ring_dhost[TOKEN_RING_ADDR_LEN];
01573     u_int8_t  token_ring_shost[TOKEN_RING_ADDR_LEN];
01574     u_int8_t  token_ring_llc_dsap;
01575     u_int8_t  token_ring_llc_ssap;
01576     u_int8_t  token_ring_llc_control_field;
01577     u_int8_t  token_ring_llc_org_code[LIBNET_ORG_CODE_SIZE];
01578     u_int16_t token_ring_type;
01579 <span class="preprocessor">#define TOKEN_RING_TYPE_IP            0x0800  </span><span class="comment">/* IP protocol */</span>
01580 <span class="preprocessor">#define TOKEN_RING_TYPE_ARP           0x0806  </span><span class="comment">/* addr. resolution protocol */</span>
01581 <span class="preprocessor">#define TOKEN_RING_TYPE_REVARP        0x8035  </span><span class="comment">/* reverse addr. resolution protocol */</span>
01582 };
01583 
01584 <span class="keyword">struct </span>libnet_token_ring_addr
01585 {
01586     u_int8_t  token_ring_addr_octet[6];        <span class="comment">/* Token Ring address */</span>
01587 };
01588 
01589 <span class="comment">/*</span>
01590 <span class="comment"> *  UDP header</span>
01591 <span class="comment"> *  User Data Protocol</span>
01592 <span class="comment"> *  Static header size: 8 bytes</span>
01593 <span class="comment"> */</span>
01594 <span class="keyword">struct </span>libnet_udp_hdr
01595 {
01596     u_int16_t uh_sport;       <span class="comment">/* soure port */</span>
01597     u_int16_t uh_dport;       <span class="comment">/* destination port */</span>
01598     u_int16_t uh_ulen;        <span class="comment">/* length */</span>
01599     u_int16_t uh_sum;         <span class="comment">/* checksum */</span>
01600 };
01601 
01602 <span class="comment">/*</span>
01603 <span class="comment"> *  Sebek header</span>
01604 <span class="comment"> *  Static header size: 48 bytes</span>
01605 <span class="comment"> */</span>
01606 <span class="keyword">struct </span>libnet_sebek_hdr
01607 {
01608     u_int32_t magic;           <span class="comment">/* identify packets that should be hidden */</span>
01609     u_int16_t version;         <span class="comment">/* protocol version, currently 1 */</span>
01610 <span class="preprocessor">#define SEBEK_PROTO_VERSION 1</span>
01611 <span class="preprocessor"></span>    u_int16_t type;            <span class="comment">/* type of record (read data is type 0, write data is type 1) */</span>
01612 <span class="preprocessor">#define SEBEK_TYPE_READ     0  </span><span class="comment">/* Currently, only read is supported */</span>
01613 <span class="preprocessor">#define SEBEK_TYPE_WRITE    1</span>
01614 <span class="preprocessor"></span>    u_int32_t counter;         <span class="comment">/*  PDU counter used to identify when packet are lost */</span>
01615     u_int32_t time_sec;        <span class="comment">/* seconds since EPOCH according to the honeypot */</span>
01616     u_int32_t time_usec;       <span class="comment">/* residual microseconds */</span>
01617     u_int32_t pid;             <span class="comment">/* PID */</span>
01618     u_int32_t uid;             <span class="comment">/* UID */</span>
01619     u_int32_t fd;              <span class="comment">/* FD */</span>
01620 <span class="preprocessor">#define SEBEK_CMD_LENGTH   12</span>
01621 <span class="preprocessor"></span>    u_int8_t cmd[SEBEK_CMD_LENGTH]; <span class="comment">/* 12 first characters of the command */</span>
01622     u_int32_t length;          <span class="comment">/* length in bytes of the PDU's body */</span>
01623 };
01624 
01625 
01626 <span class="comment">/*</span>
01627 <span class="comment"> *  VRRP header</span>
01628 <span class="comment"> *  Virtual Router Redundancy Protocol</span>
01629 <span class="comment"> *  Static header size: 8 bytes</span>
01630 <span class="comment"> */</span>
01631 <span class="preprocessor">#ifndef IPPROTO_VRRP</span>
01632 <span class="preprocessor"></span><span class="preprocessor">#define IPPROTO_VRRP 112    </span><span class="comment">/* not everyone's got this */</span>
01633 <span class="preprocessor">#endif</span>
01634 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_vrrp_hdr
01635 {
01636 <span class="preprocessor">#if (LIBNET_LIL_ENDIAN)</span>
01637 <span class="preprocessor"></span>    u_int8_t vrrp_v:4,        <span class="comment">/* protocol version */</span>
01638            vrrp_t:4;        <span class="comment">/* packet type */</span>
01639 <span class="preprocessor">#endif</span>
01640 <span class="preprocessor"></span><span class="preprocessor">#if (LIBNET_BIG_ENDIAN)</span>
01641 <span class="preprocessor"></span>    u_int8_t vrrp_t:4,        <span class="comment">/* packet type */</span>
01642            vrrp_v:4;        <span class="comment">/* protocol version */</span>
01643 <span class="preprocessor">#endif</span>
01644 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_VRRP_VERSION_01  0x1</span>
01645 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_VRRP_VERSION_02  0x2</span>
01646 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_VRRP_TYPE_ADVERT 0x1</span>
01647 <span class="preprocessor"></span>    u_int8_t vrrp_vrouter_id; <span class="comment">/* virtual router id */</span>
01648     u_int8_t vrrp_priority;   <span class="comment">/* priority */</span>
01649     u_int8_t vrrp_ip_count;   <span class="comment">/* number of IP addresses */</span>
01650     u_int8_t vrrp_auth_type;  <span class="comment">/* authorization type */</span>
01651 <span class="preprocessor">#define LIBNET_VRRP_AUTH_NONE   0x1</span>
01652 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_VRRP_AUTH_PASSWD 0x2</span>
01653 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_VRRP_AUTH_IPAH   0x3</span>
01654 <span class="preprocessor"></span>    u_int8_t vrrp_advert_int; <span class="comment">/* advertisement interval */</span>
01655     u_int16_t vrrp_sum;       <span class="comment">/* checksum */</span>
01656     <span class="comment">/* additional addresses */</span>
01657     <span class="comment">/* authentication info */</span>
01658 };
01659 
01660 <span class="preprocessor">#endif  </span><span class="comment">/* __LIBNET_HEADERS_H */</span>
01661 
01662 <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>