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 HTML 4.01 Transitional//EN">
2: <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3: <title>libnet: libnet-structures.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-structures.h</h1><div class="fragment"><pre>00001 <span class="comment">/*</span>
9: 00002 <span class="comment"> * $Id: libnet-structures.h,v 1.16 2004/02/16 23:13:38 mike Exp $</span>
10: 00003 <span class="comment"> *</span>
11: 00004 <span class="comment"> * libnet-structures.h - Network routine library structures 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_STRUCTURES_H</span>
40: 00033 <span class="preprocessor"></span><span class="preprocessor">#define __LIBNET_STRUCTURES_H</span>
41: 00034 <span class="preprocessor"></span>
42: 00035 <span class="preprocessor">#if ((__WIN32__) && !(__CYGWIN__))</span>
43: 00036 <span class="preprocessor"></span><span class="preprocessor">#include "Packet32.h"</span>
44: 00037 <span class="preprocessor">#endif</span>
45: 00038 <span class="preprocessor"></span>
46: 00039 <span class="comment">/* port list chain structure */</span>
47: 00040 <span class="keyword">typedef</span> <span class="keyword">struct </span>libnet_port_list_chain libnet_plist_t;
48: 00041 <span class="keyword">struct </span>libnet_port_list_chain
49: 00042 {
50: 00043 u_int16_t node; <span class="comment">/* node number */</span>
51: 00044 u_int16_t bport; <span class="comment">/* beggining port */</span>
52: 00045 u_int16_t eport; <span class="comment">/* terminating port */</span>
53: 00046 u_int8_t id; <span class="comment">/* global array offset */</span>
54: 00047 libnet_plist_t *next; <span class="comment">/* next node in the list */</span>
55: 00048 };
56: 00049
57: 00050
58: 00051 <span class="comment">/* libnet statistics structure */</span>
59: 00052 <span class="keyword">struct </span>libnet_stats
60: 00053 {
61: 00054 <span class="preprocessor">#if (!defined(__WIN32__) || (__CYGWIN__))</span>
62: 00055 <span class="preprocessor"></span> u_int64_t packets_sent; <span class="comment">/* packets sent */</span>
63: 00056 u_int64_t packet_errors; <span class="comment">/* packets errors */</span>
64: 00057 u_int64_t bytes_written; <span class="comment">/* bytes written */</span>
65: 00058 <span class="preprocessor">#else</span>
66: 00059 <span class="preprocessor"></span> __int64 packets_sent; <span class="comment">/* packets sent */</span>
67: 00060 __int64 packet_errors; <span class="comment">/* packets errors */</span>
68: 00061 __int64 bytes_written; <span class="comment">/* bytes written */</span>
69: 00062 <span class="preprocessor">#endif</span>
70: 00063 <span class="preprocessor"></span>};
71: 00064
72: 00065
73: 00066 <span class="comment">/*</span>
74: 00067 <span class="comment"> * Libnet ptags are how we identify specific protocol blocks inside the</span>
75: 00068 <span class="comment"> * list.</span>
76: 00069 <span class="comment"> */</span>
77: 00070 <span class="keyword">typedef</span> int32_t libnet_ptag_t;
78: 00071 <span class="preprocessor">#define LIBNET_PTAG_INITIALIZER 0</span>
79: 00072 <span class="preprocessor"></span>
80: 00073
81: 00074 <span class="comment">/*</span>
82: 00075 <span class="comment"> * Libnet generic protocol block memory object. Sort of a poor man's mbuf.</span>
83: 00076 <span class="comment"> */</span>
84: 00077 <span class="keyword">struct </span>libnet_protocol_block
85: 00078 {
86: 00079 u_int8_t *buf; <span class="comment">/* protocol buffer */</span>
87: 00080 u_int32_t b_len; <span class="comment">/* length of buf */</span>
88: 00081 u_int16_t h_len; <span class="comment">/* header length (for checksumming) */</span>
89: 00082 u_int32_t copied; <span class="comment">/* bytes copied */</span>
90: 00083 u_int8_t type; <span class="comment">/* type of pblock */</span>
91: 00084 <span class="comment">/* this needs to be updated every time a new packet builder is added */</span>
92: 00085 <span class="preprocessor">#define LIBNET_PBLOCK_ARP_H 0x01 </span><span class="comment">/* ARP header */</span>
93: 00086 <span class="preprocessor">#define LIBNET_PBLOCK_DHCPV4_H 0x02 </span><span class="comment">/* DHCP v4 header */</span>
94: 00087 <span class="preprocessor">#define LIBNET_PBLOCK_DNSV4_H 0x03 </span><span class="comment">/* DNS v4 header */</span>
95: 00088 <span class="preprocessor">#define LIBNET_PBLOCK_ETH_H 0x04 </span><span class="comment">/* Ethernet header */</span>
96: 00089 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_H 0x05 </span><span class="comment">/* ICMP v4 base header */</span>
97: 00090 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_ECHO_H 0x06 </span><span class="comment">/* ICMP v4 echo header */</span>
98: 00091 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_MASK_H 0x07 </span><span class="comment">/* ICMP v4 mask header */</span>
99: 00092 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_UNREACH_H 0x08 </span><span class="comment">/* ICMP v4 unreach header */</span>
100: 00093 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_TIMXCEED_H 0x09 </span><span class="comment">/* ICMP v4 exceed header */</span>
101: 00094 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_REDIRECT_H 0x0a </span><span class="comment">/* ICMP v4 redirect header */</span>
102: 00095 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_TS_H 0x0b </span><span class="comment">/* ICMP v4 timestamp header */</span>
103: 00096 <span class="preprocessor">#define LIBNET_PBLOCK_IGMP_H 0x0c </span><span class="comment">/* IGMP header */</span>
104: 00097 <span class="preprocessor">#define LIBNET_PBLOCK_IPV4_H 0x0d </span><span class="comment">/* IP v4 header */</span>
105: 00098 <span class="preprocessor">#define LIBNET_PBLOCK_IPO_H 0x0e </span><span class="comment">/* IP v4 options */</span>
106: 00099 <span class="preprocessor">#define LIBNET_PBLOCK_IPDATA 0x0f </span><span class="comment">/* IP data */</span>
107: 00100 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_H 0x10 </span><span class="comment">/* OSPF base header */</span>
108: 00101 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_HELLO_H 0x11 </span><span class="comment">/* OSPF hello header */</span>
109: 00102 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_DBD_H 0x12 </span><span class="comment">/* OSPF dbd header */</span>
110: 00103 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_LSR_H 0x13 </span><span class="comment">/* OSPF lsr header */</span>
111: 00104 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_LSU_H 0x14 </span><span class="comment">/* OSPF lsu header */</span>
112: 00105 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_LSA_H 0x15 </span><span class="comment">/* OSPF lsa header */</span>
113: 00106 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_AUTH_H 0x16 </span><span class="comment">/* OSPF auth header */</span>
114: 00107 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_CKSUM 0x17 </span><span class="comment">/* OSPF checksum header */</span>
115: 00108 <span class="preprocessor">#define LIBNET_PBLOCK_LS_RTR_H 0x18 </span><span class="comment">/* linkstate rtr header */</span>
116: 00109 <span class="preprocessor">#define LIBNET_PBLOCK_LS_NET_H 0x19 </span><span class="comment">/* linkstate net header */</span>
117: 00110 <span class="preprocessor">#define LIBNET_PBLOCK_LS_SUM_H 0x1a </span><span class="comment">/* linkstate as sum header */</span>
118: 00111 <span class="preprocessor">#define LIBNET_PBLOCK_LS_AS_EXT_H 0x1b </span><span class="comment">/* linkstate as ext header */</span>
119: 00112 <span class="preprocessor">#define LIBNET_PBLOCK_NTP_H 0x1c </span><span class="comment">/* NTP header */</span>
120: 00113 <span class="preprocessor">#define LIBNET_PBLOCK_RIP_H 0x1d </span><span class="comment">/* RIP header */</span>
121: 00114 <span class="preprocessor">#define LIBNET_PBLOCK_TCP_H 0x1e </span><span class="comment">/* TCP header */</span>
122: 00115 <span class="preprocessor">#define LIBNET_PBLOCK_TCPO_H 0x1f </span><span class="comment">/* TCP options */</span>
123: 00116 <span class="preprocessor">#define LIBNET_PBLOCK_TCPDATA 0x20 </span><span class="comment">/* TCP data */</span>
124: 00117 <span class="preprocessor">#define LIBNET_PBLOCK_UDP_H 0x21 </span><span class="comment">/* UDP header */</span>
125: 00118 <span class="preprocessor">#define LIBNET_PBLOCK_VRRP_H 0x22 </span><span class="comment">/* VRRP header */</span>
126: 00119 <span class="preprocessor">#define LIBNET_PBLOCK_DATA_H 0x23 </span><span class="comment">/* generic data */</span>
127: 00120 <span class="preprocessor">#define LIBNET_PBLOCK_CDP_H 0x24 </span><span class="comment">/* CDP header */</span>
128: 00121 <span class="preprocessor">#define LIBNET_PBLOCK_IPSEC_ESP_HDR_H 0x25 </span><span class="comment">/* IPSEC ESP header */</span>
129: 00122 <span class="preprocessor">#define LIBNET_PBLOCK_IPSEC_ESP_FTR_H 0x26 </span><span class="comment">/* IPSEC ESP footer */</span>
130: 00123 <span class="preprocessor">#define LIBNET_PBLOCK_IPSEC_AH_H 0x27 </span><span class="comment">/* IPSEC AH header */</span>
131: 00124 <span class="preprocessor">#define LIBNET_PBLOCK_802_1Q_H 0x28 </span><span class="comment">/* 802.1q header */</span>
132: 00125 <span class="preprocessor">#define LIBNET_PBLOCK_802_2_H 0x29 </span><span class="comment">/* 802.2 header */</span>
133: 00126 <span class="preprocessor">#define LIBNET_PBLOCK_802_2SNAP_H 0x2a </span><span class="comment">/* 802.2 SNAP header */</span>
134: 00127 <span class="preprocessor">#define LIBNET_PBLOCK_802_3_H 0x2b </span><span class="comment">/* 802.3 header */</span>
135: 00128 <span class="preprocessor">#define LIBNET_PBLOCK_STP_CONF_H 0x2c </span><span class="comment">/* STP configuration header */</span>
136: 00129 <span class="preprocessor">#define LIBNET_PBLOCK_STP_TCN_H 0x2d </span><span class="comment">/* STP TCN header */</span>
137: 00130 <span class="preprocessor">#define LIBNET_PBLOCK_ISL_H 0x2e </span><span class="comment">/* ISL header */</span>
138: 00131 <span class="preprocessor">#define LIBNET_PBLOCK_IPV6_H 0x2f </span><span class="comment">/* IP v6 header */</span>
139: 00132 <span class="preprocessor">#define LIBNET_PBLOCK_802_1X_H 0x30 </span><span class="comment">/* 802.1x header */</span>
140: 00133 <span class="preprocessor">#define LIBNET_PBLOCK_RPC_CALL_H 0x31 </span><span class="comment">/* RPC Call header */</span>
141: 00134 <span class="preprocessor">#define LIBNET_PBLOCK_MPLS_H 0x32 </span><span class="comment">/* MPLS header */</span>
142: 00135 <span class="preprocessor">#define LIBNET_PBLOCK_FDDI_H 0x33 </span><span class="comment">/* FDDI header */</span>
143: 00136 <span class="preprocessor">#define LIBNET_PBLOCK_TOKEN_RING_H 0x34 </span><span class="comment">/* TOKEN RING header */</span>
144: 00137 <span class="preprocessor">#define LIBNET_PBLOCK_BGP4_HEADER_H 0x35 </span><span class="comment">/* BGP4 header */</span>
145: 00138 <span class="preprocessor">#define LIBNET_PBLOCK_BGP4_OPEN_H 0x36 </span><span class="comment">/* BGP4 open header */</span>
146: 00139 <span class="preprocessor">#define LIBNET_PBLOCK_BGP4_UPDATE_H 0x37 </span><span class="comment">/* BGP4 update header */</span>
147: 00140 <span class="preprocessor">#define LIBNET_PBLOCK_BGP4_NOTIFICATION_H 0x38 </span><span class="comment">/* BGP4 notification header */</span>
148: 00141 <span class="preprocessor">#define LIBNET_PBLOCK_GRE_H 0x39 </span><span class="comment">/* GRE header */</span>
149: 00142 <span class="preprocessor">#define LIBNET_PBLOCK_GRE_SRE_H 0x3a </span><span class="comment">/* GRE SRE header */</span>
150: 00143 <span class="preprocessor">#define LIBNET_PBLOCK_IPV6_FRAG_H 0x3b </span><span class="comment">/* IPv6 frag header */</span>
151: 00144 <span class="preprocessor">#define LIBNET_PBLOCK_IPV6_ROUTING_H 0x3c </span><span class="comment">/* IPv6 routing header */</span>
152: 00145 <span class="preprocessor">#define LIBNET_PBLOCK_IPV6_DESTOPTS_H 0x3d </span><span class="comment">/* IPv6 dest opts header */</span>
153: 00146 <span class="preprocessor">#define LIBNET_PBLOCK_IPV6_HBHOPTS_H 0x3e </span><span class="comment">/* IPv6 hop/hop opts header */</span>
154: 00147 <span class="preprocessor">#define LIBNET_PBLOCK_SEBEK_H 0x3f </span><span class="comment">/* Sebek header */</span>
155: 00148 u_int8_t flags; <span class="comment">/* control flags */</span>
156: 00149 <span class="preprocessor">#define LIBNET_PBLOCK_DO_CHECKSUM 0x01 </span><span class="comment">/* needs a checksum */</span>
157: 00150 libnet_ptag_t ptag; <span class="comment">/* protocol block tag */</span>
158: 00151 <span class="keyword">struct </span>libnet_protocol_block *next; <span class="comment">/* next pblock */</span>
159: 00152 <span class="keyword">struct </span>libnet_protocol_block *prev; <span class="comment">/* prev pblock */</span>
160: 00153 };
161: 00154 <span class="keyword">typedef</span> <span class="keyword">struct </span>libnet_protocol_block libnet_pblock_t;
162: 00155
163: 00156
164: 00157 <span class="comment">/*</span>
165: 00158 <span class="comment"> * Libnet context</span>
166: 00159 <span class="comment"> * Opaque structure. Nothing in here should ever been touched first hand by</span>
167: 00160 <span class="comment"> * the applications programmer.</span>
168: 00161 <span class="comment"> */</span>
169: 00162 <span class="keyword">struct </span>libnet_context
170: 00163 {
171: 00164 <span class="preprocessor">#if ((__WIN32__) && !(__CYGWIN__)) </span>
172: 00165 <span class="preprocessor"></span> SOCKET fd;
173: 00166 LPADAPTER lpAdapter;
174: 00167 <span class="preprocessor">#else</span>
175: 00168 <span class="preprocessor"></span> <span class="keywordtype">int</span> fd; <span class="comment">/* file descriptor of packet device */</span>
176: 00169 <span class="preprocessor">#endif</span>
177: 00170 <span class="preprocessor"></span> <span class="keywordtype">int</span> injection_type; <span class="comment">/* raw (ipv4 or ipv6) or link */</span>
178: 00171 <span class="preprocessor">#define LIBNET_LINK 0x00 </span><span class="comment">/* link-layer interface */</span>
179: 00172 <span class="preprocessor">#define LIBNET_RAW4 0x01 </span><span class="comment">/* raw socket interface (ipv4) */</span>
180: 00173 <span class="preprocessor">#define LIBNET_RAW6 0x02 </span><span class="comment">/* raw socket interface (ipv6) */</span>
181: 00174 <span class="comment">/* the following should actually set a flag in the flags variable above */</span>
182: 00175 <span class="preprocessor">#define LIBNET_LINK_ADV 0x08 </span><span class="comment">/* advanced mode link-layer */</span>
183: 00176 <span class="preprocessor">#define LIBNET_RAW4_ADV 0x09 </span><span class="comment">/* advanced mode raw socket (ipv4) */</span>
184: 00177 <span class="preprocessor">#define LIBNET_RAW6_ADV 0x0a </span><span class="comment">/* advanced mode raw socket (ipv6) */</span>
185: 00178 <span class="preprocessor">#define LIBNET_ADV_MASK 0x08 </span><span class="comment">/* mask to determine adv mode */</span>
186: 00179
187: 00180 libnet_pblock_t *protocol_blocks; <span class="comment">/* protocol headers / data */</span>
188: 00181 libnet_pblock_t *pblock_end; <span class="comment">/* last node in list */</span>
189: 00182
190: 00183 <span class="keywordtype">int</span> link_type; <span class="comment">/* link-layer type */</span>
191: 00184 <span class="keywordtype">int</span> link_offset; <span class="comment">/* link-layer header size */</span>
192: 00185 <span class="keywordtype">int</span> aligner; <span class="comment">/* used to align packets */</span>
193: 00186 <span class="keywordtype">char</span> *device; <span class="comment">/* device name */</span>
194: 00187
195: 00188 <span class="keyword">struct </span>libnet_stats stats; <span class="comment">/* statistics */</span>
196: 00189 libnet_ptag_t ptag_state; <span class="comment">/* state holder for pblock tag */</span>
197: 00190 <span class="keywordtype">char</span> label[LIBNET_LABEL_SIZE]; <span class="comment">/* textual label for cq interface */</span>
198: 00191
199: 00192 <span class="keywordtype">char</span> err_buf[<a class="code" href="libnet-macros_8h.html#a18">LIBNET_ERRBUF_SIZE</a>]; <span class="comment">/* error buffer */</span>
200: 00193 u_int32_t total_size; <span class="comment">/* total size */</span>
201: 00194 };
202: 00195 <span class="keyword">typedef</span> <span class="keyword">struct </span>libnet_context libnet_t;
203: 00196
204: 00197 <span class="comment">/*</span>
205: 00198 <span class="comment"> * Libnet context queue structure</span>
206: 00199 <span class="comment"> * Opaque structure. Nothing in here should ever been touched first hand by</span>
207: 00200 <span class="comment"> * the applications programmer.</span>
208: 00201 <span class="comment"> */</span>
209: 00202 <span class="keyword">typedef</span> <span class="keyword">struct </span>_libnet_context_queue libnet_cq_t;
210: 00203 <span class="keyword">struct </span>_libnet_context_queue
211: 00204 {
212: 00205 libnet_t *context; <span class="comment">/* pointer to libnet context */</span>
213: 00206 libnet_cq_t *next; <span class="comment">/* next node in the list */</span>
214: 00207 libnet_cq_t *prev; <span class="comment">/* previous node in the list */</span>
215: 00208 };
216: 00209
217: 00210 <span class="keyword">struct </span>_libnet_context_queue_descriptor
218: 00211 {
219: 00212 u_int32_t node; <span class="comment">/* number of nodes in the list */</span>
220: 00213 u_int32_t cq_lock; <span class="comment">/* lock status */</span>
221: 00214 libnet_cq_t *current; <span class="comment">/* current context */</span>
222: 00215 };
223: 00216 <span class="keyword">typedef</span> <span class="keyword">struct </span>_libnet_context_queue_descriptor libnet_cqd_t;
224: 00217
225: 00218 <span class="preprocessor">#endif </span><span class="comment">/* __LIBNET_STRUCTURES_H */</span>
226: 00219
227: 00220 <span class="comment">/* EOF */</span>
228: </pre></div><hr size="1"><address style="align: right;"><small>Generated on Wed Mar 10 13:23:37 2004 for libnet by
229: <a href="http://www.doxygen.org/index.html">
230: <img src="doxygen.png" alt="doxygen" align="middle" border=0 >
231: </a>1.3.4 </small></address>
232: </body>
233: </html>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>