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-macros_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-macros.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-macros.h</h1><a href="libnet-macros_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span>
00002 <span class="comment"> *  $Id: libnet-macros.h,v 1.6 2004/03/01 20:26:12 mike Exp $</span>
00003 <span class="comment"> *</span>
00004 <span class="comment"> *  libnet-macros.h - Network routine library macro 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_MACROS_H</span>
00033 <span class="preprocessor"></span><span class="preprocessor">#define __LIBNET_MACROS_H</span>
00034 <span class="preprocessor"></span>
00039 <span class="comment">/* for systems without snprintf */</span>
00040 <span class="preprocessor">#if defined(NO_SNPRINTF)</span>
00041 <span class="preprocessor"></span><span class="preprocessor">#define snprintf(buf, len, args...) sprintf(buf, ##args)</span>
00042 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00043 <span class="preprocessor"></span>
00044 
<a name="l00049"></a><a class="code" href="libnet-macros_8h.html#a0">00049</a> <span class="preprocessor">#define LIBNET_DONT_RESOLVE 0</span>
00050 <span class="preprocessor"></span>
<a name="l00055"></a><a class="code" href="libnet-macros_8h.html#a1">00055</a> <span class="preprocessor">#define LIBNET_RESOLVE      1</span>
00056 <span class="preprocessor"></span>
<a name="l00060"></a><a class="code" href="libnet-macros_8h.html#a2">00060</a> <span class="preprocessor">#define LIBNET_ON   0</span>
00061 <span class="preprocessor"></span>
<a name="l00065"></a><a class="code" href="libnet-macros_8h.html#a3">00065</a> <span class="preprocessor">#define LIBNET_OFF  1</span>
00066 <span class="preprocessor"></span>
00070 <span class="preprocessor">#ifndef IN6ADDR_ERROR_INIT</span>
<a name="l00071"></a><a class="code" href="libnet-macros_8h.html#a4">00071</a> <span class="preprocessor"></span><span class="preprocessor">#define IN6ADDR_ERROR_INIT { { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \</span>
00072 <span class="preprocessor">                                 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \</span>
00073 <span class="preprocessor">                                 0xff, 0xff } } }</span>
00074 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00075 <span class="preprocessor"></span>
<a name="l00079"></a><a class="code" href="libnet-macros_8h.html#a5">00079</a> <span class="preprocessor">#define LIBNET_PR2          0</span>
00080 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PR8          1</span>
00081 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PR16         2</span>
00082 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PRu16        3</span>
00083 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PR32         4</span>
00084 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PRu32        5</span>
00085 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_PRAND_MAX    0xffffffff</span>
00086 <span class="preprocessor"></span>
<a name="l00090"></a><a class="code" href="libnet-macros_8h.html#a12">00090</a> <span class="preprocessor">#define LIBNET_MAX_PACKET   0xffff</span>
00091 <span class="preprocessor"></span><span class="preprocessor">#ifndef IP_MAXPACKET</span>
00092 <span class="preprocessor"></span><span class="preprocessor">#define IP_MAXPACKET        0xffff</span>
00093 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00094 <span class="preprocessor"></span>
00095 
00096 <span class="comment">/* ethernet addresses are 6 octets long */</span>
00097 <span class="preprocessor">#ifndef ETHER_ADDR_LEN</span>
00098 <span class="preprocessor"></span><span class="preprocessor">#define ETHER_ADDR_LEN      0x6</span>
00099 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00100 <span class="preprocessor"></span>
00101 <span class="comment">/* FDDI addresses are 6 octets long */</span>
00102 <span class="preprocessor">#ifndef FDDI_ADDR_LEN</span>
00103 <span class="preprocessor"></span><span class="preprocessor">#define FDDI_ADDR_LEN       0x6</span>
00104 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00105 <span class="preprocessor"></span>
00106 <span class="comment">/* token ring addresses are 6 octets long */</span>
00107 <span class="preprocessor">#ifndef TOKEN_RING_ADDR_LEN</span>
00108 <span class="preprocessor"></span><span class="preprocessor">#define TOKEN_RING_ADDR_LEN 0x6</span>
00109 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00110 <span class="preprocessor"></span>
00111 <span class="comment">/* LLC Organization Code is 3 bytes long */</span>
00112 <span class="preprocessor">#define LIBNET_ORG_CODE_SIZE  0x3</span>
00113 <span class="preprocessor"></span>
<a name="l00117"></a><a class="code" href="libnet-macros_8h.html#a18">00117</a> <span class="preprocessor">#define LIBNET_ERRBUF_SIZE      0x100</span>
00118 <span class="preprocessor"></span>
<a name="l00122"></a><a class="code" href="libnet-macros_8h.html#a19">00122</a> <span class="preprocessor">#define LIBNET_MAXOPTION_SIZE   0x28</span>
00123 <span class="preprocessor"></span>
00124 <span class="comment">/* some BSD variants have this endianess problem */</span>
00125 <span class="preprocessor">#if (LIBNET_BSD_BYTE_SWAP)</span>
00126 <span class="preprocessor"></span><span class="preprocessor">#define FIX(n)      ntohs(n)</span>
00127 <span class="preprocessor"></span><span class="preprocessor">#define UNFIX(n)    htons(n)</span>
00128 <span class="preprocessor"></span><span class="preprocessor">#else</span>
00129 <span class="preprocessor"></span><span class="preprocessor">#define FIX(n)      (n)</span>
00130 <span class="preprocessor"></span><span class="preprocessor">#define UNFIX(n)    (n)</span>
00131 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00132 <span class="preprocessor"></span>
00133 <span class="comment">/* used internally for checksum stuff */</span>
00134 <span class="preprocessor">#define LIBNET_CKSUM_CARRY(x) \</span>
00135 <span class="preprocessor">    (x = (x &gt;&gt; 16) + (x &amp; 0xffff), (~(x + (x &gt;&gt; 16)) &amp; 0xffff))</span>
00136 <span class="preprocessor"></span>
00137 <span class="comment">/* used interally for OSPF stuff */</span>
00138 <span class="preprocessor">#define LIBNET_OSPF_AUTHCPY(x, y) \</span>
00139 <span class="preprocessor">    memcpy((u_int8_t *)x, (u_int8_t *)y, sizeof(y))</span>
00140 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_OSPF_CKSUMBUF(x, y) \</span>
00141 <span class="preprocessor">    memcpy((u_int8_t *)x, (u_int8_t *)y, sizeof(y))  </span>
00142 <span class="preprocessor"></span>
00143 <span class="comment">/* used internally for NTP leap indicator, version, and mode */</span>
00144 <span class="preprocessor">#define LIBNET_NTP_DO_LI_VN_MODE(li, vn, md) \</span>
00145 <span class="preprocessor">    ((u_int8_t)((((li) &lt;&lt; 6) &amp; 0xc0) | (((vn) &lt;&lt; 3) &amp; 0x38) | ((md) &amp; 0x7)))</span>
00146 <span class="preprocessor"></span>
00147 <span class="comment">/* Not all systems have IFF_LOOPBACK */</span>
00148 <span class="preprocessor">#ifdef IFF_LOOPBACK</span>
00149 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_ISLOOPBACK(p) ((p)-&gt;ifr_flags &amp; IFF_LOOPBACK)</span>
00150 <span class="preprocessor"></span><span class="preprocessor">#else</span>
00151 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_ISLOOPBACK(p) (strcmp((p)-&gt;ifr_name, "lo0") == 0)</span>
00152 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00153 <span class="preprocessor"></span>
00154 <span class="comment">/* advanced mode check */</span>
00155 <span class="preprocessor">#define LIBNET_ISADVMODE(x) (x &amp; 0x08)</span>
00156 <span class="preprocessor"></span>
00157 <span class="comment">/* context queue macros and constants */</span>
00158 <span class="preprocessor">#define LIBNET_LABEL_SIZE   64</span>
00159 <span class="preprocessor"></span><span class="preprocessor">#define LIBNET_LABEL_DEFAULT "cardshark"</span>
00160 <span class="preprocessor"></span><span class="preprocessor">#define CQ_LOCK_UNLOCKED    (u_int)0x00000000</span>
00161 <span class="preprocessor"></span><span class="preprocessor">#define CQ_LOCK_READ        (u_int)0x00000001</span>
00162 <span class="preprocessor"></span><span class="preprocessor">#define CQ_LOCK_WRITE       (u_int)0x00000002</span>
00163 <span class="preprocessor"></span>
<a name="l00169"></a><a class="code" href="libnet-macros_8h.html#a33">00169</a> <span class="preprocessor">#define for_each_context_in_cq(l) \</span>
00170 <span class="preprocessor">    for (l = libnet_cq_head(); libnet_cq_last(); l = libnet_cq_next())</span>
00171 <span class="preprocessor"></span>
00172 <span class="comment">/* return 1 if write lock is set on cq */</span>
00173 <span class="preprocessor">#define cq_is_wlocked() (l_cqd.cq_lock &amp; CQ_LOCK_WRITE)</span>
00174 <span class="preprocessor"></span>
00175 <span class="comment">/* return 1 if read lock is set on cq */</span>
00176 <span class="preprocessor">#define cq_is_rlocked() (l_cqd.cq_lock &amp; CQ_LOCK_READ)</span>
00177 <span class="preprocessor"></span>
00178 <span class="comment">/* return 1 if any lock is set on cq */</span>
00179 <span class="preprocessor">#define cq_is_locked() (l_cqd.cq_lock &amp; (CQ_LOCK_READ | CQ_LOCK_WRITE))</span>
00180 <span class="preprocessor"></span>
00181 <span class="comment">/* check if a context queue is locked */</span>
00182 <span class="preprocessor">#define check_cq_lock(x) (l_cqd.cq_lock &amp; x)</span>
00183 <span class="preprocessor"></span>
00184 <span class="preprocessor">#endif  </span><span class="comment">/* __LIBNET_MACROS_H */</span>
00185 
00186 <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