a00148.html 32.4 KB
Newer Older
I
add uip  
itspy.wei 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634
<!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>uIP 1.0: uIP conversion functions</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.6 -->
<div class="tabs">
  <ul>
    <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</span></a></li>
    <li><a href="classes.html"><span>Data&nbsp;Structures</span></a></li>
    <li><a href="files.html"><span>Files</span></a></li>
    <li><a href="examples.html"><span>Examples</span></a></li>
  </ul></div>
<h1>uIP conversion functions<br>
<small>
[<a class="el" href="a00150.html">The uIP TCP/IP stack</a>]</small>
</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
These functions can be used for converting between different data formats used by uIP. 
<p>

<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Defines</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00148.html#g87f0b54ade0d159fba495089128a4932">uip_ipaddr</a>(addr, addr0, addr1, addr2, addr3)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Construct an IP address from four bytes.  <a href="#g87f0b54ade0d159fba495089128a4932"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00148.html#g53fbda0e8c31d4882294c8dc3cb5f487">uip_ip6addr</a>(addr, addr0, addr1, addr2, addr3, addr4, addr5, addr6, addr7)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Construct an IPv6 address from eight 16-bit words.  <a href="#g53fbda0e8c31d4882294c8dc3cb5f487"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00148.html#g769512993b7b27271909d6daa4748b60">uip_ipaddr_copy</a>(dest, src)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Copy an IP address to another IP address.  <a href="#g769512993b7b27271909d6daa4748b60"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00148.html#g210e629f7252e4bc8458cbdf260b3318">uip_ipaddr_cmp</a>(addr1, addr2)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Compare two IP addresses.  <a href="#g210e629f7252e4bc8458cbdf260b3318"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00148.html#g6b16e0bac41821c1fbe0c267071642f0">uip_ipaddr_maskcmp</a>(addr1, addr2, mask)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Compare two IP addresses with netmasks.  <a href="#g6b16e0bac41821c1fbe0c267071642f0"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00148.html#g969d7fff37a979737da045e0d538a9bd">uip_ipaddr_mask</a>(dest, src, mask)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Mask out the network part of an IP address.  <a href="#g969d7fff37a979737da045e0d538a9bd"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00148.html#g22fa0681cd463191d7a01fe85d86996f">uip_ipaddr1</a>(addr)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Pick the first octet of an IP address.  <a href="#g22fa0681cd463191d7a01fe85d86996f"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00148.html#gffcd2fbe181e2aaefbf970551c302af5">uip_ipaddr2</a>(addr)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Pick the second octet of an IP address.  <a href="#gffcd2fbe181e2aaefbf970551c302af5"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00148.html#ge23534479ead15af8ff08ace26a47fb5">uip_ipaddr3</a>(addr)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Pick the third octet of an IP address.  <a href="#ge23534479ead15af8ff08ace26a47fb5"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00148.html#g165b603ec150e26efec7be199c9c2901">uip_ipaddr4</a>(addr)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Pick the fourth octet of an IP address.  <a href="#g165b603ec150e26efec7be199c9c2901"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00148.html#g69a7a4951ff21b302267532c21ee78fc">HTONS</a>(n)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Convert 16-bit quantity from host byte order to network byte order.  <a href="#g69a7a4951ff21b302267532c21ee78fc"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g118e9d76568ab81ad97f138d4ea1ddd2"></a><!-- doxytag: member="uipconvfunc::ntohs" ref="g118e9d76568ab81ad97f138d4ea1ddd2" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00148.html#g118e9d76568ab81ad97f138d4ea1ddd2">ntohs</a>&nbsp;&nbsp;&nbsp;htons</td></tr>

