config root man

Current Path : /usr/local/share/doc/libnet11/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //usr/local/share/doc/libnet11/libnet-structures_8h-source.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>libnet: libnet-structures.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.4 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
<h1>libnet-structures.h</h1><div class="fragment"><pre>00001 <span class="comment">/*</span>
00002 <span class="comment"> *  $Id: libnet-structures.h,v 1.16 2004/02/16 23:13:38 mike Exp $</span>
00003 <span class="comment"> *</span>
00004 <span class="comment"> *  libnet-structures.h - Network routine library structures header file</span>
00005 <span class="comment"> *</span>
00006 <span class="comment"> *  Copyright (c) 1998 - 2004 Mike D. Schiffman &lt;mike@infonexus.com&gt;</span>
00007 <span class="comment"> *  All rights reserved.</span>
00008 <span class="comment"> *</span>
00009 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span>
00010 <span class="comment"> * modification, are permitted provided that the following conditions</span>
00011 <span class="comment"> * are met:</span>
00012 <span class="comment"> * 1. Redistributions of source code must retain the above copyright</span>
00013 <span class="comment"> *    notice, this list of conditions and the following disclaimer.</span>
00014 <span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span>
00015 <span class="comment"> *    notice, this list of conditions and the following disclaimer in the</span>
00016 <span class="comment"> *    documentation and/or other materials provided with the distribution.</span>
00017 <span class="comment"> *</span>
00018 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND</span>
00019 <span class="comment"> * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span>
00020 <span class="comment"> * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</span>
00021 <span class="comment"> * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE</span>
00022 <span class="comment"> * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL</span>
00023 <span class="comment"> * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS</span>
00024 <span class="comment"> * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)</span>
00025 <span class="comment"> * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT</span>
00026 <span class="comment"> * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY</span>
00027 <span class="comment"> * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</span>
00028 <span class="comment"> * SUCH DAMAGE.</span>
00029 <span class="comment"> *</span>
00030 <span class="comment"> */</span>
00031 
00032 <span class="preprocessor">#ifndef __LIBNET_STRUCTURES_H</span>
00033 <span class="preprocessor"></span><span class="preprocessor">#define __LIBNET_STRUCTURES_H</span>
00034 <span class="preprocessor"></span>
00035 <span class="preprocessor">#if ((__WIN32__) &amp;&amp; !(__CYGWIN__))</span>
00036 <span class="preprocessor"></span><span class="preprocessor">#include "Packet32.h"</span>
00037 <span class="preprocessor">#endif</span>
00038 <span class="preprocessor"></span>
00039 <span class="comment">/* port list chain structure */</span>
00040 <span class="keyword">typedef</span> <span class="keyword">struct </span>libnet_port_list_chain libnet_plist_t;
00041 <span class="keyword">struct </span>libnet_port_list_chain
00042 {
00043     u_int16_t node;                     <span class="comment">/* node number */</span>
00044     u_int16_t bport;                    <span class="comment">/* beggining port */</span>
00045     u_int16_t eport;                    <span class="comment">/* terminating port */</span>
00046     u_int8_t  id;                       <span class="comment">/* global array offset */</span>
00047     libnet_plist_t *next;               <span class="comment">/* next node in the list */</span>
00048 };
00049 
00050 
00051 <span class="comment">/* libnet statistics structure */</span>
00052 <span class="keyword">struct </span>libnet_stats
00053 {
00054 <span class="preprocessor">#if (!defined(__WIN32__) || (__CYGWIN__))</span>
00055 <span class="preprocessor"></span>    u_int64_t packets_sent;             <span class="comment">/* packets sent */</span>
00056     u_int64_t packet_errors;            <span class="comment">/* packets errors */</span>
00057     u_int64_t bytes_written;            <span class="comment">/* bytes written */</span>
00058 <span class="preprocessor">#else</span>
00059 <span class="preprocessor"></span>    __int64 packets_sent;               <span class="comment">/* packets sent */</span>
00060     __int64 packet_errors;              <span class="comment">/* packets errors */</span>
00061     __int64 bytes_written;              <span class="comment">/* bytes written */</span>
00062 <span class="preprocessor">#endif</span>
00063 <span class="preprocessor"></span>};
00064 
00065 
00066 <span class="comment">/*</span>
00067 <span class="comment"> *  Libnet ptags are how we identify specific protocol blocks inside the</span>
00068 <span class="comment"> *  list.</span>
00069 <span class="comment"> */</span>
00070 <span class="keyword">typedef</span> int32_t libnet_ptag_t;
00071 <span class="preprocessor">#define LIBNET_PTAG_INITIALIZER         0</span>
00072 <span class="preprocessor"></span>
00073 
00074 <span class="comment">/*</span>
00075 <span class="comment"> *  Libnet generic protocol block memory object.  Sort of a poor man's mbuf.</span>
00076 <span class="comment"> */</span>
00077 <span class="keyword">struct </span>libnet_protocol_block
00078 {
00079     u_int8_t *buf;                      <span class="comment">/* protocol buffer */</span>
00080     u_int32_t b_len;                    <span class="comment">/* length of buf */</span>
00081     u_int16_t h_len;                    <span class="comment">/* header length (for checksumming) */</span>
00082     u_int32_t copied;                   <span class="comment">/* bytes copied */</span>
00083     u_int8_t type;                      <span class="comment">/* type of pblock */</span>
00084 <span class="comment">/* this needs to be updated every time a new packet builder is added */</span>
00085 <span class="preprocessor">#define LIBNET_PBLOCK_ARP_H             0x01    </span><span class="comment">/* ARP header */</span>
00086 <span class="preprocessor">#define LIBNET_PBLOCK_DHCPV4_H          0x02    </span><span class="comment">/* DHCP v4 header */</span>
00087 <span class="preprocessor">#define LIBNET_PBLOCK_DNSV4_H           0x03    </span><span class="comment">/* DNS v4 header */</span>
00088 <span class="preprocessor">#define LIBNET_PBLOCK_ETH_H             0x04    </span><span class="comment">/* Ethernet header */</span>
00089 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_H          0x05    </span><span class="comment">/* ICMP v4 base header */</span>
00090 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_ECHO_H     0x06    </span><span class="comment">/* ICMP v4 echo header */</span>
00091 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_MASK_H     0x07    </span><span class="comment">/* ICMP v4 mask header */</span>
00092 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_UNREACH_H  0x08    </span><span class="comment">/* ICMP v4 unreach header */</span>
00093 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_TIMXCEED_H 0x09    </span><span class="comment">/* ICMP v4 exceed header */</span>
00094 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_REDIRECT_H 0x0a    </span><span class="comment">/* ICMP v4 redirect header */</span>
00095 <span class="preprocessor">#define LIBNET_PBLOCK_ICMPV4_TS_H       0x0b    </span><span class="comment">/* ICMP v4 timestamp header */</span>
00096 <span class="preprocessor">#define LIBNET_PBLOCK_IGMP_H            0x0c    </span><span class="comment">/* IGMP header */</span>
00097 <span class="preprocessor">#define LIBNET_PBLOCK_IPV4_H            0x0d    </span><span class="comment">/* IP v4 header */</span>
00098 <span class="preprocessor">#define LIBNET_PBLOCK_IPO_H             0x0e    </span><span class="comment">/* IP v4 options */</span>
00099 <span class="preprocessor">#define LIBNET_PBLOCK_IPDATA            0x0f    </span><span class="comment">/* IP data */</span>
00100 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_H            0x10    </span><span class="comment">/* OSPF base header */</span>
00101 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_HELLO_H      0x11    </span><span class="comment">/* OSPF hello header */</span>
00102 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_DBD_H        0x12    </span><span class="comment">/* OSPF dbd header */</span>
00103 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_LSR_H        0x13    </span><span class="comment">/* OSPF lsr header */</span>
00104 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_LSU_H        0x14    </span><span class="comment">/* OSPF lsu header */</span>
00105 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_LSA_H        0x15    </span><span class="comment">/* OSPF lsa header */</span>
00106 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_AUTH_H       0x16    </span><span class="comment">/* OSPF auth header */</span>
00107 <span class="preprocessor">#define LIBNET_PBLOCK_OSPF_CKSUM        0x17    </span><span class="comment">/* OSPF checksum header */</span>
00108 <span class="preprocessor">#define LIBNET_PBLOCK_LS_RTR_H          0x18    </span><span class="comment">/* linkstate rtr header */</span>
00109 <span class="preprocessor">#define LIBNET_PBLOCK_LS_NET_H          0x19    </span><span class="comment">/* linkstate net header */</span>
00110 <span class="preprocessor">#define LIBNET_PBLOCK_LS_SUM_H          0x1a    </span><span class="comment">/* linkstate as sum header */</span>
00111 <span class="preprocessor">#define LIBNET_PBLOCK_LS_AS_EXT_H       0x1b    </span><span class="comment">/* linkstate as ext header */</span>
00112 <span class="preprocessor">#define LIBNET_PBLOCK_NTP_H             0x1c    </span><span class="comment">/* NTP header */</span>
00113 <span class="preprocessor">#define LIBNET_PBLOCK_RIP_H             0x1d    </span><span class="comment">/* RIP header */</span>
00114 <span class="preprocessor">#define LIBNET_PBLOCK_TCP_H             0x1e    </span><span class="comment">/* TCP header */</span>
00115 <span class="preprocessor">#define LIBNET_PBLOCK_TCPO_H            0x1f    </span><span class="comment">/* TCP options */</span>
00116 <span class="preprocessor">#define LIBNET_PBLOCK_TCPDATA           0x20    </span><span class="comment">/* TCP data */</span>
00117 <span class="preprocessor">#define LIBNET_PBLOCK_UDP_H             0x21    </span><span class="comment">/* UDP header */</span>
00118 <span class="preprocessor">#define LIBNET_PBLOCK_VRRP_H            0x22    </span><span class="comment">/* VRRP header */</span>
00119 <span class="preprocessor">#define LIBNET_PBLOCK_DATA_H            0x23    </span><span class="comment">/* generic data */</span>
00120 <span class="preprocessor">#define LIBNET_PBLOCK_CDP_H             0x24    </span><span class="comment">/* CDP header */</span>
00121 <span class="preprocessor">#define LIBNET_PBLOCK_IPSEC_ESP_HDR_H   0x25    </span><span class="comment">/* IPSEC ESP header */</span>
00122 <span class="preprocessor">#define LIBNET_PBLOCK_IPSEC_ESP_FTR_H   0x26    </span><span class="comment">/* IPSEC ESP footer */</span>
00123 <span class="preprocessor">#define LIBNET_PBLOCK_IPSEC_AH_H        0x27    </span><span class="comment">/* IPSEC AH header */</span>
00124 <span class="preprocessor">#define LIBNET_PBLOCK_802_1Q_H          0x28    </span><span class="comment">/* 802.1q header */</span>
00125 <span class="preprocessor">#define LIBNET_PBLOCK_802_2_H           0x29    </span><span class="comment">/* 802.2 header */</span>
00126 <span class="preprocessor">#define LIBNET_PBLOCK_802_2SNAP_H       0x2a    </span><span class="comment">/* 802.2 SNAP header */</span>
00127 <span class="preprocessor">#define LIBNET_PBLOCK_802_3_H           0x2b    </span><span class="comment">/* 802.3 header */</span>
00128 <span class="preprocessor">#define LIBNET_PBLOCK_STP_CONF_H        0x2c    </span><span class="comment">/* STP configuration header */</span>
00129 <span class="preprocessor">#define LIBNET_PBLOCK_STP_TCN_H         0x2d    </span><span class="comment">/* STP TCN header */</span>
00130 <span class="preprocessor">#define LIBNET_PBLOCK_ISL_H             0x2e    </span><span class="comment">/* ISL header */</span>
00131 <span class="preprocessor">#define LIBNET_PBLOCK_IPV6_H            0x2f    </span><span class="comment">/* IP v6 header */</span>
00132 <span class="preprocessor">#define LIBNET_PBLOCK_802_1X_H          0x30    </span><span class="comment">/* 802.1x header */</span>
00133 <span class="preprocessor">#define LIBNET_PBLOCK_RPC_CALL_H        0x31    </span><span class="comment">/* RPC Call header */</span>
00134 <span class="preprocessor">#define LIBNET_PBLOCK_MPLS_H            0x32    </span><span class="comment">/* MPLS header */</span>
00135 <span class="preprocessor">#define LIBNET_PBLOCK_FDDI_H            0x33    </span><span class="comment">/* FDDI header */</span>
00136 <span class="preprocessor">#define LIBNET_PBLOCK_TOKEN_RING_H      0x34    </span><span class="comment">/* TOKEN RING header */</span>
00137 <span class="preprocessor">#define LIBNET_PBLOCK_BGP4_HEADER_H     0x35    </span><span class="comment">/* BGP4 header */</span>
00138 <span class="preprocessor">#define LIBNET_PBLOCK_BGP4_OPEN_H       0x36    </span><span class="comment">/* BGP4 open header */</span>
00139 <span class="preprocessor">#define LIBNET_PBLOCK_BGP4_UPDATE_H     0x37    </span><span class="comment">/* BGP4 update header */</span>
00140 <span class="preprocessor">#define LIBNET_PBLOCK_BGP4_NOTIFICATION_H 0x38  </span><span class="comment">/* BGP4 notification header */</span>
00141 <span class="preprocessor">#define LIBNET_PBLOCK_GRE_H             0x39    </span><span class="comment">/* GRE header */</span>
00142 <span class="preprocessor">#define LIBNET_PBLOCK_GRE_SRE_H         0x3a    </span><span class="comment">/* GRE SRE header */</span>
00143 <span class="preprocessor">#define LIBNET_PBLOCK_IPV6_FRAG_H       0x3b    </span><span class="comment">/* IPv6 frag header */</span>
00144 <span class="preprocessor">#define LIBNET_PBLOCK_IPV6_ROUTING_H    0x3c    </span><span class="comment">/* IPv6 routing header */</span>
00145 <span class="preprocessor">#define LIBNET_PBLOCK_IPV6_DESTOPTS_H   0x3d    </span><span class="comment">/* IPv6 dest opts header */</span>
00146 <span class="preprocessor">#define LIBNET_PBLOCK_IPV6_HBHOPTS_H    0x3e    </span><span class="comment">/* IPv6 hop/hop opts header */</span>
00147 <span class="preprocessor">#define LIBNET_PBLOCK_SEBEK_H           0x3f    </span><span class="comment">/* Sebek header */</span>
00148     u_int8_t flags;                             <span class="comment">/* control flags */</span>
00149 <span class="preprocessor">#define LIBNET_PBLOCK_DO_CHECKSUM       0x01    </span><span class="comment">/* needs a checksum */</span>
00150     libnet_ptag_t ptag;                 <span class="comment">/* protocol block tag */</span>
00151     <span class="keyword">struct </span>libnet_protocol_block *next; <span class="comment">/* next pblock */</span>
00152     <span class="keyword">struct </span>libnet_protocol_block *prev; <span class="comment">/* prev pblock */</span>
00153 };
00154 <span class="keyword">typedef</span> <span class="keyword">struct </span>libnet_protocol_block libnet_pblock_t;
00155 
00156 
00157 <span class="comment">/*</span>
00158 <span class="comment"> *  Libnet context</span>
00159 <span class="comment"> *  Opaque structure.  Nothing in here should ever been touched first hand by</span>
00160 <span class="comment"> *  the applications programmer.</span>
00161 <span class="comment"> */</span>
00162 <span class="keyword">struct </span>libnet_context
00163 {
00164 <span class="preprocessor">#if ((__WIN32__) &amp;&amp; !(__CYGWIN__)) </span>
00165 <span class="preprocessor"></span>    SOCKET fd;
00166     LPADAPTER  lpAdapter;
00167 <span class="preprocessor">#else</span>
00168 <span class="preprocessor"></span>    <span class="keywordtype">int</span> fd;                             <span class="comment">/* file descriptor of packet device */</span>
00169 <span class="preprocessor">#endif</span>
00170 <span class="preprocessor"></span>    <span class="keywordtype">int</span> injection_type;                 <span class="comment">/* raw (ipv4 or ipv6) or link */</span>
00171 <span class="preprocessor">#define LIBNET_LINK     0x00            </span><span class="comment">/* link-layer interface */</span>
00172 <span class="preprocessor">#define LIBNET_RAW4     0x01            </span><span class="comment">/* raw socket interface (ipv4) */</span>
00173 <span class="preprocessor">#define LIBNET_RAW6     0x02            </span><span class="comment">/* raw socket interface (ipv6) */</span>
00174 <span class="comment">/* the following should actually set a flag in the flags variable above */</span>
00175 <span class="preprocessor">#define LIBNET_LINK_ADV 0x08            </span><span class="comment">/* advanced mode link-layer */</span>
00176 <span class="preprocessor">#define LIBNET_RAW4_ADV 0x09            </span><span class="comment">/* advanced mode raw socket (ipv4) */</span>
00177 <span class="preprocessor">#define LIBNET_RAW6_ADV 0x0a            </span><span class="comment">/* advanced mode raw socket (ipv6) */</span>
00178 <span class="preprocessor">#define LIBNET_ADV_MASK 0x08            </span><span class="comment">/* mask to determine adv mode */</span>
00179 
00180     libnet_pblock_t *protocol_blocks;   <span class="comment">/* protocol headers / data */</span>
00181     libnet_pblock_t *pblock_end;        <span class="comment">/* last node in list */</span>
00182 
00183     <span class="keywordtype">int</span> link_type;                      <span class="comment">/* link-layer type */</span>
00184     <span class="keywordtype">int</span> link_offset;                    <span class="comment">/* link-layer header size */</span>
00185     <span class="keywordtype">int</span> aligner;                        <span class="comment">/* used to align packets */</span>
00186     <span class="keywordtype">char</span> *device;                       <span class="comment">/* device name */</span>
00187 
00188     <span class="keyword">struct </span>libnet_stats stats;          <span class="comment">/* statistics */</span>
00189     libnet_ptag_t ptag_state;           <span class="comment">/* state holder for pblock tag */</span>
00190     <span class="keywordtype">char</span> label[LIBNET_LABEL_SIZE];      <span class="comment">/* textual label for cq interface */</span>
00191 
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>
00193     u_int32_t total_size;               <span class="comment">/* total size */</span>
00194 };
00195 <span class="keyword">typedef</span> <span class="keyword">struct </span>libnet_context libnet_t;
00196 
00197 <span class="comment">/*</span>
00198 <span class="comment"> *  Libnet context queue structure</span>
00199 <span class="comment"> *  Opaque structure.  Nothing in here should ever been touched first hand by</span>
00200 <span class="comment"> *  the applications programmer.</span>
00201 <span class="comment"> */</span>
00202 <span class="keyword">typedef</span> <span class="keyword">struct </span>_libnet_context_queue libnet_cq_t;
00203 <span class="keyword">struct </span>_libnet_context_queue
00204 {
00205     libnet_t *context;                  <span class="comment">/* pointer to libnet context */</span>
00206     libnet_cq_t *next;                  <span class="comment">/* next node in the list */</span>
00207     libnet_cq_t *prev;                  <span class="comment">/* previous node in the list */</span>
00208 };
00209 
00210 <span class="keyword">struct </span>_libnet_context_queue_descriptor
00211 {
00212     u_int32_t node;                     <span class="comment">/* number of nodes in the list */</span>
00213     u_int32_t cq_lock;                  <span class="comment">/* lock status */</span>
00214     libnet_cq_t *current;               <span class="comment">/* current context */</span>
00215 };
00216 <span class="keyword">typedef</span> <span class="keyword">struct </span>_libnet_context_queue_descriptor libnet_cqd_t;
00217 
00218 <span class="preprocessor">#endif  </span><span class="comment">/* __LIBNET_STRUCTURES_H */</span>
00219 
00220 <span class="comment">/* EOF */</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Wed Mar 10 13:23:37 2004 for libnet by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 > 
</a>1.3.4 </small></address>
</body>
</html>

Man Man