Newer
Older
ubix2 / doc / html / tcp_8h-source.html
@reddawg reddawg on 12 Dec 2006 63 KB Changes
<!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>UbixOS V2: src/sys/include/net/tcp.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
  <ul>
    <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="classes.html"><span>Data&nbsp;Structures</span></a></li>
    <li id="current"><a href="files.html"><span>Files</span></a></li>
    <li><a href="dirs.html"><span>Directories</span></a></li>
    <li>
      <form action="search.php" method="get">
        <table cellspacing="0" cellpadding="0" border="0">
          <tr>
            <td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
            <td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
          </tr>
        </table>
      </form>
    </li>
  </ul></div>
<div class="tabs">
  <ul>
    <li><a href="files.html"><span>File&nbsp;List</span></a></li>
    <li><a href="globals.html"><span>Globals</span></a></li>
  </ul></div>
<div class="nav">
<a class="el" href="dir_897b6a2d7bab147dd1db58381aad3984.html">src</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_832905b1f7f5feaf61a306b40c0ac817.html">sys</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_caf4200c438ae9601464168e21e8e4d8.html">include</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_c1d11d251a83b2498f44d410b793c5eb.html">net</a></div>
<h1>tcp.h</h1><a href="tcp_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * Copyright (c) 2001, Swedish Institute of Computer Science.</span>
<a name="l00003"></a>00003 <span class="comment"> * All rights reserved. </span>
<a name="l00004"></a>00004 <span class="comment"> *</span>
<a name="l00005"></a>00005 <span class="comment"> * Redistribution and use in source and binary forms, with or without </span>
<a name="l00006"></a>00006 <span class="comment"> * modification, are permitted provided that the following conditions </span>
<a name="l00007"></a>00007 <span class="comment"> * are met: </span>
<a name="l00008"></a>00008 <span class="comment"> * 1. Redistributions of source code must retain the above copyright </span>
<a name="l00009"></a>00009 <span class="comment"> *    notice, this list of conditions and the following disclaimer. </span>
<a name="l00010"></a>00010 <span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright </span>
<a name="l00011"></a>00011 <span class="comment"> *    notice, this list of conditions and the following disclaimer in the </span>
<a name="l00012"></a>00012 <span class="comment"> *    documentation and/or other materials provided with the distribution. </span>
<a name="l00013"></a>00013 <span class="comment"> * 3. Neither the name of the Institute nor the names of its contributors </span>
<a name="l00014"></a>00014 <span class="comment"> *    may be used to endorse or promote products derived from this software </span>
<a name="l00015"></a>00015 <span class="comment"> *    without specific prior written permission. </span>
<a name="l00016"></a>00016 <span class="comment"> *</span>
<a name="l00017"></a>00017 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND </span>
<a name="l00018"></a>00018 <span class="comment"> * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE </span>
<a name="l00019"></a>00019 <span class="comment"> * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE </span>
<a name="l00020"></a>00020 <span class="comment"> * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE </span>
<a name="l00021"></a>00021 <span class="comment"> * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL </span>
<a name="l00022"></a>00022 <span class="comment"> * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS </span>
<a name="l00023"></a>00023 <span class="comment"> * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) </span>
<a name="l00024"></a>00024 <span class="comment"> * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT </span>
<a name="l00025"></a>00025 <span class="comment"> * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY </span>
<a name="l00026"></a>00026 <span class="comment"> * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF </span>
<a name="l00027"></a>00027 <span class="comment"> * SUCH DAMAGE. </span>
<a name="l00028"></a>00028 <span class="comment"> *</span>
<a name="l00029"></a>00029 <span class="comment"> * This file is part of the lwIP TCP/IP stack.</span>
<a name="l00030"></a>00030 <span class="comment"> * </span>
<a name="l00031"></a>00031 <span class="comment"> * Author: Adam Dunkels &lt;adam@sics.se&gt;</span>
<a name="l00032"></a>00032 <span class="comment"> *</span>
<a name="l00033"></a>00033 <span class="comment"> * $Id$</span>
<a name="l00034"></a>00034 <span class="comment"> */</span>
<a name="l00035"></a>00035 <span class="preprocessor">#ifndef __LWIP_TCP_H__</span>
<a name="l00036"></a>00036 <span class="preprocessor"></span><span class="preprocessor">#define __LWIP_TCP_H__</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span>
<a name="l00038"></a>00038 <span class="preprocessor">#include "<a class="code" href="sys_8h.html">net/sys.h</a>"</span>
<a name="l00039"></a>00039 <span class="preprocessor">#include "<a class="code" href="mem_8h.html">net/mem.h</a>"</span>
<a name="l00040"></a>00040 
<a name="l00041"></a>00041 <span class="preprocessor">#include "<a class="code" href="pbuf_8h.html">net/pbuf.h</a>"</span>
<a name="l00042"></a>00042 <span class="preprocessor">#include "<a class="code" href="opt_8h.html">net/opt.h</a>"</span>
<a name="l00043"></a>00043 <span class="comment">//UBU</span>
<a name="l00044"></a>00044 <span class="preprocessor">#include "<a class="code" href="ipv4_2ip_8h.html">net/ipv4/ip.h</a>"</span>
<a name="l00045"></a>00045 <span class="comment">//UBU</span>
<a name="l00046"></a>00046 <span class="preprocessor">#include "<a class="code" href="ipv4_2icmp_8h.html">net/ipv4/icmp.h</a>"</span>
<a name="l00047"></a>00047 
<a name="l00048"></a>00048 <span class="preprocessor">#include "<a class="code" href="sys_8h.html">net/sys.h</a>"</span>
<a name="l00049"></a>00049 
<a name="l00050"></a>00050 <span class="preprocessor">#include "<a class="code" href="err_8h.html">net/err.h</a>"</span>
<a name="l00051"></a>00051 
<a name="l00052"></a>00052 <span class="keyword">struct </span><a class="code" href="structtcp__pcb.html">tcp_pcb</a>;
<a name="l00053"></a>00053 
<a name="l00054"></a>00054 <span class="comment">/* Functions for interfacing with TCP: */</span>
<a name="l00055"></a>00055 
<a name="l00056"></a>00056 <span class="comment">/* Lower layer interface to TCP: */</span>
<a name="l00057"></a>00057 <span class="keywordtype">void</span>             <a class="code" href="tcp_8h.html#51de4ded7d342456d31722493c92c969">tcp_init</a>    (<span class="keywordtype">void</span>);  <span class="comment">/* Must be called first to</span>
<a name="l00058"></a>00058 <span class="comment">                                         initialize TCP. */</span>
<a name="l00059"></a>00059 <span class="keywordtype">void</span>             <a class="code" href="tcp_8h.html#3846a756b13214ed88ea47d0ff8279eb">tcp_tmr</a>     (<span class="keywordtype">void</span>);  <span class="comment">/* Must be called every</span>
<a name="l00060"></a>00060 <span class="comment">                                         TCP_TMR_INTERVAL</span>
<a name="l00061"></a>00061 <span class="comment">                                         ms. (Typically 100 ms). */</span>
<a name="l00062"></a>00062 <span class="comment">/* Application program's interface: */</span>
<a name="l00063"></a>00063 <span class="keyword">struct </span><a class="code" href="structtcp__pcb.html">tcp_pcb</a> * <a class="code" href="tcp_8h.html#7427c5d237fe66a8097bfa8d24ceb943">tcp_new</a>     (<span class="keywordtype">void</span>);
<a name="l00064"></a>00064 
<a name="l00065"></a>00065 <span class="keywordtype">void</span>             <a class="code" href="tcp_8h.html#c10926e6f76f73e17c0d37aaab3e56b6">tcp_arg</a>     (<span class="keyword">struct</span> <a class="code" href="structtcp__pcb.html">tcp_pcb</a> *pcb, <span class="keywordtype">void</span> *arg);
<a name="l00066"></a>00066 <span class="keywordtype">void</span>             <a class="code" href="tcp_8h.html#e77434b264a469ee4124ff945feac490">tcp_accept</a>  (<span class="keyword">struct</span> <a class="code" href="structtcp__pcb.html">tcp_pcb</a> *pcb,
<a name="l00067"></a>00067                               <a class="code" href="err_8h.html#b7190f3da5c85931fc059e0312bc1407">err_t</a> (* <a class="code" href="structtcp__pcb.html#7db60023f473c0ac30f276f7081af7cc">accept</a>)(<span class="keywordtype">void</span> *arg, <span class="keyword">struct</span> <a class="code" href="structtcp__pcb.html">tcp_pcb</a> *newpcb,
<a name="l00068"></a>00068                                                <a class="code" href="err_8h.html#b7190f3da5c85931fc059e0312bc1407">err_t</a> err));
<a name="l00069"></a>00069 <span class="keywordtype">void</span>             <a class="code" href="tcp_8h.html#f58be9006b4ddb720113f03d56bc6e52">tcp_recv</a>    (<span class="keyword">struct</span> <a class="code" href="structtcp__pcb.html">tcp_pcb</a> *pcb,
<a name="l00070"></a>00070                               <a class="code" href="err_8h.html#b7190f3da5c85931fc059e0312bc1407">err_t</a> (* <a class="code" href="structtcp__pcb.html#47cbc234ff5228456e7241d851b98dd9">recv</a>)(<span class="keywordtype">void</span> *arg, <span class="keyword">struct</span> <a class="code" href="structtcp__pcb.html">tcp_pcb</a> *tpcb,
<a name="l00071"></a>00071                                   <span class="keyword">struct</span> <a class="code" href="structpbuf.html">pbuf</a> *p, <a class="code" href="err_8h.html#b7190f3da5c85931fc059e0312bc1407">err_t</a> err));
<a name="l00072"></a>00072 <span class="keywordtype">void</span>             <a class="code" href="tcp_8h.html#3df9afd68d4aca2fe5113c67eacb8b7a">tcp_sent</a>    (<span class="keyword">struct</span> <a class="code" href="structtcp__pcb.html">tcp_pcb</a> *pcb,
<a name="l00073"></a>00073                               <a class="code" href="err_8h.html#b7190f3da5c85931fc059e0312bc1407">err_t</a> (* <a class="code" href="structtcp__pcb.html#99f0e2a5a4930a70fbb6585df05e5492">sent</a>)(<span class="keywordtype">void</span> *arg, <span class="keyword">struct</span> <a class="code" href="structtcp__pcb.html">tcp_pcb</a> *tpcb,
<a name="l00074"></a>00074                                              <a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> len));
<a name="l00075"></a>00075 <span class="keywordtype">void</span>             <a class="code" href="tcp_8h.html#305113b53237aa7c6ab87234e9a1e441">tcp_poll</a>    (<span class="keyword">struct</span> <a class="code" href="structtcp__pcb.html">tcp_pcb</a> *pcb,
<a name="l00076"></a>00076                               <a class="code" href="err_8h.html#b7190f3da5c85931fc059e0312bc1407">err_t</a> (* <a class="code" href="structtcp__pcb.html#126cb76a2919f16179bc8fbe519838a4">poll</a>)(<span class="keywordtype">void</span> *arg, <span class="keyword">struct</span> <a class="code" href="structtcp__pcb.html">tcp_pcb</a> *tpcb),
<a name="l00077"></a>00077                               <a class="code" href="types_8h.html#a4e0f27a9aca905e340c06d2dcae843c">uInt8</a> interval);
<a name="l00078"></a>00078 <span class="keywordtype">void</span>             <a class="code" href="tcp_8h.html#fe31e32503125886e9174d1aa132310a">tcp_err</a>     (<span class="keyword">struct</span> <a class="code" href="structtcp__pcb.html">tcp_pcb</a> *pcb,
<a name="l00079"></a>00079                               <span class="keywordtype">void</span> (* err)(<span class="keywordtype">void</span> *arg, <a class="code" href="err_8h.html#b7190f3da5c85931fc059e0312bc1407">err_t</a> err));
<a name="l00080"></a>00080 
<a name="l00081"></a><a class="code" href="tcp_8h.html#d1a95f09deb49cd7341d35527d6d3e2f">00081</a> <span class="preprocessor">#define          tcp_sndbuf(pcb)   ((pcb)-&gt;snd_buf)</span>
<a name="l00082"></a>00082 <span class="preprocessor"></span>
<a name="l00083"></a>00083 <span class="keywordtype">void</span>             <a class="code" href="tcp_8h.html#6b6b2d7993a2b4e1ef7e0f9425a2870d">tcp_recved</a>  (<span class="keyword">struct</span> <a class="code" href="structtcp__pcb.html">tcp_pcb</a> *pcb, <a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> len);
<a name="l00084"></a>00084 <a class="code" href="err_8h.html#b7190f3da5c85931fc059e0312bc1407">err_t</a>            <a class="code" href="tcp_8h.html#9c6755fabde07b48e59cb98d6102fbfc">tcp_bind</a>    (<span class="keyword">struct</span> <a class="code" href="structtcp__pcb.html">tcp_pcb</a> *pcb, <span class="keyword">struct</span> <a class="code" href="structip__addr.html">ip_addr</a> *ipaddr,
<a name="l00085"></a>00085                               <a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> port);
<a name="l00086"></a>00086 <a class="code" href="err_8h.html#b7190f3da5c85931fc059e0312bc1407">err_t</a>            <a class="code" href="tcp_8h.html#e444a97cf28a0f6b644550ab77e9dfb7">tcp_connect</a> (<span class="keyword">struct</span> <a class="code" href="structtcp__pcb.html">tcp_pcb</a> *pcb, <span class="keyword">struct</span> <a class="code" href="structip__addr.html">ip_addr</a> *ipaddr,
<a name="l00087"></a>00087                               <a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> port, <a class="code" href="err_8h.html#b7190f3da5c85931fc059e0312bc1407">err_t</a> (* <a class="code" href="structtcp__pcb.html#0b3bfed05ffbbccfd76b5fca13d6110a">connected</a>)(<span class="keywordtype">void</span> *arg,
<a name="l00088"></a>00088                                                               <span class="keyword">struct</span> <a class="code" href="structtcp__pcb.html">tcp_pcb</a> *tpcb,
<a name="l00089"></a>00089                                                               <a class="code" href="err_8h.html#b7190f3da5c85931fc059e0312bc1407">err_t</a> err));
<a name="l00090"></a>00090 <span class="keyword">struct </span><a class="code" href="structtcp__pcb.html">tcp_pcb</a> * <a class="code" href="tcp_8h.html#d756bca9bf3258d2df5df16fd8ed26ad">tcp_listen</a>  (<span class="keyword">struct</span> <a class="code" href="structtcp__pcb.html">tcp_pcb</a> *pcb);
<a name="l00091"></a>00091 <span class="keywordtype">void</span>             <a class="code" href="tcp_8h.html#468c2260ddb01582e966ddcf3c25ce61">tcp_abort</a>   (<span class="keyword">struct</span> <a class="code" href="structtcp__pcb.html">tcp_pcb</a> *pcb);
<a name="l00092"></a>00092 <a class="code" href="err_8h.html#b7190f3da5c85931fc059e0312bc1407">err_t</a>            <a class="code" href="tcp_8h.html#87093e137fcc53ea82a134a3f5b33623">tcp_close</a>   (<span class="keyword">struct</span> <a class="code" href="structtcp__pcb.html">tcp_pcb</a> *pcb);
<a name="l00093"></a>00093 <a class="code" href="err_8h.html#b7190f3da5c85931fc059e0312bc1407">err_t</a>            <a class="code" href="tcp_8h.html#212607f48aaac1e91a2f09b7880b7c3f">tcp_write</a>   (<span class="keyword">struct</span> <a class="code" href="structtcp__pcb.html">tcp_pcb</a> *pcb, <span class="keyword">const</span> <span class="keywordtype">void</span> *dataptr, <a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> len,
<a name="l00094"></a>00094                               <a class="code" href="types_8h.html#a4e0f27a9aca905e340c06d2dcae843c">uInt8</a> copy);
<a name="l00095"></a>00095 
<a name="l00096"></a>00096 <span class="comment">/* It is also possible to call these two functions at the right</span>
<a name="l00097"></a>00097 <span class="comment">   intervals (instead of calling tcp_tmr()). */</span>
<a name="l00098"></a>00098 <span class="keywordtype">void</span>             <a class="code" href="tcp_8h.html#421fb42ef919018e14ae413adfee9905">tcp_slowtmr</a> (<span class="keywordtype">void</span>);
<a name="l00099"></a>00099 <span class="keywordtype">void</span>             <a class="code" href="tcp_8h.html#bf446b07e52161b8a53cea07bc6c366d">tcp_fasttmr</a> (<span class="keywordtype">void</span>);
<a name="l00100"></a>00100 
<a name="l00101"></a>00101 
<a name="l00102"></a>00102 <span class="comment">/* Only used by IP to pass a TCP segment to TCP: */</span>
<a name="l00103"></a>00103 <span class="keywordtype">void</span>             <a class="code" href="tcp_8h.html#e70c3c99d9dd6b07f7e11f7ba5eedcb5">tcp_input</a>   (<span class="keyword">struct</span> <a class="code" href="structpbuf.html">pbuf</a> *p, <span class="keyword">struct</span> <a class="code" href="structnetif.html">netif</a> *inp);
<a name="l00104"></a>00104 <span class="comment">/* Used within the TCP code only: */</span>
<a name="l00105"></a>00105 <a class="code" href="err_8h.html#b7190f3da5c85931fc059e0312bc1407">err_t</a>            <a class="code" href="tcp_8h.html#0cbcc6d628f644a530daf629fa3e5f7f">tcp_output</a>  (<span class="keyword">struct</span> <a class="code" href="structtcp__pcb.html">tcp_pcb</a> *pcb);
<a name="l00106"></a>00106 
<a name="l00107"></a>00107 
<a name="l00108"></a>00108 
<a name="l00109"></a>00109 
<a name="l00110"></a><a class="code" href="tcp_8h.html#af70bfea25733f085a8e5c429b597ac4">00110</a> <span class="preprocessor">#define TCP_SEQ_LT(a,b)     ((Int32)((a)-(b)) &lt; 0)</span>
<a name="l00111"></a><a class="code" href="tcp_8h.html#67688521f2b040529431a17e4fefe0b6">00111</a> <span class="preprocessor"></span><span class="preprocessor">#define TCP_SEQ_LEQ(a,b)    ((Int32)((a)-(b)) &lt;= 0)</span>
<a name="l00112"></a><a class="code" href="tcp_8h.html#82a26df32c421e5eba32de8650382d59">00112</a> <span class="preprocessor"></span><span class="preprocessor">#define TCP_SEQ_GT(a,b)     ((Int32)((a)-(b)) &gt; 0)</span>
<a name="l00113"></a><a class="code" href="tcp_8h.html#450d82fe0a95a217fea45e4e28064a67">00113</a> <span class="preprocessor"></span><span class="preprocessor">#define TCP_SEQ_GEQ(a,b)    ((Int32)((a)-(b)) &gt;= 0)</span>
<a name="l00114"></a>00114 <span class="preprocessor"></span>
<a name="l00115"></a><a class="code" href="tcp_8h.html#88e60aa2cf23e1c65d630701db08c743">00115</a> <span class="preprocessor">#define TCP_FIN 0x01</span>
<a name="l00116"></a><a class="code" href="tcp_8h.html#6020613f5062417d9811cfa837215c83">00116</a> <span class="preprocessor"></span><span class="preprocessor">#define TCP_SYN 0x02</span>
<a name="l00117"></a><a class="code" href="tcp_8h.html#5ca559def464ef20d8b1f7d32f2f160d">00117</a> <span class="preprocessor"></span><span class="preprocessor">#define TCP_RST 0x04</span>
<a name="l00118"></a><a class="code" href="tcp_8h.html#1320fd0006a2f70138bc2d0018dda829">00118</a> <span class="preprocessor"></span><span class="preprocessor">#define TCP_PSH 0x08</span>
<a name="l00119"></a><a class="code" href="tcp_8h.html#44b3b1ab31a403ba28ec135adfcbefef">00119</a> <span class="preprocessor"></span><span class="preprocessor">#define TCP_ACK 0x10</span>
<a name="l00120"></a><a class="code" href="tcp_8h.html#c84f499cba8a02fc0e306c10b2acabf0">00120</a> <span class="preprocessor"></span><span class="preprocessor">#define TCP_URG 0x20</span>
<a name="l00121"></a>00121 <span class="preprocessor"></span>
<a name="l00122"></a>00122 <span class="comment">/* Length of the TCP header, excluding options. */</span>
<a name="l00123"></a><a class="code" href="tcp_8h.html#5758db371d6daa394d178429b7c94c2a">00123</a> <span class="preprocessor">#define TCP_HLEN 20</span>
<a name="l00124"></a>00124 <span class="preprocessor"></span>
<a name="l00125"></a><a class="code" href="tcp_8h.html#d3e68a4c69b6e005e1de46275de3dd09">00125</a> <span class="preprocessor">#define TCP_TMR_INTERVAL       100  </span><span class="comment">/* The TCP timer interval in</span>
<a name="l00126"></a>00126 <span class="comment">                                       milliseconds. */</span>
<a name="l00127"></a>00127 
<a name="l00128"></a><a class="code" href="tcp_8h.html#4cb07190c160bd799c8a892229690807">00128</a> <span class="preprocessor">#define TCP_FAST_INTERVAL      200  </span><span class="comment">/* the fine grained timeout in</span>
<a name="l00129"></a>00129 <span class="comment">                                       milliseconds */</span>
<a name="l00130"></a><a class="code" href="tcp_8h.html#6adb391fb7a37611c536b53eb2864d19">00130</a> <span class="preprocessor">#define TCP_SLOW_INTERVAL      500  </span><span class="comment">/* the coarse grained timeout in</span>
<a name="l00131"></a>00131 <span class="comment">                                       milliseconds */</span>
<a name="l00132"></a><a class="code" href="tcp_8h.html#e6585b41f836b1b8ca7c7b77d06a6aa6">00132</a> <span class="preprocessor">#define TCP_FIN_WAIT_TIMEOUT 20000 </span><span class="comment">/* milliseconds */</span>
<a name="l00133"></a><a class="code" href="tcp_8h.html#f47a5928fbbf12665409900b5debd6d2">00133</a> <span class="preprocessor">#define TCP_SYN_RCVD_TIMEOUT 20000 </span><span class="comment">/* milliseconds */</span>
<a name="l00134"></a>00134 
<a name="l00135"></a><a class="code" href="tcp_8h.html#c190a697c41de0c8915ddc6ca00a2b23">00135</a> <span class="preprocessor">#define TCP_OOSEQ_TIMEOUT        6 </span><span class="comment">/* x RTO */</span>
<a name="l00136"></a>00136 
<a name="l00137"></a><a class="code" href="tcp_8h.html#a6a464bac77e35eaed0e9cd5bb622722">00137</a> <span class="preprocessor">#define TCP_MSL 60000  </span><span class="comment">/* The maximum segment lifetime in microseconds */</span>
<a name="l00138"></a>00138 
<a name="l00139"></a><a class="code" href="structtcp__hdr.html">00139</a> <span class="keyword">struct </span><a class="code" href="structtcp__hdr.html">tcp_hdr</a> {
<a name="l00140"></a>00140   <a class="code" href="structtcp__hdr.html#6340b2ed7263f8f4d996f4838544dfd2">PACK_STRUCT_FIELD</a>(<a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> src);
<a name="l00141"></a>00141   <a class="code" href="structtcp__hdr.html#6340b2ed7263f8f4d996f4838544dfd2">PACK_STRUCT_FIELD</a>(<a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> dest);
<a name="l00142"></a>00142   <a class="code" href="structtcp__hdr.html#6340b2ed7263f8f4d996f4838544dfd2">PACK_STRUCT_FIELD</a>(<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> seqno);
<a name="l00143"></a>00143   <a class="code" href="structtcp__hdr.html#6340b2ed7263f8f4d996f4838544dfd2">PACK_STRUCT_FIELD</a>(<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> ackno);
<a name="l00144"></a>00144   <a class="code" href="structtcp__hdr.html#6340b2ed7263f8f4d996f4838544dfd2">PACK_STRUCT_FIELD</a>(<a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> _offset_flags);
<a name="l00145"></a>00145   <a class="code" href="structtcp__hdr.html#6340b2ed7263f8f4d996f4838544dfd2">PACK_STRUCT_FIELD</a>(<a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> wnd);
<a name="l00146"></a>00146   <a class="code" href="structtcp__hdr.html#6340b2ed7263f8f4d996f4838544dfd2">PACK_STRUCT_FIELD</a>(<a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> chksum);
<a name="l00147"></a>00147   <a class="code" href="structtcp__hdr.html#6340b2ed7263f8f4d996f4838544dfd2">PACK_STRUCT_FIELD</a>(<a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> urgp);
<a name="l00148"></a>00148 } <a class="code" href="cc_8h.html#33623da05bb55497534c3dc26ebebeb2">PACK_STRUCT_STRUCT</a>;
<a name="l00149"></a>00149 
<a name="l00150"></a><a class="code" href="tcp_8h.html#403593983c0c7850ae73396e62de043e">00150</a> <span class="preprocessor">#define TCPH_OFFSET(hdr) (NTOHS((hdr)-&gt;_offset_flags) &gt;&gt; 8)</span>
<a name="l00151"></a><a class="code" href="tcp_8h.html#7cbed647d5a3f1c3ea08217c2209470e">00151</a> <span class="preprocessor"></span><span class="preprocessor">#define TCPH_FLAGS(hdr) (NTOHS((hdr)-&gt;_offset_flags) &amp; 0xff)</span>
<a name="l00152"></a>00152 <span class="preprocessor"></span>
<a name="l00153"></a><a class="code" href="tcp_8h.html#df73b8a5787048ba91dda965f0fa547a">00153</a> <span class="preprocessor">#define TCPH_OFFSET_SET(hdr, offset) (hdr)-&gt;_offset_flags = HTONS(((offset) &lt;&lt; 8) | TCPH_FLAGS(hdr))</span>
<a name="l00154"></a><a class="code" href="tcp_8h.html#4b5689df8913d4f563057fd0091af7b3">00154</a> <span class="preprocessor"></span><span class="preprocessor">#define TCPH_FLAGS_SET(hdr, flags) (hdr)-&gt;_offset_flags = HTONS((TCPH_OFFSET(hdr) &lt;&lt; 8) | (flags))</span>
<a name="l00155"></a>00155 <span class="preprocessor"></span>
<a name="l00156"></a><a class="code" href="tcp_8h.html#a878c2fe18c397e18545c1d128beebed">00156</a> <span class="preprocessor">#define TCP_TCPLEN(seg) ((seg)-&gt;len + ((TCPH_FLAGS((seg)-&gt;tcphdr) &amp; TCP_FIN || \</span>
<a name="l00157"></a>00157 <span class="preprocessor">                                        TCPH_FLAGS((seg)-&gt;tcphdr) &amp; TCP_SYN)? 1: 0))</span>
<a name="l00158"></a>00158 <span class="preprocessor"></span>
<a name="l00159"></a><a class="code" href="tcp_8h.html#aad63c28ec94587c99838bd52424d634">00159</a> <span class="keyword">enum</span> <a class="code" href="tcp_8h.html#aad63c28ec94587c99838bd52424d634">tcp_state</a> {
<a name="l00160"></a>00160   <a class="code" href="tcp_8h.html#aad63c28ec94587c99838bd52424d634929f0327e17604ce9713b2a6117bd603">CLOSED</a>      = 0,
<a name="l00161"></a>00161   <a class="code" href="tcp_8h.html#aad63c28ec94587c99838bd52424d634331ec9878c0ed22e62de969d4b96b5bb">LISTEN</a>      = 1,
<a name="l00162"></a>00162   <a class="code" href="tcp_8h.html#aad63c28ec94587c99838bd52424d6343884e45cc6d937b234e2a8c2c933d7e5">SYN_SENT</a>    = 2,
<a name="l00163"></a>00163   <a class="code" href="tcp_8h.html#aad63c28ec94587c99838bd52424d6341ee0633a9749f202ccb75862d3aefc85">SYN_RCVD</a>    = 3,
<a name="l00164"></a>00164   <a class="code" href="tcp_8h.html#aad63c28ec94587c99838bd52424d63481d0d81381abb711562b19a00a4cb9af">ESTABLISHED</a> = 4,
<a name="l00165"></a>00165   <a class="code" href="tcp_8h.html#aad63c28ec94587c99838bd52424d6342ca754767c3666fc17fe7f5bf49e7518">FIN_WAIT_1</a>  = 5,
<a name="l00166"></a>00166   <a class="code" href="tcp_8h.html#aad63c28ec94587c99838bd52424d6341ff416801732ff573184491c86ee7032">FIN_WAIT_2</a>  = 6,
<a name="l00167"></a>00167   <a class="code" href="tcp_8h.html#aad63c28ec94587c99838bd52424d634dbf32c37bc28f37e44d0fe611d341178">CLOSE_WAIT</a>  = 7,
<a name="l00168"></a>00168   <a class="code" href="tcp_8h.html#aad63c28ec94587c99838bd52424d6348ab2cae69d2b33297ab24a5818213f18">CLOSING</a>     = 8,
<a name="l00169"></a>00169   <a class="code" href="tcp_8h.html#aad63c28ec94587c99838bd52424d6341b588a108a727c1de55f818cb9ff57eb">LAST_ACK</a>    = 9,
<a name="l00170"></a>00170   <a class="code" href="tcp_8h.html#aad63c28ec94587c99838bd52424d634799374a9f3fbdfc7f7e92c0f9c5627f7">TIME_WAIT</a>   = 10
<a name="l00171"></a>00171 };
<a name="l00172"></a>00172 
<a name="l00173"></a>00173 
<a name="l00174"></a>00174 <span class="comment">/* the TCP protocol control block */</span>
<a name="l00175"></a><a class="code" href="structtcp__pcb.html">00175</a> <span class="keyword">struct </span><a class="code" href="structtcp__pcb.html">tcp_pcb</a> {
<a name="l00176"></a><a class="code" href="structtcp__pcb.html#2aed7ffb5fb83aabe68b36f097d99260">00176</a>   <span class="keyword">struct </span><a class="code" href="structtcp__pcb.html">tcp_pcb</a> *<a class="code" href="structtcp__pcb.html#2aed7ffb5fb83aabe68b36f097d99260">next</a>;   <span class="comment">/* for the linked list */</span>
<a name="l00177"></a>00177 
<a name="l00178"></a><a class="code" href="structtcp__pcb.html#f5fed23770a314eabbad7225fbf09ade">00178</a>   <span class="keyword">enum</span> <a class="code" href="tcp_8h.html#aad63c28ec94587c99838bd52424d634">tcp_state</a> <a class="code" href="structtcp__pcb.html#f5fed23770a314eabbad7225fbf09ade">state</a>;   <span class="comment">/* TCP state */</span>
<a name="l00179"></a>00179 
<a name="l00180"></a><a class="code" href="structtcp__pcb.html#b16551509a7846960e2bb7e2347db89d">00180</a>   <span class="keywordtype">void</span> *<a class="code" href="structtcp__pcb.html#b16551509a7846960e2bb7e2347db89d">callback_arg</a>;
<a name="l00181"></a>00181   
<a name="l00182"></a>00182   <span class="comment">/* Function to call when a listener has been connected. */</span>
<a name="l00183"></a>00183   <a class="code" href="err_8h.html#b7190f3da5c85931fc059e0312bc1407">err_t</a> (* accept)(<span class="keywordtype">void</span> *arg, <span class="keyword">struct </span><a class="code" href="structtcp__pcb.html">tcp_pcb</a> *newpcb, <a class="code" href="err_8h.html#b7190f3da5c85931fc059e0312bc1407">err_t</a> err);
<a name="l00184"></a>00184 
<a name="l00185"></a><a class="code" href="structtcp__pcb.html#9f625ba7c954031759a87b09f9d3bf66">00185</a>   <span class="keyword">struct </span><a class="code" href="structip__addr.html">ip_addr</a> <a class="code" href="structtcp__pcb.html#9f625ba7c954031759a87b09f9d3bf66">local_ip</a>;
<a name="l00186"></a><a class="code" href="structtcp__pcb.html#ea74c25566d8d5f965ec9458dc5a4f59">00186</a>   <a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> <a class="code" href="structtcp__pcb.html#ea74c25566d8d5f965ec9458dc5a4f59">local_port</a>;
<a name="l00187"></a>00187   
<a name="l00188"></a><a class="code" href="structtcp__pcb.html#104f8c50bb00edff11df71133ac76fd7">00188</a>   <span class="keyword">struct </span><a class="code" href="structip__addr.html">ip_addr</a> <a class="code" href="structtcp__pcb.html#104f8c50bb00edff11df71133ac76fd7">remote_ip</a>;
<a name="l00189"></a><a class="code" href="structtcp__pcb.html#3f779fa78a77818fc8f6210a17c52e81">00189</a>   <a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> <a class="code" href="structtcp__pcb.html#3f779fa78a77818fc8f6210a17c52e81">remote_port</a>;
<a name="l00190"></a>00190   
<a name="l00191"></a>00191   <span class="comment">/* receiver varables */</span>
<a name="l00192"></a><a class="code" href="structtcp__pcb.html#ad5a68f38b318f3791d7b53a684ee5af">00192</a>   <a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> <a class="code" href="structtcp__pcb.html#ad5a68f38b318f3791d7b53a684ee5af">rcv_nxt</a>;   <span class="comment">/* next seqno expected */</span>
<a name="l00193"></a><a class="code" href="structtcp__pcb.html#72c2f4a5b185b61aa9f26b0305bf8b44">00193</a>   <a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> <a class="code" href="structtcp__pcb.html#72c2f4a5b185b61aa9f26b0305bf8b44">rcv_wnd</a>;   <span class="comment">/* receiver window */</span>
<a name="l00194"></a>00194 
<a name="l00195"></a>00195   <span class="comment">/* Timers */</span>
<a name="l00196"></a><a class="code" href="structtcp__pcb.html#85604804a5256842fd9986d17b718c8b">00196</a>   <a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> <a class="code" href="structtcp__pcb.html#85604804a5256842fd9986d17b718c8b">tmr</a>;
<a name="l00197"></a>00197 
<a name="l00198"></a>00198   <span class="comment">/* Retransmission timer. */</span>
<a name="l00199"></a><a class="code" href="structtcp__pcb.html#2a7cbd4af8c40222dd89f2f48d021a89">00199</a>   <a class="code" href="types_8h.html#a4e0f27a9aca905e340c06d2dcae843c">uInt8</a> <a class="code" href="structtcp__pcb.html#2a7cbd4af8c40222dd89f2f48d021a89">rtime</a>;
<a name="l00200"></a>00200   
<a name="l00201"></a><a class="code" href="structtcp__pcb.html#9abcbe1be87d924cfb9891d4a8af88eb">00201</a>   <a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> <a class="code" href="structtcp__pcb.html#9abcbe1be87d924cfb9891d4a8af88eb">mss</a>;   <span class="comment">/* maximum segment size */</span>
<a name="l00202"></a>00202 
<a name="l00203"></a><a class="code" href="structtcp__pcb.html#889ca6170adbd43cece68f2734d3e248">00203</a>   <a class="code" href="types_8h.html#a4e0f27a9aca905e340c06d2dcae843c">uInt8</a> <a class="code" href="structtcp__pcb.html#889ca6170adbd43cece68f2734d3e248">flags</a>;
<a name="l00204"></a><a class="code" href="tcp_8h.html#b578ff02026a5e4b1bbad24ec9e9f4d5">00204</a> <span class="preprocessor">#define TF_ACK_DELAY 0x01   </span><span class="comment">/* Delayed ACK. */</span>
<a name="l00205"></a><a class="code" href="tcp_8h.html#cab515db1f19653bfe55b4eb34a441a6">00205</a> <span class="preprocessor">#define TF_ACK_NOW   0x02   </span><span class="comment">/* Immediate ACK. */</span>
<a name="l00206"></a><a class="code" href="tcp_8h.html#923f934772e1cb9b3efb785e627f7682">00206</a> <span class="preprocessor">#define TF_INFR      0x04   </span><span class="comment">/* In fast recovery. */</span>
<a name="l00207"></a><a class="code" href="tcp_8h.html#c9dbdaeac3e25f5badf3a763a1b0b990">00207</a> <span class="preprocessor">#define TF_RESET     0x08   </span><span class="comment">/* Connection was reset. */</span>
<a name="l00208"></a><a class="code" href="tcp_8h.html#d911d2567fa5bb98044e271bf84e81fa">00208</a> <span class="preprocessor">#define TF_CLOSED    0x10   </span><span class="comment">/* Connection was sucessfully closed. */</span>
<a name="l00209"></a><a class="code" href="tcp_8h.html#0ecc5fb69bdd77ac66d945f7434b7431">00209</a> <span class="preprocessor">#define TF_GOT_FIN   0x20   </span><span class="comment">/* Connection was closed by the remote end. */</span>
<a name="l00210"></a>00210   
<a name="l00211"></a>00211   <span class="comment">/* RTT estimation variables. */</span>
<a name="l00212"></a><a class="code" href="structtcp__pcb.html#21f092f1e775bedc51db26cf0f0db3e4">00212</a>   <a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> <a class="code" href="structtcp__pcb.html#21f092f1e775bedc51db26cf0f0db3e4">rttest</a>; <span class="comment">/* RTT estimate in 500ms ticks */</span>
<a name="l00213"></a><a class="code" href="structtcp__pcb.html#16cbb47cd6dcb125d293d8b0e98f7a29">00213</a>   <a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> <a class="code" href="structtcp__pcb.html#16cbb47cd6dcb125d293d8b0e98f7a29">rtseq</a>;  <span class="comment">/* sequence number being timed */</span>
<a name="l00214"></a><a class="code" href="structtcp__pcb.html#922ce1af61445c2ef74f351f3679823e">00214</a>   <a class="code" href="types_8h.html#1657cdc78acd17f92fb047e02f7a5f14">Int32</a> <a class="code" href="structtcp__pcb.html#603b529a927c2060bc766f6f1bcfa6b0">sa</a>, <a class="code" href="structtcp__pcb.html#922ce1af61445c2ef74f351f3679823e">sv</a>;
<a name="l00215"></a>00215 
<a name="l00216"></a><a class="code" href="structtcp__pcb.html#e2da68d83be475a98d4660a0ba29b04a">00216</a>   <a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> <a class="code" href="structtcp__pcb.html#e2da68d83be475a98d4660a0ba29b04a">rto</a>;    <span class="comment">/* retransmission time-out */</span>
<a name="l00217"></a><a class="code" href="structtcp__pcb.html#5fb9d70849fcd3d957b761906df5e76b">00217</a>   <a class="code" href="types_8h.html#a4e0f27a9aca905e340c06d2dcae843c">uInt8</a> <a class="code" href="structtcp__pcb.html#5fb9d70849fcd3d957b761906df5e76b">nrtx</a>;    <span class="comment">/* number of retransmissions */</span>
<a name="l00218"></a>00218 
<a name="l00219"></a>00219   <span class="comment">/* fast retransmit/recovery */</span>
<a name="l00220"></a><a class="code" href="structtcp__pcb.html#ed6b8503e546cdb38361ad91e1751121">00220</a>   <a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> <a class="code" href="structtcp__pcb.html#ed6b8503e546cdb38361ad91e1751121">lastack</a>; <span class="comment">/* Highest acknowledged seqno. */</span>
<a name="l00221"></a><a class="code" href="structtcp__pcb.html#dbd6caa217ca303666c97e9756aa650e">00221</a>   <a class="code" href="types_8h.html#a4e0f27a9aca905e340c06d2dcae843c">uInt8</a> <a class="code" href="structtcp__pcb.html#dbd6caa217ca303666c97e9756aa650e">dupacks</a>;
<a name="l00222"></a>00222   
<a name="l00223"></a>00223   <span class="comment">/* congestion avoidance/control variables */</span>
<a name="l00224"></a><a class="code" href="structtcp__pcb.html#04d980fcc30c880934f2ad23d4c5fed1">00224</a>   <a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> <a class="code" href="structtcp__pcb.html#04d980fcc30c880934f2ad23d4c5fed1">cwnd</a>;  
<a name="l00225"></a><a class="code" href="structtcp__pcb.html#01abbb914a02ed3155ffaec498d2d923">00225</a>   <a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> <a class="code" href="structtcp__pcb.html#01abbb914a02ed3155ffaec498d2d923">ssthresh</a>;
<a name="l00226"></a>00226 
<a name="l00227"></a>00227   <span class="comment">/* sender variables */</span>
<a name="l00228"></a><a class="code" href="structtcp__pcb.html#251d92e99934e189404e52e592e9a457">00228</a>   <a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> <a class="code" href="structtcp__pcb.html#90554b2a024a4c18fcda98cbfd2b6128">snd_nxt</a>,       <span class="comment">/* next seqno to be sent */</span>
<a name="l00229"></a>00229     <a class="code" href="structtcp__pcb.html#bef219e3e817c5dd5568250c254512d0">snd_max</a>,       <span class="comment">/* Highest seqno sent. */</span>
<a name="l00230"></a>00230     <a class="code" href="structtcp__pcb.html#251d92e99934e189404e52e592e9a457">snd_wnd</a>,       <span class="comment">/* sender window */</span>
<a name="l00231"></a>00231     <a class="code" href="structtcp__pcb.html#9d5302ff0c5d6b868c6512714db4bf3d">snd_wl1</a>, <a class="code" href="structtcp__pcb.html#9d4fd71846d118ffcfe9e747e487dbc1">snd_wl2</a>,
<a name="l00232"></a>00232     <a class="code" href="structtcp__pcb.html#e50ea29639c80998d802fad87d31631f">snd_lbb</a>;      
<a name="l00233"></a>00233 
<a name="l00234"></a><a class="code" href="structtcp__pcb.html#5c8c8b59a296f07423f8c54958729020">00234</a>   <a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> <a class="code" href="structtcp__pcb.html#5c8c8b59a296f07423f8c54958729020">snd_buf</a>;   <span class="comment">/* Avaliable buffer space for sending. */</span>
<a name="l00235"></a><a class="code" href="structtcp__pcb.html#725706c6fca36ee6cef7c63f4e60724e">00235</a>   <a class="code" href="types_8h.html#a4e0f27a9aca905e340c06d2dcae843c">uInt8</a> <a class="code" href="structtcp__pcb.html#725706c6fca36ee6cef7c63f4e60724e">snd_queuelen</a>;
<a name="l00236"></a>00236 
<a name="l00237"></a>00237   <span class="comment">/* Function to be called when more send buffer space is avaliable. */</span>
<a name="l00238"></a>00238   <a class="code" href="err_8h.html#b7190f3da5c85931fc059e0312bc1407">err_t</a> (* sent)(<span class="keywordtype">void</span> *arg, <span class="keyword">struct </span><a class="code" href="structtcp__pcb.html">tcp_pcb</a> *pcb, <a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> space);
<a name="l00239"></a><a class="code" href="structtcp__pcb.html#079b95201fde97978972ec2f087441ce">00239</a>   <a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> <a class="code" href="structtcp__pcb.html#079b95201fde97978972ec2f087441ce">acked</a>;
<a name="l00240"></a>00240   
<a name="l00241"></a>00241   <span class="comment">/* Function to be called when (in-sequence) data has arrived. */</span>
<a name="l00242"></a>00242   <a class="code" href="err_8h.html#b7190f3da5c85931fc059e0312bc1407">err_t</a> (* recv)(<span class="keywordtype">void</span> *arg, <span class="keyword">struct </span><a class="code" href="structtcp__pcb.html">tcp_pcb</a> *pcb, <span class="keyword">struct </span><a class="code" href="structpbuf.html">pbuf</a> *p, <a class="code" href="err_8h.html#b7190f3da5c85931fc059e0312bc1407">err_t</a> err);
<a name="l00243"></a><a class="code" href="structtcp__pcb.html#4d546e30555666016e85eaf153a5d8ad">00243</a>   <span class="keyword">struct </span><a class="code" href="structpbuf.html">pbuf</a> *<a class="code" href="structtcp__pcb.html#4d546e30555666016e85eaf153a5d8ad">recv_data</a>;
<a name="l00244"></a>00244 
<a name="l00245"></a>00245   <span class="comment">/* Function to be called when a connection has been set up. */</span>
<a name="l00246"></a>00246   <a class="code" href="err_8h.html#b7190f3da5c85931fc059e0312bc1407">err_t</a> (* connected)(<span class="keywordtype">void</span> *arg, <span class="keyword">struct </span><a class="code" href="structtcp__pcb.html">tcp_pcb</a> *pcb, <a class="code" href="err_8h.html#b7190f3da5c85931fc059e0312bc1407">err_t</a> err);
<a name="l00247"></a>00247 
<a name="l00248"></a>00248   <span class="comment">/* Function which is called periodically. */</span>
<a name="l00249"></a>00249   <a class="code" href="err_8h.html#b7190f3da5c85931fc059e0312bc1407">err_t</a> (* poll)(<span class="keywordtype">void</span> *arg, <span class="keyword">struct </span><a class="code" href="structtcp__pcb.html">tcp_pcb</a> *pcb);
<a name="l00250"></a>00250 
<a name="l00251"></a>00251   <span class="comment">/* Function to be called whenever a fatal error occurs. */</span>
<a name="l00252"></a>00252   void (* <a class="code" href="structtcp__pcb.html#db13ee7fe9ca8475dc7eb17fecdb4d1b">errf</a>)(<span class="keywordtype">void</span> *arg, <a class="code" href="err_8h.html#b7190f3da5c85931fc059e0312bc1407">err_t</a> err);
<a name="l00253"></a>00253   
<a name="l00254"></a><a class="code" href="structtcp__pcb.html#c7cc178f2182a76f91add42a6052e185">00254</a>   <a class="code" href="types_8h.html#a4e0f27a9aca905e340c06d2dcae843c">uInt8</a> <a class="code" href="structtcp__pcb.html#c7cc178f2182a76f91add42a6052e185">polltmr</a>, <a class="code" href="structtcp__pcb.html#26020b736baa56b9604fc81a1e24868d">pollinterval</a>;
<a name="l00255"></a>00255   
<a name="l00256"></a>00256   <span class="comment">/* These are ordered by sequence number: */</span>
<a name="l00257"></a><a class="code" href="structtcp__pcb.html#487f784367bacf0f826fc91a2c04bfdd">00257</a>   <span class="keyword">struct </span><a class="code" href="structtcp__seg.html">tcp_seg</a> *<a class="code" href="structtcp__pcb.html#487f784367bacf0f826fc91a2c04bfdd">unsent</a>;   <span class="comment">/* Unsent (queued) segments. */</span>
<a name="l00258"></a><a class="code" href="structtcp__pcb.html#9e6ed24ec0f8e5855c3b34fa361bfd5a">00258</a>   <span class="keyword">struct </span><a class="code" href="structtcp__seg.html">tcp_seg</a> *<a class="code" href="structtcp__pcb.html#9e6ed24ec0f8e5855c3b34fa361bfd5a">unacked</a>;  <span class="comment">/* Sent but unacknowledged segments. */</span>
<a name="l00259"></a>00259 <span class="preprocessor">#if TCP_QUEUE_OOSEQ  </span>
<a name="l00260"></a>00260 <span class="preprocessor"></span>  <span class="keyword">struct </span><a class="code" href="structtcp__seg.html">tcp_seg</a> *ooseq;    <span class="comment">/* Received out of sequence segments. */</span>
<a name="l00261"></a>00261 <span class="preprocessor">#endif </span><span class="comment">/* TCP_QUEUE_OOSEQ */</span>
<a name="l00262"></a>00262 
<a name="l00263"></a>00263 };
<a name="l00264"></a>00264 
<a name="l00265"></a><a class="code" href="structtcp__pcb__listen.html">00265</a> <span class="keyword">struct </span><a class="code" href="structtcp__pcb__listen.html">tcp_pcb_listen</a> {  
<a name="l00266"></a><a class="code" href="structtcp__pcb__listen.html#0483d0c2a2758dcef18689be2efbdf34">00266</a>   <span class="keyword">struct </span><a class="code" href="structtcp__pcb__listen.html">tcp_pcb_listen</a> *<a class="code" href="structtcp__pcb__listen.html#0483d0c2a2758dcef18689be2efbdf34">next</a>;   <span class="comment">/* for the linked list */</span>
<a name="l00267"></a>00267   
<a name="l00268"></a><a class="code" href="structtcp__pcb__listen.html#1601c85dd2aa3f2e183a9653b2fcbfb0">00268</a>   <span class="keyword">enum</span> <a class="code" href="tcp_8h.html#aad63c28ec94587c99838bd52424d634">tcp_state</a> <a class="code" href="structtcp__pcb__listen.html#1601c85dd2aa3f2e183a9653b2fcbfb0">state</a>;   <span class="comment">/* TCP state */</span>
<a name="l00269"></a>00269 
<a name="l00270"></a><a class="code" href="structtcp__pcb__listen.html#d6c5b31cadf89f218ce6a99e4349badd">00270</a>   <span class="keywordtype">void</span> *<a class="code" href="structtcp__pcb__listen.html#d6c5b31cadf89f218ce6a99e4349badd">callback_arg</a>;
<a name="l00271"></a>00271   
<a name="l00272"></a>00272   <span class="comment">/* Function to call when a listener has been connected. */</span>
<a name="l00273"></a>00273   void (* accept)(<span class="keywordtype">void</span> *arg, <span class="keyword">struct </span><a class="code" href="structtcp__pcb.html">tcp_pcb</a> *newpcb);
<a name="l00274"></a>00274 
<a name="l00275"></a><a class="code" href="structtcp__pcb__listen.html#0445896db7b8677e8e4bc437308b1270">00275</a>   <span class="keyword">struct </span><a class="code" href="structip__addr.html">ip_addr</a> <a class="code" href="structtcp__pcb__listen.html#0445896db7b8677e8e4bc437308b1270">local_ip</a>;
<a name="l00276"></a><a class="code" href="structtcp__pcb__listen.html#ade628d2846221f386d5eca50d07ad32">00276</a>   <a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> <a class="code" href="structtcp__pcb__listen.html#ade628d2846221f386d5eca50d07ad32">local_port</a>;
<a name="l00277"></a>00277 };
<a name="l00278"></a>00278 
<a name="l00279"></a>00279 <span class="comment">/* This structure is used to repressent TCP segments. */</span>
<a name="l00280"></a><a class="code" href="structtcp__seg.html">00280</a> <span class="keyword">struct </span><a class="code" href="structtcp__seg.html">tcp_seg</a> {
<a name="l00281"></a><a class="code" href="structtcp__seg.html#3e1479b94a15c20a26bd0f0592cd5601">00281</a>   <span class="keyword">struct </span><a class="code" href="structtcp__seg.html">tcp_seg</a> *<a class="code" href="structtcp__seg.html#3e1479b94a15c20a26bd0f0592cd5601">next</a>;    <span class="comment">/* used when putting segements on a queue */</span>
<a name="l00282"></a><a class="code" href="structtcp__seg.html#3a0a6be553eb5cd5c641f519d3fa7f2f">00282</a>   <span class="keyword">struct </span><a class="code" href="structpbuf.html">pbuf</a> *<a class="code" href="structtcp__seg.html#3a0a6be553eb5cd5c641f519d3fa7f2f">p</a>;          <span class="comment">/* buffer containing data + TCP header */</span>
<a name="l00283"></a><a class="code" href="structtcp__seg.html#ba9711261d2fb72c6ea14955f23de4f2">00283</a>   <span class="keywordtype">void</span> *<a class="code" href="structtcp__seg.html#ba9711261d2fb72c6ea14955f23de4f2">dataptr</a>;           <span class="comment">/* pointer to the TCP data in the pbuf */</span>
<a name="l00284"></a><a class="code" href="structtcp__seg.html#cd56b9873ed54d5c717cff398765357d">00284</a>   <a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> <a class="code" href="structtcp__seg.html#cd56b9873ed54d5c717cff398765357d">len</a>;               <span class="comment">/* the TCP length of this segment */</span>
<a name="l00285"></a><a class="code" href="structtcp__seg.html#699247f83271b1ca4434a30a376680ab">00285</a>   <span class="keyword">struct </span><a class="code" href="structtcp__hdr.html">tcp_hdr</a> *<a class="code" href="structtcp__seg.html#699247f83271b1ca4434a30a376680ab">tcphdr</a>;  <span class="comment">/* the TCP header */</span>
<a name="l00286"></a>00286 };
<a name="l00287"></a>00287 
<a name="l00288"></a>00288 <span class="comment">/* Internal functions and global variables: */</span>
<a name="l00289"></a>00289 <span class="keyword">struct </span><a class="code" href="structtcp__pcb.html">tcp_pcb</a> *<a class="code" href="tcp_8h.html#8dc15d72a4f385846d924592da33c879">tcp_pcb_copy</a>(<span class="keyword">struct</span> <a class="code" href="structtcp__pcb.html">tcp_pcb</a> *pcb);
<a name="l00290"></a>00290 <span class="keywordtype">void</span> <a class="code" href="tcp_8h.html#44fc672b9d14a65e61040707c45302ba">tcp_pcb_purge</a>(<span class="keyword">struct</span> <a class="code" href="structtcp__pcb.html">tcp_pcb</a> *pcb);
<a name="l00291"></a>00291 <span class="keywordtype">void</span> <a class="code" href="tcp_8h.html#aaef096f6a03bf5b778329bb66ee06f6">tcp_pcb_remove</a>(<span class="keyword">struct</span> <a class="code" href="structtcp__pcb.html">tcp_pcb</a> **pcblist, <span class="keyword">struct</span> <a class="code" href="structtcp__pcb.html">tcp_pcb</a> *pcb);
<a name="l00292"></a>00292 
<a name="l00293"></a>00293 <a class="code" href="types_8h.html#a4e0f27a9aca905e340c06d2dcae843c">uInt8</a> <a class="code" href="tcp_8h.html#2a7a22b8d118eb3b4c9682fb7cf455ef">tcp_segs_free</a>(<span class="keyword">struct</span> <a class="code" href="structtcp__seg.html">tcp_seg</a> *seg);
<a name="l00294"></a>00294 <a class="code" href="types_8h.html#a4e0f27a9aca905e340c06d2dcae843c">uInt8</a> <a class="code" href="tcp_8h.html#1ea20aae291bb7cd0928c816124ecbac">tcp_seg_free</a>(<span class="keyword">struct</span> <a class="code" href="structtcp__seg.html">tcp_seg</a> *seg);
<a name="l00295"></a>00295 <span class="keyword">struct </span><a class="code" href="structtcp__seg.html">tcp_seg</a> *<a class="code" href="tcp_8h.html#569d79451d2570e4ef406775725ef6ef">tcp_seg_copy</a>(<span class="keyword">struct</span> <a class="code" href="structtcp__seg.html">tcp_seg</a> *seg);
<a name="l00296"></a>00296 
<a name="l00297"></a><a class="code" href="tcp_8h.html#ccaf5aff579a6f08407d691bc92d765d">00297</a> <span class="preprocessor">#define tcp_ack(pcb)     if((pcb)-&gt;flags &amp; TF_ACK_DELAY) { \</span>
<a name="l00298"></a>00298 <span class="preprocessor">                            (pcb)-&gt;flags |= TF_ACK_NOW; \</span>
<a name="l00299"></a>00299 <span class="preprocessor">                            tcp_output(pcb); \</span>
<a name="l00300"></a>00300 <span class="preprocessor">                         } else { \</span>
<a name="l00301"></a>00301 <span class="preprocessor">                            (pcb)-&gt;flags |= TF_ACK_DELAY; \</span>
<a name="l00302"></a>00302 <span class="preprocessor">                         }</span>
<a name="l00303"></a>00303 <span class="preprocessor"></span>
<a name="l00304"></a><a class="code" href="tcp_8h.html#d80dc16443af0e5d6dbe5de686274424">00304</a> <span class="preprocessor">#define tcp_ack_now(pcb) (pcb)-&gt;flags |= TF_ACK_NOW; \</span>
<a name="l00305"></a>00305 <span class="preprocessor">                         tcp_output(pcb)</span>
<a name="l00306"></a>00306 <span class="preprocessor"></span>
<a name="l00307"></a>00307 <a class="code" href="err_8h.html#b7190f3da5c85931fc059e0312bc1407">err_t</a> <a class="code" href="tcp_8h.html#bbfc0df797ca8d52b73703e3a8e5e030">tcp_send_ctrl</a>(<span class="keyword">struct</span> <a class="code" href="structtcp__pcb.html">tcp_pcb</a> *pcb, <a class="code" href="types_8h.html#a4e0f27a9aca905e340c06d2dcae843c">uInt8</a> flags);
<a name="l00308"></a>00308 <a class="code" href="err_8h.html#b7190f3da5c85931fc059e0312bc1407">err_t</a> <a class="code" href="tcp_8h.html#598c918fc63361644d1bd10bb994cfc6">tcp_enqueue</a>(<span class="keyword">struct</span> <a class="code" href="structtcp__pcb.html">tcp_pcb</a> *pcb, <span class="keywordtype">void</span> *<a class="code" href="structtcp__seg.html#ba9711261d2fb72c6ea14955f23de4f2">dataptr</a>, <a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> <a class="code" href="structtcp__seg.html#cd56b9873ed54d5c717cff398765357d">len</a>,
<a name="l00309"></a>00309                 <a class="code" href="types_8h.html#a4e0f27a9aca905e340c06d2dcae843c">uInt8</a> flags, <a class="code" href="types_8h.html#a4e0f27a9aca905e340c06d2dcae843c">uInt8</a> copy,
<a name="l00310"></a>00310                 <a class="code" href="types_8h.html#a4e0f27a9aca905e340c06d2dcae843c">uInt8</a> *optdata, <a class="code" href="types_8h.html#a4e0f27a9aca905e340c06d2dcae843c">uInt8</a> optlen);
<a name="l00311"></a>00311 
<a name="l00312"></a>00312 <span class="keywordtype">void</span> <a class="code" href="tcp_8h.html#31749219b8aeb4957f7c350f4427a839">tcp_rexmit_seg</a>(<span class="keyword">struct</span> <a class="code" href="structtcp__pcb.html">tcp_pcb</a> *pcb, <span class="keyword">struct</span> <a class="code" href="structtcp__seg.html">tcp_seg</a> *seg);
<a name="l00313"></a>00313 
<a name="l00314"></a>00314 <span class="keywordtype">void</span> <a class="code" href="tcp_8h.html#c34efb2d4b95acff840c84d22d59fb4c">tcp_rst</a>(<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> seqno, <a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> ackno,
<a name="l00315"></a>00315              <span class="keyword">struct</span> <a class="code" href="structip__addr.html">ip_addr</a> *local_ip, <span class="keyword">struct</span> <a class="code" href="structip__addr.html">ip_addr</a> *remote_ip,
<a name="l00316"></a>00316              <a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> local_port, <a class="code" href="types_8h.html#3b65128d2644e9b80cec9a69bfa7e094">uInt16</a> remote_port);
<a name="l00317"></a>00317 
<a name="l00318"></a>00318 <a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> <a class="code" href="tcp_8h.html#f2d1b7b0daa5d9c05d1bb8082f8264eb">tcp_next_iss</a>(<span class="keywordtype">void</span>);
<a name="l00319"></a>00319 
<a name="l00320"></a>00320 <span class="keyword">extern</span> <a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> <a class="code" href="tcp_8h.html#89c4a68ace479c2362a2821616e2c15a">tcp_ticks</a>;
<a name="l00321"></a>00321 
<a name="l00322"></a>00322 <span class="preprocessor">#if TCP_DEBUG || TCP_INPUT_DEBUG || TCP_OUTPUT_DEBUG</span>
<a name="l00323"></a>00323 <span class="preprocessor"></span><span class="keywordtype">void</span> tcp_debug_print(<span class="keyword">struct</span> <a class="code" href="structtcp__hdr.html">tcp_hdr</a> *<a class="code" href="structtcp__seg.html#699247f83271b1ca4434a30a376680ab">tcphdr</a>);
<a name="l00324"></a>00324 <span class="keywordtype">void</span> tcp_debug_print_flags(<a class="code" href="types_8h.html#a4e0f27a9aca905e340c06d2dcae843c">uInt8</a> flags);
<a name="l00325"></a>00325 <span class="keywordtype">void</span> tcp_debug_print_state(<span class="keyword">enum</span> <a class="code" href="tcp_8h.html#aad63c28ec94587c99838bd52424d634">tcp_state</a> s);
<a name="l00326"></a>00326 <span class="keywordtype">void</span> tcp_debug_print_pcbs(<span class="keywordtype">void</span>);
<a name="l00327"></a>00327 <span class="keywordtype">int</span> <a class="code" href="tcp_8h.html#99eac823d00bd1192bc65244e7f0fa8c">tcp_pcbs_sane</a>(<span class="keywordtype">void</span>);
<a name="l00328"></a>00328 <span class="preprocessor">#else</span>
<a name="l00329"></a><a class="code" href="tcp_8h.html#99eac823d00bd1192bc65244e7f0fa8c">00329</a> <span class="preprocessor"></span><span class="preprocessor">#define tcp_pcbs_sane() 1</span>
<a name="l00330"></a>00330 <span class="preprocessor"></span><span class="preprocessor">#endif </span><span class="comment">/* TCP_DEBUG */</span>
<a name="l00331"></a>00331 
<a name="l00332"></a>00332 
<a name="l00333"></a>00333 <span class="comment">/* The TCP PCB lists. */</span>
<a name="l00334"></a>00334 <span class="keyword">extern</span> <span class="keyword">struct </span><a class="code" href="structtcp__pcb__listen.html">tcp_pcb_listen</a> *<a class="code" href="tcp_8h.html#b7b955629fe5e7d94321580f969cf076">tcp_listen_pcbs</a>;  <span class="comment">/* List of all TCP PCBs in LISTEN state. */</span>
<a name="l00335"></a>00335 <span class="keyword">extern</span> <span class="keyword">struct </span><a class="code" href="structtcp__pcb.html">tcp_pcb</a> *<a class="code" href="tcp_8h.html#78c09dbae67ccc06b659d9f1a388f911">tcp_active_pcbs</a>;  <span class="comment">/* List of all TCP PCBs that are in a</span>
<a name="l00336"></a>00336 <span class="comment">                                            state in which they accept or send</span>
<a name="l00337"></a>00337 <span class="comment">                                            data. */</span>
<a name="l00338"></a>00338 <span class="keyword">extern</span> <span class="keyword">struct </span><a class="code" href="structtcp__pcb.html">tcp_pcb</a> *<a class="code" href="tcp_8h.html#9a522a66c5e1f1a4e28fe7a672cc64e3">tcp_tw_pcbs</a>;      <span class="comment">/* List of all TCP PCBs in TIME-WAIT. */</span>
<a name="l00339"></a>00339 
<a name="l00340"></a>00340 <span class="keyword">extern</span> <span class="keyword">struct </span><a class="code" href="structtcp__pcb.html">tcp_pcb</a> *<a class="code" href="tcp_8h.html#d5ba0fd03d297b097808b45437face0c">tcp_tmp_pcb</a>;      <span class="comment">/* Only used for temporary storage. */</span>
<a name="l00341"></a>00341 
<a name="l00342"></a>00342 <span class="comment">/* Axoims about the above lists:   </span>
<a name="l00343"></a>00343 <span class="comment">   1) Every TCP PCB that is not CLOSED is in one of the lists.</span>
<a name="l00344"></a>00344 <span class="comment">   2) A PCB is only in one of the lists.</span>
<a name="l00345"></a>00345 <span class="comment">   3) All PCBs in the tcp_listen_pcbs list is in LISTEN state.</span>
<a name="l00346"></a>00346 <span class="comment">   4) All PCBs in the tcp_tw_pcbs list is in TIME-WAIT state.</span>
<a name="l00347"></a>00347 <span class="comment">*/</span>
<a name="l00348"></a>00348 
<a name="l00349"></a>00349 <span class="comment">/* Define two macros, TCP_REG and TCP_RMV that registers a TCP PCB</span>
<a name="l00350"></a>00350 <span class="comment">   with a PCB list or removes a PCB from a list, respectively. */</span>
<a name="l00351"></a>00351 <span class="preprocessor">#ifdef LWIP_DEBUG</span>
<a name="l00352"></a>00352 <span class="preprocessor"></span><span class="preprocessor">#define TCP_REG(pcbs, npcb) do {\</span>
<a name="l00353"></a>00353 <span class="preprocessor">                            DEBUGF(TCP_DEBUG, ("TCP_REG %p local port %d\n", npcb, npcb-&gt;local_port)); \</span>
<a name="l00354"></a>00354 <span class="preprocessor">                            for(tcp_tmp_pcb = *pcbs; \</span>
<a name="l00355"></a>00355 <span class="preprocessor">                                  tcp_tmp_pcb != NULL; \</span>
<a name="l00356"></a>00356 <span class="preprocessor">                                tcp_tmp_pcb = tcp_tmp_pcb-&gt;next) { \</span>
<a name="l00357"></a>00357 <span class="preprocessor">                                ASSERT("TCP_REG: already registered\n", tcp_tmp_pcb != npcb); \</span>
<a name="l00358"></a>00358 <span class="preprocessor">                            } \</span>
<a name="l00359"></a>00359 <span class="preprocessor">                            ASSERT("TCP_REG: pcb-&gt;state != CLOSED", npcb-&gt;state != CLOSED); \</span>
<a name="l00360"></a>00360 <span class="preprocessor">                            npcb-&gt;next = *pcbs; \</span>
<a name="l00361"></a>00361 <span class="preprocessor">                            ASSERT("TCP_REG: npcb-&gt;next != npcb", npcb-&gt;next != npcb); \</span>
<a name="l00362"></a>00362 <span class="preprocessor">                            *pcbs = npcb; \</span>
<a name="l00363"></a>00363 <span class="preprocessor">                            ASSERT("TCP_RMV: tcp_pcbs sane", tcp_pcbs_sane()); \</span>
<a name="l00364"></a>00364 <span class="preprocessor">                            } while(0)</span>
<a name="l00365"></a>00365 <span class="preprocessor"></span><span class="preprocessor">#define TCP_RMV(pcbs, npcb) do { \</span>
<a name="l00366"></a>00366 <span class="preprocessor">                            ASSERT("TCP_RMV: pcbs != NULL", *pcbs != NULL); \</span>
<a name="l00367"></a>00367 <span class="preprocessor">                            DEBUGF(TCP_DEBUG, ("TCP_RMV: removing %p from %p\n", npcb, *pcbs)); \</span>
<a name="l00368"></a>00368 <span class="preprocessor">                            if(*pcbs == npcb) { \</span>
<a name="l00369"></a>00369 <span class="preprocessor">                               *pcbs = (*pcbs)-&gt;next; \</span>
<a name="l00370"></a>00370 <span class="preprocessor">                            } else for(tcp_tmp_pcb = *pcbs; tcp_tmp_pcb != NULL; tcp_tmp_pcb = tcp_tmp_pcb-&gt;next) { \</span>
<a name="l00371"></a>00371 <span class="preprocessor">                               if(tcp_tmp_pcb-&gt;next != NULL &amp;&amp; tcp_tmp_pcb-&gt;next == npcb) { \</span>
<a name="l00372"></a>00372 <span class="preprocessor">                                  tcp_tmp_pcb-&gt;next = npcb-&gt;next; \</span>
<a name="l00373"></a>00373 <span class="preprocessor">                                  break; \</span>
<a name="l00374"></a>00374 <span class="preprocessor">                               } \</span>
<a name="l00375"></a>00375 <span class="preprocessor">                            } \</span>
<a name="l00376"></a>00376 <span class="preprocessor">                            npcb-&gt;next = NULL; \</span>
<a name="l00377"></a>00377 <span class="preprocessor">                            ASSERT("TCP_RMV: tcp_pcbs sane", tcp_pcbs_sane()); \</span>
<a name="l00378"></a>00378 <span class="preprocessor">                            DEBUGF(TCP_DEBUG, ("TCP_RMV: removed %p from %p\n", npcb, *pcbs)); \</span>
<a name="l00379"></a>00379 <span class="preprocessor">                            } while(0)</span>
<a name="l00380"></a>00380 <span class="preprocessor"></span>
<a name="l00381"></a>00381 <span class="preprocessor">#else </span><span class="comment">/* LWIP_DEBUG */</span>
<a name="l00382"></a><a class="code" href="tcp_8h.html#50cbae9c0438222ed92ed8cd470d3cb0">00382</a> <span class="preprocessor">#define TCP_REG(pcbs, npcb) do { \</span>
<a name="l00383"></a>00383 <span class="preprocessor">                            npcb-&gt;next = *pcbs; \</span>
<a name="l00384"></a>00384 <span class="preprocessor">                            *pcbs = npcb; \</span>
<a name="l00385"></a>00385 <span class="preprocessor">                            } while(0)</span>
<a name="l00386"></a><a class="code" href="tcp_8h.html#340e27f5b99231f7a706959ab3be3b59">00386</a> <span class="preprocessor"></span><span class="preprocessor">#define TCP_RMV(pcbs, npcb) do { \</span>
<a name="l00387"></a>00387 <span class="preprocessor">                            if(*pcbs == npcb) { \</span>
<a name="l00388"></a>00388 <span class="preprocessor">                               *pcbs = (*pcbs)-&gt;next; \</span>
<a name="l00389"></a>00389 <span class="preprocessor">                            } else for(tcp_tmp_pcb = *pcbs; tcp_tmp_pcb != NULL; tcp_tmp_pcb = tcp_tmp_pcb-&gt;next) { \</span>
<a name="l00390"></a>00390 <span class="preprocessor">                               if(tcp_tmp_pcb-&gt;next != NULL &amp;&amp; tcp_tmp_pcb-&gt;next == npcb) { \</span>
<a name="l00391"></a>00391 <span class="preprocessor">                                  tcp_tmp_pcb-&gt;next = npcb-&gt;next; \</span>
<a name="l00392"></a>00392 <span class="preprocessor">                                  break; \</span>
<a name="l00393"></a>00393 <span class="preprocessor">                               } \</span>
<a name="l00394"></a>00394 <span class="preprocessor">                            } \</span>
<a name="l00395"></a>00395 <span class="preprocessor">                            npcb-&gt;next = NULL; \</span>
<a name="l00396"></a>00396 <span class="preprocessor">                            } while(0)</span>
<a name="l00397"></a>00397 <span class="preprocessor"></span><span class="preprocessor">#endif </span><span class="comment">/* LWIP_DEBUG */</span>
<a name="l00398"></a>00398 <span class="preprocessor">#endif </span><span class="comment">/* __LWIP_TCP_H__ */</span>
<a name="l00399"></a>00399 
<a name="l00400"></a>00400 
<a name="l00401"></a>00401 
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Tue Dec 12 08:52:04 2006 for UbixOS V2 by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>