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