Annotation of embedaddon/libnet/doc/html/libnet-headers_8h-source.html, revision 1.1.1.1
1.1 misho 1: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2: <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3: <title>libnet: libnet-headers.h Source File</title>
4: <link href="doxygen.css" rel="stylesheet" type="text/css">
5: </head><body>
6: <!-- Generated by Doxygen 1.3.4 -->
7: <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
8: <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>
9: 00002 <span class="comment"> * $Id: libnet-headers.h,v 1.13 2004/03/01 20:26:12 mike Exp $</span>
10: 00003 <span class="comment"> *</span>
11: 00004 <span class="comment"> * libnet-headers.h - Network routine library headers header file</span>
12: 00005 <span class="comment"> *</span>
13: 00006 <span class="comment"> * Copyright (c) 1998 - 2004 Mike D. Schiffman <mike@infonexus.com></span>
14: 00007 <span class="comment"> * All rights reserved.</span>
15: 00008 <span class="comment"> *</span>
16: 00009 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span>
17: 00010 <span class="comment"> * modification, are permitted provided that the following conditions</span>
18: 00011 <span class="comment"> * are met:</span>
19: 00012 <span class="comment"> * 1. Redistributions of source code must retain the above copyright</span>
20: 00013 <span class="comment"> * notice, this list of conditions and the following disclaimer.</span>
21: 00014 <span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span>
22: 00015 <span class="comment"> * notice, this list of conditions and the following disclaimer in the</span>
23: 00016 <span class="comment"> * documentation and/or other materials provided with the distribution.</span>
24: 00017 <span class="comment"> *</span>
25: 00018 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND</span>
26: 00019 <span class="comment"> * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span>
27: 00020 <span class="comment"> * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</span>
28: 00021 <span class="comment"> * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE</span>
29: 00022 <span class="comment"> * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL</span>
30: 00023 <span class="comment"> * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS</span>
31: 00024 <span class="comment"> * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)</span>
32: 00025 <span class="comment"> * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT</span>
33: 00026 <span class="comment"> * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY</span>
34: 00027 <span class="comment"> * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</span>
35: 00028 <span class="comment"> * SUCH DAMAGE.</span>
36: 00029 <span class="comment"> *</span>
37: 00030 <span class="comment"> */</span>
38: 00031
39: 00032 <span class="preprocessor">#ifndef __LIBNET_HEADERS_H</span>
40: 00033 <span class="preprocessor"></span><span class="preprocessor">#define __LIBNET_HEADERS_H</span>
41: 00034 <span class="preprocessor"></span>
42: <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>
43: <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>
44: <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>
45: <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>
46: <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>
47: <a name="l00047"></a><a class="code" href="libnet-headers_8h.html#a5">00047</a> <span class="preprocessor">#define LIBNET_ARP_H 0x08 </span>
48: <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>
49: <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>
50: <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>
51: <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>
52: <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>
53: <a name="l00053"></a><a class="code" href="libnet-headers_8h.html#a11">00053</a> <span class="preprocessor">#define LIBNET_CDP_H 0x08 </span>
54: <a name="l00054"></a><a class="code" href="libnet-headers_8h.html#a12">00054</a> <span class="preprocessor">#define LIBNET_DHCPV4_H 0xf0 </span>
55: <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>
56: <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>
57: <a name="l00057"></a><a class="code" href="libnet-headers_8h.html#a15">00057</a> <span class="preprocessor">#define LIBNET_ETH_H 0x0e </span>
58: <a name="l00058"></a><a class="code" href="libnet-headers_8h.html#a16">00058</a> <span class="preprocessor">#define LIBNET_FDDI_H 0x15 </span>
59: <a name="l00059"></a><a class="code" href="libnet-headers_8h.html#a17">00059</a> <span class="preprocessor">#define LIBNET_ICMPV4_H 0x04 </span>
60: <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>
61: <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>
62: <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>
63: <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>
64: <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>
65: <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>
66: <a name="l00066"></a><a class="code" href="libnet-headers_8h.html#a24">00066</a> <span class="preprocessor">#define LIBNET_ICMPV6_H 0x08 </span>
67: <a name="l00067"></a><a class="code" href="libnet-headers_8h.html#a25">00067</a> <span class="preprocessor">#define LIBNET_IGMP_H 0x08 </span>
68: <a name="l00068"></a><a class="code" href="libnet-headers_8h.html#a26">00068</a> <span class="preprocessor">#define LIBNET_IPV4_H 0x14 </span>
69: <a name="l00069"></a><a class="code" href="libnet-headers_8h.html#a27">00069</a> <span class="preprocessor">#define LIBNET_IPV6_H 0x28 </span>
70: <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>
71: <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>
72: <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>
73: <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>
74: <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>
75: <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>
76: <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>
77: <a name="l00077"></a><a class="code" href="libnet-headers_8h.html#a35">00077</a> <span class="preprocessor">#define LIBNET_ISL_H 0x1a </span>
78: <a name="l00078"></a><a class="code" href="libnet-headers_8h.html#a36">00078</a> <span class="preprocessor">#define LIBNET_GRE_H 0x04 </span>
79: <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>
80: <a name="l00080"></a><a class="code" href="libnet-headers_8h.html#a38">00080</a> <span class="preprocessor">#define LIBNET_MPLS_H 0x04 </span>
81: <a name="l00081"></a><a class="code" href="libnet-headers_8h.html#a39">00081</a> <span class="preprocessor">#define LIBNET_OSPF_H 0x10 </span>
82: <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>
83: <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>
84: <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>
85: <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>
86: <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>
87: <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>
88: <a name="l00088"></a><a class="code" href="libnet-headers_8h.html#a46">00088</a> <span class="preprocessor">#define LIBNET_OSPF_CKSUM 0x10 </span>
89: <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>
90: <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>
91: <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>
92: <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>
93: <a name="l00093"></a><a class="code" href="libnet-headers_8h.html#a51">00093</a> <span class="preprocessor">#define LIBNET_NTP_H 0x30 </span>
94: <a name="l00094"></a><a class="code" href="libnet-headers_8h.html#a52">00094</a> <span class="preprocessor">#define LIBNET_RIP_H 0x18 </span>
95: <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>
96: <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>
97: 00101 <span class="preprocessor">#define LIBNET_SEBEK_H 0x30 </span><span class="comment">/* sebek header: 48 bytes */</span>
98: <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>
99: <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>
100: <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>
101: <a name="l00105"></a><a class="code" href="libnet-headers_8h.html#a59">00105</a> <span class="preprocessor">#define LIBNET_TCP_H 0x14 </span>
102: <a name="l00106"></a><a class="code" href="libnet-headers_8h.html#a60">00106</a> <span class="preprocessor">#define LIBNET_UDP_H 0x08 </span>
103: <a name="l00107"></a><a class="code" href="libnet-headers_8h.html#a61">00107</a> <span class="preprocessor">#define LIBNET_VRRP_H 0x08 </span>
104: <a name="l00113"></a><a class="code" href="structlibnet__802__1q__hdr.html">00113</a> <span class="preprocessor">struct libnet_802_1q_hdr</span>
105: 00114 <span class="preprocessor"></span>{
106: <a name="l00115"></a><a class="code" href="structlibnet__802__1q__hdr.html#o0">00115</a> u_int8_t vlan_dhost[ETHER_ADDR_LEN];
107: <a name="l00116"></a><a class="code" href="structlibnet__802__1q__hdr.html#o1">00116</a> u_int8_t vlan_shost[ETHER_ADDR_LEN];
108: <a name="l00117"></a><a class="code" href="structlibnet__802__1q__hdr.html#o2">00117</a> u_int16_t vlan_tpi;
109: <a name="l00118"></a><a class="code" href="structlibnet__802__1q__hdr.html#o3">00118</a> u_int16_t vlan_priority_c_vid;
110: <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>
111: <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>
112: <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>
113: <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>
114: 00123 <span class="preprocessor">}; </span>
115: 00124 <span class="preprocessor"></span>
116: <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>
117: 00130 {
118: <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>;
119: <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>;
120: <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>
121: <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>
122: <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>
123: <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>
124: <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>
125: <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>
126: 00139 <span class="preprocessor">}; </span>
127: 00140 <span class="preprocessor"></span>
128: 00141 <span class="comment">/*</span>
129: 00142 <span class="comment"> * IEEE 802.2 LLC header</span>
130: 00143 <span class="comment"> * Link Layer Control</span>
131: 00144 <span class="comment"> * static header size: 3 bytes</span>
132: 00145 <span class="comment"> */</span>
133: 00146 <span class="keyword">struct </span>libnet_802_2_hdr
134: 00147 {
135: 00148 u_int8_t llc_dsap; <span class="comment">/* destination service access point */</span>
136: 00149 u_int8_t llc_ssap; <span class="comment">/* source service access point */</span>
137: 00150 <span class="preprocessor">#define LIBNET_SAP_STP 0x42</span>
138: 00151 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_SAP_SNAP 0xaa</span>
139: 00152 <span class="preprocessor"></span> u_int8_t llc_control; <span class="comment">/* control field */</span>
140: 00153 };
141: 00154
142: 00155
143: 00156 <span class="comment">/*</span>
144: 00157 <span class="comment"> * IEEE 802.2 LLC/SNAP header</span>
145: 00158 <span class="comment"> * SubNetwork Attachment Point</span>
146: 00159 <span class="comment"> * static header size: 8 bytes</span>
147: 00160 <span class="comment"> */</span>
148: 00161 <span class="keyword">struct </span>libnet_802_2snap_hdr
149: 00162 {
150: 00163 u_int8_t snap_dsap; <span class="comment">/* destination service access point */</span>
151: 00164 u_int8_t snap_ssap; <span class="comment">/* destination service access point */</span>
152: 00165 u_int8_t snap_control; <span class="comment">/* control field */</span>
153: 00166 u_int8_t snap_oui[3]; <span class="comment">/* OUI */</span>
154: 00167 u_int16_t snap_type; <span class="comment">/* type */</span>
155: 00168 };
156: 00169
157: 00170
158: 00171 <span class="comment">/*</span>
159: 00172 <span class="comment"> * 802.3 header</span>
160: 00173 <span class="comment"> * IEEE Ethernet</span>
161: 00174 <span class="comment"> * Static header size: 14 bytes</span>
162: 00175 <span class="comment"> */</span>
163: 00176 <span class="keyword">struct </span>libnet_802_3_hdr
164: 00177 {
165: 00178 u_int8_t _802_3_dhost[ETHER_ADDR_LEN];<span class="comment">/* destination ethernet address */</span>
166: 00179 u_int8_t _802_3_shost[ETHER_ADDR_LEN];<span class="comment">/* source ethernet address */</span>
167: 00180 u_int16_t _802_3_len; <span class="comment">/* packet type ID */</span>
168: 00181 };
169: 00182
170: 00183
171: 00184 <span class="comment">/* </span>
172: 00185 <span class="comment"> * ARP header</span>
173: 00186 <span class="comment"> * Address Resolution Protocol</span>
174: 00187 <span class="comment"> * Base header size: 8 bytes</span>
175: 00188 <span class="comment"> */</span>
176: 00189 <span class="keyword">struct </span>libnet_arp_hdr
177: 00190 {
178: 00191 u_int16_t ar_hrd; <span class="comment">/* format of hardware address */</span>
179: 00192 <span class="preprocessor">#define ARPHRD_NETROM 0 </span><span class="comment">/* from KA9Q: NET/ROM pseudo */</span>
180: 00193 <span class="preprocessor">#define ARPHRD_ETHER 1 </span><span class="comment">/* Ethernet 10Mbps */</span>
181: 00194 <span class="preprocessor">#define ARPHRD_EETHER 2 </span><span class="comment">/* Experimental Ethernet */</span>
182: 00195 <span class="preprocessor">#define ARPHRD_AX25 3 </span><span class="comment">/* AX.25 Level 2 */</span>
183: 00196 <span class="preprocessor">#define ARPHRD_PRONET 4 </span><span class="comment">/* PROnet token ring */</span>
184: 00197 <span class="preprocessor">#define ARPHRD_CHAOS 5 </span><span class="comment">/* Chaosnet */</span>
185: 00198 <span class="preprocessor">#define ARPHRD_IEEE802 6 </span><span class="comment">/* IEEE 802.2 Ethernet/TR/TB */</span>
186: 00199 <span class="preprocessor">#define ARPHRD_ARCNET 7 </span><span class="comment">/* ARCnet */</span>
187: 00200 <span class="preprocessor">#define ARPHRD_APPLETLK 8 </span><span class="comment">/* APPLEtalk */</span>
188: 00201 <span class="preprocessor">#define ARPHRD_LANSTAR 9 </span><span class="comment">/* Lanstar */</span>
189: 00202 <span class="preprocessor">#define ARPHRD_DLCI 15 </span><span class="comment">/* Frame Relay DLCI */</span>
190: 00203 <span class="preprocessor">#define ARPHRD_ATM 19 </span><span class="comment">/* ATM */</span>
191: 00204 <span class="preprocessor">#define ARPHRD_METRICOM 23 </span><span class="comment">/* Metricom STRIP (new IANA id) */</span>
192: 00205 <span class="preprocessor">#define ARPHRD_IPSEC 31 </span><span class="comment">/* IPsec tunnel */</span>
193: 00206 u_int16_t ar_pro; <span class="comment">/* format of protocol address */</span>
194: 00207 u_int8_t ar_hln; <span class="comment">/* length of hardware address */</span>
195: 00208 u_int8_t ar_pln; <span class="comment">/* length of protocol addres */</span>
196: 00209 u_int16_t ar_op; <span class="comment">/* operation type */</span>
197: 00210 <span class="preprocessor">#define ARPOP_REQUEST 1 </span><span class="comment">/* req to resolve address */</span>
198: 00211 <span class="preprocessor">#define ARPOP_REPLY 2 </span><span class="comment">/* resp to previous request */</span>
199: 00212 <span class="preprocessor">#define ARPOP_REVREQUEST 3 </span><span class="comment">/* req protocol address given hardware */</span>
200: 00213 <span class="preprocessor">#define ARPOP_REVREPLY 4 </span><span class="comment">/* resp giving protocol address */</span>
201: 00214 <span class="preprocessor">#define ARPOP_INVREQUEST 8 </span><span class="comment">/* req to identify peer */</span>
202: 00215 <span class="preprocessor">#define ARPOP_INVREPLY 9 </span><span class="comment">/* resp identifying peer */</span>
203: 00216 <span class="comment">/* address information allocated dynamically */</span>
204: 00217 };
205: 00218
206: 00219 <span class="comment">/*</span>
207: 00220 <span class="comment"> * BGP4 header</span>
208: 00221 <span class="comment"> * Border Gateway Protocol 4</span>
209: 00222 <span class="comment"> * Base header size : 19 bytes</span>
210: 00223 <span class="comment"> */</span>
211: 00224 <span class="keyword">struct </span>libnet_bgp4_header_hdr
212: 00225 {
213: 00226 <span class="preprocessor">#define LIBNET_BGP4_MARKER_SIZE 16</span>
214: 00227 <span class="preprocessor"></span> u_int8_t marker[LIBNET_BGP4_MARKER_SIZE];
215: 00228 u_int16_t len;
216: 00229 u_int8_t type;
217: 00230 <span class="preprocessor">#define LIBNET_BGP4_OPEN 1</span>
218: 00231 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_UPDATE 2</span>
219: 00232 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_NOTIFICATION 3</span>
220: 00233 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_KEEPALIVE 4</span>
221: 00234 <span class="preprocessor"></span>};
222: 00235
223: 00236 <span class="comment">/*</span>
224: 00237 <span class="comment"> * BGP4 open header</span>
225: 00238 <span class="comment"> * Border Gateway Protocol 4</span>
226: 00239 <span class="comment"> * Base header size : 10 bytes</span>
227: 00240 <span class="comment"> */</span>
228: 00241 <span class="keyword">struct </span>libnet_bgp4_open_hdr
229: 00242 {
230: 00243 u_int8_t version;
231: 00244 u_int16_t src_as;
232: 00245 u_int16_t hold_time;
233: 00246 u_int32_t bgp_id;
234: 00247 u_int8_t opt_len;
235: 00248 };
236: 00249
237: 00250 <span class="comment">/*</span>
238: 00251 <span class="comment"> * BGP4 notification message</span>
239: 00252 <span class="comment"> *</span>
240: 00253 <span class="comment"> * Border Gateway Protocol 4</span>
241: 00254 <span class="comment"> * Base header size : 2 bytes</span>
242: 00255 <span class="comment"> *</span>
243: 00256 <span class="comment"> * Use payload if you need data</span>
244: 00257 <span class="comment"> */</span>
245: 00258 <span class="keyword">struct </span>libnet_bgp4_notification_hdr
246: 00259 {
247: 00260 <span class="preprocessor">#define LIBNET_BGP4_MESSAGE_HEADER_ERROR 1</span>
248: 00261 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_OPEN_MESSAGE_ERROR 2</span>
249: 00262 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_UPDATE_MESSAGE_ERROR 3</span>
250: 00263 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_HOLD_TIMER_EXPIRED 4</span>
251: 00264 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_FINITE_STATE__ERROR 5</span>
252: 00265 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_CEASE 6</span>
253: 00266 <span class="preprocessor"></span> u_int8_t err_code;
254: 00267
255: 00268 <span class="comment">/* Message Header Error subcodes */</span>
256: 00269 <span class="preprocessor">#define LIBNET_BGP4_CONNECTION_NOT_SYNCHRONIZED 1</span>
257: 00270 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_BAD_MESSAGE_LENGTH 2</span>
258: 00271 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_BAD_MESSAGE_TYPE 3</span>
259: 00272 <span class="preprocessor"></span><span class="comment">/* OPEN Message Error subcodes */</span>
260: 00273 <span class="preprocessor">#define LIBNET_BGP4_UNSUPPORTED_VERSION_NUMBER 1</span>
261: 00274 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_BAD_PEER_AS 2</span>
262: 00275 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_BAD_BGP_IDENTIFIER 3</span>
263: 00276 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_UNSUPPORTED_OPTIONAL_PARAMETER 4</span>
264: 00277 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_AUTHENTICATION_FAILURE 5</span>
265: 00278 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_UNACCEPTABLE_HOLD_TIME 6</span>
266: 00279 <span class="preprocessor"></span><span class="comment">/* UPDATE Message Error subcodes */</span>
267: 00280 <span class="preprocessor">#define LIBNET_BGP4_MALFORMED_ATTRIBUTE_LIST</span>
268: 00281 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_UNRECOGNIZED_WELL_KNOWN_ATTRIBUTE</span>
269: 00282 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_MISSING_WELL_KNOWN_ATTRIBUTE</span>
270: 00283 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_ATTRIBUTE_FLAGS_ERROR</span>
271: 00284 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_ATTRIBUTE_LENGTH_ERROR</span>
272: 00285 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_INVALID_ORIGIN_ATTRIBUTE</span>
273: 00286 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_AS_ROUTING_LOOP</span>
274: 00287 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_INVALID_NEXT_HOP_ATTRIBUTE</span>
275: 00288 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_OPTIONAL_ATTRIBUTE_ERROR</span>
276: 00289 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_INVALID_NETWORK_FIELD</span>
277: 00290 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BGP4_MALFORMED_AS_PATH</span>
278: 00291 <span class="preprocessor"></span> u_int8_t err_subcode;
279: 00292 };
280: 00293
281: 00294
282: 00295
283: 00296 <span class="comment">/*</span>
284: 00297 <span class="comment"> * CDP header</span>
285: 00298 <span class="comment"> * Cisco Discovery Protocol</span>
286: 00299 <span class="comment"> * Base header size: 8 bytes</span>
287: 00300 <span class="comment"> */</span>
288: 00301
289: 00302 <span class="comment">/*</span>
290: 00303 <span class="comment"> * For checksum stuff -- IANA says 135-254 is "unassigned" as of 12.2001.</span>
291: 00304 <span class="comment"> * Let's hope this one stays that way for a while!</span>
292: 00305 <span class="comment"> */</span>
293: 00306 <span class="preprocessor">#define LIBNET_PROTO_CDP 200</span>
294: 00307 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_cdp_hdr
295: 00308 {
296: 00309 u_int8_t cdp_version; <span class="comment">/* version (should always be 0x01) */</span>
297: 00310 u_int8_t cdp_ttl; <span class="comment">/* time reciever should hold info in this packet */</span>
298: 00311 u_int16_t cdp_sum; <span class="comment">/* checksum */</span>
299: 00312 u_int16_t cdp_type; <span class="comment">/* type */</span>
300: 00313 <span class="preprocessor">#define LIBNET_CDP_DEVID 0x1 </span><span class="comment">/* device id */</span>
301: 00314 <span class="preprocessor">#define LIBNET_CDP_ADDRESS 0x2 </span><span class="comment">/* address */</span>
302: 00315 <span class="preprocessor">#define LIBNET_CDP_PORTID 0x3 </span><span class="comment">/* port id */</span>
303: 00316 <span class="preprocessor">#define LIBNET_CDP_CAPABIL 0x4 </span><span class="comment">/* capabilities */</span>
304: 00317 <span class="preprocessor">#define LIBNET_CDP_VERSION 0x5 </span><span class="comment">/* version */</span>
305: 00318 <span class="preprocessor">#define LIBNET_CDP_PLATFORM 0x6 </span><span class="comment">/* platform */</span>
306: 00319 <span class="preprocessor">#define LIBNET_CDP_IPPREFIX 0x7 </span><span class="comment">/* ip prefix */</span>
307: 00320 u_int16_t cdp_len; <span class="comment">/* type + length + value */</span>
308: 00321 <span class="comment">/* value information done dynamically */</span>
309: 00322
310: 00323 <span class="comment">/* CDP capabilities */</span>
311: 00324 <span class="preprocessor">#define LIBNET_CDP_CAP_L3R 0x01</span><span class="comment">/* performs level 3 routing */</span>
312: 00325 <span class="preprocessor">#define LIBNET_CDP_CAP_L2B 0x02</span><span class="comment">/* performs level 2 transparent bridging */</span>
313: 00326 <span class="preprocessor">#define LIBNET_CDP_CAP_L2SRB 0x04</span><span class="comment">/* performs level 2 sourceroute bridging */</span>
314: 00327 <span class="preprocessor">#define LIBNET_CDP_CAP_L2S 0x08</span><span class="comment">/* performs level 2 switching */</span>
315: 00328 <span class="preprocessor">#define LIBNET_CDP_CAP_SR 0x10</span><span class="comment">/* sends and recieves packets on a network */</span>
316: 00329 <span class="preprocessor">#define LIBNET_CDP_CAP_NOI 0x20</span><span class="comment">/* does not forward IGMP on non-router ports */</span>
317: 00330 <span class="preprocessor">#define LIBNET_CDP_CAP_L1F 0x40</span><span class="comment">/* provides level 1 functionality */</span>
318: 00331 };
319: 00332
320: 00333
321: 00334 <span class="comment">/*</span>
322: 00335 <span class="comment"> * Used as an overlay for type/len/values</span>
323: 00336 <span class="comment"> */</span>
324: 00337 <span class="keyword">struct </span>libnet_cdp_value_hdr
325: 00338 {
326: 00339 u_int16_t cdp_type;
327: 00340 u_int16_t cdp_len;
328: 00341 };
329: 00342
330: 00343
331: 00344 <span class="comment">/*</span>
332: 00345 <span class="comment"> * DHCP header</span>
333: 00346 <span class="comment"> * Dynamic Host Configuration Protocol</span>
334: 00347 <span class="comment"> * Static header size: f0 bytes</span>
335: 00348 <span class="comment"> */</span>
336: 00349 <span class="keyword">struct </span>libnet_dhcpv4_hdr
337: 00350 {
338: 00351 u_int8_t dhcp_opcode; <span class="comment">/* opcode */</span>
339: 00352 <span class="preprocessor">#define LIBNET_DHCP_REQUEST 0x1</span>
340: 00353 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_REPLY 0x2</span>
341: 00354 <span class="preprocessor"></span> u_int8_t dhcp_htype; <span class="comment">/* hardware address type */</span>
342: 00355 u_int8_t dhcp_hlen; <span class="comment">/* hardware address length */</span>
343: 00356 u_int8_t dhcp_hopcount; <span class="comment">/* used by proxy servers */</span>
344: 00357 u_int32_t dhcp_xid; <span class="comment">/* transaction ID */</span>
345: 00358 u_int16_t dhcp_secs; <span class="comment">/* number of seconds since trying to bootstrap */</span>
346: 00359 u_int16_t dhcp_flags; <span class="comment">/* flags for DHCP, unused for BOOTP */</span>
347: 00360 u_int32_t dhcp_cip; <span class="comment">/* client's IP */</span>
348: 00361 u_int32_t dhcp_yip; <span class="comment">/* your IP */</span>
349: 00362 u_int32_t dhcp_sip; <span class="comment">/* server's IP */</span>
350: 00363 u_int32_t dhcp_gip; <span class="comment">/* gateway IP */</span>
351: 00364 u_int8_t dhcp_chaddr[16]; <span class="comment">/* client hardware address */</span>
352: 00365 u_int8_t dhcp_sname[64]; <span class="comment">/* server host name */</span>
353: 00366 u_int8_t dhcp_file[128]; <span class="comment">/* boot file name */</span>
354: 00367 u_int32_t dhcp_magic; <span class="comment">/* BOOTP magic header */</span>
355: 00368 <span class="preprocessor">#define DHCP_MAGIC 0x63825363</span>
356: 00369 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_BOOTP_MIN_LEN 0x12c</span>
357: 00370 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_PAD 0x00</span>
358: 00371 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_SUBNETMASK 0x01</span>
359: 00372 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_TIMEOFFSET 0x02</span>
360: 00373 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_ROUTER 0x03</span>
361: 00374 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_TIMESERVER 0x04</span>
362: 00375 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NAMESERVER 0x05</span>
363: 00376 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_DNS 0x06</span>
364: 00377 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_LOGSERV 0x07</span>
365: 00378 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_COOKIESERV 0x08</span>
366: 00379 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_LPRSERV 0x09</span>
367: 00380 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_IMPSERV 0x0a</span>
368: 00381 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_RESSERV 0x0b</span>
369: 00382 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_HOSTNAME 0x0c</span>
370: 00383 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_BOOTFILESIZE 0x0d</span>
371: 00384 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_DUMPFILE 0x0e</span>
372: 00385 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_DOMAINNAME 0x0f</span>
373: 00386 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_SWAPSERV 0x10</span>
374: 00387 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_ROOTPATH 0x11</span>
375: 00388 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_EXTENPATH 0x12</span>
376: 00389 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_IPFORWARD 0x13</span>
377: 00390 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_SRCROUTE 0x14</span>
378: 00391 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_POLICYFILTER 0x15</span>
379: 00392 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MAXASMSIZE 0x16</span>
380: 00393 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_IPTTL 0x17</span>
381: 00394 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MTUTIMEOUT 0x18</span>
382: 00395 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MTUTABLE 0x19</span>
383: 00396 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MTUSIZE 0x1a</span>
384: 00397 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_LOCALSUBNETS 0x1b</span>
385: 00398 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_BROADCASTADDR 0x1c</span>
386: 00399 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_DOMASKDISCOV 0x1d</span>
387: 00400 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MASKSUPPLY 0x1e</span>
388: 00401 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_DOROUTEDISC 0x1f</span>
389: 00402 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_ROUTERSOLICIT 0x20</span>
390: 00403 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_STATICROUTE 0x21</span>
391: 00404 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_TRAILERENCAP 0x22</span>
392: 00405 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_ARPTIMEOUT 0x23</span>
393: 00406 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_ETHERENCAP 0x24</span>
394: 00407 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_TCPTTL 0x25</span>
395: 00408 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_TCPKEEPALIVE 0x26</span>
396: 00409 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_TCPALIVEGARBAGE 0x27</span>
397: 00410 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NISDOMAIN 0x28</span>
398: 00411 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NISSERVERS 0x29</span>
399: 00412 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NISTIMESERV 0x2a</span>
400: 00413 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_VENDSPECIFIC 0x2b</span>
401: 00414 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NBNS 0x2c</span>
402: 00415 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NBDD 0x2d</span>
403: 00416 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NBTCPIP 0x2e</span>
404: 00417 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NBTCPSCOPE 0x2f</span>
405: 00418 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_XFONT 0x30</span>
406: 00419 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_XDISPLAYMGR 0x31</span>
407: 00420 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_DISCOVERADDR 0x32</span>
408: 00421 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_LEASETIME 0x33</span>
409: 00422 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_OPTIONOVERLOAD 0x34</span>
410: 00423 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MESSAGETYPE 0x35</span>
411: 00424 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_SERVIDENT 0x36</span>
412: 00425 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_PARAMREQUEST 0x37</span>
413: 00426 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MESSAGE 0x38</span>
414: 00427 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MAXMSGSIZE 0x39</span>
415: 00428 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_RENEWTIME 0x3a</span>
416: 00429 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_REBINDTIME 0x3b</span>
417: 00430 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_CLASSSID 0x3c</span>
418: 00431 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_CLIENTID 0x3d</span>
419: 00432 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NISPLUSDOMAIN 0x40</span>
420: 00433 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NISPLUSSERVERS 0x41</span>
421: 00434 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MOBILEIPAGENT 0x44</span>
422: 00435 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_SMTPSERVER 0x45</span>
423: 00436 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_POP3SERVER 0x46</span>
424: 00437 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_NNTPSERVER 0x47</span>
425: 00438 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_WWWSERVER 0x48</span>
426: 00439 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_FINGERSERVER 0x49</span>
427: 00440 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_IRCSERVER 0x4a</span>
428: 00441 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_STSERVER 0x4b</span>
429: 00442 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_STDASERVER 0x4c</span>
430: 00443 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_END 0xff</span>
431: 00444 <span class="preprocessor"></span>
432: 00445 <span class="preprocessor">#define LIBNET_DHCP_MSGDISCOVER 0x01</span>
433: 00446 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MSGOFFER 0x02</span>
434: 00447 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MSGREQUEST 0x03</span>
435: 00448 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MSGDECLINE 0x04</span>
436: 00449 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MSGACK 0x05</span>
437: 00450 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MSGNACK 0x06</span>
438: 00451 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MSGRELEASE 0x07</span>
439: 00452 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_DHCP_MSGINFORM 0x08</span>
440: 00453 <span class="preprocessor"></span>};
441: 00454
442: 00455
443: 00456 <span class="comment">/*</span>
444: 00457 <span class="comment"> * Base DNSv4 header</span>
445: 00458 <span class="comment"> * Domain Name System</span>
446: 00459 <span class="comment"> * Base header size: 12/14 bytes</span>
447: 00460 <span class="comment"> */</span>
448: 00461 <span class="comment">/* this little guy got left out in the cold */</span>
449: 00462 <span class="preprocessor">#define LIBNET_DNS_H LIBNET_UDP_DNSV4_H</span>
450: 00463 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_dnsv4_hdr
451: 00464 {
452: 00465 u_int16_t h_len; <span class="comment">/* length of the packet - only used with TCP */</span>
453: 00466 u_int16_t id; <span class="comment">/* DNS packet ID */</span>
454: 00467 u_int16_t flags; <span class="comment">/* DNS flags */</span>
455: 00468 u_int16_t num_q; <span class="comment">/* Number of questions */</span>
456: 00469 u_int16_t num_answ_rr; <span class="comment">/* Number of answer resource records */</span>
457: 00470 u_int16_t num_auth_rr; <span class="comment">/* Number of authority resource records */</span>
458: 00471 u_int16_t num_addi_rr; <span class="comment">/* Number of additional resource records */</span>
459: 00472 };
460: 00473
461: 00474
462: 00475 <span class="comment">/*</span>
463: 00476 <span class="comment"> * Ethernet II header</span>
464: 00477 <span class="comment"> * Static header size: 14 bytes</span>
465: 00478 <span class="comment"> */</span>
466: 00479 <span class="keyword">struct </span>libnet_ethernet_hdr
467: 00480 {
468: 00481 u_int8_t ether_dhost[ETHER_ADDR_LEN];<span class="comment">/* destination ethernet address */</span>
469: 00482 u_int8_t ether_shost[ETHER_ADDR_LEN];<span class="comment">/* source ethernet address */</span>
470: 00483 u_int16_t ether_type; <span class="comment">/* protocol */</span>
471: 00484 };
472: 00485
473: 00486 <span class="preprocessor">#ifndef ETHERTYPE_PUP</span>
474: 00487 <span class="preprocessor"></span><span class="preprocessor">#define ETHERTYPE_PUP 0x0200 </span><span class="comment">/* PUP protocol */</span>
475: 00488 <span class="preprocessor">#endif</span>
476: 00489 <span class="preprocessor"></span><span class="preprocessor">#ifndef ETHERTYPE_IP</span>
477: 00490 <span class="preprocessor"></span><span class="preprocessor">#define ETHERTYPE_IP 0x0800 </span><span class="comment">/* IP protocol */</span>
478: 00491 <span class="preprocessor">#endif</span>
479: 00492 <span class="preprocessor"></span><span class="preprocessor">#ifndef ETHERTYPE_ARP</span>
480: 00493 <span class="preprocessor"></span><span class="preprocessor">#define ETHERTYPE_ARP 0x0806 </span><span class="comment">/* addr. resolution protocol */</span>
481: 00494 <span class="preprocessor">#endif</span>
482: 00495 <span class="preprocessor"></span><span class="preprocessor">#ifndef ETHERTYPE_REVARP</span>
483: 00496 <span class="preprocessor"></span><span class="preprocessor">#define ETHERTYPE_REVARP 0x8035 </span><span class="comment">/* reverse addr. resolution protocol */</span>
484: 00497 <span class="preprocessor">#endif</span>
485: 00498 <span class="preprocessor"></span><span class="preprocessor">#ifndef ETHERTYPE_VLAN</span>
486: 00499 <span class="preprocessor"></span><span class="preprocessor">#define ETHERTYPE_VLAN 0x8100 </span><span class="comment">/* IEEE 802.1Q VLAN tagging */</span>
487: 00500 <span class="preprocessor">#endif</span>
488: 00501 <span class="preprocessor"></span><span class="preprocessor">#ifndef ETHERTYPE_EAP</span>
489: 00502 <span class="preprocessor"></span><span class="preprocessor">#define ETHERTYPE_EAP 0x888e </span><span class="comment">/* IEEE 802.1X EAP authentication */</span>
490: 00503 <span class="preprocessor">#endif</span>
491: 00504 <span class="preprocessor"></span><span class="preprocessor">#ifndef ETHERTYPE_MPLS</span>
492: 00505 <span class="preprocessor"></span><span class="preprocessor">#define ETHERTYPE_MPLS 0x8847 </span><span class="comment">/* MPLS */</span>
493: 00506 <span class="preprocessor">#endif</span>
494: 00507 <span class="preprocessor"></span><span class="preprocessor">#ifndef ETHERTYPE_LOOPBACK</span>
495: 00508 <span class="preprocessor"></span><span class="preprocessor">#define ETHERTYPE_LOOPBACK 0x9000 </span><span class="comment">/* used to test interfaces */</span>
496: 00509 <span class="preprocessor">#endif</span>
497: 00510 <span class="preprocessor"></span>
498: 00511 <span class="keyword">struct </span>libnet_ether_addr
499: 00512 {
500: 00513 u_int8_t ether_addr_octet[6]; <span class="comment">/* Ethernet address */</span>
501: 00514 };
502: 00515
503: 00516 <span class="comment">/*</span>
504: 00517 <span class="comment"> * Fiber Distributed Data Interface header</span>
505: 00518 <span class="comment"> *</span>
506: 00519 <span class="comment"> * Static header size: 21 bytes (LLC and 48-bit address addr only)</span>
507: 00520 <span class="comment"> *</span>
508: 00521 <span class="comment"> * Note: Organization field is 3 bytes which throws off the</span>
509: 00522 <span class="comment"> * alignment of type. Therefore fddi_type (19 bytes in) </span>
510: 00523 <span class="comment"> * is specified as two u_int8_ts.</span>
511: 00524 <span class="comment"> */</span>
512: 00525 <span class="keyword">struct </span>libnet_fddi_hdr
513: 00526 {
514: 00527 u_int8_t fddi_frame_control; <span class="comment">/* Class/Format/Priority */</span>
515: 00528 <span class="preprocessor">#define LIBNET_FDDI_LLC_FRAME 0x10</span>
516: 00529 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_FDDI_48BIT_ADDR 0x40</span>
517: 00530 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_FDDI_FC_REQD LIBNET_FDDI_LLC_FRAME | LIBNET_FDDI_48BIT_ADDR </span>
518: 00531 <span class="preprocessor"></span> u_int8_t fddi_dhost[FDDI_ADDR_LEN]; <span class="comment">/* destination fddi address */</span>
519: 00532 u_int8_t fddi_shost[FDDI_ADDR_LEN]; <span class="comment">/* source fddi address */</span>
520: 00533 u_int8_t fddi_llc_dsap; <span class="comment">/* DSAP */</span>
521: 00534 u_int8_t fddi_llc_ssap; <span class="comment">/* SSAP */</span>
522: 00535 u_int8_t fddi_llc_control_field; <span class="comment">/* Class/Format/Priority */</span>
523: 00536 u_int8_t fddi_llc_org_code[LIBNET_ORG_CODE_SIZE]; <span class="comment">/* Organization Code 3-bytes */</span>
524: 00537 u_int8_t fddi_type; <span class="comment">/* Protocol Type */</span>
525: 00538 u_int8_t fddi_type1; <span class="comment">/* see note above. */</span>
526: 00539 <span class="preprocessor">#define FDDI_TYPE_IP 0x0800 </span><span class="comment">/* IP protocol */</span>
527: 00540 <span class="preprocessor">#define FDDI_TYPE_ARP 0x0806 </span><span class="comment">/* addr. resolution protocol */</span>
528: 00541 <span class="preprocessor">#define FDDI_TYPE_REVARP 0x8035 </span><span class="comment">/* reverse addr. resolution protocol */</span>
529: 00542 };
530: 00543
531: 00544
532: 00545 <span class="keyword">struct </span>libnet_fddi_addr
533: 00546 {
534: 00547 u_int8_t fddi_addr_octet[6]; <span class="comment">/* FDDI address */</span>
535: 00548 };
536: 00549
537: 00550
538: 00551 <span class="comment">/*</span>
539: 00552 <span class="comment"> * GRE header - RFC 1701 & 2637</span>
540: 00553 <span class="comment"> * Generic Routing Encapsulation (GRE) </span>
541: 00554 <span class="comment"> * Base header size: 4 bytes</span>
542: 00555 <span class="comment"> */</span>
543: 00556 <span class="keyword">struct </span>libnet_gre_hdr
544: 00557 {
545: 00558 u_int16_t flags_ver;
546: 00559 <span class="preprocessor">#define GRE_CSUM 0x8000</span>
547: 00560 <span class="preprocessor"></span><span class="preprocessor">#define GRE_ROUTING 0x4000</span>
548: 00561 <span class="preprocessor"></span><span class="preprocessor">#define GRE_KEY 0x2000</span>
549: 00562 <span class="preprocessor"></span><span class="preprocessor">#define GRE_SEQ 0x1000</span>
550: 00563 <span class="preprocessor"></span><span class="preprocessor">#define GRE_STRICT 0x0800</span>
551: 00564 <span class="preprocessor"></span><span class="preprocessor">#define GRE_REC 0x0700</span>
552: 00565 <span class="preprocessor"></span><span class="preprocessor">#define GRE_ACK 0x0080</span>
553: 00566 <span class="preprocessor"></span>
554: 00567 <span class="preprocessor">#define GRE_FLAGS_MASK 0x00F8</span>
555: 00568 <span class="preprocessor"></span><span class="preprocessor">#define GRE_VERSION_MASK 0x0007</span>
556: 00569 <span class="preprocessor"></span>
557: 00570 <span class="preprocessor">#define GRE_VERSION_0 0x0000</span>
558: 00571 <span class="preprocessor"></span><span class="preprocessor">#define GRE_VERSION_1 0x0001</span>
559: 00572 <span class="preprocessor"></span>
560: 00573 u_int16_t type;
561: 00574 <span class="preprocessor">#define GRE_SNA 0x0004</span>
562: 00575 <span class="preprocessor"></span><span class="preprocessor">#define GRE_OSI_NETWORK_LAYER 0x00FE</span>
563: 00576 <span class="preprocessor"></span><span class="preprocessor">#define GRE_PUP 0x0200</span>
564: 00577 <span class="preprocessor"></span><span class="preprocessor">#define GRE_XNS 0x0600</span>
565: 00578 <span class="preprocessor"></span><span class="preprocessor">#define GRE_IP 0x0800</span>
566: 00579 <span class="preprocessor"></span><span class="preprocessor">#define GRE_CHAOS 0x0804</span>
567: 00580 <span class="preprocessor"></span><span class="preprocessor">#define GRE_RFC_826_ARP 0x0806</span>
568: 00581 <span class="preprocessor"></span><span class="preprocessor">#define GRE_FRAME_RELAY_ARP 0x0808</span>
569: 00582 <span class="preprocessor"></span><span class="preprocessor">#define GRE_VINES 0x0BAD</span>
570: 00583 <span class="preprocessor"></span><span class="preprocessor">#define GRE_VINES_ECHO 0x0BAE</span>
571: 00584 <span class="preprocessor"></span><span class="preprocessor">#define GRE_VINES_LOOPBACK 0x0BAF</span>
572: 00585 <span class="preprocessor"></span><span class="preprocessor">#define GRE_DECNET 0x6003</span>
573: 00586 <span class="preprocessor"></span><span class="preprocessor">#define GRE_TRANSPARENT_ETHERNET_BRIDGING 0x6558</span>
574: 00587 <span class="preprocessor"></span><span class="preprocessor">#define GRE_RAW_FRAME_RELAY 0x6559</span>
575: 00588 <span class="preprocessor"></span><span class="preprocessor">#define GRE_APOLLO_DOMAIN 0x8019</span>
576: 00589 <span class="preprocessor"></span><span class="preprocessor">#define GRE_ETHERTALK 0x809B</span>
577: 00590 <span class="preprocessor"></span><span class="preprocessor">#define GRE_NOVELL_IPX 0x8137</span>
578: 00591 <span class="preprocessor"></span><span class="preprocessor">#define GRE_RFC_1144_TCP_IP_COMPRESSION 0x876B</span>
579: 00592 <span class="preprocessor"></span><span class="preprocessor">#define GRE_IP_AUTONOMOUS_SYSTEMS 0x876C</span>
580: 00593 <span class="preprocessor"></span><span class="preprocessor">#define GRE_SECURE_DATA 0x876D</span>
581: 00594 <span class="preprocessor"></span><span class="preprocessor">#define GRE_PPP 0x880b </span><span class="comment">/* taken from RFC 2637 */</span>
582: 00595
583: 00596 <span class="keyword">union </span>{
584: 00597 <span class="keyword">struct </span>{
585: 00598 u_int16_t sum; <span class="comment">/* optional */</span>
586: 00599 u_int16_t offset; <span class="comment">/* optional */</span>
587: 00600 u_int32_t key; <span class="comment">/* optional */</span>
588: 00601 u_int32_t seq; <span class="comment">/* optional */</span>
589: 00602 } _gre;
590: 00603
591: 00604 <span class="keyword">struct </span>{
592: 00605 u_int16_t payload_s; <span class="comment">/* optional */</span>
593: 00606 u_int16_t callID; <span class="comment">/* optional */</span>
594: 00607 u_int32_t seq; <span class="comment">/* optional */</span>
595: 00608 u_int32_t ack; <span class="comment">/* optional */</span>
596: 00609 } _egre;
597: 00610 }_data;
598: 00611
599: 00612 <span class="preprocessor">#define gre_sum _data._gre.sum</span>
600: 00613 <span class="preprocessor"></span><span class="preprocessor">#define gre_offset _data._gre.offset</span>
601: 00614 <span class="preprocessor"></span><span class="preprocessor">#define gre_key _data._gre.key</span>
602: 00615 <span class="preprocessor"></span><span class="preprocessor">#define gre_seq _data._gre.seq</span>
603: 00616 <span class="preprocessor"></span>
604: 00617 <span class="preprocessor">#define egre_payload_s _data._egre.payload_s</span>
605: 00618 <span class="preprocessor"></span><span class="preprocessor">#define egre_callID _data._egre.callID</span>
606: 00619 <span class="preprocessor"></span><span class="preprocessor">#define egre_seq _data._egre.seq</span>
607: 00620 <span class="preprocessor"></span><span class="preprocessor">#define egre_ack _data._egre.ack</span>
608: 00621 <span class="preprocessor"></span>};
609: 00622
610: 00623
611: 00624 <span class="preprocessor">#ifndef IPPROTO_GRE</span>
612: 00625 <span class="preprocessor"></span><span class="preprocessor">#define IPPROTO_GRE 47</span>
613: 00626 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
614: 00627 <span class="preprocessor"></span>
615: 00628 <span class="comment">/*</span>
616: 00629 <span class="comment"> * Source Route Entries (SRE)</span>
617: 00630 <span class="comment"> * This is used for GRE as the Routing field is a list of SREs - RFC 1701</span>
618: 00631 <span class="comment"> * Base header size: 4 bytes</span>
619: 00632 <span class="comment"> */</span>
620: 00633 <span class="keyword">struct </span>libnet_gre_sre_hdr
621: 00634 {
622: 00635 u_int16_t af; <span class="comment">/* address familly */</span>
623: 00636 u_int8_t sre_offset;
624: 00637 u_int8_t sre_length;
625: 00638 u_int8_t *routing;
626: 00639 };
627: 00640
628: 00641
629: 00642 <span class="comment">/*</span>
630: 00643 <span class="comment"> * IPv4 header</span>
631: 00644 <span class="comment"> * Internet Protocol, version 4</span>
632: 00645 <span class="comment"> * Static header size: 20 bytes</span>
633: 00646 <span class="comment"> */</span>
634: 00647 <span class="keyword">struct </span>libnet_ipv4_hdr
635: 00648 {
636: 00649 <span class="preprocessor">#if (LIBNET_LIL_ENDIAN)</span>
637: 00650 <span class="preprocessor"></span> u_int8_t ip_hl:4, <span class="comment">/* header length */</span>
638: 00651 ip_v:4; <span class="comment">/* version */</span>
639: 00652 <span class="preprocessor">#endif</span>
640: 00653 <span class="preprocessor"></span><span class="preprocessor">#if (LIBNET_BIG_ENDIAN)</span>
641: 00654 <span class="preprocessor"></span> u_int8_t ip_v:4, <span class="comment">/* version */</span>
642: 00655 ip_hl:4; <span class="comment">/* header length */</span>
643: 00656 <span class="preprocessor">#endif</span>
644: 00657 <span class="preprocessor"></span> u_int8_t ip_tos; <span class="comment">/* type of service */</span>
645: 00658 <span class="preprocessor">#ifndef IPTOS_LOWDELAY</span>
646: 00659 <span class="preprocessor"></span><span class="preprocessor">#define IPTOS_LOWDELAY 0x10</span>
647: 00660 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
648: 00661 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPTOS_THROUGHPUT</span>
649: 00662 <span class="preprocessor"></span><span class="preprocessor">#define IPTOS_THROUGHPUT 0x08</span>
650: 00663 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
651: 00664 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPTOS_RELIABILITY</span>
652: 00665 <span class="preprocessor"></span><span class="preprocessor">#define IPTOS_RELIABILITY 0x04</span>
653: 00666 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
654: 00667 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPTOS_LOWCOST</span>
655: 00668 <span class="preprocessor"></span><span class="preprocessor">#define IPTOS_LOWCOST 0x02</span>
656: 00669 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
657: 00670 <span class="preprocessor"></span> u_int16_t ip_len; <span class="comment">/* total length */</span>
658: 00671 u_int16_t ip_id; <span class="comment">/* identification */</span>
659: 00672 u_int16_t ip_off;
660: 00673 <span class="preprocessor">#ifndef IP_RF</span>
661: 00674 <span class="preprocessor"></span><span class="preprocessor">#define IP_RF 0x8000 </span><span class="comment">/* reserved fragment flag */</span>
662: 00675 <span class="preprocessor">#endif</span>
663: 00676 <span class="preprocessor"></span><span class="preprocessor">#ifndef IP_DF</span>
664: 00677 <span class="preprocessor"></span><span class="preprocessor">#define IP_DF 0x4000 </span><span class="comment">/* dont fragment flag */</span>
665: 00678 <span class="preprocessor">#endif</span>
666: 00679 <span class="preprocessor"></span><span class="preprocessor">#ifndef IP_MF</span>
667: 00680 <span class="preprocessor"></span><span class="preprocessor">#define IP_MF 0x2000 </span><span class="comment">/* more fragments flag */</span>
668: 00681 <span class="preprocessor">#endif </span>
669: 00682 <span class="preprocessor"></span><span class="preprocessor">#ifndef IP_OFFMASK</span>
670: 00683 <span class="preprocessor"></span><span class="preprocessor">#define IP_OFFMASK 0x1fff </span><span class="comment">/* mask for fragmenting bits */</span>
671: 00684 <span class="preprocessor">#endif</span>
672: 00685 <span class="preprocessor"></span> u_int8_t ip_ttl; <span class="comment">/* time to live */</span>
673: 00686 u_int8_t ip_p; <span class="comment">/* protocol */</span>
674: 00687 u_int16_t ip_sum; <span class="comment">/* checksum */</span>
675: 00688 <span class="keyword">struct </span>in_addr ip_src, ip_dst; <span class="comment">/* source and dest address */</span>
676: 00689 };
677: 00690
678: 00691 <span class="comment">/*</span>
679: 00692 <span class="comment"> * IP options</span>
680: 00693 <span class="comment"> */</span>
681: 00694 <span class="preprocessor">#ifndef IPOPT_EOL</span>
682: 00695 <span class="preprocessor"></span><span class="preprocessor">#define IPOPT_EOL 0 </span><span class="comment">/* end of option list */</span>
683: 00696 <span class="preprocessor">#endif</span>
684: 00697 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPOPT_NOP</span>
685: 00698 <span class="preprocessor"></span><span class="preprocessor">#define IPOPT_NOP 1 </span><span class="comment">/* no operation */</span>
686: 00699 <span class="preprocessor">#endif </span>
687: 00700 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPOPT_RR</span>
688: 00701 <span class="preprocessor"></span><span class="preprocessor">#define IPOPT_RR 7 </span><span class="comment">/* record packet route */</span>
689: 00702 <span class="preprocessor">#endif</span>
690: 00703 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPOPT_TS</span>
691: 00704 <span class="preprocessor"></span><span class="preprocessor">#define IPOPT_TS 68 </span><span class="comment">/* timestamp */</span>
692: 00705 <span class="preprocessor">#endif</span>
693: 00706 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPOPT_SECURITY</span>
694: 00707 <span class="preprocessor"></span><span class="preprocessor">#define IPOPT_SECURITY 130 </span><span class="comment">/* provide s,c,h,tcc */</span>
695: 00708 <span class="preprocessor">#endif</span>
696: 00709 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPOPT_LSRR</span>
697: 00710 <span class="preprocessor"></span><span class="preprocessor">#define IPOPT_LSRR 131 </span><span class="comment">/* loose source route */</span>
698: 00711 <span class="preprocessor">#endif</span>
699: 00712 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPOPT_SATID</span>
700: 00713 <span class="preprocessor"></span><span class="preprocessor">#define IPOPT_SATID 136 </span><span class="comment">/* satnet id */</span>
701: 00714 <span class="preprocessor">#endif</span>
702: 00715 <span class="preprocessor"></span><span class="preprocessor">#ifndef IPOPT_SSRR</span>
703: 00716 <span class="preprocessor"></span><span class="preprocessor">#define IPOPT_SSRR 137 </span><span class="comment">/* strict source route */</span>
704: 00717 <span class="preprocessor">#endif</span>
705: 00718 <span class="preprocessor"></span>
706: 00719 <span class="keyword">struct </span>libnet_in6_addr
707: 00720 {
708: 00721 <span class="keyword">union</span>
709: 00722 <span class="keyword"> </span>{
710: 00723 u_int8_t __u6_addr8[16];
711: 00724 u_int16_t __u6_addr16[8];
712: 00725 u_int32_t __u6_addr32[4];
713: 00726 } __u6_addr; <span class="comment">/* 128-bit IP6 address */</span>
714: 00727 };
715: 00728 <span class="preprocessor">#define libnet_s6_addr __u6_addr.__u6_addr8</span>
716: 00729 <span class="preprocessor"></span>
717: 00730 <span class="comment">/*</span>
718: 00731 <span class="comment"> * IPv6 header</span>
719: 00732 <span class="comment"> * Internet Protocol, version 6</span>
720: 00733 <span class="comment"> * Static header size: 40 bytes</span>
721: 00734 <span class="comment"> */</span>
722: 00735 <span class="keyword">struct </span>libnet_ipv6_hdr
723: 00736 {
724: 00737 u_int8_t ip_flags[4]; <span class="comment">/* version, traffic class, flow label */</span>
725: 00738 u_int16_t ip_len; <span class="comment">/* total length */</span>
726: 00739 u_int8_t ip_nh; <span class="comment">/* next header */</span>
727: 00740 u_int8_t ip_hl; <span class="comment">/* hop limit */</span>
728: 00741 <span class="keyword">struct </span>libnet_in6_addr ip_src, ip_dst; <span class="comment">/* source and dest address */</span>
729: 00742
730: 00743 };
731: 00744
732: 00745 <span class="comment">/*</span>
733: 00746 <span class="comment"> * IPv6 frag header</span>
734: 00747 <span class="comment"> * Internet Protocol, version 6</span>
735: 00748 <span class="comment"> * Static header size: 8 bytes</span>
736: 00749 <span class="comment"> */</span>
737: 00750 <span class="preprocessor">#define LIBNET_IPV6_NH_FRAGMENT 44</span>
738: 00751 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_ipv6_frag_hdr
739: 00752 {
740: 00753 u_int8_t ip_nh; <span class="comment">/* next header */</span>
741: 00754 u_int8_t ip_reserved; <span class="comment">/* reserved */</span>
742: 00755 u_int16_t ip_frag; <span class="comment">/* fragmentation stuff */</span>
743: 00756 u_int32_t ip_id; <span class="comment">/* id */</span>
744: 00757 };
745: 00758
746: 00759 <span class="comment">/*</span>
747: 00760 <span class="comment"> * IPv6 routing header</span>
748: 00761 <span class="comment"> * Internet Protocol, version 6</span>
749: 00762 <span class="comment"> * Base header size: 4 bytes</span>
750: 00763 <span class="comment"> */</span>
751: 00764 <span class="preprocessor">#define LIBNET_IPV6_NH_ROUTING 43</span>
752: 00765 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_ipv6_routing_hdr
753: 00766 {
754: 00767 u_int8_t ip_nh; <span class="comment">/* next header */</span>
755: 00768 u_int8_t ip_len; <span class="comment">/* length of header in 8 octet units (sans 1st) */</span>
756: 00769 u_int8_t ip_rtype; <span class="comment">/* routing type */</span>
757: 00770 u_int8_t ip_segments; <span class="comment">/* segments left */</span>
758: 00771 <span class="comment">/* routing information allocated dynamically */</span>
759: 00772 };
760: 00773
761: 00774 <span class="comment">/*</span>
762: 00775 <span class="comment"> * IPv6 destination options header</span>
763: 00776 <span class="comment"> * Internet Protocol, version 6</span>
764: 00777 <span class="comment"> * Base header size: 2 bytes</span>
765: 00778 <span class="comment"> */</span>
766: 00779 <span class="preprocessor">#define LIBNET_IPV6_NH_DESTOPTS 60</span>
767: 00780 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_ipv6_destopts_hdr
768: 00781 {
769: 00782 u_int8_t ip_nh; <span class="comment">/* next header */</span>
770: 00783 u_int8_t ip_len; <span class="comment">/* length of header in 8 octet units (sans 1st) */</span>
771: 00784 <span class="comment">/* destination options information allocated dynamically */</span>
772: 00785 };
773: 00786
774: 00787 <span class="comment">/*</span>
775: 00788 <span class="comment"> * IPv6 hop by hop options header</span>
776: 00789 <span class="comment"> * Internet Protocol, version 6</span>
777: 00790 <span class="comment"> * Base header size: 2 bytes</span>
778: 00791 <span class="comment"> */</span>
779: 00792 <span class="preprocessor">#define LIBNET_IPV6_NH_HBH 0</span>
780: 00793 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_ipv6_hbhopts_hdr
781: 00794 {
782: 00795 u_int8_t ip_nh; <span class="comment">/* next header */</span>
783: 00796 u_int8_t ip_len; <span class="comment">/* length of header in 8 octet units (sans 1st) */</span>
784: 00797 <span class="comment">/* destination options information allocated dynamically */</span>
785: 00798 };
786: 00799
787: 00800 <span class="comment">/*</span>
788: 00801 <span class="comment"> * ICMP6 header</span>
789: 00802 <span class="comment"> * Internet Control Message Protocol v6</span>
790: 00803 <span class="comment"> * Base header size: 8 bytes</span>
791: 00804 <span class="comment"> */</span>
792: 00805 <span class="preprocessor">#ifndef IPPROTO_ICMP6</span>
793: 00806 <span class="preprocessor"></span><span class="preprocessor">#define IPPROTO_ICMP6 0x3a</span>
794: 00807 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
795: 00808 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_icmpv6_hdr
796: 00809 {
797: 00810 u_int8_t icmp_type; <span class="comment">/* ICMP type */</span>
798: 00811 <span class="preprocessor">#ifndef ICMP6_ECHO</span>
799: 00812 <span class="preprocessor"></span><span class="preprocessor">#define ICMP6_ECHO 128</span>
800: 00813 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
801: 00814 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP6_ECHOREPLY</span>
802: 00815 <span class="preprocessor"></span><span class="preprocessor">#define ICMP6_ECHOREPLY 129</span>
803: 00816 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
804: 00817 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP6_UNREACH</span>
805: 00818 <span class="preprocessor"></span><span class="preprocessor">#define ICMP6_UNREACH 1</span>
806: 00819 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
807: 00820 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP6_PKTTOOBIG</span>
808: 00821 <span class="preprocessor"></span><span class="preprocessor">#define ICMP6_PKTTOOBIG 2</span>
809: 00822 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
810: 00823 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP6_TIMXCEED</span>
811: 00824 <span class="preprocessor"></span><span class="preprocessor">#define ICMP6_TIMXCEED 3</span>
812: 00825 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
813: 00826 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP6_PARAMPROB</span>
814: 00827 <span class="preprocessor"></span><span class="preprocessor">#define ICMP6_PARAMPROB 4</span>
815: 00828 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
816: 00829 <span class="preprocessor"></span> u_int8_t icmp_code; <span class="comment">/* ICMP code */</span>
817: 00830 u_int16_t icmp_sum; <span class="comment">/* ICMP Checksum */</span>
818: 00831 u_int16_t id; <span class="comment">/* ICMP id */</span>
819: 00832 u_int16_t seq; <span class="comment">/* ICMP sequence number */</span>
820: 00833 };
821: 00834
822: 00835
823: 00836
824: 00837 <span class="comment">/*</span>
825: 00838 <span class="comment"> * ICMP header</span>
826: 00839 <span class="comment"> * Internet Control Message Protocol</span>
827: 00840 <span class="comment"> * Base header size: 4 bytes</span>
828: 00841 <span class="comment"> */</span>
829: 00842 <span class="keyword">struct </span>libnet_icmpv4_hdr
830: 00843 {
831: 00844 u_int8_t icmp_type; <span class="comment">/* ICMP type */</span>
832: 00845 <span class="preprocessor">#ifndef ICMP_ECHOREPLY</span>
833: 00846 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_ECHOREPLY 0</span>
834: 00847 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
835: 00848 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH</span>
836: 00849 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH 3</span>
837: 00850 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
838: 00851 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_SOURCEQUENCH</span>
839: 00852 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_SOURCEQUENCH 4</span>
840: 00853 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
841: 00854 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_REDIRECT</span>
842: 00855 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_REDIRECT 5</span>
843: 00856 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
844: 00857 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_ECHO</span>
845: 00858 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_ECHO 8</span>
846: 00859 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
847: 00860 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_ROUTERADVERT</span>
848: 00861 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_ROUTERADVERT 9</span>
849: 00862 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
850: 00863 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_ROUTERSOLICIT</span>
851: 00864 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_ROUTERSOLICIT 10</span>
852: 00865 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
853: 00866 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_TIMXCEED</span>
854: 00867 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_TIMXCEED 11</span>
855: 00868 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
856: 00869 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_PARAMPROB</span>
857: 00870 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_PARAMPROB 12</span>
858: 00871 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
859: 00872 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_TSTAMP</span>
860: 00873 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_TSTAMP 13</span>
861: 00874 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
862: 00875 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_TSTAMPREPLY</span>
863: 00876 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_TSTAMPREPLY 14</span>
864: 00877 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
865: 00878 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_IREQ</span>
866: 00879 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_IREQ 15</span>
867: 00880 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
868: 00881 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_IREQREPLY</span>
869: 00882 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_IREQREPLY 16</span>
870: 00883 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
871: 00884 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_MASKREQ</span>
872: 00885 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_MASKREQ 17</span>
873: 00886 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
874: 00887 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_MASKREPLY</span>
875: 00888 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_MASKREPLY 18</span>
876: 00889 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
877: 00890 <span class="preprocessor"></span> u_int8_t icmp_code; <span class="comment">/* ICMP code */</span>
878: 00891 <span class="preprocessor">#ifndef ICMP_UNREACH_NET</span>
879: 00892 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_NET 0</span>
880: 00893 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
881: 00894 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_HOST</span>
882: 00895 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_HOST 1</span>
883: 00896 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
884: 00897 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_PROTOCOL</span>
885: 00898 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_PROTOCOL 2</span>
886: 00899 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
887: 00900 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_PORT</span>
888: 00901 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_PORT 3</span>
889: 00902 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
890: 00903 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_NEEDFRAG</span>
891: 00904 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_NEEDFRAG 4</span>
892: 00905 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
893: 00906 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_SRCFAIL</span>
894: 00907 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_SRCFAIL 5</span>
895: 00908 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
896: 00909 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_NET_UNKNOWN</span>
897: 00910 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_NET_UNKNOWN 6</span>
898: 00911 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
899: 00912 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_HOST_UNKNOWN</span>
900: 00913 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_HOST_UNKNOWN 7</span>
901: 00914 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
902: 00915 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_ISOLATED</span>
903: 00916 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_ISOLATED 8</span>
904: 00917 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
905: 00918 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_NET_PROHIB</span>
906: 00919 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_NET_PROHIB 9</span>
907: 00920 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
908: 00921 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_HOST_PROHIB</span>
909: 00922 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_HOST_PROHIB 10</span>
910: 00923 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
911: 00924 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_TOSNET</span>
912: 00925 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_TOSNET 11</span>
913: 00926 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
914: 00927 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_TOSHOST</span>
915: 00928 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_TOSHOST 12</span>
916: 00929 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
917: 00930 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_FILTER_PROHIB</span>
918: 00931 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_FILTER_PROHIB 13</span>
919: 00932 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
920: 00933 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_HOST_PRECEDENCE</span>
921: 00934 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_HOST_PRECEDENCE 14</span>
922: 00935 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
923: 00936 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_UNREACH_PRECEDENCE_CUTOFF</span>
924: 00937 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15</span>
925: 00938 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
926: 00939 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_REDIRECT_NET</span>
927: 00940 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_REDIRECT_NET 0</span>
928: 00941 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
929: 00942 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_REDIRECT_HOST</span>
930: 00943 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_REDIRECT_HOST 1</span>
931: 00944 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
932: 00945 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_REDIRECT_TOSNET</span>
933: 00946 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_REDIRECT_TOSNET 2</span>
934: 00947 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
935: 00948 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_REDIRECT_TOSHOST</span>
936: 00949 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_REDIRECT_TOSHOST 3</span>
937: 00950 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
938: 00951 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_TIMXCEED_INTRANS</span>
939: 00952 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_TIMXCEED_INTRANS 0</span>
940: 00953 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
941: 00954 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_TIMXCEED_REASS</span>
942: 00955 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_TIMXCEED_REASS 1</span>
943: 00956 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
944: 00957 <span class="preprocessor"></span><span class="preprocessor">#ifndef ICMP_PARAMPROB_OPTABSENT</span>
945: 00958 <span class="preprocessor"></span><span class="preprocessor">#define ICMP_PARAMPROB_OPTABSENT 1</span>
946: 00959 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
947: 00960 <span class="preprocessor"></span>
948: 00961 u_int16_t icmp_sum; <span class="comment">/* ICMP Checksum */</span>
949: 00962
950: 00963 <span class="keyword">union</span>
951: 00964 <span class="keyword"> </span>{
952: 00965 <span class="keyword">struct</span>
953: 00966 <span class="keyword"> </span>{
954: 00967 u_int16_t id; <span class="comment">/* ICMP id */</span>
955: 00968 u_int16_t seq;<span class="comment">/* ICMP sequence number */</span>
956: 00969 } echo;
957: 00970
958: 00971 <span class="preprocessor">#undef icmp_id</span>
959: 00972 <span class="preprocessor"></span><span class="preprocessor">#undef icmp_seq</span>
960: 00973 <span class="preprocessor"></span><span class="preprocessor">#define icmp_id hun.echo.id</span>
961: 00974 <span class="preprocessor"></span><span class="preprocessor">#define icmp_seq hun.echo.seq</span>
962: 00975 <span class="preprocessor"></span>
963: 00976 u_int32_t gateway; <span class="comment">/* gateway host */</span>
964: 00977 <span class="keyword">struct</span>
965: 00978 <span class="keyword"> </span>{
966: 00979 u_int16_t pad;<span class="comment">/* padding */</span>
967: 00980 u_int16_t mtu;<span class="comment">/* MTU size */</span>
968: 00981 } frag;
969: 00982 } hun;
970: 00983 <span class="keyword">union</span>
971: 00984 <span class="keyword"> </span>{
972: 00985 <span class="keyword">struct</span>
973: 00986 <span class="keyword"> </span>{
974: 00987 n_time its_otime;
975: 00988 n_time its_rtime;
976: 00989 n_time its_ttime;
977: 00990 } ts;
978: 00991 <span class="keyword">struct</span>
979: 00992 <span class="keyword"> </span>{
980: 00993 <span class="keyword">struct </span>libnet_ipv4_hdr idi_ip;
981: 00994 <span class="comment">/* options and then 64 bits of data */</span>
982: 00995 } ip;
983: 00996 u_int32_t mask;
984: 00997 int8_t data[1];
985: 00998
986: 00999 <span class="preprocessor">#undef icmp_mask</span>
987: 01000 <span class="preprocessor"></span><span class="preprocessor">#define icmp_mask dun.mask</span>
988: 01001 <span class="preprocessor"></span><span class="preprocessor">#undef icmp_data</span>
989: 01002 <span class="preprocessor"></span><span class="preprocessor">#define icmp_data dun.data</span>
990: 01003 <span class="preprocessor"></span>
991: 01004 <span class="preprocessor">#undef icmp_otime</span>
992: 01005 <span class="preprocessor"></span><span class="preprocessor">#define icmp_otime dun.ts.its_otime</span>
993: 01006 <span class="preprocessor"></span><span class="preprocessor">#undef icmp_rtime</span>
994: 01007 <span class="preprocessor"></span><span class="preprocessor">#define icmp_rtime dun.ts.its_rtime</span>
995: 01008 <span class="preprocessor"></span><span class="preprocessor">#undef icmp_ttime</span>
996: 01009 <span class="preprocessor"></span><span class="preprocessor">#define icmp_ttime dun.ts.its_ttime</span>
997: 01010 <span class="preprocessor"></span> }dun;
998: 01011 };
999: 01012
1000: 01013
1001: 01014 <span class="comment">/*</span>
1002: 01015 <span class="comment"> * IGMP header</span>
1003: 01016 <span class="comment"> * Internet Group Message Protocol</span>
1004: 01017 <span class="comment"> * Static header size: 8 bytes</span>
1005: 01018 <span class="comment"> */</span>
1006: 01019 <span class="keyword">struct </span>libnet_igmp_hdr
1007: 01020 {
1008: 01021 u_int8_t igmp_type; <span class="comment">/* IGMP type */</span>
1009: 01022 <span class="preprocessor">#ifndef IGMP_MEMBERSHIP_QUERY</span>
1010: 01023 <span class="preprocessor"></span><span class="preprocessor">#define IGMP_MEMBERSHIP_QUERY 0x11 </span><span class="comment">/* membership query */</span>
1011: 01024 <span class="preprocessor">#endif</span>
1012: 01025 <span class="preprocessor"></span><span class="preprocessor">#ifndef IGMP_V1_MEMBERSHIP_REPORT</span>
1013: 01026 <span class="preprocessor"></span><span class="preprocessor">#define IGMP_V1_MEMBERSHIP_REPORT 0x12 </span><span class="comment">/* Ver. 1 membership report */</span>
1014: 01027 <span class="preprocessor">#endif</span>
1015: 01028 <span class="preprocessor"></span><span class="preprocessor">#ifndef IGMP_V2_MEMBERSHIP_REPORT</span>
1016: 01029 <span class="preprocessor"></span><span class="preprocessor">#define IGMP_V2_MEMBERSHIP_REPORT 0x16 </span><span class="comment">/* Ver. 2 membership report */</span>
1017: 01030 <span class="preprocessor">#endif</span>
1018: 01031 <span class="preprocessor"></span><span class="preprocessor">#ifndef IGMP_LEAVE_GROUP</span>
1019: 01032 <span class="preprocessor"></span><span class="preprocessor">#define IGMP_LEAVE_GROUP 0x17 </span><span class="comment">/* Leave-group message */</span>
1020: 01033 <span class="preprocessor">#endif</span>
1021: 01034 <span class="preprocessor"></span> u_int8_t igmp_code; <span class="comment">/* IGMP code */</span>
1022: 01035 u_int16_t igmp_sum; <span class="comment">/* IGMP checksum */</span>
1023: 01036 <span class="keyword">struct </span>in_addr igmp_group;<span class="comment">/* IGMP host IP */</span>
1024: 01037 };
1025: 01038
1026: 01039
1027: 01040 <span class="comment">/*</span>
1028: 01041 <span class="comment"> * IPSEC header</span>
1029: 01042 <span class="comment"> * Internet Protocol Security Protocol</span>
1030: 01043 <span class="comment"> * Encapsulating Security Payload Header Static header size: 12 bytes</span>
1031: 01044 <span class="comment"> * Encapsulating Security Payload Footer Base header size: 2 bytes</span>
1032: 01045 <span class="comment"> * Authentication Header Static Size: 16 bytes</span>
1033: 01046 <span class="comment"> */</span>
1034: 01047 <span class="preprocessor">#ifndef IPPROTO_ESP</span>
1035: 01048 <span class="preprocessor"></span><span class="preprocessor">#define IPPROTO_ESP 50 </span><span class="comment">/* not everyone's got this */</span>
1036: 01049 <span class="preprocessor">#endif</span>
1037: 01050 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_esp_hdr
1038: 01051 {
1039: 01052 u_int32_t esp_spi; <span class="comment">/* security parameter index */</span>
1040: 01053 u_int32_t esp_seq; <span class="comment">/* ESP sequence number */</span>
1041: 01054 u_int32_t esp_iv; <span class="comment">/* initialization vector */</span>
1042: 01055 };
1043: 01056
1044: 01057 <span class="keyword">struct </span>libnet_esp_ftr
1045: 01058 {
1046: 01059 u_int8_t esp_pad_len; <span class="comment">/* padding length */</span>
1047: 01060 u_int8_t esp_nh; <span class="comment">/* next header pointer */</span>
1048: 01061 int8_t *esp_auth; <span class="comment">/* authentication data */</span>
1049: 01062 };
1050: 01063
1051: 01064 <span class="preprocessor">#ifndef IPPROTO_AH</span>
1052: 01065 <span class="preprocessor"></span><span class="preprocessor">#define IPPROTO_AH 51 </span><span class="comment">/* not everyone's got this */</span>
1053: 01066 <span class="preprocessor">#endif</span>
1054: 01067 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_ah_hdr
1055: 01068 {
1056: 01069 u_int8_t ah_nh; <span class="comment">/* next header */</span>
1057: 01070 u_int8_t ah_len; <span class="comment">/* payload length */</span>
1058: 01071 u_int16_t ah_res; <span class="comment">/* reserved */</span>
1059: 01072 u_int32_t ah_spi; <span class="comment">/* security parameter index */</span>
1060: 01073 u_int32_t ah_seq; <span class="comment">/* AH sequence number */</span>
1061: 01074 u_int32_t ah_auth; <span class="comment">/* authentication data */</span>
1062: 01075 };
1063: 01076
1064: 01077
1065: 01078 <span class="comment">/*</span>
1066: 01079 <span class="comment"> * ISL header</span>
1067: 01080 <span class="comment"> * Cisco Inter-Switch Link</span>
1068: 01081 <span class="comment"> * Static header size: 26 bytes</span>
1069: 01082 <span class="comment"> */</span>
1070: 01083 <span class="comment">/*</span>
1071: 01084 <span class="comment"> * For checksum stuff -- IANA says 135-254 is "unassigned" as of 12.2001.</span>
1072: 01085 <span class="comment"> * Let's hope this one stays that way for a while!</span>
1073: 01086 <span class="comment"> */</span>
1074: 01087 <span class="preprocessor">#define LIBNET_PROTO_ISL 201</span>
1075: 01088 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_isl_hdr
1076: 01089 {
1077: 01090 u_int8_t isl_dhost[5]; <span class="comment">/* destination address "01:00:0c:00:00" */</span>
1078: 01091 <span class="preprocessor">#if (LIBNET_LIL_ENDIAN)</span>
1079: 01092 <span class="preprocessor"></span> u_int8_t isl_type:4, <span class="comment">/* type of frame */</span>
1080: 01093 isl_user:4; <span class="comment">/* user defined bits */</span>
1081: 01094 <span class="preprocessor">#endif</span>
1082: 01095 <span class="preprocessor"></span><span class="preprocessor">#if (LIBNET_BIG_ENDIAN)</span>
1083: 01096 <span class="preprocessor"></span> u_int8_t isl_user:4, <span class="comment">/* user defined bits */</span>
1084: 01097 isl_type:4; <span class="comment">/* type of frame */</span>
1085: 01098 <span class="preprocessor">#endif</span>
1086: 01099 <span class="preprocessor"></span> u_int8_t isl_shost[6]; <span class="comment">/* source address */</span>
1087: 01100 u_int16_t isl_len; <span class="comment">/* total length of packet - 18 bytes */</span>
1088: 01101 u_int8_t isl_snap[6]; <span class="comment">/* 0xaaaa03 + vendor code */</span>
1089: 01102 u_int16_t isl_vid; <span class="comment">/* 15 bit VLAN ID, 1 bit BPDU / CDP indicator */</span>
1090: 01103 u_int16_t isl_index; <span class="comment">/* port index */</span>
1091: 01104 u_int16_t isl_reserved; <span class="comment">/* used for FDDI and token ring */</span>
1092: 01105 <span class="comment">/* ethernet frame and 4 byte isl crc */</span>
1093: 01106 };
1094: 01107
1095: 01108 <span class="preprocessor">#ifndef IPPROTO_OSPF</span>
1096: 01109 <span class="preprocessor"></span><span class="preprocessor">#define IPPROTO_OSPF 89 </span><span class="comment">/* not everyone's got this */</span>
1097: 01110 <span class="preprocessor">#endif</span>
1098: 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>
1099: 01112 <span class="preprocessor">#define LIBNET_MODX 4102 </span><span class="comment">/* used in LSA checksum */</span>
1100: 01113
1101: 01114 <span class="comment">/*</span>
1102: 01115 <span class="comment"> * Options used in multiple OSPF packets</span>
1103: 01116 <span class="comment"> * More info can be found in section A.2 of RFC 2328.</span>
1104: 01117 <span class="comment"> */</span>
1105: 01118 <span class="preprocessor">#define LIBNET_OPT_EBIT 0x02 </span><span class="comment">/* describes the way AS-external-LSAs are flooded */</span>
1106: 01119 <span class="preprocessor">#define LIBNET_OPT_MCBIT 0x04 </span><span class="comment">/* whether or not IP multicast dgrams are fwdd */</span>
1107: 01120 <span class="preprocessor">#define LIBNET_OPT_NPBIT 0x08 </span><span class="comment">/* describes handling of type-7 LSAs */</span>
1108: 01121 <span class="preprocessor">#define LIBNET_OPT_EABIT 0x10 </span><span class="comment">/* rtr's willingness to send/recv EA-LSAs */</span>
1109: 01122 <span class="preprocessor">#define LIBNET_OPT_DCBIT 0x20 </span><span class="comment">/* describes handling of demand circuits */</span>
1110: 01123
1111: 01124
1112: 01125 <span class="comment">/*</span>
1113: 01126 <span class="comment"> * MPLS header</span>
1114: 01127 <span class="comment"> * Multi-Protocol Label Switching</span>
1115: 01128 <span class="comment"> * Static header size: 4 bytes</span>
1116: 01129 <span class="comment"> */</span>
1117: 01130 <span class="keyword">struct </span>libnet_mpls_hdr
1118: 01131 {
1119: 01132 u_int32_t mpls_les; <span class="comment">/* 20 bits label, 3 bits exp, 1 bit bos, ttl */</span>
1120: 01133 <span class="preprocessor">#define LIBNET_MPLS_BOS_ON 1</span>
1121: 01134 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_MPLS_BOS_OFF 0</span>
1122: 01135 <span class="preprocessor"></span>};
1123: 01136
1124: 01137 <span class="comment">/*</span>
1125: 01138 <span class="comment"> * NTP header</span>
1126: 01139 <span class="comment"> * Network Time Protocol</span>
1127: 01140 <span class="comment"> * Static header size: 48 bytes</span>
1128: 01141 <span class="comment"> */</span>
1129: 01142 <span class="keyword">struct </span>libnet_ntp_hdr_l_fp <span class="comment">/* int32_t floating point (64-bit) */</span>
1130: 01143 {
1131: 01144 u_int32_t integer; <span class="comment">/* integer */</span>
1132: 01145 u_int32_t fraction; <span class="comment">/* fraction */</span>
1133: 01146 };
1134: 01147
1135: 01148 <span class="keyword">struct </span>libnet_ntp_hdr_s_fp <span class="comment">/* int16_t floating point (32-bit) */</span>
1136: 01149 {
1137: 01150 u_int16_t integer; <span class="comment">/* integer */</span>
1138: 01151 u_int16_t fraction; <span class="comment">/* fraction */</span>
1139: 01152 };
1140: 01153
1141: 01154
1142: 01155 <span class="keyword">struct </span>libnet_ntp_hdr
1143: 01156 {
1144: 01157 u_int8_t ntp_li_vn_mode; <span class="comment">/* leap indicator, version, mode */</span>
1145: 01158 <span class="preprocessor">#define LIBNET_NTP_LI_NW 0x0 </span><span class="comment">/* no warning */</span>
1146: 01159 <span class="preprocessor">#define LIBNET_NTP_LI_AS 0x1 </span><span class="comment">/* last minute has 61 seconds */</span>
1147: 01160 <span class="preprocessor">#define LIBNET_NTP_LI_DS 0x2 </span><span class="comment">/* last minute has 59 seconds */</span>
1148: 01161 <span class="preprocessor">#define LIBNET_NTP_LI_AC 0x3 </span><span class="comment">/* alarm condition */</span>
1149: 01162
1150: 01163 <span class="preprocessor">#define LIBNET_NTP_VN_2 0x2 </span><span class="comment">/* version 2 */</span>
1151: 01164 <span class="preprocessor">#define LIBNET_NTP_VN_3 0x3 </span><span class="comment">/* version 3 */</span>
1152: 01165 <span class="preprocessor">#define LIBNET_NTP_VN_4 0x4 </span><span class="comment">/* version 4 */</span>
1153: 01166
1154: 01167 <span class="preprocessor">#define LIBNET_NTP_MODE_R 0x0 </span><span class="comment">/* reserved */</span>
1155: 01168 <span class="preprocessor">#define LIBNET_NTP_MODE_A 0x1 </span><span class="comment">/* symmetric active */</span>
1156: 01169 <span class="preprocessor">#define LIBNET_NTP_MODE_P 0x2 </span><span class="comment">/* symmetric passive */</span>
1157: 01170 <span class="preprocessor">#define LIBNET_NTP_MODE_C 0x3 </span><span class="comment">/* client */</span>
1158: 01171 <span class="preprocessor">#define LIBNET_NTP_MODE_S 0x4 </span><span class="comment">/* server */</span>
1159: 01172 <span class="preprocessor">#define LIBNET_NTP_MODE_B 0x5 </span><span class="comment">/* broadcast */</span>
1160: 01173 <span class="preprocessor">#define LIBNET_NTP_MODE_RC 0x6 </span><span class="comment">/* reserved for NTP control message */</span>
1161: 01174 <span class="preprocessor">#define LIBNET_NTP_MODE_RP 0x7 </span><span class="comment">/* reserved for private use */</span>
1162: 01175 u_int8_t ntp_stratum; <span class="comment">/* stratum */</span>
1163: 01176 <span class="preprocessor">#define LIBNET_NTP_STRATUM_UNAVAIL 0x0 </span><span class="comment">/* unspecified or unavailable */</span>
1164: 01177 <span class="preprocessor">#define LIBNET_NTP_STRATUM_PRIMARY 0x1 </span><span class="comment">/* primary reference (radio clock) */</span>
1165: 01178 <span class="comment">/* 2 - 15 is secondary */</span>
1166: 01179 <span class="comment">/* 16 - 255 is reserved */</span>
1167: 01180 u_int8_t ntp_poll; <span class="comment">/* poll interval (should be 4 - 12) */</span>
1168: 01181 u_int8_t ntp_precision; <span class="comment">/* local clock precision */</span>
1169: 01182 <span class="keyword">struct </span>libnet_ntp_hdr_s_fp ntp_delay; <span class="comment">/* roundtrip delay */</span>
1170: 01183 <span class="keyword">struct </span>libnet_ntp_hdr_s_fp ntp_dispersion; <span class="comment">/* nominal error */</span>
1171: 01184 u_int32_t ntp_reference_id; <span class="comment">/* reference source id */</span>
1172: 01185 <span class="preprocessor">#define LIBNET_NTP_REF_LOCAL 0x4c4f434c </span><span class="comment">/* uncalibrated local clock */</span>
1173: 01186 <span class="preprocessor">#define LIBNET_NTP_REF_PPS 0x50505300 </span><span class="comment">/* atomic / pulse-per-second clock */</span>
1174: 01187 <span class="preprocessor">#define LIBNET_NTP_REF_ACTS 0x41435453 </span><span class="comment">/* NIST dialup modem */</span>
1175: 01188 <span class="preprocessor">#define LIBNET_NTP_REF_USNO 0x55534e4f </span><span class="comment">/* USNO modem service */</span>
1176: 01189 <span class="preprocessor">#define LIBNET_NTP_REF_PTB 0x50544200 </span><span class="comment">/* PTB (German) modem service */</span>
1177: 01190 <span class="preprocessor">#define LIBNET_NTP_REF_TDF 0x54444600 </span><span class="comment">/* Allouis (French) radio */</span>
1178: 01191 <span class="preprocessor">#define LIBNET_NTP_REF_DCF 0x44434600 </span><span class="comment">/* Mainflingen (German) radio */</span>
1179: 01192 <span class="preprocessor">#define LIBNET_NTP_REF_MSF 0x4d534600 </span><span class="comment">/* Rugby (UK) radio */</span>
1180: 01193 <span class="preprocessor">#define LIBNET_NTP_REF_WWV 0x57575600 </span><span class="comment">/* Ft Collins (US) radio */</span>
1181: 01194 <span class="preprocessor">#define LIBNET_NTP_REF_WWVB 0x57575642 </span><span class="comment">/* Boulder (US) radio */</span>
1182: 01195 <span class="preprocessor">#define LIBNET_NTP_REF_WWVH 0x57575648 </span><span class="comment">/* Kaui Hawaii (US) radio */</span>
1183: 01196 <span class="preprocessor">#define LIBNET_NTP_REF_CHU 0x43485500 </span><span class="comment">/* Ottaha (Canada) radio */</span>
1184: 01197 <span class="preprocessor">#define LIBNET_NTP_REF_LORC 0x4c4f5243 </span><span class="comment">/* LORAN-C radionavigation */</span>
1185: 01198 <span class="preprocessor">#define LIBNET_NTP_REF_OMEG 0x4f4d4547 </span><span class="comment">/* OMEGA radionavigation */</span>
1186: 01199 <span class="preprocessor">#define LIBNET_NTP_REF_GPS 0x47505300 </span><span class="comment">/* global positioning system */</span>
1187: 01200 <span class="preprocessor">#define LIBNET_NTP_REF_GOES 0x474f4553 </span><span class="comment">/* geostationary orbit env satellite */</span>
1188: 01201 <span class="keyword">struct </span>libnet_ntp_hdr_l_fp ntp_ref_ts; <span class="comment">/* reference timestamp */</span>
1189: 01202 <span class="keyword">struct </span>libnet_ntp_hdr_l_fp ntp_orig_ts; <span class="comment">/* originate timestamp */</span>
1190: 01203 <span class="keyword">struct </span>libnet_ntp_hdr_l_fp ntp_rec_ts; <span class="comment">/* receive timestamp */</span>
1191: 01204 <span class="keyword">struct </span>libnet_ntp_hdr_l_fp ntp_xmt_ts; <span class="comment">/* transmit timestamp */</span>
1192: 01205 };
1193: 01206
1194: 01207
1195: 01208 <span class="comment">/*</span>
1196: 01209 <span class="comment"> * OSPFv2 header</span>
1197: 01210 <span class="comment"> * Open Shortest Path First</span>
1198: 01211 <span class="comment"> * Static header size: 16 bytes</span>
1199: 01212 <span class="comment"> */</span>
1200: 01213 <span class="keyword">struct </span>libnet_ospf_hdr
1201: 01214 {
1202: 01215 u_int8_t ospf_v; <span class="comment">/* version */</span>
1203: 01216 <span class="preprocessor">#define OSPFVERSION 2</span>
1204: 01217 <span class="preprocessor"></span> u_int8_t ospf_type; <span class="comment">/* type */</span>
1205: 01218 <span class="preprocessor">#define LIBNET_OSPF_UMD 0 </span><span class="comment">/* UMd monitoring packet */</span>
1206: 01219 <span class="preprocessor">#define LIBNET_OSPF_HELLO 1 </span><span class="comment">/* HELLO packet */</span>
1207: 01220 <span class="preprocessor">#define LIBNET_OSPF_DBD 2 </span><span class="comment">/* dataBase description packet */</span>
1208: 01221 <span class="preprocessor">#define LIBNET_OSPF_LSR 3 </span><span class="comment">/* link state request packet */</span>
1209: 01222 <span class="preprocessor">#define LIBNET_OSPF_LSU 4 </span><span class="comment">/* link state Update Packet */</span>
1210: 01223 <span class="preprocessor">#define LIBNET_OSPF_LSA 5 </span><span class="comment">/* link state acknowledgement packet */</span>
1211: 01224 u_int16_t ospf_len; <span class="comment">/* length */</span>
1212: 01225 <span class="keyword">struct </span>in_addr ospf_rtr_id; <span class="comment">/* source router ID */</span>
1213: 01226 <span class="keyword">struct </span>in_addr ospf_area_id;<span class="comment">/* roam ID */</span>
1214: 01227 u_int16_t ospf_sum; <span class="comment">/* checksum */</span>
1215: 01228 u_int16_t ospf_auth_type; <span class="comment">/* authentication type */</span>
1216: 01229 <span class="preprocessor">#define LIBNET_OSPF_AUTH_NULL 0 </span><span class="comment">/* null password */</span>
1217: 01230 <span class="preprocessor">#define LIBNET_OSPF_AUTH_SIMPLE 1 </span><span class="comment">/* simple, plaintext, 8 int8_t password */</span>
1218: 01231 <span class="preprocessor">#define LIBNET_OSPF_AUTH_MD5 2 </span><span class="comment">/* MD5 */</span>
1219: 01232 };
1220: 01233
1221: 01234
1222: 01235 <span class="comment">/*</span>
1223: 01236 <span class="comment"> * OSPF authentication header</span>
1224: 01237 <span class="comment"> * Open Shortest Path First</span>
1225: 01238 <span class="comment"> * Static header size: 8 bytes</span>
1226: 01239 <span class="comment"> */</span>
1227: 01240 <span class="keyword">struct </span>libnet_auth_hdr
1228: 01241 {
1229: 01242 u_int16_t ospf_auth_null; <span class="comment">/* NULL */</span>
1230: 01243 u_int8_t ospf_auth_keyid; <span class="comment">/* authentication key ID */</span>
1231: 01244 u_int8_t ospf_auth_len; <span class="comment">/* auth data length */</span>
1232: 01245 u_int ospf_auth_seq; <span class="comment">/* cryptographic sequence number */</span>
1233: 01246 };
1234: 01247
1235: 01248
1236: 01249 <span class="comment">/*</span>
1237: 01250 <span class="comment"> * OSPF hello header</span>
1238: 01251 <span class="comment"> * Open Shortest Path First</span>
1239: 01252 <span class="comment"> * Static header size: 28 bytes</span>
1240: 01253 <span class="comment"> */</span>
1241: 01254 <span class="keyword">struct </span>libnet_ospf_hello_hdr
1242: 01255 {
1243: 01256 <span class="keyword">struct </span>in_addr hello_nmask; <span class="comment">/* netmask associated with the interface */</span>
1244: 01257 u_int16_t hello_intrvl; <span class="comment">/* num of seconds between routers last packet */</span>
1245: 01258 u_int8_t hello_opts; <span class="comment">/* Options for HELLO packets (look above) */</span>
1246: 01259 u_int8_t hello_rtr_pri; <span class="comment">/* router's priority (if 0, can't be backup) */</span>
1247: 01260 u_int hello_dead_intvl; <span class="comment">/* # of secs a router is silent till deemed down */</span>
1248: 01261 <span class="keyword">struct </span>in_addr hello_des_rtr; <span class="comment">/* Designated router on the network */</span>
1249: 01262 <span class="keyword">struct </span>in_addr hello_bkup_rtr; <span class="comment">/* Backup router */</span>
1250: 01263 <span class="keyword">struct </span>in_addr hello_nbr; <span class="comment">/* neighbor router, memcpy more as needed */</span>
1251: 01264 };
1252: 01265
1253: 01266
1254: 01267 <span class="comment">/*</span>
1255: 01268 <span class="comment"> * Database Description header.</span>
1256: 01269 <span class="comment"> */</span>
1257: 01270 <span class="keyword">struct </span>libnet_dbd_hdr
1258: 01271 {
1259: 01272 u_int16_t dbd_mtu_len; <span class="comment">/* max length of IP dgram that this 'if' can use */</span>
1260: 01273 u_int8_t dbd_opts; <span class="comment">/* DBD packet options (from above) */</span>
1261: 01274 u_int8_t dbd_type; <span class="comment">/* type of exchange occurring */</span>
1262: 01275 <span class="preprocessor">#define LIBNET_DBD_IBI 0x01 </span><span class="comment">/* init */</span>
1263: 01276 <span class="preprocessor">#define LIBNET_DBD_MBIT 0x02 </span><span class="comment">/* more DBD packets are to come */</span>
1264: 01277 <span class="preprocessor">#define LIBNET_DBD_MSBIT 0x04 </span><span class="comment">/* If 1, sender is the master in the exchange */</span>
1265: 01278 u_int dbd_seq; <span class="comment">/* DBD sequence number */</span>
1266: 01279 };
1267: 01280
1268: 01281
1269: 01282 <span class="comment">/*</span>
1270: 01283 <span class="comment"> * used for the LS type field in all LS* headers</span>
1271: 01284 <span class="comment"> */</span>
1272: 01285 <span class="preprocessor">#define LIBNET_LS_TYPE_RTR 1 </span><span class="comment">/* router-LSA */</span>
1273: 01286 <span class="preprocessor">#define LIBNET_LS_TYPE_NET 2 </span><span class="comment">/* network-LSA */</span>
1274: 01287 <span class="preprocessor">#define LIBNET_LS_TYPE_IP 3 </span><span class="comment">/* summary-LSA (IP Network) */</span>
1275: 01288 <span class="preprocessor">#define LIBNET_LS_TYPE_ASBR 4 </span><span class="comment">/* summary-LSA (ASBR) */</span>
1276: 01289 <span class="preprocessor">#define LIBNET_LS_TYPE_ASEXT 5 </span><span class="comment">/* AS-external-LSA */</span>
1277: 01290
1278: 01291
1279: 01292 <span class="comment">/*</span>
1280: 01293 <span class="comment"> * Link State Request header</span>
1281: 01294 <span class="comment"> */</span>
1282: 01295 <span class="keyword">struct </span>libnet_lsr_hdr
1283: 01296 {
1284: 01297 u_int lsr_type; <span class="comment">/* type of LS being requested */</span>
1285: 01298 u_int lsr_lsid; <span class="comment">/* link state ID */</span>
1286: 01299 <span class="keyword">struct </span>in_addr lsr_adrtr; <span class="comment">/* advertising router (memcpy more as needed) */</span>
1287: 01300 };
1288: 01301
1289: 01302
1290: 01303 <span class="comment">/*</span>
1291: 01304 <span class="comment"> * Link State Update header</span>
1292: 01305 <span class="comment"> */</span>
1293: 01306 <span class="keyword">struct </span>libnet_lsu_hdr
1294: 01307 {
1295: 01308 u_int lsu_num; <span class="comment">/* number of LSAs that will be broadcasted */</span>
1296: 01309 };
1297: 01310
1298: 01311
1299: 01312 <span class="comment">/*</span>
1300: 01313 <span class="comment"> * Link State Acknowledgement header.</span>
1301: 01314 <span class="comment"> */</span>
1302: 01315 <span class="keyword">struct </span>libnet_lsa_hdr
1303: 01316 {
1304: 01317 u_int16_t lsa_age; <span class="comment">/* time in seconds since the LSA was originated */</span>
1305: 01318 u_int8_t lsa_opts; <span class="comment">/* look above for OPTS_* */</span>
1306: 01319 u_int8_t lsa_type; <span class="comment">/* look below for LS_TYPE_* */</span>
1307: 01320 u_int lsa_id; <span class="comment">/* link State ID */</span>
1308: 01321 <span class="keyword">struct </span>in_addr lsa_adv; <span class="comment">/* router ID of Advertising router */</span>
1309: 01322 u_int lsa_seq; <span class="comment">/* LSA sequence number to detect old/bad ones */</span>
1310: 01323 u_int16_t lsa_sum; <span class="comment">/* "Fletcher Checksum" of all fields minus age */</span>
1311: 01324 u_int16_t lsa_len; <span class="comment">/* length in bytes including the 20 byte header */</span>
1312: 01325 };
1313: 01326
1314: 01327
1315: 01328 <span class="comment">/*</span>
1316: 01329 <span class="comment"> * Router LSA data format</span>
1317: 01330 <span class="comment"> *</span>
1318: 01331 <span class="comment"> * Other stuff for TOS can be added for backward compatability, for this</span>
1319: 01332 <span class="comment"> * version, only OSPFv2 is being FULLY supported.</span>
1320: 01333 <span class="comment"> */</span>
1321: 01334 <span class="keyword">struct </span>libnet_rtr_lsa_hdr
1322: 01335 {
1323: 01336 u_int16_t rtr_flags; <span class="comment">/* set to help describe packet */</span>
1324: 01337 <span class="preprocessor">#define LIBNET_RTR_FLAGS_W 0x0100 </span><span class="comment">/* W bit */</span>
1325: 01338 <span class="preprocessor">#define LIBNET_RTR_FLAGS_E 0x0200 </span><span class="comment">/* E bit */</span>
1326: 01339 <span class="preprocessor">#define LIBNET_RTR_FLAGS_B 0x0400 </span><span class="comment">/* B bit */</span>
1327: 01340 u_int16_t rtr_num; <span class="comment">/* number of links within that packet */</span>
1328: 01341 u_int rtr_link_id; <span class="comment">/* describes link_data (look below) */</span>
1329: 01342 <span class="preprocessor">#define LIBNET_LINK_ID_NBR_ID 1 </span><span class="comment">/* Neighbors router ID, also can be 4 */</span>
1330: 01343 <span class="preprocessor">#define LIBNET_LINK_ID_IP_DES 2 </span><span class="comment">/* IP address of designated router */</span>
1331: 01344 <span class="preprocessor">#define LIBNET_LINK_ID_SUB 3 </span><span class="comment">/* IP subnet number */</span>
1332: 01345 u_int rtr_link_data; <span class="comment">/* Depending on link_id, info is here */</span>
1333: 01346 u_int8_t rtr_type; <span class="comment">/* Description of router link */</span>
1334: 01347 <span class="preprocessor">#define LIBNET_RTR_TYPE_PTP 1 </span><span class="comment">/* Point-To-Point */</span>
1335: 01348 <span class="preprocessor">#define LIBNET_RTR_TYPE_TRANS 2 </span><span class="comment">/* Connection to a "transit network" */</span>
1336: 01349 <span class="preprocessor">#define LIBNET_RTR_TYPE_STUB 3 </span><span class="comment">/* Connectin to a "stub network" */</span>
1337: 01350 <span class="preprocessor">#define RTR_TYPE_VRTL 4 </span><span class="comment">/* connects to a "virtual link" */</span>
1338: 01351 u_int8_t rtr_tos_num; <span class="comment">/* number of different TOS metrics for this link */</span>
1339: 01352 u_int16_t rtr_metric; <span class="comment">/* the "cost" of using this link */</span>
1340: 01353 };
1341: 01354
1342: 01355
1343: 01356 <span class="comment">/*</span>
1344: 01357 <span class="comment"> * Network LSA data format.</span>
1345: 01358 <span class="comment"> */</span>
1346: 01359 <span class="keyword">struct </span>libnet_net_lsa_hdr
1347: 01360 {
1348: 01361 <span class="keyword">struct </span>in_addr net_nmask; <span class="comment">/* Netmask for that network */</span>
1349: 01362 u_int net_rtr_id; <span class="comment">/* ID of router attached to that network */</span>
1350: 01363 };
1351: 01364
1352: 01365
1353: 01366 <span class="comment">/*</span>
1354: 01367 <span class="comment"> * Summary LSA data format.</span>
1355: 01368 <span class="comment"> */</span>
1356: 01369 <span class="keyword">struct </span>libnet_sum_lsa_hdr
1357: 01370 {
1358: 01371 <span class="keyword">struct </span>in_addr sum_nmask; <span class="comment">/* Netmask of destination IP address */</span>
1359: 01372 u_int sum_metric; <span class="comment">/* Same as in rtr_lsa (&0xfff to use last 24bit */</span>
1360: 01373 u_int sum_tos_metric; <span class="comment">/* first 8bits are TOS, 24bits are TOS Metric */</span>
1361: 01374 };
1362: 01375
1363: 01376
1364: 01377 <span class="comment">/*</span>
1365: 01378 <span class="comment"> * AS External LSA data format.</span>
1366: 01379 <span class="comment"> * & 0xfff logic operator for as_metric to get last 24bits.</span>
1367: 01380 <span class="comment"> */</span>
1368: 01381 <span class="keyword">struct </span>libnet_as_lsa_hdr
1369: 01382 {
1370: 01383 <span class="keyword">struct </span>in_addr as_nmask; <span class="comment">/* Netmask for advertised destination */</span>
1371: 01384 u_int as_metric; <span class="comment">/* May have to set E bit in first 8bits */</span>
1372: 01385 <span class="preprocessor">#define LIBNET_AS_E_BIT_ON 0x80000000 </span><span class="comment">/* as_metric */</span>
1373: 01386 <span class="keyword">struct </span>in_addr as_fwd_addr; <span class="comment">/* Forwarding address */</span>
1374: 01387 u_int as_rte_tag; <span class="comment">/* External route tag */</span>
1375: 01388 };
1376: 01389
1377: 01390
1378: 01391 <span class="comment">/*</span>
1379: 01392 <span class="comment"> * Base RIP header</span>
1380: 01393 <span class="comment"> * Routing Information Protocol</span>
1381: 01394 <span class="comment"> * Base header size: 24 bytes</span>
1382: 01395 <span class="comment"> */</span>
1383: 01396 <span class="keyword">struct </span>libnet_rip_hdr
1384: 01397 {
1385: 01398 u_int8_t rip_cmd; <span class="comment">/* RIP command */</span>
1386: 01399 <span class="preprocessor">#define RIPCMD_REQUEST 1 </span><span class="comment">/* want info */</span>
1387: 01400 <span class="preprocessor">#define RIPCMD_RESPONSE 2 </span><span class="comment">/* responding to request */</span>
1388: 01401 <span class="preprocessor">#define RIPCMD_TRACEON 3 </span><span class="comment">/* turn tracing on */</span>
1389: 01402 <span class="preprocessor">#define RIPCMD_TRACEOFF 4 </span><span class="comment">/* turn it off */</span>
1390: 01403 <span class="preprocessor">#define RIPCMD_POLL 5 </span><span class="comment">/* like request, but anyone answers */</span>
1391: 01404 <span class="preprocessor">#define RIPCMD_POLLENTRY 6 </span><span class="comment">/* like poll, but for entire entry */</span>
1392: 01405 <span class="preprocessor">#define RIPCMD_MAX 7 </span><span class="comment">/* ? command */</span>
1393: 01406 u_int8_t rip_ver; <span class="comment">/* RIP version */</span>
1394: 01407 <span class="preprocessor">#define RIPVER_0 0</span>
1395: 01408 <span class="preprocessor"></span><span class="preprocessor">#define RIPVER_1 1</span>
1396: 01409 <span class="preprocessor"></span><span class="preprocessor">#define RIPVER_2 2</span>
1397: 01410 <span class="preprocessor"></span> u_int16_t rip_rd; <span class="comment">/* Zero (v1) or Routing Domain (v2) */</span>
1398: 01411 u_int16_t rip_af; <span class="comment">/* Address family */</span>
1399: 01412 u_int16_t rip_rt; <span class="comment">/* Zero (v1) or Route Tag (v2) */</span>
1400: 01413 u_int32_t rip_addr; <span class="comment">/* IP address */</span>
1401: 01414 u_int32_t rip_mask; <span class="comment">/* Zero (v1) or Subnet Mask (v2) */</span>
1402: 01415 u_int32_t rip_next_hop; <span class="comment">/* Zero (v1) or Next hop IP address (v2) */</span>
1403: 01416 u_int32_t rip_metric; <span class="comment">/* Metric */</span>
1404: 01417 };
1405: 01418
1406: 01419 <span class="comment">/*</span>
1407: 01420 <span class="comment"> * RPC headers</span>
1408: 01421 <span class="comment"> * Remote Procedure Call</span>
1409: 01422 <span class="comment"> */</span>
1410: 01423 <span class="preprocessor">#define LIBNET_RPC_CALL 0</span>
1411: 01424 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_RPC_REPLY 1</span>
1412: 01425 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_RPC_VERS 2</span>
1413: 01426 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_RPC_LAST_FRAG 0x80000000</span>
1414: 01427 <span class="preprocessor"></span>
1415: 01428 <span class="comment">/*</span>
1416: 01429 <span class="comment"> * Portmap defines</span>
1417: 01430 <span class="comment"> */</span>
1418: 01431 <span class="preprocessor">#define LIBNET_PMAP_PROGRAM 100000</span>
1419: 01432 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_NULL 0</span>
1420: 01433 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_SET 1</span>
1421: 01434 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_UNSET 2</span>
1422: 01435 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_GETADDR 3</span>
1423: 01436 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_DUMP 4</span>
1424: 01437 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_CALLIT 5</span>
1425: 01438 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_BCAST 5 </span><span class="comment">/* Not a typo */</span>
1426: 01439 <span class="preprocessor">#define LIBNET_PMAP_PROC_GETTIME 6</span>
1427: 01440 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_UADDR2TADDR 7</span>
1428: 01441 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_TADDR2UADDR 8</span>
1429: 01442 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_GETVERSADDR 9</span>
1430: 01443 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_INDIRECT 10</span>
1431: 01444 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_GETADDRLIST 11</span>
1432: 01445 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PMAP_PROC_GETSTAT 12</span>
1433: 01446 <span class="preprocessor"></span>
1434: 01447 <span class="comment">/* There will be more to add... */</span>
1435: 01448
1436: 01449 <span class="keyword">struct </span>libnet_rpc_opaque_auth
1437: 01450 {
1438: 01451 u_int32_t rpc_auth_flavor;
1439: 01452 u_int32_t rpc_auth_length;
1440: 01453 <span class="comment">// u_int8_t *rpc_auth_data;</span>
1441: 01454 };
1442: 01455
1443: 01456 <span class="keyword">struct </span>libnet_rpc_call
1444: 01457 {
1445: 01458 u_int32_t rpc_rpcvers; <span class="comment">/* RPC version - must be 2 */</span>
1446: 01459 u_int32_t rpc_prognum; <span class="comment">/* Program Number */</span>
1447: 01460 u_int32_t rpc_vers; <span class="comment">/* Program Version */</span>
1448: 01461 u_int32_t rpc_procedure; <span class="comment">/* RPC procedure */</span>
1449: 01462 <span class="keyword">struct </span>libnet_rpc_opaque_auth rpc_credentials;
1450: 01463 <span class="keyword">struct </span>libnet_rpc_opaque_auth rpc_verifier;
1451: 01464 };
1452: 01465
1453: 01466 <span class="keyword">struct </span>libnet_rpc_call_hdr
1454: 01467 {
1455: 01468 u_int32_t rpc_xid; <span class="comment">/* xid (transaction identifier) */</span>
1456: 01469 u_int32_t rpc_type;
1457: 01470 <span class="keyword">struct </span>libnet_rpc_call rpc_call;
1458: 01471 };
1459: 01472
1460: 01473 <span class="keyword">struct </span>libnet_rpc_call_tcp_hdr
1461: 01474 {
1462: 01475 u_int32_t rpc_record_marking; <span class="comment">/* used with byte stream protocols */</span>
1463: 01476 <span class="keyword">struct </span>libnet_rpc_call_hdr rpc_common;
1464: 01477 };
1465: 01478
1466: 01479 <span class="comment">/*</span>
1467: 01480 <span class="comment"> * STP configuration header</span>
1468: 01481 <span class="comment"> * Spanning Tree Protocol</span>
1469: 01482 <span class="comment"> * Static header size: 35 bytes</span>
1470: 01483 <span class="comment"> */</span>
1471: 01484 <span class="keyword">struct </span>libnet_stp_conf_hdr
1472: 01485 {
1473: 01486 u_int16_t stp_id; <span class="comment">/* protocol id */</span>
1474: 01487 u_int8_t stp_version; <span class="comment">/* protocol version */</span>
1475: 01488 u_int8_t stp_bpdu_type; <span class="comment">/* bridge protocol data unit type */</span>
1476: 01489 u_int8_t stp_flags; <span class="comment">/* control flags */</span>
1477: 01490 u_int8_t stp_rootid[8]; <span class="comment">/* root id */</span>
1478: 01491 u_int32_t stp_rootpc; <span class="comment">/* root path cost */</span>
1479: 01492 u_int8_t stp_bridgeid[8]; <span class="comment">/* bridge id */</span>
1480: 01493 u_int16_t stp_portid; <span class="comment">/* port id */</span>
1481: 01494 u_int16_t stp_mage; <span class="comment">/* message age */</span>
1482: 01495 u_int16_t stp_maxage; <span class="comment">/* max age */</span>
1483: 01496 u_int16_t stp_hellot; <span class="comment">/* hello time */</span>
1484: 01497 u_int16_t stp_fdelay; <span class="comment">/* forward delay */</span>
1485: 01498 };
1486: 01499
1487: 01500
1488: 01501 <span class="comment">/*</span>
1489: 01502 <span class="comment"> * STP topology change notification header</span>
1490: 01503 <span class="comment"> * Spanning Tree Protocol</span>
1491: 01504 <span class="comment"> * Static header size: 4 bytes</span>
1492: 01505 <span class="comment"> */</span>
1493: 01506 <span class="keyword">struct </span>libnet_stp_tcn_hdr
1494: 01507 {
1495: 01508 u_int16_t stp_id; <span class="comment">/* protocol id */</span>
1496: 01509 u_int8_t stp_version; <span class="comment">/* protocol version */</span>
1497: 01510 u_int8_t stp_bpdu_type; <span class="comment">/* bridge protocol data unit type */</span>
1498: 01511 };
1499: 01512
1500: 01513
1501: 01514 <span class="comment">/*</span>
1502: 01515 <span class="comment"> * TCP header</span>
1503: 01516 <span class="comment"> * Transmission Control Protocol</span>
1504: 01517 <span class="comment"> * Static header size: 20 bytes</span>
1505: 01518 <span class="comment"> */</span>
1506: 01519 <span class="keyword">struct </span>libnet_tcp_hdr
1507: 01520 {
1508: 01521 u_int16_t th_sport; <span class="comment">/* source port */</span>
1509: 01522 u_int16_t th_dport; <span class="comment">/* destination port */</span>
1510: 01523 u_int32_t th_seq; <span class="comment">/* sequence number */</span>
1511: 01524 u_int32_t th_ack; <span class="comment">/* acknowledgement number */</span>
1512: 01525 <span class="preprocessor">#if (LIBNET_LIL_ENDIAN)</span>
1513: 01526 <span class="preprocessor"></span> u_int8_t th_x2:4, <span class="comment">/* (unused) */</span>
1514: 01527 th_off:4; <span class="comment">/* data offset */</span>
1515: 01528 <span class="preprocessor">#endif</span>
1516: 01529 <span class="preprocessor"></span><span class="preprocessor">#if (LIBNET_BIG_ENDIAN)</span>
1517: 01530 <span class="preprocessor"></span> u_int8_t th_off:4, <span class="comment">/* data offset */</span>
1518: 01531 th_x2:4; <span class="comment">/* (unused) */</span>
1519: 01532 <span class="preprocessor">#endif</span>
1520: 01533 <span class="preprocessor"></span> u_int8_t th_flags; <span class="comment">/* control flags */</span>
1521: 01534 <span class="preprocessor">#ifndef TH_FIN</span>
1522: 01535 <span class="preprocessor"></span><span class="preprocessor">#define TH_FIN 0x01 </span><span class="comment">/* finished send data */</span>
1523: 01536 <span class="preprocessor">#endif</span>
1524: 01537 <span class="preprocessor"></span><span class="preprocessor">#ifndef TH_SYN</span>
1525: 01538 <span class="preprocessor"></span><span class="preprocessor">#define TH_SYN 0x02 </span><span class="comment">/* synchronize sequence numbers */</span>
1526: 01539 <span class="preprocessor">#endif</span>
1527: 01540 <span class="preprocessor"></span><span class="preprocessor">#ifndef TH_RST</span>
1528: 01541 <span class="preprocessor"></span><span class="preprocessor">#define TH_RST 0x04 </span><span class="comment">/* reset the connection */</span>
1529: 01542 <span class="preprocessor">#endif</span>
1530: 01543 <span class="preprocessor"></span><span class="preprocessor">#ifndef TH_PUSH</span>
1531: 01544 <span class="preprocessor"></span><span class="preprocessor">#define TH_PUSH 0x08 </span><span class="comment">/* push data to the app layer */</span>
1532: 01545 <span class="preprocessor">#endif</span>
1533: 01546 <span class="preprocessor"></span><span class="preprocessor">#ifndef TH_ACK</span>
1534: 01547 <span class="preprocessor"></span><span class="preprocessor">#define TH_ACK 0x10 </span><span class="comment">/* acknowledge */</span>
1535: 01548 <span class="preprocessor">#endif</span>
1536: 01549 <span class="preprocessor"></span><span class="preprocessor">#ifndef TH_URG</span>
1537: 01550 <span class="preprocessor"></span><span class="preprocessor">#define TH_URG 0x20 </span><span class="comment">/* urgent! */</span>
1538: 01551 <span class="preprocessor">#endif</span>
1539: 01552 <span class="preprocessor"></span><span class="preprocessor">#ifndef TH_ECE</span>
1540: 01553 <span class="preprocessor"></span><span class="preprocessor">#define TH_ECE 0x40</span>
1541: 01554 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
1542: 01555 <span class="preprocessor"></span><span class="preprocessor">#ifndef TH_CWR </span>
1543: 01556 <span class="preprocessor"></span><span class="preprocessor">#define TH_CWR 0x80</span>
1544: 01557 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
1545: 01558 <span class="preprocessor"></span> u_int16_t th_win; <span class="comment">/* window */</span>
1546: 01559 u_int16_t th_sum; <span class="comment">/* checksum */</span>
1547: 01560 u_int16_t th_urp; <span class="comment">/* urgent pointer */</span>
1548: 01561 };
1549: 01562
1550: 01563 <span class="comment">/*</span>
1551: 01564 <span class="comment"> * Token Ring Header</span>
1552: 01565 <span class="comment"> */</span>
1553: 01566 <span class="keyword">struct </span>libnet_token_ring_hdr
1554: 01567 {
1555: 01568 u_int8_t token_ring_access_control;
1556: 01569 <span class="preprocessor">#define LIBNET_TOKEN_RING_FRAME 0x10</span>
1557: 01570 <span class="preprocessor"></span> u_int8_t token_ring_frame_control;
1558: 01571 <span class="preprocessor">#define LIBNET_TOKEN_RING_LLC_FRAME 0x40</span>
1559: 01572 <span class="preprocessor"></span> u_int8_t token_ring_dhost[TOKEN_RING_ADDR_LEN];
1560: 01573 u_int8_t token_ring_shost[TOKEN_RING_ADDR_LEN];
1561: 01574 u_int8_t token_ring_llc_dsap;
1562: 01575 u_int8_t token_ring_llc_ssap;
1563: 01576 u_int8_t token_ring_llc_control_field;
1564: 01577 u_int8_t token_ring_llc_org_code[LIBNET_ORG_CODE_SIZE];
1565: 01578 u_int16_t token_ring_type;
1566: 01579 <span class="preprocessor">#define TOKEN_RING_TYPE_IP 0x0800 </span><span class="comment">/* IP protocol */</span>
1567: 01580 <span class="preprocessor">#define TOKEN_RING_TYPE_ARP 0x0806 </span><span class="comment">/* addr. resolution protocol */</span>
1568: 01581 <span class="preprocessor">#define TOKEN_RING_TYPE_REVARP 0x8035 </span><span class="comment">/* reverse addr. resolution protocol */</span>
1569: 01582 };
1570: 01583
1571: 01584 <span class="keyword">struct </span>libnet_token_ring_addr
1572: 01585 {
1573: 01586 u_int8_t token_ring_addr_octet[6]; <span class="comment">/* Token Ring address */</span>
1574: 01587 };
1575: 01588
1576: 01589 <span class="comment">/*</span>
1577: 01590 <span class="comment"> * UDP header</span>
1578: 01591 <span class="comment"> * User Data Protocol</span>
1579: 01592 <span class="comment"> * Static header size: 8 bytes</span>
1580: 01593 <span class="comment"> */</span>
1581: 01594 <span class="keyword">struct </span>libnet_udp_hdr
1582: 01595 {
1583: 01596 u_int16_t uh_sport; <span class="comment">/* soure port */</span>
1584: 01597 u_int16_t uh_dport; <span class="comment">/* destination port */</span>
1585: 01598 u_int16_t uh_ulen; <span class="comment">/* length */</span>
1586: 01599 u_int16_t uh_sum; <span class="comment">/* checksum */</span>
1587: 01600 };
1588: 01601
1589: 01602 <span class="comment">/*</span>
1590: 01603 <span class="comment"> * Sebek header</span>
1591: 01604 <span class="comment"> * Static header size: 48 bytes</span>
1592: 01605 <span class="comment"> */</span>
1593: 01606 <span class="keyword">struct </span>libnet_sebek_hdr
1594: 01607 {
1595: 01608 u_int32_t magic; <span class="comment">/* identify packets that should be hidden */</span>
1596: 01609 u_int16_t version; <span class="comment">/* protocol version, currently 1 */</span>
1597: 01610 <span class="preprocessor">#define SEBEK_PROTO_VERSION 1</span>
1598: 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>
1599: 01612 <span class="preprocessor">#define SEBEK_TYPE_READ 0 </span><span class="comment">/* Currently, only read is supported */</span>
1600: 01613 <span class="preprocessor">#define SEBEK_TYPE_WRITE 1</span>
1601: 01614 <span class="preprocessor"></span> u_int32_t counter; <span class="comment">/* PDU counter used to identify when packet are lost */</span>
1602: 01615 u_int32_t time_sec; <span class="comment">/* seconds since EPOCH according to the honeypot */</span>
1603: 01616 u_int32_t time_usec; <span class="comment">/* residual microseconds */</span>
1604: 01617 u_int32_t pid; <span class="comment">/* PID */</span>
1605: 01618 u_int32_t uid; <span class="comment">/* UID */</span>
1606: 01619 u_int32_t fd; <span class="comment">/* FD */</span>
1607: 01620 <span class="preprocessor">#define SEBEK_CMD_LENGTH 12</span>
1608: 01621 <span class="preprocessor"></span> u_int8_t cmd[SEBEK_CMD_LENGTH]; <span class="comment">/* 12 first characters of the command */</span>
1609: 01622 u_int32_t length; <span class="comment">/* length in bytes of the PDU's body */</span>
1610: 01623 };
1611: 01624
1612: 01625
1613: 01626 <span class="comment">/*</span>
1614: 01627 <span class="comment"> * VRRP header</span>
1615: 01628 <span class="comment"> * Virtual Router Redundancy Protocol</span>
1616: 01629 <span class="comment"> * Static header size: 8 bytes</span>
1617: 01630 <span class="comment"> */</span>
1618: 01631 <span class="preprocessor">#ifndef IPPROTO_VRRP</span>
1619: 01632 <span class="preprocessor"></span><span class="preprocessor">#define IPPROTO_VRRP 112 </span><span class="comment">/* not everyone's got this */</span>
1620: 01633 <span class="preprocessor">#endif</span>
1621: 01634 <span class="preprocessor"></span><span class="keyword">struct </span>libnet_vrrp_hdr
1622: 01635 {
1623: 01636 <span class="preprocessor">#if (LIBNET_LIL_ENDIAN)</span>
1624: 01637 <span class="preprocessor"></span> u_int8_t vrrp_v:4, <span class="comment">/* protocol version */</span>
1625: 01638 vrrp_t:4; <span class="comment">/* packet type */</span>
1626: 01639 <span class="preprocessor">#endif</span>
1627: 01640 <span class="preprocessor"></span><span class="preprocessor">#if (LIBNET_BIG_ENDIAN)</span>
1628: 01641 <span class="preprocessor"></span> u_int8_t vrrp_t:4, <span class="comment">/* packet type */</span>
1629: 01642 vrrp_v:4; <span class="comment">/* protocol version */</span>
1630: 01643 <span class="preprocessor">#endif</span>
1631: 01644 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_VRRP_VERSION_01 0x1</span>
1632: 01645 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_VRRP_VERSION_02 0x2</span>
1633: 01646 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_VRRP_TYPE_ADVERT 0x1</span>
1634: 01647 <span class="preprocessor"></span> u_int8_t vrrp_vrouter_id; <span class="comment">/* virtual router id */</span>
1635: 01648 u_int8_t vrrp_priority; <span class="comment">/* priority */</span>
1636: 01649 u_int8_t vrrp_ip_count; <span class="comment">/* number of IP addresses */</span>
1637: 01650 u_int8_t vrrp_auth_type; <span class="comment">/* authorization type */</span>
1638: 01651 <span class="preprocessor">#define LIBNET_VRRP_AUTH_NONE 0x1</span>
1639: 01652 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_VRRP_AUTH_PASSWD 0x2</span>
1640: 01653 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_VRRP_AUTH_IPAH 0x3</span>
1641: 01654 <span class="preprocessor"></span> u_int8_t vrrp_advert_int; <span class="comment">/* advertisement interval */</span>
1642: 01655 u_int16_t vrrp_sum; <span class="comment">/* checksum */</span>
1643: 01656 <span class="comment">/* additional addresses */</span>
1644: 01657 <span class="comment">/* authentication info */</span>
1645: 01658 };
1646: 01659
1647: 01660 <span class="preprocessor">#endif </span><span class="comment">/* __LIBNET_HEADERS_H */</span>
1648: 01661
1649: 01662 <span class="comment">/* EOF */</span>
1650: </pre></div><hr size="1"><address style="align: right;"><small>Generated on Wed Mar 10 13:23:37 2004 for libnet by
1651: <a href="http://www.doxygen.org/index.html">
1652: <img src="doxygen.png" alt="doxygen" align="middle" border=0 >
1653: </a>1.3.4 </small></address>
1654: </body>
1655: </html>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>