<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00148.html#ga22b04cac8cf283ca12f028578bebc06">htons</a> (<a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> val)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Convert 16-bit quantity from host byte order to network byte order.  <a href="#ga22b04cac8cf283ca12f028578bebc06"></a><br></td></tr>
</table>
<hr><h2>Define Documentation</h2>
<a class="anchor" name="g69a7a4951ff21b302267532c21ee78fc"></a><!-- doxytag: member="uip.h::HTONS" ref="g69a7a4951ff21b302267532c21ee78fc" args="(n)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">#define HTONS          </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">n&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Convert 16-bit quantity from host byte order to network byte order. 
<p>
This macro is primarily used for converting constants from host byte order to network byte order. For converting variables to network byte order, use the <a class="el" href="a00148.html#ga22b04cac8cf283ca12f028578bebc06">htons()</a> function instead. <dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="a00048.html#a6">dhcpc.c</a>, <a class="el" href="a00036.html#a103">hello-world.c</a>, <a class="el" href="a00046.html#a139">resolv.c</a>, <a class="el" href="a00038.html#a191">smtp.c</a>, and <a class="el" href="a00044.html#a219">telnetd.c</a>.</dl>
<p>
Definition at line <a class="el" href="a00202.html#l01070">1070</a> of file <a class="el" href="a00202.html">uip.h</a>.
<p>
Referenced by <a class="el" href="a00170.html#l00041">hello_world_init()</a>, <a class="el" href="a00201.html#l01882">htons()</a>, <a class="el" href="a00184.html#l00333">httpd_init()</a>, <a class="el" href="a00172.html#l00331">resolv_appcall()</a>, <a class="el" href="a00172.html#l00438">resolv_conf()</a>, <a class="el" href="a00174.html#l00233">smtp_send()</a>, <a class="el" href="a00204.html#l00278">uip_arp_arpin()</a>, and <a class="el" href="a00201.html#l00682">uip_process()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="g53fbda0e8c31d4882294c8dc3cb5f487"></a><!-- doxytag: member="uip.h::uip_ip6addr" ref="g53fbda0e8c31d4882294c8dc3cb5f487" args="(addr, addr0, addr1, addr2, addr3, addr4, addr5, addr6, addr7)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">#define uip_ip6addr          </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">addr,         <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>addr0,         <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>addr1,         <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>addr2,         <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>addr3,         <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>addr4,         <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>addr5,         <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>addr6,         <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>addr7&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Construct an IPv6 address from eight 16-bit words. 
<p>
This function constructs an IPv6 address. 
<p>
Definition at line <a class="el" href="a00202.html#l00852">852</a> of file <a class="el" href="a00202.html">uip.h</a>.    </td>
  </tr>
</table>
<a class="anchor" name="g87f0b54ade0d159fba495089128a4932"></a><!-- doxytag: member="uip.h::uip_ipaddr" ref="g87f0b54ade0d159fba495089128a4932" args="(addr, addr0, addr1, addr2, addr3)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">#define uip_ipaddr          </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">addr,         <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>addr0,         <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>addr1,         <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>addr2,         <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>addr3&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Construct an IP address from four bytes. 
<p>
This function constructs an IP address of the type that uIP handles internally from four bytes. The function is handy for specifying IP addresses to use with e.g. the <a class="el" href="a00147.html#g8096b0c4b543dc408f4dd031ddae7240">uip_connect()</a> function.<p>
Example: <div class="fragment"><pre class="fragment"> <a class="code" href="a00150.html#g1ef35301f43a5bbb9f89f07b5a36b9a0">uip_ipaddr_t</a> ipaddr;
 <span class="keyword">struct </span><a class="code" href="a00088.html">uip_conn</a> *c;
 
 <a class="code" href="a00148.html#g87f0b54ade0d159fba495089128a4932">uip_ipaddr</a>(&amp;ipaddr, 192,168,1,2);
 c = <a class="code" href="a00147.html#g8096b0c4b543dc408f4dd031ddae7240">uip_connect</a>(&amp;ipaddr, <a class="code" href="a00148.html#g69a7a4951ff21b302267532c21ee78fc">HTONS</a>(80));
</pre></div><p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>addr</em>&nbsp;</td><td>A pointer to a uip_ipaddr_t variable that will be filled in with the IP address.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>addr0</em>&nbsp;</td><td>The first octet of the IP address. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>addr1</em>&nbsp;</td><td>The second octet of the IP address. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>addr2</em>&nbsp;</td><td>The third octet of the IP address. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>addr3</em>&nbsp;</td><td>The forth octet of the IP address. </td></tr>
  </table>
</dl>
<dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="a00048.html#a36">dhcpc.c</a>, <a class="el" href="a00042.html#a65">example-mainloop-with-arp.c</a>, and <a class="el" href="a00043.html#a89">example-mainloop-without-arp.c</a>.</dl>
<p>
Definition at line <a class="el" href="a00202.html#l00840">840</a> of file <a class="el" href="a00202.html">uip.h</a>.    </td>
  </tr>
</table>
<a class="anchor" name="g22fa0681cd463191d7a01fe85d86996f"></a><!-- doxytag: member="uip.h::uip_ipaddr1" ref="g22fa0681cd463191d7a01fe85d86996f" args="(addr)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">#define uip_ipaddr1          </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">addr&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Pick the first octet of an IP address. 
<p>
Picks out the first octet of an IP address.<p>
Example: <div class="fragment"><pre class="fragment"> <a class="code" href="a00150.html#g1ef35301f43a5bbb9f89f07b5a36b9a0">uip_ipaddr_t</a> ipaddr;
 <a class="code" href="a00153.html#g4caecabca98b43919dd11be1c0d4cd8e">u8_t</a> octet;

 <a class="code" href="a00148.html#g87f0b54ade0d159fba495089128a4932">uip_ipaddr</a>(&amp;ipaddr, 1,2,3,4);
 octet = <a class="code" href="a00148.html#g22fa0681cd463191d7a01fe85d86996f">uip_ipaddr1</a>(&amp;ipaddr);
</pre></div><p>
In the example above, the variable "octet" will contain the value 1. <dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="a00048.html#a28">dhcpc.c</a>.</dl>
<p>
Definition at line <a class="el" href="a00202.html#l00995">995</a> of file <a class="el" href="a00202.html">uip.h</a>.    </td>
  </tr>
</table>
<a class="anchor" name="gffcd2fbe181e2aaefbf970551c302af5"></a><!-- doxytag: member="uip.h::uip_ipaddr2" ref="gffcd2fbe181e2aaefbf970551c302af5" args="(addr)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">#define uip_ipaddr2          </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">addr&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Pick the second octet of an IP address. 
<p>
Picks out the second octet of an IP address.<p>
Example: <div class="fragment"><pre class="fragment"> <a class="code" href="a00150.html#g1ef35301f43a5bbb9f89f07b5a36b9a0">uip_ipaddr_t</a> ipaddr;
 <a class="code" href="a00153.html#g4caecabca98b43919dd11be1c0d4cd8e">u8_t</a> octet;

 <a class="code" href="a00148.html#g87f0b54ade0d159fba495089128a4932">uip_ipaddr</a>(&amp;ipaddr, 1,2,3,4);
 octet = <a class="code" href="a00148.html#gffcd2fbe181e2aaefbf970551c302af5">uip_ipaddr2</a>(&amp;ipaddr);
</pre></div><p>
In the example above, the variable "octet" will contain the value 2. <dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="a00048.html#a29">dhcpc.c</a>.</dl>
<p>
Definition at line <a class="el" href="a00202.html#l01015">1015</a> of file <a class="el" href="a00202.html">uip.h</a>.    </td>
  </tr>
</table>
<a class="anchor" name="ge23534479ead15af8ff08ace26a47fb5"></a><!-- doxytag: member="uip.h::uip_ipaddr3" ref="ge23534479ead15af8ff08ace26a47fb5" args="(addr)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">#define uip_ipaddr3          </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">addr&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Pick the third octet of an IP address. 
<p>
Picks out the third octet of an IP address.<p>
Example: <div class="fragment"><pre class="fragment"> <a class="code" href="a00150.html#g1ef35301f43a5bbb9f89f07b5a36b9a0">uip_ipaddr_t</a> ipaddr;
 <a class="code" href="a00153.html#g4caecabca98b43919dd11be1c0d4cd8e">u8_t</a> octet;

 <a class="code" href="a00148.html#g87f0b54ade0d159fba495089128a4932">uip_ipaddr</a>(&amp;ipaddr, 1,2,3,4);
 octet = <a class="code" href="a00148.html#ge23534479ead15af8ff08ace26a47fb5">uip_ipaddr3</a>(&amp;ipaddr);
</pre></div><p>
In the example above, the variable "octet" will contain the value 3. <dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="a00048.html#a30">dhcpc.c</a>.</dl>
<p>
Definition at line <a class="el" href="a00202.html#l01035">1035</a> of file <a class="el" href="a00202.html">uip.h</a>.    </td>
  </tr>
</table>
<a class="anchor" name="g165b603ec150e26efec7be199c9c2901"></a><!-- doxytag: member="uip.h::uip_ipaddr4" ref="g165b603ec150e26efec7be199c9c2901" args="(addr)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">#define uip_ipaddr4          </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">addr&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Pick the fourth octet of an IP address. 
<p>
Picks out the fourth octet of an IP address.<p>
Example: <div class="fragment"><pre class="fragment"> <a class="code" href="a00150.html#g1ef35301f43a5bbb9f89f07b5a36b9a0">uip_ipaddr_t</a> ipaddr;
 <a class="code" href="a00153.html#g4caecabca98b43919dd11be1c0d4cd8e">u8_t</a> octet;

 <a class="code" href="a00148.html#g87f0b54ade0d159fba495089128a4932">uip_ipaddr</a>(&amp;ipaddr, 1,2,3,4);
 octet = <a class="code" href="a00148.html#g165b603ec150e26efec7be199c9c2901">uip_ipaddr4</a>(&amp;ipaddr);
</pre></div><p>
In the example above, the variable "octet" will contain the value 4. <dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="a00048.html#a31">dhcpc.c</a>.</dl>
<p>
Definition at line <a class="el" href="a00202.html#l01055">1055</a> of file <a class="el" href="a00202.html">uip.h</a>.    </td>
  </tr>
</table>
<a class="anchor" name="g210e629f7252e4bc8458cbdf260b3318"></a><!-- doxytag: member="uip.h::uip_ipaddr_cmp" ref="g210e629f7252e4bc8458cbdf260b3318" args="(addr1, addr2)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">#define uip_ipaddr_cmp          </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">addr1,         <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>addr2&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Compare two IP addresses. 
<p>
Compares two IP addresses.<p>
Example: <div class="fragment"><pre class="fragment"> <a class="code" href="a00150.html#g1ef35301f43a5bbb9f89f07b5a36b9a0">uip_ipaddr_t</a> ipaddr1, ipaddr2;

 <a class="code" href="a00148.html#g87f0b54ade0d159fba495089128a4932">uip_ipaddr</a>(&amp;ipaddr1, 192,16,1,2);
 <span class="keywordflow">if</span>(<a class="code" href="a00148.html#g210e629f7252e4bc8458cbdf260b3318">uip_ipaddr_cmp</a>(&amp;ipaddr2, &amp;ipaddr1)) {
    printf(<span class="stringliteral">"They are the same"</span>);
 }
</pre></div><p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>addr1</em>&nbsp;</td><td>The first IP address. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>addr2</em>&nbsp;</td><td>The second IP address. </td></tr>
  </table>
</dl>

<p>
Definition at line <a class="el" href="a00202.html#l00911">911</a> of file <a class="el" href="a00202.html">uip.h</a>.
<p>
Referenced by <a class="el" href="a00204.html#l00278">uip_arp_arpin()</a>, <a class="el" href="a00204.html#l00354">uip_arp_out()</a>, and <a class="el" href="a00201.html#l00682">uip_process()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="g769512993b7b27271909d6daa4748b60"></a><!-- doxytag: member="uip.h::uip_ipaddr_copy" ref="g769512993b7b27271909d6daa4748b60" args="(dest, src)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">#define uip_ipaddr_copy          </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">dest,         <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>src&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Copy an IP address to another IP address. 
<p>
Copies an IP address from one place to another.<p>
Example: <div class="fragment"><pre class="fragment"> <a class="code" href="a00150.html#g1ef35301f43a5bbb9f89f07b5a36b9a0">uip_ipaddr_t</a> ipaddr1, ipaddr2;

 <a class="code" href="a00148.html#g87f0b54ade0d159fba495089128a4932">uip_ipaddr</a>(&amp;ipaddr1, 192,16,1,2);
 <a class="code" href="a00148.html#g769512993b7b27271909d6daa4748b60">uip_ipaddr_copy</a>(&amp;ipaddr2, &amp;ipaddr1);
</pre></div><p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>dest</em>&nbsp;</td><td>The destination for the copy. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>src</em>&nbsp;</td><td>The source from where to copy. </td></tr>
  </table>
</dl>
<dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="a00038.html#a187">smtp.c</a>.</dl>
<p>
Definition at line <a class="el" href="a00202.html#l00882">882</a> of file <a class="el" href="a00202.html">uip.h</a>.
<p>
Referenced by <a class="el" href="a00174.html#l00216">smtp_configure()</a>, <a class="el" href="a00204.html#l00354">uip_arp_out()</a>, and <a class="el" href="a00201.html#l00682">uip_process()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="g969d7fff37a979737da045e0d538a9bd"></a><!-- doxytag: member="uip.h::uip_ipaddr_mask" ref="g969d7fff37a979737da045e0d538a9bd" args="(dest, src, mask)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">#define uip_ipaddr_mask          </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">dest,         <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>src,         <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>mask&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Mask out the network part of an IP address. 
<p>
Masks out the network part of an IP address, given the address and the netmask.<p>
Example: <div class="fragment"><pre class="fragment"> <a class="code" href="a00150.html#g1ef35301f43a5bbb9f89f07b5a36b9a0">uip_ipaddr_t</a> ipaddr1, ipaddr2, netmask;

 <a class="code" href="a00148.html#g87f0b54ade0d159fba495089128a4932">uip_ipaddr</a>(&amp;ipaddr1, 192,16,1,2);
 <a class="code" href="a00148.html#g87f0b54ade0d159fba495089128a4932">uip_ipaddr</a>(&amp;netmask, 255,255,255,0);
 <a class="code" href="a00148.html#g969d7fff37a979737da045e0d538a9bd">uip_ipaddr_mask</a>(&amp;ipaddr2, &amp;ipaddr1, &amp;netmask);
</pre></div><p>
In the example above, the variable "ipaddr2" will contain the IP address 192.168.1.0.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>dest</em>&nbsp;</td><td>Where the result is to be placed. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>src</em>&nbsp;</td><td>The IP address. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>mask</em>&nbsp;</td><td>The netmask. </td></tr>
  </table>
</dl>

<p>
Definition at line <a class="el" href="a00202.html#l00972">972</a> of file <a class="el" href="a00202.html">uip.h</a>.    </td>
  </tr>
</table>
<a class="anchor" name="g6b16e0bac41821c1fbe0c267071642f0"></a><!-- doxytag: member="uip.h::uip_ipaddr_maskcmp" ref="g6b16e0bac41821c1fbe0c267071642f0" args="(addr1, addr2, mask)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">#define uip_ipaddr_maskcmp          </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">addr1,         <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>addr2,         <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>mask&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Compare two IP addresses with netmasks. 
<p>
Compares two IP addresses with netmasks. The masks are used to mask out the bits that are to be compared.<p>
Example: <div class="fragment"><pre class="fragment"> <a class="code" href="a00150.html#g1ef35301f43a5bbb9f89f07b5a36b9a0">uip_ipaddr_t</a> ipaddr1, ipaddr2, mask;

 <a class="code" href="a00148.html#g87f0b54ade0d159fba495089128a4932">uip_ipaddr</a>(&amp;mask, 255,255,255,0);
 <a class="code" href="a00148.html#g87f0b54ade0d159fba495089128a4932">uip_ipaddr</a>(&amp;ipaddr1, 192,16,1,2);
 <a class="code" href="a00148.html#g87f0b54ade0d159fba495089128a4932">uip_ipaddr</a>(&amp;ipaddr2, 192,16,1,3);
 <span class="keywordflow">if</span>(<a class="code" href="a00148.html#g6b16e0bac41821c1fbe0c267071642f0">uip_ipaddr_maskcmp</a>(&amp;ipaddr1, &amp;ipaddr2, &amp;mask)) {
    printf(<span class="stringliteral">"They are the same"</span>);
 }
</pre></div><p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>addr1</em>&nbsp;</td><td>The first IP address. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>addr2</em>&nbsp;</td><td>The second IP address. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>mask</em>&nbsp;</td><td>The netmask. </td></tr>
  </table>
</dl>

<p>
Definition at line <a class="el" href="a00202.html#l00941">941</a> of file <a class="el" href="a00202.html">uip.h</a>.
<p>
Referenced by <a class="el" href="a00204.html#l00354">uip_arp_out()</a>.    </td>
  </tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="ga22b04cac8cf283ca12f028578bebc06"></a><!-- doxytag: member="uip.h::htons" ref="ga22b04cac8cf283ca12f028578bebc06" args="(u16_t val)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> htons           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a>&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>val</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Convert 16-bit quantity from host byte order to network byte order. 
<p>
This function is primarily used for converting variables from host byte order to network byte order. For converting constants to network byte order, use the <a class="el" href="a00148.html#g69a7a4951ff21b302267532c21ee78fc">HTONS()</a> macro instead. <dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="a00042.html#a70">example-mainloop-with-arp.c</a>, <a class="el" href="a00046.html#a137">resolv.c</a>, and <a class="el" href="a00040.html#a274">webclient.c</a>.</dl>
<p>
Definition at line <a class="el" href="a00201.html#l01882">1882</a> of file <a class="el" href="a00201.html">uip.c</a>.
<p>
References <a class="el" href="a00202.html#l01070">HTONS</a>.
<p>
Referenced by <a class="el" href="a00201.html#l00311">uip_chksum()</a>, <a class="el" href="a00201.html#l00407">uip_connect()</a>, <a class="el" href="a00201.html#l00318">uip_ipchksum()</a>, <a class="el" href="a00201.html#l00473">uip_udp_new()</a>, and <a class="el" href="a00180.html#l00140">webclient_get()</a>.    </td>
  </tr>
</table>
<hr size="1"><address style="align: right;"><small>Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.6 </small></address>
</body>
</html>