File: libnet-structures_8h_source.html

package info (click to toggle)
libnet 1.1.6%2Bdfsg-3
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 4,208 kB
  • ctags: 3,569
  • sloc: ansic: 18,416; sh: 10,754; makefile: 158
file content (306 lines) | stat: -rw-r--r-- 32,050 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>libnet: libnet-structures.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.4 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">libnet&#160;<span id="projectnumber">1.1</span></div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">libnet-structures.h</div>  </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> *  $Id: libnet-structures.h,v 1.19 2004/11/09 07:05:07 mike Exp $</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> *  libnet-structures.h - Network routine library structures header file</span>
<a name="l00005"></a>00005 <span class="comment"> *</span>
<a name="l00006"></a>00006 <span class="comment"> *  Copyright (c) 1998 - 2004 Mike D. Schiffman &lt;mike@infonexus.com&gt;</span>
<a name="l00007"></a>00007 <span class="comment"> *  All rights reserved.</span>
<a name="l00008"></a>00008 <span class="comment"> *</span>
<a name="l00009"></a>00009 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span>
<a name="l00010"></a>00010 <span class="comment"> * modification, are permitted provided that the following conditions</span>
<a name="l00011"></a>00011 <span class="comment"> * are met:</span>
<a name="l00012"></a>00012 <span class="comment"> * 1. Redistributions of source code must retain the above copyright</span>
<a name="l00013"></a>00013 <span class="comment"> *    notice, this list of conditions and the following disclaimer.</span>
<a name="l00014"></a>00014 <span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span>
<a name="l00015"></a>00015 <span class="comment"> *    notice, this list of conditions and the following disclaimer in the</span>
<a name="l00016"></a>00016 <span class="comment"> *    documentation and/or other materials provided with the distribution.</span>
<a name="l00017"></a>00017 <span class="comment"> *</span>
<a name="l00018"></a>00018 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS&#39;&#39; AND</span>
<a name="l00019"></a>00019 <span class="comment"> * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span>
<a name="l00020"></a>00020 <span class="comment"> * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</span>
<a name="l00021"></a>00021 <span class="comment"> * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE</span>
<a name="l00022"></a>00022 <span class="comment"> * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL</span>
<a name="l00023"></a>00023 <span class="comment"> * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS</span>
<a name="l00024"></a>00024 <span class="comment"> * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)</span>
<a name="l00025"></a>00025 <span class="comment"> * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT</span>
<a name="l00026"></a>00026 <span class="comment"> * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY</span>
<a name="l00027"></a>00027 <span class="comment"> * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</span>
<a name="l00028"></a>00028 <span class="comment"> * SUCH DAMAGE.</span>
<a name="l00029"></a>00029 <span class="comment"> *</span>
<a name="l00030"></a>00030 <span class="comment"> */</span>
<a name="l00031"></a>00031 
<a name="l00032"></a>00032 <span class="preprocessor">#ifndef __LIBNET_STRUCTURES_H</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span><span class="preprocessor">#define __LIBNET_STRUCTURES_H</span>
<a name="l00034"></a>00034 <span class="preprocessor"></span>
<a name="l00035"></a>00035 <span class="preprocessor">#if ((__WIN32__) &amp;&amp; !(__CYGWIN__))</span>
<a name="l00036"></a>00036 <span class="preprocessor"></span><span class="preprocessor">#include &quot;Packet32.h&quot;</span>
<a name="l00037"></a>00037 <span class="preprocessor">#endif</span>
<a name="l00038"></a>00038 <span class="preprocessor"></span>
<a name="l00039"></a>00039 <span class="comment">/* port list chain structure */</span>
<a name="l00040"></a>00040 <span class="keyword">typedef</span> <span class="keyword">struct </span>libnet_port_list_chain libnet_plist_t;
<a name="l00041"></a>00041 <span class="keyword">struct </span>libnet_port_list_chain
<a name="l00042"></a>00042 {
<a name="l00043"></a>00043     uint16_t node;                     <span class="comment">/* node number */</span>
<a name="l00044"></a>00044     uint16_t bport;                    <span class="comment">/* beggining port */</span>
<a name="l00045"></a>00045     uint16_t eport;                    <span class="comment">/* terminating port */</span>
<a name="l00046"></a>00046     uint8_t  id;                       <span class="comment">/* global array offset */</span>
<a name="l00047"></a>00047     libnet_plist_t *next;               <span class="comment">/* next node in the list */</span>
<a name="l00048"></a>00048 };
<a name="l00049"></a>00049 
<a name="l00050"></a>00050 
<a name="l00051"></a>00051 <span class="comment">/* libnet statistics structure */</span>
<a name="l00052"></a>00052 <span class="keyword">struct </span><a class="code" href="libnet-functions_8h.html#a886dc359d6add4b0608e8611af7e1b35">libnet_stats</a>
<a name="l00053"></a>00053 {
<a name="l00054"></a>00054 <span class="preprocessor">#if (!defined(__WIN32__) || (__CYGWIN__))</span>
<a name="l00055"></a>00055 <span class="preprocessor"></span>    uint64_t packets_sent;             <span class="comment">/* packets sent */</span>
<a name="l00056"></a>00056     uint64_t packet_errors;            <span class="comment">/* packets errors */</span>
<a name="l00057"></a>00057     uint64_t bytes_written;            <span class="comment">/* bytes written */</span>
<a name="l00058"></a>00058 <span class="preprocessor">#else</span>
<a name="l00059"></a>00059 <span class="preprocessor"></span>    __int64 packets_sent;               <span class="comment">/* packets sent */</span>
<a name="l00060"></a>00060     __int64 packet_errors;              <span class="comment">/* packets errors */</span>
<a name="l00061"></a>00061     __int64 bytes_written;              <span class="comment">/* bytes written */</span>
<a name="l00062"></a>00062 <span class="preprocessor">#endif</span>
<a name="l00063"></a>00063 <span class="preprocessor"></span>};
<a name="l00064"></a>00064 
<a name="l00065"></a>00065 
<a name="l00066"></a>00066 <span class="comment">/*</span>
<a name="l00067"></a>00067 <span class="comment"> *  Libnet ptags are how we identify specific protocol blocks inside the</span>
<a name="l00068"></a>00068 <span class="comment"> *  list.</span>
<a name="l00069"></a>00069 <span class="comment"> */</span>
<a name="l00070"></a>00070 <span class="keyword">typedef</span> int32_t libnet_ptag_t;
<a name="l00071"></a>00071 <span class="preprocessor">#define LIBNET_PTAG_INITIALIZER         0</span>
<a name="l00072"></a>00072 <span class="preprocessor"></span>
<a name="l00073"></a>00073 
<a name="l00074"></a>00074 <span class="comment">/*</span>
<a name="l00075"></a>00075 <span class="comment"> *  Libnet generic protocol block memory object.  Sort of a poor man&#39;s mbuf.</span>
<a name="l00076"></a>00076 <span class="comment"> */</span>
<a name="l00077"></a>00077 <span class="keyword">struct </span>libnet_protocol_block
<a name="l00078"></a>00078 {
<a name="l00079"></a>00079     uint8_t *buf;                      <span class="comment">/* protocol buffer */</span>
<a name="l00080"></a>00080     uint32_t b_len;                    <span class="comment">/* length of buf */</span>
<a name="l00081"></a>00081     uint16_t h_len;                    <span class="comment">/* header length */</span>
<a name="l00082"></a>00082        <span class="comment">/* Passed as last argument to libnet_do_checksum(). Not necessarily used</span>
<a name="l00083"></a>00083 <span class="comment">        * by that function, it is essentially a pblock specific number, passed</span>
<a name="l00084"></a>00084 <span class="comment">        * from _builder to the _do_checksum</span>
<a name="l00085"></a>00085 <span class="comment">        *</span>
<a name="l00086"></a>00086 <span class="comment">        * Unused for IPV4_H block types.</span>
<a name="l00087"></a>00087 <span class="comment">        *</span>
<a name="l00088"></a>00088 <span class="comment">        * For protocols that sit on top of IP, it should be the the amount of</span>
<a name="l00089"></a>00089 <span class="comment">        * buf that will be included in the checksum, starting from the beginning</span>
<a name="l00090"></a>00090 <span class="comment">        * of the header.</span>
<a name="l00091"></a>00091 <span class="comment">        */</span>
<a name="l00092"></a>00092     uint32_t copied;                   <span class="comment">/* bytes copied - the amount of data copied into buf */</span>
<a name="l00093"></a>00093        <span class="comment">/* Used and updated by libnet_pblock_append(). */</span>
<a name="l00094"></a>00094     uint8_t type;                      <span class="comment">/* type of pblock */</span>
<a name="l00095"></a>00095 <span class="comment">/* this needs to be updated every time a new packet builder is added */</span>
<a name="l00096"></a>00096 <span class="comment">/* libnet_diag_dump_pblock_type() also needs updating for every new pblock tag */</span>
<a name="l00097"></a>00097 <span class="preprocessor">#define LIBNET_PBLOCK_ARP_H             0x01    </span><span class="comment">/* ARP header */</span>
<a name="l00098"></a>00098 <span class="preprocessor">#define LIBNET_PBLOCK_DHCPV4_H          0x02    </span><span class="comment">/* DHCP v4 header */</span>
<a name="l00099"></a>00099 <span class="preprocessor">#define LIBNET_PBLOCK_DNSV4_H           0x03    </span><span class="comment">/* DNS v4 header */</span>
<a name="l00100"></a>00100 <span class="preprocessor">#define LIBNET_PBLOCK_ETH_H             0x04    </span><span class="comment">/* Ethernet header */</span>
<a name="l00101"></a>00101 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_H          0x05    </span><span class="comment">/* ICMP v4 base header */</span>
<a name="l00102"></a>00102 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_ECHO_H     0x06    </span><span class="comment">/* ICMP v4 echo header */</span>
<a name="l00103"></a>00103 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_MASK_H     0x07    </span><span class="comment">/* ICMP v4 mask header */</span>
<a name="l00104"></a>00104 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_UNREACH_H  0x08    </span><span class="comment">/* ICMP v4 unreach header */</span>
<a name="l00105"></a>00105 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_TIMXCEED_H 0x09    </span><span class="comment">/* ICMP v4 exceed header */</span>
<a name="l00106"></a>00106 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_REDIRECT_H 0x0a    </span><span class="comment">/* ICMP v4 redirect header */</span>
<a name="l00107"></a>00107 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_TS_H       0x0b    </span><span class="comment">/* ICMP v4 timestamp header */</span>
<a name="l00108"></a>00108 <span class="preprocessor">#define LIBNET_PBLOCK_IGMP_H            0x0c    </span><span class="comment">/* IGMP header */</span>
<a name="l00109"></a>00109 <span class="preprocessor">#define LIBNET_PBLOCK_IPV4_H            0x0d    </span><span class="comment">/* IP v4 header */</span>
<a name="l00110"></a>00110 <span class="preprocessor">#define LIBNET_PBLOCK_IPO_H             0x0e    </span><span class="comment">/* IP v4 options */</span>
<a name="l00111"></a>00111 <span class="preprocessor">#define LIBNET_PBLOCK_IPDATA            0x0f    </span><span class="comment">/* IP data */</span>
<a name="l00112"></a>00112 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_H            0x10    </span><span class="comment">/* OSPF base header */</span>
<a name="l00113"></a>00113 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_HELLO_H      0x11    </span><span class="comment">/* OSPF hello header */</span>
<a name="l00114"></a>00114 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_DBD_H        0x12    </span><span class="comment">/* OSPF dbd header */</span>
<a name="l00115"></a>00115 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_LSR_H        0x13    </span><span class="comment">/* OSPF lsr header */</span>
<a name="l00116"></a>00116 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_LSU_H        0x14    </span><span class="comment">/* OSPF lsu header */</span>
<a name="l00117"></a>00117 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_LSA_H        0x15    </span><span class="comment">/* OSPF lsa header */</span>
<a name="l00118"></a>00118 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_AUTH_H       0x16    </span><span class="comment">/* OSPF auth header */</span>
<a name="l00119"></a>00119 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_CKSUM        0x17    </span><span class="comment">/* OSPF checksum header */</span>
<a name="l00120"></a>00120 <span class="preprocessor">#define LIBNET_PBLOCK_LS_RTR_H          0x18    </span><span class="comment">/* linkstate rtr header */</span>
<a name="l00121"></a>00121 <span class="preprocessor">#define LIBNET_PBLOCK_LS_NET_H          0x19    </span><span class="comment">/* linkstate net header */</span>
<a name="l00122"></a>00122 <span class="preprocessor">#define LIBNET_PBLOCK_LS_SUM_H          0x1a    </span><span class="comment">/* linkstate as sum header */</span>
<a name="l00123"></a>00123 <span class="preprocessor">#define LIBNET_PBLOCK_LS_AS_EXT_H       0x1b    </span><span class="comment">/* linkstate as ext header */</span>
<a name="l00124"></a>00124 <span class="preprocessor">#define LIBNET_PBLOCK_NTP_H             0x1c    </span><span class="comment">/* NTP header */</span>
<a name="l00125"></a>00125 <span class="preprocessor">#define LIBNET_PBLOCK_RIP_H             0x1d    </span><span class="comment">/* RIP header */</span>
<a name="l00126"></a>00126 <span class="preprocessor">#define LIBNET_PBLOCK_TCP_H             0x1e    </span><span class="comment">/* TCP header */</span>
<a name="l00127"></a>00127 <span class="preprocessor">#define LIBNET_PBLOCK_TCPO_H            0x1f    </span><span class="comment">/* TCP options */</span>
<a name="l00128"></a>00128 <span class="preprocessor">#define LIBNET_PBLOCK_TCPDATA           0x20    </span><span class="comment">/* TCP data */</span>
<a name="l00129"></a>00129 <span class="preprocessor">#define LIBNET_PBLOCK_UDP_H             0x21    </span><span class="comment">/* UDP header */</span>
<a name="l00130"></a>00130 <span class="preprocessor">#define LIBNET_PBLOCK_VRRP_H            0x22    </span><span class="comment">/* VRRP header */</span>
<a name="l00131"></a>00131 <span class="preprocessor">#define LIBNET_PBLOCK_DATA_H            0x23    </span><span class="comment">/* generic data */</span>
<a name="l00132"></a>00132 <span class="preprocessor">#define LIBNET_PBLOCK_CDP_H             0x24    </span><span class="comment">/* CDP header */</span>
<a name="l00133"></a>00133 <span class="preprocessor">#define LIBNET_PBLOCK_IPSEC_ESP_HDR_H   0x25    </span><span class="comment">/* IPSEC ESP header */</span>
<a name="l00134"></a>00134 <span class="preprocessor">#define LIBNET_PBLOCK_IPSEC_ESP_FTR_H   0x26    </span><span class="comment">/* IPSEC ESP footer */</span>
<a name="l00135"></a>00135 <span class="preprocessor">#define LIBNET_PBLOCK_IPSEC_AH_H        0x27    </span><span class="comment">/* IPSEC AH header */</span>
<a name="l00136"></a>00136 <span class="preprocessor">#define LIBNET_PBLOCK_802_1Q_H          0x28    </span><span class="comment">/* 802.1q header */</span>
<a name="l00137"></a>00137 <span class="preprocessor">#define LIBNET_PBLOCK_802_2_H           0x29    </span><span class="comment">/* 802.2 header */</span>
<a name="l00138"></a>00138 <span class="preprocessor">#define LIBNET_PBLOCK_802_2SNAP_H       0x2a    </span><span class="comment">/* 802.2 SNAP header */</span>
<a name="l00139"></a>00139 <span class="preprocessor">#define LIBNET_PBLOCK_802_3_H           0x2b    </span><span class="comment">/* 802.3 header */</span>
<a name="l00140"></a>00140 <span class="preprocessor">#define LIBNET_PBLOCK_STP_CONF_H        0x2c    </span><span class="comment">/* STP configuration header */</span>
<a name="l00141"></a>00141 <span class="preprocessor">#define LIBNET_PBLOCK_STP_TCN_H         0x2d    </span><span class="comment">/* STP TCN header */</span>
<a name="l00142"></a>00142 <span class="preprocessor">#define LIBNET_PBLOCK_ISL_H             0x2e    </span><span class="comment">/* ISL header */</span>
<a name="l00143"></a>00143 <span class="preprocessor">#define LIBNET_PBLOCK_IPV6_H            0x2f    </span><span class="comment">/* IP v6 header */</span>
<a name="l00144"></a>00144 <span class="preprocessor">#define LIBNET_PBLOCK_802_1X_H          0x30    </span><span class="comment">/* 802.1x header */</span>
<a name="l00145"></a>00145 <span class="preprocessor">#define LIBNET_PBLOCK_RPC_CALL_H        0x31    </span><span class="comment">/* RPC Call header */</span>
<a name="l00146"></a>00146 <span class="preprocessor">#define LIBNET_PBLOCK_MPLS_H            0x32    </span><span class="comment">/* MPLS header */</span>
<a name="l00147"></a>00147 <span class="preprocessor">#define LIBNET_PBLOCK_FDDI_H            0x33    </span><span class="comment">/* FDDI header */</span>
<a name="l00148"></a>00148 <span class="preprocessor">#define LIBNET_PBLOCK_TOKEN_RING_H      0x34    </span><span class="comment">/* TOKEN RING header */</span>
<a name="l00149"></a>00149 <span class="preprocessor">#define LIBNET_PBLOCK_BGP4_HEADER_H     0x35    </span><span class="comment">/* BGP4 header */</span>
<a name="l00150"></a>00150 <span class="preprocessor">#define LIBNET_PBLOCK_BGP4_OPEN_H       0x36    </span><span class="comment">/* BGP4 open header */</span>
<a name="l00151"></a>00151 <span class="preprocessor">#define LIBNET_PBLOCK_BGP4_UPDATE_H     0x37    </span><span class="comment">/* BGP4 update header */</span>
<a name="l00152"></a>00152 <span class="preprocessor">#define LIBNET_PBLOCK_BGP4_NOTIFICATION_H 0x38  </span><span class="comment">/* BGP4 notification header */</span>
<a name="l00153"></a>00153 <span class="preprocessor">#define LIBNET_PBLOCK_GRE_H             0x39    </span><span class="comment">/* GRE header */</span>
<a name="l00154"></a>00154 <span class="preprocessor">#define LIBNET_PBLOCK_GRE_SRE_H         0x3a    </span><span class="comment">/* GRE SRE header */</span>
<a name="l00155"></a>00155 <span class="preprocessor">#define LIBNET_PBLOCK_IPV6_FRAG_H       0x3b    </span><span class="comment">/* IPv6 frag header */</span>
<a name="l00156"></a>00156 <span class="preprocessor">#define LIBNET_PBLOCK_IPV6_ROUTING_H    0x3c    </span><span class="comment">/* IPv6 routing header */</span>
<a name="l00157"></a>00157 <span class="preprocessor">#define LIBNET_PBLOCK_IPV6_DESTOPTS_H   0x3d    </span><span class="comment">/* IPv6 dest opts header */</span>
<a name="l00158"></a>00158 <span class="preprocessor">#define LIBNET_PBLOCK_IPV6_HBHOPTS_H    0x3e    </span><span class="comment">/* IPv6 hop/hop opts header */</span>
<a name="l00159"></a>00159 <span class="preprocessor">#define LIBNET_PBLOCK_SEBEK_H           0x3f    </span><span class="comment">/* Sebek header */</span>
<a name="l00160"></a>00160 <span class="preprocessor">#define LIBNET_PBLOCK_HSRP_H            0x40    </span><span class="comment">/* HSRP header */</span>
<a name="l00161"></a>00161 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV6_H          0x41    </span><span class="comment">/* ICMPv6 header (unused) */</span>
<a name="l00162"></a>00162 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV6_ECHO_H     0x46    </span><span class="comment">/* ICMPv6 echo header */</span>
<a name="l00163"></a>00163 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV6_UNREACH_H  0x42    </span><span class="comment">/* ICMPv6 unreach header */</span>
<a name="l00164"></a>00164 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV6_NDP_NSOL_H 0x43    </span><span class="comment">/* ICMPv6 NDP neighbor solicitation header */</span>
<a name="l00165"></a>00165 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV6_NDP_NADV_H 0x44    </span><span class="comment">/* ICMPv6 NDP neighbor advertisement header */</span>
<a name="l00166"></a>00166 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV6_NDP_OPT_H  0x45    </span><span class="comment">/* ICMPv6 NDP option */</span>
<a name="l00167"></a>00167 
<a name="l00168"></a>00168     uint8_t flags;                             <span class="comment">/* control flags */</span>
<a name="l00169"></a>00169 <span class="preprocessor">#define LIBNET_PBLOCK_DO_CHECKSUM       0x01    </span><span class="comment">/* needs a checksum */</span>
<a name="l00170"></a>00170     libnet_ptag_t ptag;                 <span class="comment">/* protocol block tag */</span>
<a name="l00171"></a>00171     <span class="comment">/* Chains are built from highest level protocol, towards the link level, so</span>
<a name="l00172"></a>00172 <span class="comment">     * prev traverses away from link level, and next traverses towards the</span>
<a name="l00173"></a>00173 <span class="comment">     * link level.</span>
<a name="l00174"></a>00174 <span class="comment">     */</span>
<a name="l00175"></a>00175     <span class="keyword">struct </span>libnet_protocol_block *next; <span class="comment">/* next pblock */</span>
<a name="l00176"></a>00176     <span class="keyword">struct </span>libnet_protocol_block *prev; <span class="comment">/* prev pblock */</span>
<a name="l00177"></a>00177 };
<a name="l00178"></a>00178 <span class="keyword">typedef</span> <span class="keyword">struct </span>libnet_protocol_block libnet_pblock_t;
<a name="l00179"></a>00179 
<a name="l00180"></a>00180 
<a name="l00181"></a>00181 <span class="comment">/*</span>
<a name="l00182"></a>00182 <span class="comment"> *  Libnet context</span>
<a name="l00183"></a>00183 <span class="comment"> *  Opaque structure.  Nothing in here should ever been touched first hand by</span>
<a name="l00184"></a>00184 <span class="comment"> *  the applications programmer.</span>
<a name="l00185"></a>00185 <span class="comment"> */</span>
<a name="l00186"></a>00186 <span class="keyword">struct </span>libnet_context
<a name="l00187"></a>00187 {
<a name="l00188"></a>00188 <span class="preprocessor">#if ((__WIN32__) &amp;&amp; !(__CYGWIN__)) </span>
<a name="l00189"></a>00189 <span class="preprocessor"></span>    SOCKET fd;
<a name="l00190"></a>00190     LPADAPTER  lpAdapter;
<a name="l00191"></a>00191 <span class="preprocessor">#else</span>
<a name="l00192"></a>00192 <span class="preprocessor"></span>    <span class="keywordtype">int</span> fd;                             <span class="comment">/* file descriptor of packet device */</span>
<a name="l00193"></a>00193 <span class="preprocessor">#endif</span>
<a name="l00194"></a>00194 <span class="preprocessor"></span>    <span class="keywordtype">int</span> injection_type;                 <span class="comment">/* one of: */</span>
<a name="l00195"></a>00195 <span class="preprocessor">#define LIBNET_NONE     0xf8            </span><span class="comment">/* no injection type, only construct packets */</span>
<a name="l00196"></a>00196 <span class="preprocessor">#define LIBNET_LINK     0x00            </span><span class="comment">/* link-layer interface */</span>
<a name="l00197"></a>00197 <span class="preprocessor">#define LIBNET_RAW4     0x01            </span><span class="comment">/* raw socket interface (ipv4) */</span>
<a name="l00198"></a>00198 <span class="preprocessor">#define LIBNET_RAW6     0x02            </span><span class="comment">/* raw socket interface (ipv6) */</span>
<a name="l00199"></a>00199 <span class="comment">/* the following should actually set a flag in the flags variable above */</span>
<a name="l00200"></a>00200 <span class="preprocessor">#define LIBNET_LINK_ADV 0x08            </span><span class="comment">/* advanced mode link-layer */</span>
<a name="l00201"></a>00201 <span class="preprocessor">#define LIBNET_RAW4_ADV 0x09            </span><span class="comment">/* advanced mode raw socket (ipv4) */</span>
<a name="l00202"></a>00202 <span class="preprocessor">#define LIBNET_RAW6_ADV 0x0a            </span><span class="comment">/* advanced mode raw socket (ipv6) */</span>
<a name="l00203"></a>00203 <span class="preprocessor">#define LIBNET_ADV_MASK 0x08            </span><span class="comment">/* mask to determine adv mode */</span>
<a name="l00204"></a>00204 
<a name="l00205"></a>00205     <span class="comment">/* _blocks is the highest level, and _end is closest to link-level */</span>
<a name="l00206"></a>00206     libnet_pblock_t *protocol_blocks;   <span class="comment">/* protocol headers / data */</span>
<a name="l00207"></a>00207     libnet_pblock_t *pblock_end;        <span class="comment">/* last node in list */</span>
<a name="l00208"></a>00208     uint32_t n_pblocks;                <span class="comment">/* number of pblocks */</span>
<a name="l00209"></a>00209 
<a name="l00210"></a>00210     <span class="keywordtype">int</span> link_type;                      <span class="comment">/* link-layer type, a DLT_ value. */</span>
<a name="l00211"></a>00211     <span class="comment">/* These are the only values used by libnet (see libnet_build_arp and</span>
<a name="l00212"></a>00212 <span class="comment">     * libnet_build_link).  Other values are assigned by the various</span>
<a name="l00213"></a>00213 <span class="comment">     * libnet_link_*.c OS support functions, but are not yet used or supported,</span>
<a name="l00214"></a>00214 <span class="comment">     * they are effectively dead code. &lt;pcap.h&gt; claims these two are invariant</span>
<a name="l00215"></a>00215 <span class="comment">     * across operating systems... hopefully it is correct!</span>
<a name="l00216"></a>00216 <span class="comment">     */</span>
<a name="l00217"></a>00217 <span class="preprocessor">#ifndef DLT_EN10MB</span>
<a name="l00218"></a>00218 <span class="preprocessor"></span><span class="preprocessor"># define DLT_EN10MB      1       </span><span class="comment">/* Ethernet (10Mb) */</span>
<a name="l00219"></a>00219 <span class="preprocessor">#endif</span>
<a name="l00220"></a>00220 <span class="preprocessor"></span><span class="preprocessor">#ifndef DLT_IEEE802</span>
<a name="l00221"></a>00221 <span class="preprocessor"></span><span class="preprocessor"># define DLT_IEEE802     6       </span><span class="comment">/* IEEE 802 Networks */</span>
<a name="l00222"></a>00222 <span class="preprocessor">#endif</span>
<a name="l00223"></a>00223 <span class="preprocessor"></span>
<a name="l00224"></a>00224     <span class="keywordtype">int</span> link_offset;                    <span class="comment">/* link-layer header size */</span>
<a name="l00225"></a>00225     <span class="keywordtype">int</span> aligner;                        <span class="comment">/* used to align packets */</span>
<a name="l00226"></a>00226     <span class="keywordtype">char</span> *device;                       <span class="comment">/* device name */</span>
<a name="l00227"></a>00227 
<a name="l00228"></a>00228     <span class="keyword">struct </span><a class="code" href="libnet-functions_8h.html#a886dc359d6add4b0608e8611af7e1b35">libnet_stats</a> stats;          <span class="comment">/* statistics */</span>
<a name="l00229"></a>00229     libnet_ptag_t ptag_state;           <span class="comment">/* state holder for pblock tag */</span>
<a name="l00230"></a>00230     <span class="keywordtype">char</span> label[LIBNET_LABEL_SIZE];      <span class="comment">/* textual label for cq interface */</span>
<a name="l00231"></a>00231 
<a name="l00232"></a>00232     <span class="keywordtype">char</span> err_buf[<a class="code" href="libnet-macros_8h.html#a2d720375e2ef5a85a62d6069283a5223">LIBNET_ERRBUF_SIZE</a>];   <span class="comment">/* error buffer */</span>
<a name="l00233"></a>00233     uint32_t total_size;               <span class="comment">/* total size */</span>
<a name="l00234"></a>00234 };
<a name="l00235"></a>00235 <span class="keyword">typedef</span> <span class="keyword">struct </span>libnet_context libnet_t;
<a name="l00236"></a>00236 
<a name="l00237"></a>00237 <span class="comment">/*</span>
<a name="l00238"></a>00238 <span class="comment"> *  Libnet context queue structure</span>
<a name="l00239"></a>00239 <span class="comment"> *  Opaque structure.  Nothing in here should ever been touched first hand by</span>
<a name="l00240"></a>00240 <span class="comment"> *  the applications programmer.</span>
<a name="l00241"></a>00241 <span class="comment"> */</span>
<a name="l00242"></a>00242 <span class="keyword">typedef</span> <span class="keyword">struct </span>_libnet_context_queue libnet_cq_t;
<a name="l00243"></a>00243 <span class="keyword">struct </span>_libnet_context_queue
<a name="l00244"></a>00244 {
<a name="l00245"></a>00245     libnet_t *context;                  <span class="comment">/* pointer to libnet context */</span>
<a name="l00246"></a>00246     libnet_cq_t *next;                  <span class="comment">/* next node in the list */</span>
<a name="l00247"></a>00247     libnet_cq_t *prev;                  <span class="comment">/* previous node in the list */</span>
<a name="l00248"></a>00248 };
<a name="l00249"></a>00249 
<a name="l00250"></a>00250 <span class="keyword">struct </span>_libnet_context_queue_descriptor
<a name="l00251"></a>00251 {
<a name="l00252"></a>00252     uint32_t node;                     <span class="comment">/* number of nodes in the list */</span>
<a name="l00253"></a>00253     uint32_t cq_lock;                  <span class="comment">/* lock status */</span>
<a name="l00254"></a>00254     libnet_cq_t *current;               <span class="comment">/* current context */</span>
<a name="l00255"></a>00255 };
<a name="l00256"></a>00256 <span class="keyword">typedef</span> <span class="keyword">struct </span>_libnet_context_queue_descriptor libnet_cqd_t;
<a name="l00257"></a>00257 
<a name="l00258"></a>00258 <span class="preprocessor">#endif  </span><span class="comment">/* __LIBNET_STRUCTURES_H */</span>
<a name="l00259"></a>00259 
<a name="l00260"></a>00260 <span class="comment">/* EOF */</span>
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Thu Mar 29 2012 14:19:18 for libnet by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>