⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 watt-32 tcp-ip src-ppp_c source file.htm

📁 关于PPP点对点协议的一些详细资料
💻 HTM
📖 第 1 页 / 共 5 页
字号:
00199       <SPAN class=comment>/* evClose */</SPAN> { stClosing,  { acNull, acNull, acNull } },
00200       <SPAN class=comment>/* evTOp */</SPAN>   { stClosing,  { acStr,  acNull, acNull } },
00201       <SPAN class=comment>/* evTOm */</SPAN>   { stClosed,   { acTlf,  acNull, acNull } },
00202       <SPAN class=comment>/* evRCRp */</SPAN>  { stClosing,  { acNull, acNull, acNull } },
00203       <SPAN class=comment>/* evRCRm */</SPAN>  { stClosing,  { acNull, acNull, acNull } },
00204       <SPAN class=comment>/* evRCA */</SPAN>   { stClosing,  { acNull, acNull, acNull } },
00205       <SPAN class=comment>/* evRCN */</SPAN>   { stClosing,  { acNull, acNull, acNull } },
00206       <SPAN class=comment>/* evRTR */</SPAN>   { stClosing,  { acSta,  acNull, acNull } },
00207       <SPAN class=comment>/* evRTA */</SPAN>   { stClosed,   { acTlf,  acNull, acNull } },
00208       <SPAN class=comment>/* evRUC */</SPAN>   { stClosing,  { acScj,  acNull, acNull } },
00209       <SPAN class=comment>/* evRXJp */</SPAN>  { stClosing,  { acNull, acNull, acNull } },
00210       <SPAN class=comment>/* evRXJm */</SPAN>  { stClosed,   { acTlf,  acNull, acNull } },
00211       <SPAN class=comment>/* evRXR */</SPAN>   { stClosing,  { acNull, acNull, acNull } },
00212     },
00213     { <SPAN class=comment>/* stStopping */</SPAN>
00214       <SPAN class=comment>/* evUp */</SPAN>    { stNoChange, { acNull, acNull, acNull } },
00215       <SPAN class=comment>/* evDown */</SPAN>  { stInitial,  { acNull, acNull, acNull } },
00216       <SPAN class=comment>/* evOpen */</SPAN>  { stStopping, { acNull, acNull, acNull } },
00217       <SPAN class=comment>/* evClose */</SPAN> { stClosing,  { acNull, acNull, acNull } },
00218       <SPAN class=comment>/* evTOp */</SPAN>   { stStopping, { acStr,  acNull, acNull } },
00219       <SPAN class=comment>/* evTOm */</SPAN>   { stStopped,  { acTlf,  acNull, acNull } },
00220       <SPAN class=comment>/* evRCRp */</SPAN>  { stStopping, { acNull, acNull, acNull } },
00221       <SPAN class=comment>/* evRCRm */</SPAN>  { stStopping, { acNull, acNull, acNull } },
00222       <SPAN class=comment>/* evRCA */</SPAN>   { stStopping, { acNull, acNull, acNull } },
00223       <SPAN class=comment>/* evRCN */</SPAN>   { stStopping, { acNull, acNull, acNull } },
00224       <SPAN class=comment>/* evRTR */</SPAN>   { stStopping, { acSta,  acNull, acNull } },
00225       <SPAN class=comment>/* evRTA */</SPAN>   { stStopped,  { acTlf,  acNull, acNull } },
00226       <SPAN class=comment>/* evRUC */</SPAN>   { stStopping, { acScj,  acNull, acNull } },
00227       <SPAN class=comment>/* evRXJp */</SPAN>  { stStopping, { acNull, acNull, acNull } },
00228       <SPAN class=comment>/* evRXJm */</SPAN>  { stStopped,  { acTlf,  acNull, acNull } },
00229       <SPAN class=comment>/* evRXR */</SPAN>   { stStopping, { acNull, acNull, acNull } },
00230     },
00231     { <SPAN class=comment>/* stReqSent */</SPAN>
00232       <SPAN class=comment>/* evUp */</SPAN>    { stNoChange, { acNull, acNull, acNull } },
00233       <SPAN class=comment>/* evDown */</SPAN>  { stStarting, { acNull, acNull, acNull } },
00234       <SPAN class=comment>/* evOpen */</SPAN>  { stReqSent,  { acNull, acNull, acNull } },
00235       <SPAN class=comment>/* evClose */</SPAN> { stClosing,  { acIrc,  acStr,  acNull } },
00236       <SPAN class=comment>/* evTOp */</SPAN>   { stReqSent,  { acScr,  acNull, acNull } },
00237       <SPAN class=comment>/* evTOm */</SPAN>   { stStopped,  { acTlf,  acNull, acNull } },
00238       <SPAN class=comment>/* evRCRp */</SPAN>  { stAckSent,  { acSca,  acNull, acNull } },
00239       <SPAN class=comment>/* evRCRm */</SPAN>  { stReqSent,  { acScn,  acNull, acNull } },
00240       <SPAN class=comment>/* evRCA */</SPAN>   { stAckRcvd,  { acIrc,  acNull, acNull } },
00241       <SPAN class=comment>/* evRCN */</SPAN>   { stReqSent,  { acIrc,  acScr,  acNull } },
00242       <SPAN class=comment>/* evRTR */</SPAN>   { stReqSent,  { acSta,  acNull, acNull } },
00243       <SPAN class=comment>/* evRTA */</SPAN>   { stReqSent,  { acNull, acNull, acNull } },
00244       <SPAN class=comment>/* evRUC */</SPAN>   { stReqSent,  { acScj,  acNull, acNull } },
00245       <SPAN class=comment>/* evRXJp */</SPAN>  { stReqSent,  { acNull, acNull, acNull } },
00246       <SPAN class=comment>/* evRXJm */</SPAN>  { stStopped,  { acTlf,  acNull, acNull } },
00247       <SPAN class=comment>/* evRXR */</SPAN>   { stReqSent,  { acNull, acNull, acNull } },
00248     },
00249     { <SPAN class=comment>/* stAckRcvd */</SPAN>
00250       <SPAN class=comment>/* evUp */</SPAN>    { stNoChange, { acNull, acNull, acNull } },
00251       <SPAN class=comment>/* evDown */</SPAN>  { stStarting, { acNull, acNull, acNull } },
00252       <SPAN class=comment>/* evOpen */</SPAN>  { stAckRcvd,  { acNull, acNull, acNull } },
00253       <SPAN class=comment>/* evClose */</SPAN> { stClosing,  { acIrc,  acStr,  acNull } },
00254       <SPAN class=comment>/* evTOp */</SPAN>   { stReqSent,  { acScr,  acNull, acNull } },
00255       <SPAN class=comment>/* evTOm */</SPAN>   { stStopped,  { acTlf,  acNull, acNull } },
00256       <SPAN class=comment>/* evRCRp */</SPAN>  { stOpened,   { acSca,  acTlu,  acNull } },
00257       <SPAN class=comment>/* evRCRm */</SPAN>  { stAckRcvd,  { acScn,  acNull, acNull } },
00258       <SPAN class=comment>/* evRCA */</SPAN>   { stReqSent,  { acScr,  acNull, acNull } },
00259       <SPAN class=comment>/* evRCN */</SPAN>   { stReqSent,  { acScr,  acNull, acNull } },
00260       <SPAN class=comment>/* evRTR */</SPAN>   { stReqSent,  { acSta,  acNull, acNull } },
00261       <SPAN class=comment>/* evRTA */</SPAN>   { stReqSent,  { acNull, acNull, acNull } },
00262       <SPAN class=comment>/* evRUC */</SPAN>   { stAckRcvd,  { acScj,  acNull, acNull } },
00263       <SPAN class=comment>/* evRXJp */</SPAN>  { stReqSent,  { acNull, acNull, acNull } },
00264       <SPAN class=comment>/* evRXJm */</SPAN>  { stStopped,  { acTlf,  acNull, acNull } },
00265       <SPAN class=comment>/* evRXR */</SPAN>   { stAckRcvd,  { acNull, acNull, acNull } },
00266     },
00267     { <SPAN class=comment>/* stAckSent */</SPAN>
00268       <SPAN class=comment>/* evUp */</SPAN>    { stNoChange, { acNull, acNull, acNull } },
00269       <SPAN class=comment>/* evDown */</SPAN>  { stStarting, { acNull, acNull, acNull } },
00270       <SPAN class=comment>/* evOpen */</SPAN>  { stAckSent,  { acNull, acNull, acNull } },
00271       <SPAN class=comment>/* evClose */</SPAN> { stClosing,  { acIrc,  acStr,  acNull } },
00272       <SPAN class=comment>/* evTOp */</SPAN>   { stAckSent,  { acScr,  acNull, acNull } },
00273       <SPAN class=comment>/* evTOm */</SPAN>   { stStopped,  { acTlf,  acNull, acNull } },
00274       <SPAN class=comment>/* evRCRp */</SPAN>  { stAckSent,  { acSca,  acNull, acNull } },
00275       <SPAN class=comment>/* evRCRm */</SPAN>  { stReqSent,  { acScn,  acNull, acNull } },
00276       <SPAN class=comment>/* evRCA */</SPAN>   { stOpened,   { acIrc,  acTlu,  acNull } },
00277       <SPAN class=comment>/* evRCN */</SPAN>   { stAckSent,  { acIrc,  acScr,  acNull } },
00278       <SPAN class=comment>/* evRTR */</SPAN>   { stReqSent,  { acSta,  acNull, acNull } },
00279       <SPAN class=comment>/* evRTA */</SPAN>   { stAckSent,  { acNull, acNull, acNull } },
00280       <SPAN class=comment>/* evRUC */</SPAN>   { stAckSent,  { acScj,  acNull, acNull } },
00281       <SPAN class=comment>/* evRXJp */</SPAN>  { stAckSent,  { acNull, acNull, acNull } },
00282       <SPAN class=comment>/* evRXJm */</SPAN>  { stStopped,  { acTlf,  acNull, acNull } },
00283       <SPAN class=comment>/* evRXR */</SPAN>   { stAckSent,  { acNull, acNull, acNull } },
00284     },
00285     { <SPAN class=comment>/* stOpened */</SPAN>
00286       <SPAN class=comment>/* evUp */</SPAN>    { stNoChange, { acNull, acNull, acNull } },
00287       <SPAN class=comment>/* evDown */</SPAN>  { stStarting, { acTld,  acNull, acNull } },
00288       <SPAN class=comment>/* evOpen */</SPAN>  { stOpened,   { acNull, acNull, acNull } },
00289       <SPAN class=comment>/* evClose */</SPAN> { stClosing,  { acTld,  acIrc,  acStr  } },
00290       <SPAN class=comment>/* evTOp */</SPAN>   { stNoChange, { acNull, acNull, acNull } },
00291       <SPAN class=comment>/* evTOm */</SPAN>   { stNoChange, { acNull, acNull, acNull } },
00292       <SPAN class=comment>/* evRCRp */</SPAN>  { stAckSent,  { acTld,  acScr,  acSca  } },
00293       <SPAN class=comment>/* evRCRm */</SPAN>  { stReqSent,  { acTld,  acScr,  acScn  } },
00294       <SPAN class=comment>/* evRCA */</SPAN>   { stReqSent,  { acTld,  acScr,  acNull } },
00295       <SPAN class=comment>/* evRCN */</SPAN>   { stReqSent,  { acTld,  acScr,  acNull } },
00296       <SPAN class=comment>/* evRTR */</SPAN>   { stStopping, { acTld,  acZrc,  acSta  } },
00297       <SPAN class=comment>/* evRTA */</SPAN>   { stReqSent,  { acTld,  acScr,  acNull } },
00298       <SPAN class=comment>/* evRUC */</SPAN>   { stOpened,   { acScj,  acNull, acNull } },
00299       <SPAN class=comment>/* evRXJp */</SPAN>  { stOpened,   { acNull, acNull, acNull } },
00300       <SPAN class=comment>/* evRXJm */</SPAN>  { stStopping, { acTld,  acIrc,  acStr  } },
00301       <SPAN class=comment>/* evRXR */</SPAN>   { stOpened,   { acSer,  acNull, acNull } },
00302     }
00303   };
00304 
00305 
00306 <SPAN class=preprocessor>#if defined(USE_DEBUG)</SPAN>
00307 <SPAN class=preprocessor></SPAN><SPAN class=comment>/*</SPAN>
00308 <SPAN class=comment> * Display contents of buffer</SPAN>
00309 <SPAN class=comment> */</SPAN>
00310 <SPAN class=keyword>static</SPAN> <SPAN class=keywordtype>void</SPAN> buffer_print (<SPAN class=keyword>const</SPAN> <SPAN class=keywordtype>char</SPAN> *verb, <SPAN class=keyword>const</SPAN> BYTE *buf, <SPAN class=keywordtype>int</SPAN> len)
00311 {
00312   <SPAN class=keywordtype>int</SPAN> i, j;
00313 
00314   (*_printf) (<SPAN class=stringliteral>"%s %d bytes:\n"</SPAN>, verb, len);
00315   <SPAN class=keywordflow>for</SPAN> (i = 0; i &lt; len; i += 16)
00316   {
00317     (*_printf) (<SPAN class=stringliteral>"  %04X: "</SPAN>, i);
00318     <SPAN class=keywordflow>for</SPAN> (j = i; j &lt; len &amp;&amp; j &lt; i + 16; j++)
00319         (*_printf) (<SPAN class=stringliteral>" %02X"</SPAN>, buf[j]);
00320     (*_printf) (<SPAN class=stringliteral>"\n"</SPAN>);
00321   }
00322 }
00323 
00324 <SPAN class=comment>/*</SPAN>
00325 <SPAN class=comment> * Print text string safely.</SPAN>
00326 <SPAN class=comment> */</SPAN>
00327 <SPAN class=keyword>static</SPAN> <SPAN class=keywordtype>void</SPAN> safe_string (<SPAN class=keyword>const</SPAN> BYTE *bp, <SPAN class=keywordtype>int</SPAN> len)
00328 {
00329   (*_printf) (<SPAN class=stringliteral>"\""</SPAN>);
00330   <SPAN class=keywordflow>while</SPAN> (--len &gt;= 0)
00331   { 
00332     <SPAN class=keywordtype>char</SPAN> buf[2];
00333     <SPAN class=keywordtype>int</SPAN>  chr = *bp++;
00334 
00335     buf[0] = chr;
00336     buf[1] =<SPAN class=charliteral>'\0'</SPAN>;
00337     <SPAN class=keywordflow>if</SPAN> (isascii(chr) &amp;&amp; isprint(chr))
00338          (*_printf) (buf);
00339     <SPAN class=keywordflow>else</SPAN> (*_printf) (<SPAN class=stringliteral>"\\%03o"</SPAN>, chr);
00340   }
00341   (*_printf) (<SPAN class=stringliteral>"\""</SPAN>);
00342 }
00343 
00344 <SPAN class=comment>/*</SPAN>
00345 <SPAN class=comment> * Show all options in negotiation message.</SPAN>
00346 <SPAN class=comment> */</SPAN>
00347 <SPAN class=keyword>static</SPAN> <SPAN class=keywordtype>void</SPAN> option_show (<SPAN class=keyword>const</SPAN> <SPAN class=keyword>struct</SPAN> ppp_state *state,
00348                          <SPAN class=keyword>const</SPAN> <SPAN class=keyword>struct</SPAN> ppp_xcp *xcp,
00349                          <SPAN class=keyword>const</SPAN> BYTE *bp, <SPAN class=keywordtype>int</SPAN> rlen)
00350 {
00351   <SPAN class=keywordflow>while</SPAN> (rlen &gt; 0)
00352   {
00353     <SPAN class=keyword>const</SPAN> <SPAN class=keyword>struct </SPAN>xcp_type *tp;
00354     <SPAN class=keywordtype>int</SPAN>   i;
00355 
00356     (*_printf) (<SPAN class=stringliteral>" "</SPAN>);
00357     <SPAN class=keywordflow>if</SPAN> (rlen &lt; 2)
00358     {
00359       (*_printf) (<SPAN class=stringliteral>"[trail %02X]\n"</SPAN>, bp[0]);
00360       <SPAN class=keywordflow>break</SPAN>;
00361     }
00362     <SPAN class=keywordflow>if</SPAN> (bp[1] &gt; rlen)
00363     {
00364       (*_printf) (<SPAN class=stringliteral>"[trunc %02X %d&gt;%d]\n"</SPAN>, bp[0], bp[1], rlen);
00365       <SPAN class=keywordflow>break</SPAN>;
00366     }
00367     <SPAN class=keywordflow>for</SPAN> (tp = xcp-&gt;types; tp-&gt;type != -1; tp++)
00368         <SPAN class=keywordflow>if</SPAN> (tp-&gt;type == bp[0])
00369           <SPAN class=keywordflow>break</SPAN>;
00370 
00371     <SPAN class=keywordflow>if</SPAN> (tp-&gt;show)
00372     {
00373       <SPAN class=comment>/* Valid option; use defined printing routine</SPAN>
00374 <SPAN class=comment>       */</SPAN>
00375       (*tp-&gt;show) ((<SPAN class=keyword>struct </SPAN>ppp_state*)state, (struct ppp_xcp*)xcp,
00376                    tp, bp + 2, bp[1]);
00377     }
00378     <SPAN class=keywordflow>else</SPAN>
00379     {
00380       <SPAN class=comment>/* Undefined option; just dump contents.</SPAN>
00381 <SPAN class=comment>       */</SPAN>
00382       <SPAN class=keywordflow>if</SPAN> (tp-&gt;name == NULL)
00383            (*_printf) (<SPAN class=stringliteral>"%02X:"</SPAN>, bp[0]);
00384       <SPAN class=keywordflow>else</SPAN> (*_printf) (<SPAN class=stringliteral>"%s:"</SPAN>, tp-&gt;name);
00385       <SPAN class=keywordflow>for</SPAN> (i = 2; i &lt; bp[1]; i++)
00386           (*_printf) (<SPAN class=stringliteral>"%02X"</SPAN>, bp[i]);
00387     }
00388     i = bp[1];
00389     <SPAN class=keywordflow>if</SPAN> (i &lt; 2)
00390         i = 2;
00391     rlen -= i;
00392     bp   += i;
00393   }
00394 }
00395 
00396 <SPAN class=comment>/*</SPAN>
00397 <SPAN class=comment> * Show a negotiation packet.</SPAN>
00398 <SPAN class=comment> * Assumes 'bp' points to the code number (after PPP Protocol ID).</SPAN>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -