📄 ip_8h-source.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>/opentcp/include/inet/ip.h Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.2.18 --><center><a class="qindex" href="main.html">Main Page</a> <a class="qindex" href="modules.html">Modules</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> <a class="qindex" href="pages.html">Related Pages</a> <a class="qindex" href="examples.html">Examples</a> </center><hr><h1>/opentcp/include/inet/ip.h</h1><a href="ip_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span>00002 <span class="comment"> *Copyright (c) 2000-2002 Viola Systems Ltd.</span>00003 <span class="comment"> *All rights reserved.</span>00004 <span class="comment"> *</span>00005 <span class="comment"> *Redistribution and use in source and binary forms, with or without </span>00006 <span class="comment"> *modification, are permitted provided that the following conditions </span>00007 <span class="comment"> *are met:</span>00008 <span class="comment"> *</span>00009 <span class="comment"> *1. Redistributions of source code must retain the above copyright </span>00010 <span class="comment"> *notice, this list of conditions and the following disclaimer.</span>00011 <span class="comment"> *</span>00012 <span class="comment"> *2. Redistributions in binary form must reproduce the above copyright </span>00013 <span class="comment"> *notice, this list of conditions and the following disclaimer in the </span>00014 <span class="comment"> *documentation and/or other materials provided with the distribution.</span>00015 <span class="comment"> *</span>00016 <span class="comment"> *3. The end-user documentation included with the redistribution, if </span>00017 <span class="comment"> *any, must include the following acknowledgment:</span>00018 <span class="comment"> * "This product includes software developed by Viola </span>00019 <span class="comment"> * Systems (http://www.violasystems.com/)."</span>00020 <span class="comment"> *</span>00021 <span class="comment"> *Alternately, this acknowledgment may appear in the software itself, </span>00022 <span class="comment"> *if and wherever such third-party acknowledgments normally appear.</span>00023 <span class="comment"> *</span>00024 <span class="comment"> *4. The names "OpenTCP" and "Viola Systems" must not be used to </span>00025 <span class="comment"> *endorse or promote products derived from this software without prior </span>00026 <span class="comment"> *written permission. For written permission, please contact </span>00027 <span class="comment"> *opentcp@opentcp.org.</span>00028 <span class="comment"> *</span>00029 <span class="comment"> *5. Products derived from this software may not be called "OpenTCP", </span>00030 <span class="comment"> *nor may "OpenTCP" appear in their name, without prior written </span>00031 <span class="comment"> *permission of the Viola Systems Ltd.</span>00032 <span class="comment"> *</span>00033 <span class="comment"> *THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED </span>00034 <span class="comment"> *WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF </span>00035 <span class="comment"> *MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. </span>00036 <span class="comment"> *IN NO EVENT SHALL VIOLA SYSTEMS LTD. OR ITS CONTRIBUTORS BE LIABLE </span>00037 <span class="comment"> *FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR </span>00038 <span class="comment"> *CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF </span>00039 <span class="comment"> *SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR </span>00040 <span class="comment"> *BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, </span>00041 <span class="comment"> *WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE </span>00042 <span class="comment"> *OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, </span>00043 <span class="comment"> *EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>00044 <span class="comment"> *====================================================================</span>00045 <span class="comment"> *</span>00046 <span class="comment"> *OpenTCP is the unified open source TCP/IP stack available on a series </span>00047 <span class="comment"> *of 8/16-bit microcontrollers, please see <http://www.opentcp.org>.</span>00048 <span class="comment"> *</span>00049 <span class="comment"> *For more information on how to network-enable your devices, or how to </span>00050 <span class="comment"> *obtain commercial technical support for OpenTCP, please see </span>00051 <span class="comment"> *<http://www.violasystems.com/>.</span>00052 <span class="comment"> */</span>00053 00064 <span class="preprocessor">#ifndef INCLUDE_IP_H</span>00065 <span class="preprocessor"></span><span class="preprocessor">#define INCLUDE_IP_H</span>00066 <span class="preprocessor"></span>00067 <span class="preprocessor">#include<<a class="code" href="datatypes_8h.html">inet/datatypes.h</a>></span>00068 <span class="preprocessor">#include<<a class="code" href="ethernet_8h.html">inet/ethernet.h</a>></span>00069 <a name="l00070"></a><a class="code" href="ip_8h.html#a0">00070</a> <span class="preprocessor">#define PHY_ADR_LEN ETH_ADDRESS_LEN </span><a name="l00072"></a><a class="code" href="ip_8h.html#a1">00072</a> <span class="preprocessor">#define IP_ICMP 0x01 </span><a name="l00073"></a><a class="code" href="ip_8h.html#a2">00073</a> <span class="preprocessor">#define IP_UDP 17 </span><a name="l00074"></a><a class="code" href="ip_8h.html#a3">00074</a> <span class="preprocessor">#define IP_TCP 6 </span>00076 <span class="preprocessor">#define IP_HLEN 20 </span><span class="comment">/* IP Header Length in bytes */</span>00077 <span class="preprocessor">#define IP_MIN_HLEN 20 </span>00078 <span class="preprocessor"></span><span class="preprocessor">#define IP_DEF_VIHL 0x45</span>00079 <span class="preprocessor"></span><span class="preprocessor">#define IP_DEF_TTL 100</span>00080 <span class="preprocessor"></span><span class="preprocessor">#define MAX_IP_OPTLEN 40 </span><span class="comment">/* Max IP Header option field length */</span>00081 <span class="preprocessor">#define IP_MAX_HLEN IP_MIN_HLEN + MAX_IP_OPTLEN</span>00082 <span class="preprocessor"></span>00083 <span class="preprocessor">#define IP_DONT_FRAGMENT 0x4000 </span><span class="comment">/* Don't Fragment Flag */</span>00084 <span class="preprocessor">#define IP_FRAGOFF 0x1FFF </span><span class="comment">/* Fragment offset mask */</span>00085 <span class="preprocessor">#define IP_MOREFRAGS 0x2000 </span><span class="comment">/* More fragments bit */</span>00086 00087 <span class="preprocessor">#define IP_GOOD_CS 0</span>00088 <span class="preprocessor"></span>00089 <span class="comment">/* IP Option control commands */</span>00090 00091 <span class="preprocessor">#define IPO_COPY 0x80 </span><span class="comment">/* Copy on fragment mask */</span>00092 <span class="preprocessor">#define IPO_NOP 0x01 </span><span class="comment">/* No operation */</span>00093 <span class="preprocessor">#define IPO_EOOP 0x00 </span><span class="comment">/* End of options */</span>00094 00095 <span class="comment">/* Reserved addresses */</span>00096 00097 <span class="preprocessor">#define IP_BROADCAST_ADDRESS 0xFFFFFFFF </span><span class="comment">/* 255.255.255.255 */</span>00098 <a name="l00113"></a><a class="code" href="structip__frame.html">00113</a> <span class="keyword">struct </span><a class="code" href="structip__frame.html">ip_frame</a>00114 {<a name="l00115"></a><a class="code" href="structip__frame.html#m0">00115</a> UINT8 <a class="code" href="structip__frame.html#m0">vihl</a>; <a name="l00116"></a><a class="code" href="structip__frame.html#m1">00116</a> UINT8 <a class="code" href="structip__frame.html#m1">tos</a>; <a name="l00117"></a><a class="code" href="structip__frame.html#m2">00117</a> UINT16 <a class="code" href="structip__frame.html#m2">tlen</a>; <a name="l00118"></a><a class="code" href="structip__frame.html#m3">00118</a> UINT16 <a class="code" href="structip__frame.html#m3">id</a>; <a name="l00119"></a><a class="code" href="structip__frame.html#m4">00119</a> UINT16 <a class="code" href="structip__frame.html#m4">frags</a>; <a name="l00120"></a><a class="code" href="structip__frame.html#m5">00120</a> UINT8 <a class="code" href="structip__frame.html#m5">ttl</a>; <a name="l00121"></a><a class="code" href="structip__frame.html#m6">00121</a> UINT8 <a class="code" href="structip__frame.html#m6">protocol</a>; <a name="l00122"></a><a class="code" href="structip__frame.html#m7">00122</a> UINT16 <a class="code" href="structip__frame.html#m7">checksum</a>; <a name="l00123"></a><a class="code" href="structip__frame.html#m8">00123</a> UINT32 <a class="code" href="structip__frame.html#m8">sip</a>; <a name="l00124"></a><a class="code" href="structip__frame.html#m9">00124</a> UINT32 <a class="code" href="structip__frame.html#m9">dip</a>; <a name="l00125"></a><a class="code" href="structip__frame.html#m10">00125</a> UINT8 <a class="code" href="structip__frame.html#m10">opt</a>[MAX_IP_OPTLEN + 1]; <a name="l00126"></a><a class="code" href="structip__frame.html#m11">00126</a> UINT16 <a class="code" href="structip__frame.html#m11">buf_index</a>; 00130 };00131 00132 <span class="comment">/* IP function prototypes */</span>00133 00134 INT16 <a class="code" href="ip_8c.html#a3">process_ip_in</a>(<span class="keyword">struct</span> <a class="code" href="structethernet__frame.html">ethernet_frame</a>*);00135 INT16 <a class="code" href="ip_8c.html#a4">process_ip_out</a>(UINT32, UINT8, UINT8, UINT8, UINT8*, UINT16);00136 UINT8 <a class="code" href="ip_8c.html#a6">ip_check_cs</a>(<span class="keyword">struct</span> <a class="code" href="structip__frame.html">ip_frame</a>*);00137 UINT16 <a class="code" href="ip_8c.html#a7">ip_checksum</a>(UINT16, UINT8, UINT8);00138 UINT32 <a class="code" href="ip_8c.html#a8">ip_checksum_buf</a> (UINT16 cs, UINT8* buf, UINT16 len);00139 UINT32 <a class="code" href="ip_8c.html#a5">ip_construct_cs</a>(<span class="keyword">struct</span> <a class="code" href="structip__frame.html">ip_frame</a>*);00140 00141 <span class="preprocessor">#endif</span></pre></div><hr><address style="align: right;"><small>Generated on Sun Aug 3 20:32:59 2003 for OpenTCP by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.18 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -