📄 bootp_8c-source.html
字号:
00377 <span class="keywordflow">return</span>(-1);00378 00379 <span class="keywordflow">if</span>( <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>() != 0x03)00380 <span class="keywordflow">return</span>(-1);00381 00382 <span class="keywordflow">if</span>( <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>() != 0x32)00383 <span class="keywordflow">return</span>(-1);00384 00385 <span class="keywordflow">if</span>( <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>() != 0xF1)00386 <span class="keywordflow">return</span>(-1);00387 00388 <span class="comment">/* Skip elapsed, unused, client address */</span>00389 00390 <span class="keywordflow">for</span>(i=0; i<8; i++)00391 <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>();00392 00393 <span class="comment">/* Get IP */</span>00394 00395 ip = <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>();00396 ip <<= 8;00397 ip |= <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>();00398 ip <<= 8;00399 ip |= <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>();00400 ip <<= 8;00401 ip |= <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>();00402 00403 <span class="comment">/* Skip server ip & bootp router address */</span>00404 00405 <span class="keywordflow">for</span>(i=0; i<8; i++)00406 <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>();00407 00408 <span class="comment">/* Check MAC */</span>00409 00410 <span class="keywordflow">if</span>( <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>() != localmachine.localHW[5])00411 <span class="keywordflow">return</span>(-1);00412 00413 <span class="keywordflow">if</span>( <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>() != localmachine.localHW[4])00414 <span class="keywordflow">return</span>(-1);00415 00416 <span class="keywordflow">if</span>( <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>() != localmachine.localHW[3])00417 <span class="keywordflow">return</span>(-1);00418 00419 <span class="keywordflow">if</span>( <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>() != localmachine.localHW[2])00420 <span class="keywordflow">return</span>(-1);00421 00422 <span class="keywordflow">if</span>( <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>() != localmachine.localHW[1])00423 <span class="keywordflow">return</span>(-1);00424 00425 <span class="keywordflow">if</span>( <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>() != localmachine.localHW[0])00426 <span class="keywordflow">return</span>(-1);00427 00428 <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>();00429 <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>();00430 00431 <span class="keywordflow">for</span>(i=0; i<200; i++)00432 <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>();00433 00434 <span class="comment">/* Check options */</span>00435 00436 dlen -= 236;00437 00438 i = 0;00439 00440 <span class="keywordflow">while</span>(i<dlen) {00441 ch = <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>();00442 i++;00443 00444 <span class="keywordflow">if</span>( (ch != <a class="code" href="bootp_8h.html#a8">BOOTP_OPTION_SUBNETMASK</a>) && (ch != <a class="code" href="bootp_8h.html#a9">BOOTP_OPTION_DEFGW</a>) ) {00445 <span class="comment">/* Not supported option, skip it */</span>00446 00447 j = <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>();00448 i++;00449 00450 <span class="keywordflow">if</span>(j >= 2) {00451 j -= 2;00452 00453 <span class="keywordflow">while</span>(j--) {00454 <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>();00455 i++;00456 }00457 }00458 00459 <span class="keywordflow">continue</span>;00460 00461 }00462 00463 <span class="keywordflow">if</span>( ch == <a class="code" href="bootp_8h.html#a8">BOOTP_OPTION_SUBNETMASK</a>) {00464 <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>(); <span class="comment">/* Skip totlen */</span>00465 nm = <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>();00466 nm <<= 8;00467 nm |= <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>();00468 nm <<= 8;00469 nm |= <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>();00470 nm <<= 8;00471 nm |= <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>();00472 00473 i += 5;00474 00475 }00476 00477 <span class="keywordflow">if</span>( ch == <a class="code" href="bootp_8h.html#a9">BOOTP_OPTION_DEFGW</a>) {00478 j = <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>(); <span class="comment">/* Get totlen */</span>00479 dgw = <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>();00480 dgw <<= 8;00481 dgw |= <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>();00482 dgw <<= 8;00483 dgw |= <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>();00484 dgw <<= 8;00485 dgw |= <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>();00486 00487 i += 5;00488 00489 <span class="comment">/* Skip others */</span>00490 00491 <span class="keywordflow">if</span>( j>5 ) {00492 j -= 5;00493 00494 <span class="keywordflow">while</span>(j--) {00495 <a class="code" href="system_8h.html#a9">RECEIVE_NETWORK_B</a>();00496 i++;00497 }00498 00499 }00500 00501 }00502 00503 }00504 00505 <span class="comment">/* Store parameters */</span>00506 00507 localmachine.localip = ip;00508 localmachine.defgw = dgw;00509 localmachine.netmask = nm;00510 00511 <span class="comment">/* Change state */</span>00512 00513 <a class="code" href="bootp_8c.html#a6">bootp</a>.state = <a class="code" href="bootp_8h.html#a7">BOOTPC_STATE_REPLY_GET</a>;00514 00515 <span class="keywordflow">return</span>(1);00516 00517 }00518 00519 00520 00521 00522 </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 + -