/usr/share/doc/libucommon-dev/a00205_source.html is in libucommon-doc 3.2.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>UCommon: ucommon/socket.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<h1>ucommon/socket.h</h1><a href="a00205.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// Copyright (C) 2006-2010 David Sugar, Tycho Softworks.</span>
<a name="l00002"></a>00002 <span class="comment">//</span>
<a name="l00003"></a>00003 <span class="comment">// This file is part of GNU uCommon C++.</span>
<a name="l00004"></a>00004 <span class="comment">//</span>
<a name="l00005"></a>00005 <span class="comment">// GNU uCommon C++ is free software: you can redistribute it and/or modify</span>
<a name="l00006"></a>00006 <span class="comment">// it under the terms of the GNU Lesser General Public License as published </span>
<a name="l00007"></a>00007 <span class="comment">// by the Free Software Foundation, either version 3 of the License, or</span>
<a name="l00008"></a>00008 <span class="comment">// (at your option) any later version.</span>
<a name="l00009"></a>00009 <span class="comment">//</span>
<a name="l00010"></a>00010 <span class="comment">// GNU uCommon C++ is distributed in the hope that it will be useful,</span>
<a name="l00011"></a>00011 <span class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00012"></a>00012 <span class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
<a name="l00013"></a>00013 <span class="comment">// GNU Lesser General Public License for more details.</span>
<a name="l00014"></a>00014 <span class="comment">//</span>
<a name="l00015"></a>00015 <span class="comment">// You should have received a copy of the GNU Lesser General Public License</span>
<a name="l00016"></a>00016 <span class="comment">// along with GNU uCommon C++. If not, see <http://www.gnu.org/licenses/>.</span>
<a name="l00017"></a>00017
<a name="l00026"></a>00026 <span class="preprocessor">#ifndef _UCOMMON_SOCKET_H_</span>
<a name="l00027"></a>00027 <span class="preprocessor"></span><span class="preprocessor">#define _UCOMMON_SOCKET_H_</span>
<a name="l00028"></a>00028 <span class="preprocessor"></span>
<a name="l00029"></a>00029 <span class="preprocessor">#ifndef _UCOMMON_TIMERS_H_</span>
<a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">#include <<a class="code" href="a00209.html" title="Realtime timers and timer queues.">ucommon/timers.h</a>></span>
<a name="l00031"></a>00031 <span class="preprocessor">#endif</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span>
<a name="l00033"></a>00033 <span class="preprocessor">#ifndef _UCOMMON_LINKED_H_</span>
<a name="l00034"></a>00034 <span class="preprocessor"></span><span class="preprocessor">#include <<a class="code" href="a00195.html" title="Linked objects, lists, templates, and containers.">ucommon/linked.h</a>></span>
<a name="l00035"></a>00035 <span class="preprocessor">#endif</span>
<a name="l00036"></a>00036 <span class="preprocessor"></span>
<a name="l00037"></a>00037 <span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
<a name="l00038"></a>00038 <span class="keyword">struct </span><a class="code" href="a00214.html#af219737d0331ec303433aa3d4028c8cf" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a>;
<a name="l00039"></a>00039 }
<a name="l00040"></a>00040
<a name="l00041"></a>00041 <span class="preprocessor">#ifdef _MSWINDOWS_</span>
<a name="l00042"></a>00042 <span class="preprocessor"></span><span class="preprocessor">#define SHUT_RDWR SD_BOTH</span>
<a name="l00043"></a>00043 <span class="preprocessor"></span><span class="preprocessor">#define SHUT_WR SD_SEND</span>
<a name="l00044"></a>00044 <span class="preprocessor"></span><span class="preprocessor">#define SHUT_RD SD_RECV</span>
<a name="l00045"></a>00045 <span class="preprocessor"></span><span class="preprocessor">#else</span>
<a name="l00046"></a>00046 <span class="preprocessor"></span><span class="preprocessor">#include <unistd.h></span>
<a name="l00047"></a>00047 <span class="preprocessor">#include <sys/socket.h></span>
<a name="l00048"></a>00048 <span class="preprocessor">#include <net/if.h></span>
<a name="l00049"></a>00049 <span class="preprocessor">#include <netinet/in.h></span>
<a name="l00050"></a>00050 <span class="preprocessor">#include <netdb.h></span>
<a name="l00051"></a>00051 <span class="preprocessor">#endif</span>
<a name="l00052"></a>00052 <span class="preprocessor"></span>
<a name="l00053"></a>00053 <span class="preprocessor">#include <errno.h></span>
<a name="l00054"></a>00054 <span class="preprocessor">#include <stdio.h></span>
<a name="l00055"></a>00055
<a name="l00056"></a>00056 <span class="preprocessor">#ifndef IPTOS_LOWDELAY</span>
<a name="l00057"></a>00057 <span class="preprocessor"></span><span class="preprocessor">#define IPTOS_LOWDELAY 0x10</span>
<a name="l00058"></a>00058 <span class="preprocessor"></span><span class="preprocessor">#define IPTOS_THROUGHPUT 0x08</span>
<a name="l00059"></a>00059 <span class="preprocessor"></span><span class="preprocessor">#define IPTOS_RELIABILITY 0x04</span>
<a name="l00060"></a>00060 <span class="preprocessor"></span><span class="preprocessor">#define IPTOS_MINCOST 0x02</span>
<a name="l00061"></a>00061 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00062"></a>00062 <span class="preprocessor"></span>
<a name="l00063"></a>00063 <span class="preprocessor">#ifdef AF_UNSPEC</span>
<a name="l00064"></a>00064 <span class="preprocessor"></span><span class="preprocessor">#define DEFAULT_FAMILY AF_UNSPEC</span>
<a name="l00065"></a>00065 <span class="preprocessor"></span><span class="preprocessor">#else</span>
<a name="l00066"></a>00066 <span class="preprocessor"></span><span class="preprocessor">#define DEFAULT_FAMILY AF_INET</span>
<a name="l00067"></a>00067 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00068"></a>00068 <span class="preprocessor"></span>
<a name="l00069"></a>00069 <span class="keyword">struct </span><a class="code" href="a00016.html" title="An object that can hold a ipv4 or ipv6 socket address.">sockaddr_internet</a>;
<a name="l00070"></a>00070
<a name="l00074"></a><a class="code" href="a00014.html">00074</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="a00014.html" title="An object that holds ipv4 or ipv6 binary encoded host addresses.">hostaddr_internet</a>
<a name="l00075"></a>00075 {
<a name="l00076"></a>00076 <span class="keyword">union</span>
<a name="l00077"></a>00077 {
<a name="l00078"></a>00078 <span class="keyword">struct </span>in_addr ipv4;
<a name="l00079"></a>00079 <span class="preprocessor">#ifdef AF_INET6</span>
<a name="l00080"></a>00080 <span class="preprocessor"></span> <span class="keyword">struct </span>in6_addr ipv6;
<a name="l00081"></a>00081 <span class="preprocessor">#endif</span>
<a name="l00082"></a>00082 <span class="preprocessor"></span> };
<a name="l00083"></a>00083 } <a class="code" href="a00014.html" title="An object that holds ipv4 or ipv6 binary encoded host addresses.">inethostaddr_t</a>;
<a name="l00084"></a>00084
<a name="l00085"></a>00085 <span class="preprocessor">#if defined(AF_INET6) || defined(__CYGWIN__)</span>
<a name="l00086"></a>00086 <span class="preprocessor"></span>
<a name="l00093"></a><a class="code" href="a00016.html">00093</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="a00016.html" title="An object that can hold a ipv4 or ipv6 socket address.">sockaddr_internet</a>
<a name="l00094"></a>00094 {
<a name="l00095"></a>00095 <span class="keyword">union </span>{
<a name="l00096"></a>00096 <span class="preprocessor">#ifdef AF_INET6</span>
<a name="l00097"></a>00097 <span class="preprocessor"></span> <span class="keyword">struct </span>sockaddr_in6 ipv6;
<a name="l00098"></a>00098 <span class="preprocessor">#endif</span>
<a name="l00099"></a>00099 <span class="preprocessor"></span> <span class="keyword">struct </span>sockaddr_in ipv4;
<a name="l00100"></a>00100 <span class="keyword">struct </span>sockaddr address;
<a name="l00101"></a>00101 };
<a name="l00102"></a>00102 } <a class="code" href="a00016.html" title="An object that can hold a ipv4 or ipv6 socket address.">inetsockaddr_t</a>;
<a name="l00103"></a>00103 <span class="preprocessor">#else</span>
<a name="l00104"></a>00104 <span class="preprocessor"></span><span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="a00016.html" title="An object that can hold a ipv4 or ipv6 socket address.">sockaddr_internet</a>
<a name="l00105"></a>00105 {
<a name="l00106"></a>00106 <span class="keyword">union </span>{
<a name="l00107"></a>00107 <span class="keyword">struct </span>sockaddr_in ipv4;
<a name="l00108"></a>00108 <span class="keyword">struct </span>sockaddr address;
<a name="l00109"></a>00109 };
<a name="l00110"></a>00110 } <a class="code" href="a00016.html" title="An object that can hold a ipv4 or ipv6 socket address.">inetsockaddr_t</a>;
<a name="l00111"></a>00111
<a name="l00112"></a>00112 <span class="keyword">struct </span>sockaddr_storage
<a name="l00113"></a>00113 {
<a name="l00114"></a>00114 <span class="preprocessor">#ifdef AF_UNIX</span>
<a name="l00115"></a>00115 <span class="preprocessor"></span> <span class="keywordtype">char</span> sa_data[128];
<a name="l00116"></a>00116 <span class="preprocessor">#else</span>
<a name="l00117"></a>00117 <span class="preprocessor"></span> <span class="keywordtype">char</span> sa_data[<span class="keyword">sizeof</span>(<span class="keyword">struct </span>sockaddr_in)];
<a name="l00118"></a>00118 <span class="preprocessor">#endif</span>
<a name="l00119"></a>00119 <span class="preprocessor"></span>};
<a name="l00120"></a>00120 <span class="preprocessor">#endif</span>
<a name="l00121"></a>00121 <span class="preprocessor"></span>
<a name="l00122"></a>00122 <span class="preprocessor">#ifndef SOCK_DCCP</span>
<a name="l00123"></a>00123 <span class="preprocessor"></span><span class="preprocessor">#define SOCK_DCCP 6</span>
<a name="l00124"></a>00124 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00125"></a>00125 <span class="preprocessor"></span>
<a name="l00126"></a>00126 <span class="preprocessor">#ifndef IPPROTO_DCCP</span>
<a name="l00127"></a>00127 <span class="preprocessor"></span><span class="preprocessor">#define IPPROTO_DCCP 23</span>
<a name="l00128"></a>00128 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00129"></a>00129 <span class="preprocessor"></span>
<a name="l00130"></a>00130 <span class="preprocessor">#ifndef SOL_DCCP</span>
<a name="l00131"></a>00131 <span class="preprocessor"></span><span class="preprocessor">#define SOL_DCCP 269</span>
<a name="l00132"></a>00132 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00133"></a>00133 <span class="preprocessor"></span>
<a name="l00134"></a>00134 <span class="preprocessor">#define DCCP_SOCKOPT_AVAILABLE_CCIDS 12</span>
<a name="l00135"></a>00135 <span class="preprocessor"></span><span class="preprocessor">#define DCCP_SOCKOPT_CCID 13</span>
<a name="l00136"></a>00136 <span class="preprocessor"></span><span class="preprocessor">#define DCCP_SOCKOPT_TX_CCID 14</span>
<a name="l00137"></a>00137 <span class="preprocessor"></span><span class="preprocessor">#define DCCP_SOCKOPT_RX_CCID 15</span>
<a name="l00138"></a>00138 <span class="preprocessor"></span>
<a name="l00139"></a>00139 NAMESPACE_UCOMMON
<a name="l00140"></a>00140
<a name="l00150"></a><a class="code" href="a00037.html">00150</a> <span class="keyword">class </span>__EXPORT <a class="code" href="a00037.html" title="A class to hold internet segment routing rules.">cidr</a> : <span class="keyword">public</span> <a class="code" href="a00069.html" title="Common base class for all objects that can be formed into a linked list.">LinkedObject</a>
<a name="l00151"></a>00151 {
<a name="l00152"></a>00152 <span class="keyword">protected</span>:
<a name="l00153"></a>00153 <span class="keywordtype">int</span> family;
<a name="l00154"></a>00154 <a class="code" href="a00014.html" title="An object that holds ipv4 or ipv6 binary encoded host addresses.">inethostaddr_t</a> netmask, network;
<a name="l00155"></a>00155 <span class="keywordtype">char</span> name[16];
<a name="l00156"></a>00156 <span class="keywordtype">unsigned</span> getMask(<span class="keyword">const</span> <span class="keywordtype">char</span> *cp) <span class="keyword">const</span>;
<a name="l00157"></a>00157
<a name="l00158"></a>00158 <span class="keyword">public</span>:
<a name="l00162"></a><a class="code" href="a00037.html#a4a98545d3149bdf1e916556799184742">00162</a> <span class="keyword">typedef</span> <a class="code" href="a00069.html" title="Common base class for all objects that can be formed into a linked list.">LinkedObject</a> <a class="code" href="a00069.html" title="Common base class for all objects that can be formed into a linked list.">policy</a>;
<a name="l00163"></a>00163
<a name="l00167"></a>00167 <a class="code" href="a00037.html" title="A class to hold internet segment routing rules.">cidr</a>();
<a name="l00168"></a>00168
<a name="l00175"></a>00175 <a class="code" href="a00037.html" title="A class to hold internet segment routing rules.">cidr</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">string</span>);
<a name="l00176"></a>00176
<a name="l00182"></a>00182 <a class="code" href="a00037.html" title="A class to hold internet segment routing rules.">cidr</a>(<a class="code" href="a00069.html" title="Common base class for all objects that can be formed into a linked list.">policy</a> **<a class="code" href="a00069.html" title="Common base class for all objects that can be formed into a linked list.">policy</a>, <span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">string</span>);
<a name="l00183"></a>00183
<a name="l00190"></a>00190 <a class="code" href="a00037.html" title="A class to hold internet segment routing rules.">cidr</a>(<a class="code" href="a00069.html" title="Common base class for all objects that can be formed into a linked list.">policy</a> **<a class="code" href="a00069.html" title="Common base class for all objects that can be formed into a linked list.">policy</a>, <span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">string</span>, <span class="keyword">const</span> <span class="keywordtype">char</span> *name);
<a name="l00191"></a>00191
<a name="l00196"></a>00196 <a class="code" href="a00037.html" title="A class to hold internet segment routing rules.">cidr</a>(<span class="keyword">const</span> <a class="code" href="a00037.html" title="A class to hold internet segment routing rules.">cidr</a>& existing);
<a name="l00197"></a>00197
<a name="l00204"></a>00204 <span class="keyword">static</span> <a class="code" href="a00037.html" title="A class to hold internet segment routing rules.">cidr</a> *find(<a class="code" href="a00069.html" title="Common base class for all objects that can be formed into a linked list.">policy</a> *<a class="code" href="a00069.html" title="Common base class for all objects that can be formed into a linked list.">policy</a>, <span class="keyword">const</span> <span class="keyword">struct</span> sockaddr *address);
<a name="l00205"></a>00205
<a name="l00213"></a>00213 <span class="keyword">static</span> <a class="code" href="a00037.html" title="A class to hold internet segment routing rules.">cidr</a> *container(<a class="code" href="a00069.html" title="Common base class for all objects that can be formed into a linked list.">policy</a> *<a class="code" href="a00069.html" title="Common base class for all objects that can be formed into a linked list.">policy</a>, <span class="keyword">const</span> <span class="keyword">struct</span> sockaddr *address);
<a name="l00214"></a>00214
<a name="l00222"></a><a class="code" href="a00037.html#a07b6ba9aea9ceba920ea58d32f6f7874">00222</a> <span class="keyword">inline</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *getName(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<a name="l00223"></a>00223 <span class="keyword"> </span>{<span class="keywordflow">return</span> name;};
<a name="l00224"></a>00224
<a name="l00229"></a><a class="code" href="a00037.html#a69419b44cfc9155186dbf2124518ceab">00229</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> getFamily(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<a name="l00230"></a>00230 <span class="keyword"> </span>{<span class="keywordflow">return</span> family;};
<a name="l00231"></a>00231
<a name="l00236"></a><a class="code" href="a00037.html#a9d2e8638edf4a889b0f372d8bc4b4466">00236</a> <span class="keyword">inline</span> <a class="code" href="a00014.html" title="An object that holds ipv4 or ipv6 binary encoded host addresses.">inethostaddr_t</a> getNetwork(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<a name="l00237"></a>00237 <span class="keyword"> </span>{<span class="keywordflow">return</span> network;};
<a name="l00238"></a>00238
<a name="l00243"></a><a class="code" href="a00037.html#a75de7df903a35b755866349d794e807a">00243</a> <span class="keyword">inline</span> <a class="code" href="a00014.html" title="An object that holds ipv4 or ipv6 binary encoded host addresses.">inethostaddr_t</a> getNetmask(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<a name="l00244"></a>00244 <span class="keyword"> </span>{<span class="keywordflow">return</span> netmask;};
<a name="l00245"></a>00245
<a name="l00250"></a>00250 <a class="code" href="a00014.html" title="An object that holds ipv4 or ipv6 binary encoded host addresses.">inethostaddr_t</a> getBroadcast(<span class="keywordtype">void</span>) <span class="keyword">const</span>;
<a name="l00251"></a>00251
<a name="l00256"></a>00256 <span class="keywordtype">unsigned</span> getMask(<span class="keywordtype">void</span>) <span class="keyword">const</span>;
<a name="l00257"></a>00257
<a name="l00262"></a>00262 <span class="keywordtype">void</span> <span class="keyword">set</span>(<span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="a00157.html" title="A copy-on-write string class that operates by reference count.">string</a>);
<a name="l00263"></a>00263
<a name="l00269"></a>00269 <span class="keywordtype">bool</span> <a class="code" href="a00069.html#a05d733ee681c00c12951862faade90ac" title="Search to see if we are a member of a specific list.">isMember</a>(<span class="keyword">const</span> <span class="keyword">struct</span> sockaddr *address) <span class="keyword">const</span>;
<a name="l00270"></a>00270
<a name="l00276"></a><a class="code" href="a00037.html#a1591fa9532e4e750d6d7d9397347f9bc">00276</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> operator==(<span class="keyword">const</span> <span class="keyword">struct</span> sockaddr *address)<span class="keyword"> const</span>
<a name="l00277"></a>00277 <span class="keyword"> </span>{<span class="keywordflow">return</span> <a class="code" href="a00069.html#a05d733ee681c00c12951862faade90ac" title="Search to see if we are a member of a specific list.">isMember</a>(address);};
<a name="l00278"></a>00278
<a name="l00284"></a><a class="code" href="a00037.html#ab04659f9694865a447683305fcc63b90">00284</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> operator!=(<span class="keyword">const</span> <span class="keyword">struct</span> sockaddr *address)<span class="keyword"> const</span>
<a name="l00285"></a>00285 <span class="keyword"> </span>{<span class="keywordflow">return</span> !<a class="code" href="a00069.html#a05d733ee681c00c12951862faade90ac" title="Search to see if we are a member of a specific list.">isMember</a>(address);};
<a name="l00286"></a>00286 };
<a name="l00287"></a>00287
<a name="l00295"></a><a class="code" href="a00151.html">00295</a> <span class="keyword">class </span>__EXPORT <a class="code" href="a00151.html" title="A generic socket base class.">Socket</a>
<a name="l00296"></a>00296 {
<a name="l00297"></a>00297 <span class="keyword">protected</span>:
<a name="l00298"></a>00298 socket_t so;
<a name="l00299"></a>00299
<a name="l00308"></a>00308 <span class="keyword">static</span> <span class="keyword">struct </span><a class="code" href="a00214.html#af219737d0331ec303433aa3d4028c8cf" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *getaddress(<span class="keyword">const</span> <span class="keywordtype">char</span> *host, <span class="keyword">const</span> <span class="keywordtype">char</span> *service, <span class="keywordtype">int</span> type = SOCK_STREAM, <span class="keywordtype">int</span> protocol = 0);
<a name="l00309"></a>00309
<a name="l00315"></a>00315 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="a00214.html#ab7bef2898e731474a9c3dfa805a6f56d" title="Convenience function to unlock shared object through it&#39;s protocol.">release</a>(<span class="keyword">struct</span> <a class="code" href="a00214.html#af219737d0331ec303433aa3d4028c8cf" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *list);
<a name="l00316"></a>00316
<a name="l00317"></a>00317 <span class="keyword">public</span>:
<a name="l00323"></a><a class="code" href="a00151.html#a5a400bf28880fc77315a415fe6be26c9">00323</a> <span class="keyword">typedef</span> <span class="keywordtype">void</span> *set_t;
<a name="l00324"></a>00324
<a name="l00325"></a>00325 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">size_t</span> masksize;
<a name="l00326"></a>00326
<a name="l00335"></a><a class="code" href="a00152.html">00335</a> <span class="keyword">class </span>__EXPORT <a class="code" href="a00152.html" title="A generic socket address class.">address</a>
<a name="l00336"></a>00336 {
<a name="l00337"></a>00337 <span class="keyword">protected</span>:
<a name="l00338"></a>00338 <span class="keyword">struct </span><a class="code" href="a00214.html#af219737d0331ec303433aa3d4028c8cf" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *list;
<a name="l00339"></a>00339
<a name="l00340"></a>00340 <span class="keyword">public</span>:
<a name="l00348"></a>00348 <a class="code" href="a00152.html" title="A generic socket address class.">address</a>(<span class="keywordtype">int</span> family, <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="a00152.html" title="A generic socket address class.">address</a>, <span class="keywordtype">int</span> type = SOCK_STREAM, <span class="keywordtype">int</span> protocol = 0);
<a name="l00349"></a>00349
<a name="l00356"></a>00356 address(<a class="code" href="a00151.html" title="A generic socket base class.">Socket</a>& <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keyword">const</span> <span class="keywordtype">char</span> *hostname, <span class="keyword">const</span> <span class="keywordtype">char</span> *service = NULL);
<a name="l00357"></a>00357
<a name="l00364"></a>00364 address(socket_t socket, <span class="keyword">const</span> <span class="keywordtype">char</span> *hostname, <span class="keyword">const</span> <span class="keywordtype">char</span> *service = NULL);
<a name="l00365"></a>00365
<a name="l00372"></a>00372 address(<span class="keyword">const</span> <span class="keywordtype">char</span> *hostname, <span class="keywordtype">unsigned</span> service = 0, <span class="keywordtype">int</span> family = DEFAULT_FAMILY);
<a name="l00373"></a>00373
<a name="l00377"></a>00377 address();
<a name="l00378"></a>00378
<a name="l00383"></a>00383 address(<span class="keyword">const</span> address& reference);
<a name="l00384"></a>00384
<a name="l00388"></a>00388 ~address();
<a name="l00389"></a>00389
<a name="l00394"></a>00394 <span class="keyword">struct </span>sockaddr *getAddr(<span class="keywordtype">void</span>) <span class="keyword">const</span>;
<a name="l00395"></a>00395
<a name="l00401"></a>00401 <span class="keyword">struct </span>sockaddr *<span class="keyword">get</span>(<span class="keywordtype">int</span> family) <span class="keyword">const</span>;
<a name="l00402"></a>00402
<a name="l00407"></a>00407 <span class="keywordtype">int</span> getfamily(<span class="keywordtype">void</span>) <span class="keyword">const</span>;
<a name="l00408"></a>00408
<a name="l00413"></a>00413 <span class="keyword">struct </span>sockaddr *find(<span class="keyword">struct</span> sockaddr *<a class="code" href="a00214.html#a808c8560ceaca5f9237fb473c0f748f2" title="A convenience function to convert a socket address list into a socket address.">addr</a>) <span class="keyword">const</span>;
<a name="l00414"></a>00414
<a name="l00419"></a><a class="code" href="a00152.html#ad2a274be9c6343447e1c2187a82e5821">00419</a> <span class="keyword">inline</span> <span class="keyword">struct </span><a class="code" href="a00214.html#af219737d0331ec303433aa3d4028c8cf" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *getList(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<a name="l00420"></a>00420 <span class="keyword"> </span>{<span class="keywordflow">return</span> list;};
<a name="l00421"></a>00421
<a name="l00426"></a><a class="code" href="a00152.html#ab7c027bfa12d44e1284437b814c2e800">00426</a> <span class="keyword">inline</span> operator struct addrinfo *()<span class="keyword"> const</span>
<a name="l00427"></a>00427 <span class="keyword"> </span>{<span class="keywordflow">return</span> list;};
<a name="l00428"></a>00428
<a name="l00433"></a><a class="code" href="a00152.html#aedd308c2a7202346483c45d8ce488173">00433</a> <span class="keyword">inline</span> <span class="keyword">struct </span><a class="code" href="a00214.html#af219737d0331ec303433aa3d4028c8cf" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *operator*()<span class="keyword"> const</span>
<a name="l00434"></a>00434 <span class="keyword"> </span>{<span class="keywordflow">return</span> list;};
<a name="l00435"></a>00435
<a name="l00440"></a><a class="code" href="a00152.html#a7d03212d60c51749364f2e565c8f23bd">00440</a> <span class="keyword">inline</span> operator bool()<span class="keyword"> const</span>
<a name="l00441"></a>00441 <span class="keyword"> </span>{<span class="keywordflow">return</span> list != NULL;};
<a name="l00442"></a>00442
<a name="l00447"></a><a class="code" href="a00152.html#a2001390098acf2dafe981f8e6b0bd8ff">00447</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> operator!()<span class="keyword"> const</span>
<a name="l00448"></a>00448 <span class="keyword"> </span>{<span class="keywordflow">return</span> list == NULL;};
<a name="l00449"></a>00449
<a name="l00454"></a><a class="code" href="a00152.html#a1cd1455b6465da57c38104a83b62eea9">00454</a> <span class="keyword">inline</span> operator struct sockaddr *()<span class="keyword"> const</span>
<a name="l00455"></a>00455 <span class="keyword"> </span>{<span class="keywordflow">return</span> getAddr();};
<a name="l00456"></a>00456
<a name="l00460"></a>00460 <span class="keywordtype">void</span> clear(<span class="keywordtype">void</span>);
<a name="l00461"></a>00461
<a name="l00469"></a>00469 <span class="keywordtype">void</span> <span class="keyword">set</span>(<span class="keyword">const</span> <span class="keywordtype">char</span> *hostname, <span class="keyword">const</span> <span class="keywordtype">char</span> *service = NULL, <span class="keywordtype">int</span> family = 0, <span class="keywordtype">int</span> type = SOCK_STREAM);
<a name="l00470"></a>00470
<a name="l00478"></a>00478 <span class="keywordtype">void</span> <a class="code" href="a00214.html#aad0ef1f27ebf9203be99b1824400e269" title="Add a linked object onto a stack of linked objects.">add</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *hostname, <span class="keyword">const</span> <span class="keywordtype">char</span> *service = NULL, <span class="keywordtype">int</span> family = 0, <span class="keywordtype">int</span> type = SOCK_STREAM);
<a name="l00479"></a>00479
<a name="l00487"></a>00487 <span class="keywordtype">void</span> <span class="keyword">set</span>(<span class="keywordtype">int</span> family, <span class="keyword">const</span> <span class="keywordtype">char</span> *address, <span class="keywordtype">int</span> type = SOCK_STREAM, <span class="keywordtype">int</span> protocol = 0);
<a name="l00488"></a>00488
<a name="l00493"></a>00493 <span class="keywordtype">void</span> <a class="code" href="a00214.html#aad0ef1f27ebf9203be99b1824400e269" title="Add a linked object onto a stack of linked objects.">add</a>(sockaddr *address);
<a name="l00494"></a>00494
<a name="l00500"></a>00500 <span class="keywordtype">bool</span> <span class="keyword">remove</span>(<span class="keyword">struct </span>sockaddr *address);
<a name="l00501"></a>00501
<a name="l00508"></a>00508 <span class="keywordtype">bool</span> insert(<span class="keyword">struct</span> sockaddr *address);
<a name="l00509"></a>00509
<a name="l00516"></a>00516 <span class="keywordtype">unsigned</span> insert(<span class="keyword">struct</span> <a class="code" href="a00214.html#af219737d0331ec303433aa3d4028c8cf" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *address, <span class="keywordtype">int</span> family = 0);
<a name="l00517"></a>00517
<a name="l00524"></a>00524 <span class="keywordtype">unsigned</span> <span class="keyword">remove</span>(<span class="keyword">struct </span><a class="code" href="a00214.html#af219737d0331ec303433aa3d4028c8cf" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *address, <span class="keywordtype">int</span> family = 0);
<a name="l00525"></a>00525
<a name="l00531"></a>00531 <span class="keywordtype">void</span> <a class="code" href="a00214.html#a8370bd49e635d1f1c3aec9135f497cec" title="Convenence function to access object copy.">copy</a>(<span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="a00214.html#af219737d0331ec303433aa3d4028c8cf" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *address);
<a name="l00532"></a>00532
<a name="l00537"></a>00537 <span class="keywordtype">void</span> <span class="keyword">set</span>(<span class="keyword">struct </span>sockaddr *address);
<a name="l00538"></a>00538
<a name="l00545"></a>00545 <span class="keywordtype">void</span> <span class="keyword">set</span>(<span class="keyword">const</span> <span class="keywordtype">char</span> *hostname, <span class="keywordtype">unsigned</span> service = 0, <span class="keywordtype">int</span> family = DEFAULT_FAMILY);
<a name="l00546"></a>00546
<a name="l00552"></a>00552 <span class="keyword">static</span> <span class="keyword">struct </span>sockaddr *dup(<span class="keyword">struct</span> sockaddr *address);
<a name="l00553"></a>00553
<a name="l00559"></a>00559 <span class="keyword">static</span> <span class="keyword">struct </span>sockaddr_in *ipv4(<span class="keyword">struct</span> sockaddr *address);
<a name="l00560"></a>00560
<a name="l00561"></a>00561 <span class="preprocessor">#ifdef AF_INET6</span>
<a name="l00562"></a>00562 <span class="preprocessor"></span>
<a name="l00567"></a>00567 <span class="keyword">static</span> <span class="keyword">struct </span>sockaddr_in6 *ipv6(<span class="keyword">struct</span> sockaddr *address);
<a name="l00568"></a>00568 <span class="preprocessor">#endif</span>
<a name="l00569"></a>00569 <span class="preprocessor"></span> };
<a name="l00570"></a>00570
<a name="l00571"></a>00571 <span class="keyword">friend</span> <span class="keyword">class </span>address;
<a name="l00572"></a>00572
<a name="l00576"></a>00576 <a class="code" href="a00151.html" title="A generic socket base class.">Socket</a>();
<a name="l00577"></a>00577
<a name="l00582"></a>00582 <a class="code" href="a00151.html" title="A generic socket base class.">Socket</a>(<span class="keyword">const</span> <a class="code" href="a00151.html" title="A generic socket base class.">Socket</a>& existing);
<a name="l00583"></a>00583
<a name="l00588"></a>00588 <a class="code" href="a00151.html" title="A generic socket base class.">Socket</a>(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>);
<a name="l00589"></a>00589
<a name="l00595"></a>00595 <a class="code" href="a00151.html" title="A generic socket base class.">Socket</a>(<span class="keyword">struct</span> <a class="code" href="a00214.html#af219737d0331ec303433aa3d4028c8cf" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *address);
<a name="l00596"></a>00596
<a name="l00603"></a>00603 <a class="code" href="a00151.html" title="A generic socket base class.">Socket</a>(<span class="keywordtype">int</span> family, <span class="keywordtype">int</span> type, <span class="keywordtype">int</span> protocol = 0);
<a name="l00604"></a>00604
<a name="l00614"></a>00614 <a class="code" href="a00151.html" title="A generic socket base class.">Socket</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *address, <span class="keyword">const</span> <span class="keywordtype">char</span> *port, <span class="keywordtype">int</span> family = AF_UNSPEC, <span class="keywordtype">int</span> type = 0, <span class="keywordtype">int</span> protocol = 0, <span class="keywordtype">int</span> backlog = 0);
<a name="l00615"></a>00615
<a name="l00619"></a>00619 <span class="keyword">virtual</span> ~<a class="code" href="a00151.html" title="A generic socket base class.">Socket</a>();
<a name="l00620"></a>00620
<a name="l00624"></a>00624 <span class="keywordtype">void</span> cancel(<span class="keywordtype">void</span>);
<a name="l00625"></a>00625
<a name="l00630"></a>00630 <span class="keyword">static</span> <span class="keywordtype">void</span> cancel(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>);
<a name="l00631"></a>00631
<a name="l00635"></a>00635 <span class="keywordtype">void</span> <a class="code" href="a00214.html#ab7bef2898e731474a9c3dfa805a6f56d" title="Convenience function to unlock shared object through it&#39;s protocol.">release</a>(<span class="keywordtype">void</span>);
<a name="l00636"></a>00636
<a name="l00642"></a>00642 <span class="keywordtype">bool</span> isPending(<span class="keywordtype">unsigned</span> value) <span class="keyword">const</span>;
<a name="l00643"></a>00643
<a name="l00648"></a>00648 <span class="keywordtype">bool</span> isConnected(<span class="keywordtype">void</span>) <span class="keyword">const</span>;
<a name="l00649"></a>00649
<a name="l00656"></a>00656 <span class="keywordtype">bool</span> waitPending(<a class="code" href="a00201.html#af412159e5cef839836a5e7b19ee75d1c" title="Typedef for millisecond timer values.">timeout_t</a> timeout = 0) <span class="keyword">const</span>;
<a name="l00657"></a>00657
<a name="l00662"></a><a class="code" href="a00151.html#a72ae39899537cf2e7df3f76c399f9b99">00662</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> nodelay(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<a name="l00663"></a>00663 <span class="keyword"> </span>{<span class="keywordflow">return</span> <a class="code" href="a00151.html#a72ae39899537cf2e7df3f76c399f9b99" title="Set nodelay option for tcp socket.">nodelay</a>(so);};
<a name="l00664"></a>00664
<a name="l00672"></a>00672 <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="a00214.html#a2f0fa9cbff7791a5006406a3066d4dc5" title="Convenience function to wait on a barrier.">wait</a>(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <a class="code" href="a00201.html#af412159e5cef839836a5e7b19ee75d1c" title="Typedef for millisecond timer values.">timeout_t</a> timeout = 0);
<a name="l00673"></a>00673
<a name="l00680"></a>00680 <span class="keywordtype">bool</span> waitSending(<a class="code" href="a00201.html#af412159e5cef839836a5e7b19ee75d1c" title="Typedef for millisecond timer values.">timeout_t</a> timeout = 0) <span class="keyword">const</span>;
<a name="l00681"></a>00681
<a name="l00686"></a><a class="code" href="a00151.html#a41488777e433f4900fa3b5e2fb99bff7">00686</a> <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> getPending(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<a name="l00687"></a>00687 <span class="keyword"> </span>{<span class="keywordflow">return</span> pending(so);};
<a name="l00688"></a>00688
<a name="l00694"></a><a class="code" href="a00151.html#a92f90a98fa815950db93e9ec61c6d3a0">00694</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> broadcast(<span class="keywordtype">bool</span> enable)
<a name="l00695"></a>00695 {<span class="keywordflow">return</span> <a class="code" href="a00151.html#a92f90a98fa815950db93e9ec61c6d3a0" title="Set socket for unicast mode broadcasts.">broadcast</a>(so, enable);};
<a name="l00696"></a>00696
<a name="l00702"></a><a class="code" href="a00151.html#a5ca55ec62f8698ee4442b955dd0e0323">00702</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> keepalive(<span class="keywordtype">bool</span> enable)
<a name="l00703"></a>00703 {<span class="keywordflow">return</span> <a class="code" href="a00151.html#a5ca55ec62f8698ee4442b955dd0e0323" title="Set socket for keepalive packets.">keepalive</a>(so, enable);};
<a name="l00704"></a>00704
<a name="l00710"></a><a class="code" href="a00151.html#a2959b9856257634f27857d896e753160">00710</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> blocking(<span class="keywordtype">bool</span> enable)
<a name="l00711"></a>00711 {<span class="keywordflow">return</span> <a class="code" href="a00151.html#a2959b9856257634f27857d896e753160" title="Set socket blocking I/O mode.">blocking</a>(so, enable);};
<a name="l00712"></a>00712
<a name="l00718"></a><a class="code" href="a00151.html#ad20f9bc12070f452b6b872d21736174a">00718</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> multicast(<span class="keywordtype">unsigned</span> ttl = 1)
<a name="l00719"></a>00719 {<span class="keywordflow">return</span> <a class="code" href="a00151.html#ad20f9bc12070f452b6b872d21736174a" title="Set multicast mode and multicast broadcast range.">multicast</a>(so, ttl);};
<a name="l00720"></a>00720
<a name="l00726"></a><a class="code" href="a00151.html#a1b95408ffd7e2d004bdfcb75d588cd84">00726</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> loopback(<span class="keywordtype">bool</span> enable)
<a name="l00727"></a>00727 {<span class="keywordflow">return</span> <a class="code" href="a00151.html#a1b95408ffd7e2d004bdfcb75d588cd84" title="Set loopback to read multicast packets we broadcast.">loopback</a>(so, enable);};
<a name="l00728"></a>00728
<a name="l00733"></a><a class="code" href="a00151.html#ac2c23f8c755e09a2d19ffbaca820aabd">00733</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> getError(<span class="keywordtype">void</span>)
<a name="l00734"></a>00734 {<span class="keywordflow">return</span> error(so);};
<a name="l00735"></a>00735
<a name="l00741"></a><a class="code" href="a00151.html#af3cd72d2d6db194714f794d9e2a96589">00741</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> ttl(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> time)
<a name="l00742"></a>00742 {<span class="keywordflow">return</span> <a class="code" href="a00151.html#af3cd72d2d6db194714f794d9e2a96589" title="Set the time to live before packets expire.">ttl</a>(so, time);};
<a name="l00743"></a>00743
<a name="l00749"></a><a class="code" href="a00151.html#a22c259dd2969d5b0ffd9f90d3e8d3b52">00749</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> sendsize(<span class="keywordtype">unsigned</span> size)
<a name="l00750"></a>00750 {<span class="keywordflow">return</span> <a class="code" href="a00151.html#a22c259dd2969d5b0ffd9f90d3e8d3b52" title="Set the size of the socket send buffer.">sendsize</a>(so, size);};
<a name="l00751"></a>00751
<a name="l00757"></a><a class="code" href="a00151.html#ac432bfc6c40dceeb91e81e965b6c8aab">00757</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> sendwait(<span class="keywordtype">unsigned</span> size)
<a name="l00758"></a>00758 {<span class="keywordflow">return</span> <a class="code" href="a00151.html#ac432bfc6c40dceeb91e81e965b6c8aab" title="Set the size to wait before sending.">sendwait</a>(so, size);};
<a name="l00759"></a>00759
<a name="l00760"></a>00760
<a name="l00766"></a><a class="code" href="a00151.html#ae6d9dfe36bcbca4ea14cae4d6f5e5839">00766</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> recvsize(<span class="keywordtype">unsigned</span> size)
<a name="l00767"></a>00767 {<span class="keywordflow">return</span> <a class="code" href="a00151.html#ae6d9dfe36bcbca4ea14cae4d6f5e5839" title="Set the size of the socket receive buffer.">recvsize</a>(so, size);};
<a name="l00768"></a>00768
<a name="l00774"></a>00774 <span class="keyword">static</span> <span class="keywordtype">int</span> gettype(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>);
<a name="l00775"></a>00775
<a name="l00782"></a>00782 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> segsize(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">unsigned</span> size = 0);
<a name="l00783"></a>00783
<a name="l00790"></a>00790 <span class="keyword">static</span> <span class="keywordtype">bool</span> setccid(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, uint8_t ccid);
<a name="l00791"></a>00791
<a name="l00796"></a><a class="code" href="a00151.html#a561411d3df1d1bfeb844d32a80e97238">00796</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> gettype(<span class="keywordtype">void</span>)
<a name="l00797"></a>00797 {<span class="keywordflow">return</span> <a class="code" href="a00151.html#a561411d3df1d1bfeb844d32a80e97238" title="Get the type of a socket.">gettype</a>(so);};
<a name="l00798"></a>00798
<a name="l00804"></a><a class="code" href="a00151.html#a3816f4e9154f63e03c0342e71283b307">00804</a> <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> segsize(<span class="keywordtype">unsigned</span> size)
<a name="l00805"></a>00805 {<span class="keywordflow">return</span> <a class="code" href="a00151.html#a3816f4e9154f63e03c0342e71283b307" title="Set segment size and get mtu of a socket.">segsize</a>(so, size);};
<a name="l00806"></a>00806
<a name="l00812"></a><a class="code" href="a00151.html#a1290f048a8f9116ba2aafaafe228e702">00812</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> setccid(uint8_t ccid)
<a name="l00813"></a>00813 {<span class="keywordflow">return</span> <a class="code" href="a00151.html#a1290f048a8f9116ba2aafaafe228e702" title="Set ccid of dccp socket.">setccid</a>(so, ccid);};
<a name="l00814"></a>00814
<a name="l00823"></a><a class="code" href="a00151.html#a3536a4187557ba6eeda5ab1b8c59f013">00823</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> tos(<span class="keywordtype">int</span> type)
<a name="l00824"></a>00824 {<span class="keywordflow">return</span> <a class="code" href="a00151.html#a3536a4187557ba6eeda5ab1b8c59f013" title="Set the type of service field of outgoing packets.">tos</a>(so, type);};
<a name="l00825"></a>00825
<a name="l00832"></a><a class="code" href="a00151.html#a676c7d021bc5ecf28c96e92b33d08697">00832</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> priority(<span class="keywordtype">int</span> scheduling)
<a name="l00833"></a>00833 {<span class="keywordflow">return</span> <a class="code" href="a00151.html#a676c7d021bc5ecf28c96e92b33d08697" title="Set packet priority, 0 to 6 unless privileged.">priority</a>(so, scheduling);};
<a name="l00834"></a>00834
<a name="l00838"></a><a class="code" href="a00151.html#a5eec20adf65ab6a22f70213bcf085543">00838</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> shutdown(<span class="keywordtype">void</span>)
<a name="l00839"></a>00839 {::shutdown(so, SHUT_RDWR);};
<a name="l00840"></a>00840
<a name="l00848"></a><a class="code" href="a00151.html#ae7d8515088a8c6ac0219c3ace860f030">00848</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> connectto(<span class="keyword">struct</span> <a class="code" href="a00214.html#af219737d0331ec303433aa3d4028c8cf" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *list)
<a name="l00849"></a>00849 {<span class="keywordflow">return</span> <a class="code" href="a00151.html#ae7d8515088a8c6ac0219c3ace860f030" title="Connect our socket to a remote host from an address list.">connectto</a>(so, list);};
<a name="l00850"></a>00850
<a name="l00857"></a><a class="code" href="a00151.html#af713234fbd42ca1e50a2436c591bfa19">00857</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> disconnect(<span class="keywordtype">void</span>)
<a name="l00858"></a>00858 {<span class="keywordflow">return</span> <a class="code" href="a00151.html#af713234fbd42ca1e50a2436c591bfa19" title="Disconnect a connected socket.">disconnect</a>(so);};
<a name="l00859"></a>00859
<a name="l00865"></a><a class="code" href="a00151.html#a02f0ed81ef2af75ba00667472396a7ad">00865</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> join(<span class="keyword">struct</span> <a class="code" href="a00214.html#af219737d0331ec303433aa3d4028c8cf" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *list)
<a name="l00866"></a>00866 {<span class="keywordflow">return</span> <a class="code" href="a00151.html#a02f0ed81ef2af75ba00667472396a7ad" title="Join socket to multicast group.">join</a>(so, list);};
<a name="l00867"></a>00867
<a name="l00873"></a><a class="code" href="a00151.html#a5385bb0a8df2569dcad3a24203e42777">00873</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> drop(<span class="keyword">struct</span> <a class="code" href="a00214.html#af219737d0331ec303433aa3d4028c8cf" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *list)
<a name="l00874"></a>00874 {<span class="keywordflow">return</span> <a class="code" href="a00151.html#a5385bb0a8df2569dcad3a24203e42777" title="Drop socket from multicast group.">drop</a>(so, list);};
<a name="l00875"></a>00875
<a name="l00882"></a>00882 <span class="keywordtype">size_t</span> peek(<span class="keywordtype">void</span> *data, <span class="keywordtype">size_t</span> number) <span class="keyword">const</span>;
<a name="l00883"></a>00883
<a name="l00892"></a>00892 <span class="keyword">virtual</span> ssize_t <span class="keyword">get</span>(<span class="keywordtype">void</span> *data, <span class="keywordtype">size_t</span> number, <span class="keyword">struct </span>sockaddr_storage *address = NULL);
<a name="l00893"></a>00893
<a name="l00902"></a>00902 <span class="keyword">virtual</span> ssize_t put(<span class="keyword">const</span> <span class="keywordtype">void</span> *data, <span class="keywordtype">size_t</span> number, <span class="keyword">struct</span> sockaddr *address = NULL);
<a name="l00903"></a>00903
<a name="l00911"></a><a class="code" href="a00151.html#ac1e1b8a7c307eb81db0a2829888255fc">00911</a> <span class="keyword">inline</span> ssize_t readfrom(<span class="keywordtype">void</span> *data, <span class="keywordtype">size_t</span> number, <span class="keyword">struct</span> sockaddr_storage *<a class="code" href="a00152.html" title="A generic socket address class.">address</a> = NULL)
<a name="l00912"></a>00912 {<span class="keywordflow">return</span> <span class="keyword">get</span>(data, number, <a class="code" href="a00152.html" title="A generic socket address class.">address</a>);};
<a name="l00913"></a>00913
<a name="l00921"></a><a class="code" href="a00151.html#a9cea1c812b693619ac5066ea6408f49d">00921</a> <span class="keyword">inline</span> ssize_t writeto(<span class="keyword">const</span> <span class="keywordtype">void</span> *data, <span class="keywordtype">size_t</span> number, <span class="keyword">struct</span> sockaddr *<a class="code" href="a00152.html" title="A generic socket address class.">address</a> = NULL)
<a name="l00922"></a>00922 {<span class="keywordflow">return</span> put(data, number, <a class="code" href="a00152.html" title="A generic socket address class.">address</a>);};
<a name="l00923"></a>00923
<a name="l00934"></a>00934 <span class="keyword">virtual</span> ssize_t gets(<span class="keywordtype">char</span> *data, <span class="keywordtype">size_t</span> size, <a class="code" href="a00201.html#af412159e5cef839836a5e7b19ee75d1c" title="Typedef for millisecond timer values.">timeout_t</a> timeout = Timer::inf);
<a name="l00935"></a>00935
<a name="l00947"></a>00947 <span class="keyword">static</span> ssize_t readline(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">char</span> *data, <span class="keywordtype">size_t</span> size, <a class="code" href="a00201.html#af412159e5cef839836a5e7b19ee75d1c" title="Typedef for millisecond timer values.">timeout_t</a> timeout = Timer::inf);
<a name="l00948"></a>00948
<a name="l00955"></a>00955 <span class="keyword">static</span> ssize_t printf(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keyword">const</span> <span class="keywordtype">char</span> *format, ...) __PRINTF(2,3);
<a name="l00956"></a>00956
<a name="l00962"></a>00962 ssize_t puts(const <span class="keywordtype">char</span> *<span class="keywordtype">string</span>);
<a name="l00963"></a>00963
<a name="l00972"></a>00972 ssize_t puts(const <span class="keywordtype">char</span> *<span class="keywordtype">string</span>, struct sockaddr *address);
<a name="l00973"></a>00973
<a name="l00978"></a>00978 operator <span class="keywordtype">bool</span>();
<a name="l00979"></a>00979
<a name="l00984"></a>00984 <span class="keywordtype">bool</span> operator!() const;
<a name="l00985"></a>00985
<a name="l00991"></a>00991 <a class="code" href="a00151.html" title="A generic socket base class.">Socket</a>& operator=(socket_t socket);
<a name="l00992"></a>00992
<a name="l00997"></a><a class="code" href="a00151.html#aba6ee1e3f02c944194264ce25ca47520">00997</a> inline operator socket_t()<span class="keyword"> const</span>
<a name="l00998"></a>00998 <span class="keyword"> </span>{<span class="keywordflow">return</span> so;};
<a name="l00999"></a>00999
<a name="l01004"></a><a class="code" href="a00151.html#a2fbb299804a3921e49303654f03f3eb1">01004</a> <span class="keyword">inline</span> socket_t operator*()<span class="keyword"> const</span>
<a name="l01005"></a>01005 <span class="keyword"> </span>{<span class="keywordflow">return</span> so;};
<a name="l01006"></a>01006
<a name="l01013"></a>01013 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> pending(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>);
<a name="l01014"></a>01014
<a name="l01021"></a>01021 <span class="keyword">static</span> <span class="keywordtype">int</span> sendsize(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">unsigned</span> size);
<a name="l01022"></a>01022
<a name="l01029"></a>01029 <span class="keyword">static</span> <span class="keywordtype">int</span> sendwait(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">unsigned</span> size);
<a name="l01030"></a>01030
<a name="l01037"></a>01037 <span class="keyword">static</span> <span class="keywordtype">int</span> recvsize(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">unsigned</span> size);
<a name="l01038"></a>01038
<a name="l01047"></a>01047 <span class="keyword">static</span> <span class="keywordtype">int</span> connectto(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keyword">struct</span> <a class="code" href="a00214.html#af219737d0331ec303433aa3d4028c8cf" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *list);
<a name="l01048"></a>01048
<a name="l01054"></a>01054 <span class="keyword">static</span> <span class="keywordtype">int</span> disconnect(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>);
<a name="l01055"></a>01055
<a name="l01062"></a>01062 <span class="keyword">static</span> <span class="keywordtype">int</span> drop(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keyword">struct</span> <a class="code" href="a00214.html#af219737d0331ec303433aa3d4028c8cf" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *list);
<a name="l01063"></a>01063
<a name="l01070"></a>01070 <span class="keyword">static</span> <span class="keywordtype">int</span> join(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keyword">struct</span> <a class="code" href="a00214.html#af219737d0331ec303433aa3d4028c8cf" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *list);
<a name="l01071"></a>01071
<a name="l01077"></a>01077 <span class="keyword">static</span> <span class="keywordtype">int</span> error(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>);
<a name="l01078"></a>01078
<a name="l01085"></a>01085 <span class="keyword">static</span> <span class="keywordtype">int</span> multicast(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">unsigned</span> ttl = 1);
<a name="l01086"></a>01086
<a name="l01093"></a>01093 <span class="keyword">static</span> <span class="keywordtype">int</span> loopback(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">bool</span> enable);
<a name="l01094"></a>01094
<a name="l01101"></a>01101 <span class="keyword">static</span> <span class="keywordtype">int</span> blocking(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">bool</span> enable);
<a name="l01102"></a>01102
<a name="l01109"></a>01109 <span class="keyword">static</span> <span class="keywordtype">int</span> keepalive(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">bool</span> enable);
<a name="l01110"></a>01110
<a name="l01117"></a>01117 <span class="keyword">static</span> <span class="keywordtype">int</span> broadcast(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">bool</span> enable);
<a name="l01118"></a>01118
<a name="l01124"></a>01124 <span class="keyword">static</span> <span class="keywordtype">int</span> nodelay(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>);
<a name="l01125"></a>01125
<a name="l01132"></a>01132 <span class="keyword">static</span> <span class="keywordtype">int</span> priority(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">int</span> scheduling);
<a name="l01133"></a>01133
<a name="l01140"></a>01140 <span class="keyword">static</span> <span class="keywordtype">int</span> tos(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">int</span> type);
<a name="l01141"></a>01141
<a name="l01148"></a>01148 <span class="keyword">static</span> <span class="keywordtype">int</span> ttl(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> time);
<a name="l01149"></a>01149
<a name="l01154"></a>01154 <span class="keyword">static</span> <span class="keywordtype">int</span> getfamily(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>);
<a name="l01155"></a>01155
<a name="l01161"></a><a class="code" href="a00151.html#ae5a0a747e381b9025e9a0f92ab186d25">01161</a> <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keywordtype">int</span> getfamily(<span class="keyword">struct</span> sockaddr_storage& <a class="code" href="a00152.html" title="A generic socket address class.">address</a>)
<a name="l01162"></a>01162 {<span class="keywordflow">return</span> ((<span class="keyword">struct</span> sockaddr *)&address)->sa_family;};
<a name="l01163"></a>01163
<a name="l01169"></a><a class="code" href="a00151.html#afb68213ec87dc6c52b29716f48bd1fdc">01169</a> <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keywordtype">int</span> getfamily(<span class="keyword">struct</span> <a class="code" href="a00016.html" title="An object that can hold a ipv4 or ipv6 socket address.">sockaddr_internet</a>& <a class="code" href="a00152.html" title="A generic socket address class.">address</a>)
<a name="l01170"></a>01170 {<span class="keywordflow">return</span> address.address.sa_family;};
<a name="l01171"></a>01171
<a name="l01181"></a>01181 <span class="keyword">static</span> ssize_t recvfrom(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">void</span> *buffer, <span class="keywordtype">size_t</span> size, <span class="keywordtype">int</span> flags = 0, <span class="keyword">struct</span> sockaddr_storage *address = NULL);
<a name="l01182"></a>01182
<a name="l01192"></a>01192 <span class="keyword">static</span> ssize_t sendto(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keyword">const</span> <span class="keywordtype">void</span> *buffer, <span class="keywordtype">size_t</span> size, <span class="keywordtype">int</span> flags = 0, <span class="keyword">struct</span> sockaddr *address = NULL);
<a name="l01193"></a>01193
<a name="l01203"></a><a class="code" href="a00151.html#a12bba616df545f86c021298ede288a75">01203</a> <span class="keyword">inline</span> <span class="keyword">static</span> ssize_t replyto(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keyword">const</span> <span class="keywordtype">void</span> *buffer, <span class="keywordtype">size_t</span> size, <span class="keywordtype">int</span> flags, <span class="keyword">struct</span> sockaddr_storage *<a class="code" href="a00152.html" title="A generic socket address class.">address</a>)
<a name="l01204"></a>01204 {<span class="keywordflow">return</span> sendto(socket, buffer, size, flags, (<span class="keyword">struct</span> sockaddr *)address);};
<a name="l01205"></a>01205
<a name="l01215"></a><a class="code" href="a00151.html#aec0251d1097629f9ee4e639033b82b13">01215</a> <span class="keyword">inline</span> <span class="keyword">static</span> ssize_t sendinet(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keyword">const</span> <span class="keywordtype">void</span> *buffer, <span class="keywordtype">size_t</span> size, <span class="keywordtype">int</span> flags, <span class="keyword">struct</span> <a class="code" href="a00016.html" title="An object that can hold a ipv4 or ipv6 socket address.">sockaddr_internet</a> *<a class="code" href="a00152.html" title="A generic socket address class.">address</a>)
<a name="l01216"></a>01216 {<span class="keywordflow">return</span> sendto(socket, buffer, size, flags, (<span class="keyword">struct</span> sockaddr *)address);};
<a name="l01217"></a>01217
<a name="l01227"></a>01227 <span class="keyword">static</span> ssize_t recvinet(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">void</span> *buffer, <span class="keywordtype">size_t</span> size, <span class="keywordtype">int</span> flags = 0, <span class="keyword">struct</span> <a class="code" href="a00016.html" title="An object that can hold a ipv4 or ipv6 socket address.">sockaddr_internet</a> *address = NULL);
<a name="l01228"></a>01228
<a name="l01237"></a>01237 <span class="keyword">static</span> <span class="keywordtype">int</span> bindto(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keyword">const</span> <span class="keywordtype">char</span> *address, <span class="keyword">const</span> <span class="keywordtype">char</span> *service, <span class="keywordtype">int</span> protocol = 0);
<a name="l01238"></a>01238
<a name="l01246"></a>01246 <span class="keyword">static</span> <span class="keywordtype">int</span> listento(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keyword">struct</span> sockaddr *address, <span class="keywordtype">int</span> backlog = 5);
<a name="l01247"></a>01247
<a name="l01254"></a>01254 <span class="keyword">static</span> <span class="keywordtype">int</span> bindto(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keyword">struct</span> sockaddr *address);
<a name="l01255"></a>01255
<a name="l01262"></a>01262 <span class="keyword">static</span> socket_t acceptfrom(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keyword">struct</span> sockaddr_storage *address = NULL);
<a name="l01263"></a>01263
<a name="l01271"></a>01271 <span class="keyword">static</span> socket_t create(<span class="keywordtype">int</span> family, <span class="keywordtype">int</span> type, <span class="keywordtype">int</span> protocol);
<a name="l01272"></a>01272
<a name="l01280"></a>01280 <span class="keyword">static</span> socket_t create(<span class="keyword">struct</span> <a class="code" href="a00214.html#af219737d0331ec303433aa3d4028c8cf" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *address, <span class="keywordtype">int</span> type, <span class="keywordtype">int</span> protocol);
<a name="l01281"></a>01281
<a name="l01292"></a>01292 <span class="keyword">static</span> socket_t create(<span class="keyword">const</span> <span class="keywordtype">char</span> *iface, <span class="keyword">const</span> <span class="keywordtype">char</span> *service, <span class="keywordtype">int</span> family = AF_UNSPEC, <span class="keywordtype">int</span> type = 0, <span class="keywordtype">int</span> protocol = 0, <span class="keywordtype">int</span> backlog = 0);
<a name="l01293"></a>01293
<a name="l01299"></a>01299 <span class="keyword">static</span> socket_t create(<a class="code" href="a00152.html" title="A generic socket address class.">Socket::address</a> &address);
<a name="l01300"></a>01300
<a name="l01305"></a>01305 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="a00214.html#ab7bef2898e731474a9c3dfa805a6f56d" title="Convenience function to unlock shared object through it&#39;s protocol.">release</a>(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>);
<a name="l01306"></a>01306
<a name="l01315"></a><a class="code" href="a00151.html#a4e9e8c513b1c3245db947336e84c5b42">01315</a> <span class="keyword">inline</span> <span class="keyword">static</span> ssize_t writeto(<a class="code" href="a00151.html" title="A generic socket base class.">Socket</a>& <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keyword">const</span> <span class="keywordtype">char</span> *buffer, <span class="keywordtype">size_t</span> size, <span class="keyword">struct</span> sockaddr *<a class="code" href="a00152.html" title="A generic socket address class.">address</a>)
<a name="l01316"></a>01316 {<span class="keywordflow">return</span> socket.<a class="code" href="a00151.html#a9505f9fae11a0f7e254a462e9fe7fa44" title="Write data to the socket send buffer.">put</a>(buffer, size, address);};
<a name="l01317"></a>01317
<a name="l01326"></a><a class="code" href="a00151.html#ae56d8ad1fc4589ec870d657089759209">01326</a> <span class="keyword">inline</span> <span class="keyword">static</span> ssize_t readfrom(<a class="code" href="a00151.html" title="A generic socket base class.">Socket</a>& <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">char</span> *buffer, <span class="keywordtype">size_t</span> size, <span class="keyword">struct</span> sockaddr_storage *<a class="code" href="a00152.html" title="A generic socket address class.">address</a>)
<a name="l01327"></a>01327 {<span class="keywordflow">return</span> socket.<a class="code" href="a00151.html#acf92ed5298aec121777040f1f10fdcf3" title="Read data from the socket receive buffer.">get</a>(buffer, size, address);};
<a name="l01328"></a>01328
<a name="l01334"></a><a class="code" href="a00151.html#adebaaf5e9482bc2c2fe9c88eeadeaec5">01334</a> <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keywordtype">void</span> connectto(<a class="code" href="a00151.html" title="A generic socket base class.">Socket</a>& <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <a class="code" href="a00152.html" title="A generic socket address class.">Socket::address</a> &<a class="code" href="a00152.html" title="A generic socket address class.">address</a>)
<a name="l01335"></a>01335 {socket.<a class="code" href="a00151.html#ae7d8515088a8c6ac0219c3ace860f030" title="Connect our socket to a remote host from an address list.">connectto</a>(address);};
<a name="l01336"></a>01336
<a name="l01341"></a><a class="code" href="a00151.html#afe648db41c6ddcd91b02758fb86a01b3">01341</a> <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keywordtype">void</span> disconnect(<a class="code" href="a00151.html" title="A generic socket base class.">Socket</a>& <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>)
<a name="l01342"></a>01342 {socket.<a class="code" href="a00151.html#af713234fbd42ca1e50a2436c591bfa19" title="Disconnect a connected socket.">disconnect</a>();};
<a name="l01343"></a>01343
<a name="l01350"></a><a class="code" href="a00151.html#ae5eba4dd7bfdc2d66af864fff68cca5e">01350</a> <span class="keyword">inline</span> <span class="keyword">static</span> <a class="code" href="a00151.html" title="A generic socket base class.">Socket</a> acceptfrom(<a class="code" href="a00151.html" title="A generic socket base class.">Socket</a>& <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keyword">struct</span> sockaddr_storage *<a class="code" href="a00152.html" title="A generic socket address class.">address</a>)
<a name="l01351"></a>01351 {<span class="keywordflow">return</span> <a class="code" href="a00151.html" title="A generic socket base class.">Socket</a>(<a class="code" href="a00151.html#ae5eba4dd7bfdc2d66af864fff68cca5e" title="Accept connection through socket.">acceptfrom</a>(socket.so, address));};
<a name="l01352"></a>01352
<a name="l01360"></a>01360 <span class="keyword">static</span> <span class="keywordtype">char</span> *gethostname(<span class="keyword">struct</span> sockaddr *address, <span class="keywordtype">char</span> *buffer, <span class="keywordtype">size_t</span> size);
<a name="l01361"></a>01361
<a name="l01369"></a>01369 <span class="keyword">static</span> <span class="keyword">struct </span><a class="code" href="a00214.html#af219737d0331ec303433aa3d4028c8cf" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *gethint(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keyword">struct</span> <a class="code" href="a00214.html#af219737d0331ec303433aa3d4028c8cf" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *hint);
<a name="l01370"></a>01370
<a name="l01381"></a>01381 <span class="keyword">static</span> socklen_t getaddr(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keyword">struct</span> sockaddr_storage *address, <span class="keyword">const</span> <span class="keywordtype">char</span> *hostname, <span class="keyword">const</span> <span class="keywordtype">char</span> *service);
<a name="l01382"></a>01382
<a name="l01388"></a>01388 <span class="keyword">static</span> socklen_t getlen(<span class="keyword">struct</span> sockaddr *address);
<a name="l01389"></a>01389
<a name="l01397"></a>01397 <span class="keyword">static</span> <span class="keywordtype">bool</span> equal(<span class="keyword">struct</span> sockaddr *address1, <span class="keyword">struct</span> sockaddr *address2);
<a name="l01398"></a>01398
<a name="l01405"></a>01405 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <a class="code" href="a00214.html#a8370bd49e635d1f1c3aec9135f497cec" title="Convenence function to access object copy.">copy</a>(<span class="keyword">struct</span> sockaddr *target, <span class="keyword">struct</span> sockaddr *origin);
<a name="l01406"></a>01406
<a name="l01413"></a><a class="code" href="a00151.html#a69dce9361c40bbbc91b417984163676b">01413</a> <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keywordtype">unsigned</span> store(<span class="keyword">struct</span> sockaddr_storage *storage, <span class="keyword">struct</span> sockaddr *<a class="code" href="a00152.html" title="A generic socket address class.">address</a>)
<a name="l01414"></a>01414 {<span class="keywordflow">return</span> <a class="code" href="a00214.html#a8370bd49e635d1f1c3aec9135f497cec" title="Convenence function to access object copy.">copy</a>((<span class="keyword">struct</span> sockaddr*)storage, address);};
<a name="l01415"></a>01415
<a name="l01422"></a>01422 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> store(<span class="keyword">struct</span> <a class="code" href="a00016.html" title="An object that can hold a ipv4 or ipv6 socket address.">sockaddr_internet</a> *storage, <span class="keyword">struct</span> sockaddr *address);
<a name="l01423"></a>01423
<a name="l01431"></a>01431 <span class="keyword">static</span> <span class="keywordtype">bool</span> equalhost(<span class="keyword">struct</span> sockaddr *address1, <span class="keyword">struct</span> sockaddr *address2);
<a name="l01432"></a>01432
<a name="l01440"></a><a class="code" href="a00151.html#a4fe47b8eb165c6092d097fed2142cce9">01440</a> <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keywordtype">bool</span> equalfrom(<span class="keyword">struct</span> sockaddr_storage *address1, <span class="keyword">struct</span> sockaddr_storage *address2)
<a name="l01441"></a>01441 {<span class="keywordflow">return</span> equal((<span class="keyword">struct</span> sockaddr *)address1, (<span class="keyword">struct</span> sockaddr *)address2);};
<a name="l01442"></a>01442
<a name="l01450"></a><a class="code" href="a00151.html#a819fc0bbfcaf5192c2a6be1735f75fac">01450</a> <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keywordtype">bool</span> equalinet(<span class="keyword">struct</span> <a class="code" href="a00016.html" title="An object that can hold a ipv4 or ipv6 socket address.">sockaddr_internet</a> *address1, <span class="keyword">struct</span> <a class="code" href="a00016.html" title="An object that can hold a ipv4 or ipv6 socket address.">sockaddr_internet</a> *address2)
<a name="l01451"></a>01451 {<span class="keywordflow">return</span> equal((<span class="keyword">struct</span> sockaddr *)address1, (<span class="keyword">struct</span> sockaddr *)address2);};
<a name="l01452"></a>01452
<a name="l01460"></a>01460 <span class="keyword">static</span> <span class="keywordtype">bool</span> subnet(<span class="keyword">struct</span> sockaddr *address1, <span class="keyword">struct</span> sockaddr *address2);
<a name="l01461"></a>01461
<a name="l01469"></a>01469 <span class="keyword">static</span> <span class="keywordtype">int</span> getinterface(<span class="keyword">struct</span> sockaddr *address, <span class="keyword">struct</span> sockaddr *destination);
<a name="l01470"></a>01470
<a name="l01478"></a>01478 <span class="keyword">static</span> <span class="keywordtype">char</span> *getaddress(<span class="keyword">struct</span> sockaddr *address, <span class="keywordtype">char</span> *buffer, socklen_t size);
<a name="l01479"></a>01479
<a name="l01485"></a>01485 <span class="keyword">static</span> <span class="keywordtype">short</span> getservice(<span class="keyword">struct</span> sockaddr *address);
<a name="l01486"></a>01486
<a name="l01492"></a><a class="code" href="a00151.html#ad5f385113bd25ec090da972a6ed23be8">01492</a> <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keywordtype">short</span> inetservice(<span class="keyword">struct</span> <a class="code" href="a00016.html" title="An object that can hold a ipv4 or ipv6 socket address.">sockaddr_internet</a> *<a class="code" href="a00152.html" title="A generic socket address class.">address</a>)
<a name="l01493"></a>01493 {<span class="keywordflow">return</span> getservice((<span class="keyword">struct</span> sockaddr *)address);};
<a name="l01494"></a>01494
<a name="l01501"></a>01501 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> keyindex(<span class="keyword">struct</span> sockaddr *address, <span class="keywordtype">unsigned</span> size);
<a name="l01502"></a>01502
<a name="l01509"></a>01509 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> keyhost(<span class="keyword">struct</span> sockaddr *address, <span class="keywordtype">unsigned</span> size);
<a name="l01510"></a>01510
<a name="l01514"></a>01514 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="a00201.html#a5fc126f9a4406cb2d0d054488cf00809" title="Template function to initialize memory by invoking default constructor.">init</a>(<span class="keywordtype">void</span>);
<a name="l01515"></a>01515
<a name="l01520"></a>01520 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="a00201.html#a5fc126f9a4406cb2d0d054488cf00809" title="Template function to initialize memory by invoking default constructor.">init</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *program);
<a name="l01521"></a>01521
<a name="l01527"></a>01527 <span class="keyword">static</span> <span class="keywordtype">void</span> family(<span class="keywordtype">int</span> query);
<a name="l01528"></a>01528
<a name="l01535"></a>01535 <span class="keyword">static</span> <span class="keywordtype">void</span> v4mapping(<span class="keywordtype">bool</span> enable);
<a name="l01536"></a>01536
<a name="l01543"></a>01543 <span class="keyword">static</span> FILE *open(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keywordtype">bool</span> mode = <span class="keyword">false</span>);
<a name="l01544"></a>01544
<a name="l01550"></a><a class="code" href="a00151.html#ade33b61ccd8b8f75bcc0a747c95341ea">01550</a> <span class="keyword">inline</span> FILE *open(<span class="keywordtype">bool</span> mode = <span class="keyword">false</span>)
<a name="l01551"></a>01551 {<span class="keywordflow">return</span> <a class="code" href="a00151.html#ade33b61ccd8b8f75bcc0a747c95341ea" title="Get file handle for reading from a socket object.">open</a>(so, mode);};
<a name="l01552"></a>01552
<a name="l01557"></a>01557 <span class="keyword">static</span> <span class="keywordtype">void</span> close(FILE *file);
<a name="l01558"></a>01558
<a name="l01563"></a>01563 <span class="keyword">static</span> <span class="keywordtype">int</span> error(<span class="keywordtype">void</span>);
<a name="l01564"></a>01564
<a name="l01573"></a>01573 <span class="keyword">static</span> <span class="keywordtype">bool</span> isNull(<span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">string</span>);
<a name="l01574"></a>01574
<a name="l01582"></a>01582 <span class="keyword">static</span> <span class="keywordtype">bool</span> isNumeric(<span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">string</span>);
<a name="l01583"></a>01583
<a name="l01592"></a>01592 <span class="keyword">static</span> <span class="keywordtype">int</span> getlocal(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keyword">struct</span> sockaddr_storage *address);
<a name="l01593"></a>01593
<a name="l01602"></a>01602 <span class="keyword">static</span> <span class="keywordtype">int</span> getremote(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, <span class="keyword">struct</span> sockaddr_storage *address);
<a name="l01603"></a>01603
<a name="l01611"></a>01611 <span class="keyword">static</span> <span class="keywordtype">int</span> select(<span class="keywordtype">int</span> <a class="code" href="a00214.html#a8049d3aa4d2ad2df40e33d0104fe0c05" title="Template for max value of a type.">max</a>, set_t read, set_t write, set_t error);
<a name="l01612"></a>01612
<a name="l01621"></a>01621 <span class="keyword">static</span> <span class="keywordtype">int</span> select(<span class="keywordtype">int</span> <a class="code" href="a00214.html#a8049d3aa4d2ad2df40e33d0104fe0c05" title="Template for max value of a type.">max</a>, set_t read, set_t write, set_t error, <a class="code" href="a00201.html#af412159e5cef839836a5e7b19ee75d1c" title="Typedef for millisecond timer values.">timeout_t</a> timeout);
<a name="l01622"></a>01622
<a name="l01627"></a>01627 <span class="keyword">static</span> set_t getmask(<span class="keywordtype">void</span>);
<a name="l01628"></a>01628
<a name="l01633"></a>01633 <span class="keyword">static</span> <span class="keywordtype">void</span> clear(set_t mask);
<a name="l01634"></a>01634
<a name="l01639"></a>01639 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="a00214.html#ab7bef2898e731474a9c3dfa805a6f56d" title="Convenience function to unlock shared object through it&#39;s protocol.">release</a>(set_t mask);
<a name="l01640"></a>01640
<a name="l01646"></a>01646 <span class="keyword">static</span> <span class="keywordtype">void</span> <span class="keyword">set</span>(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, set_t mask);
<a name="l01647"></a>01647
<a name="l01653"></a>01653 <span class="keyword">static</span> <span class="keywordtype">void</span> clear(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, set_t mask);
<a name="l01654"></a>01654
<a name="l01661"></a>01661 <span class="keyword">static</span> <span class="keywordtype">bool</span> test(socket_t <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>, set_t mask);
<a name="l01662"></a>01662 };
<a name="l01663"></a>01663
<a name="l01669"></a><a class="code" href="a00070.html">01669</a> <span class="keyword">class </span>__EXPORT <a class="code" href="a00070.html" title="A bound socket used to listen for inbound socket connections.">ListenSocket</a> : <span class="keyword">protected</span> <a class="code" href="a00151.html" title="A generic socket base class.">Socket</a>
<a name="l01670"></a>01670 {
<a name="l01671"></a>01671 <span class="keyword">public</span>:
<a name="l01679"></a>01679 <a class="code" href="a00070.html" title="A bound socket used to listen for inbound socket connections.">ListenSocket</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="a00152.html" title="A generic socket address class.">address</a>, <span class="keyword">const</span> <span class="keywordtype">char</span> *service, <span class="keywordtype">unsigned</span> backlog = 5, <span class="keywordtype">int</span> protocol = 0);
<a name="l01680"></a>01680
<a name="l01686"></a>01686 socket_t accept(<span class="keyword">struct</span> sockaddr_storage *address = NULL);
<a name="l01687"></a>01687
<a name="l01693"></a><a class="code" href="a00070.html#a3f7eed6a3faaeef37e6698d57e966143">01693</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> waitConnection(<a class="code" href="a00201.html#af412159e5cef839836a5e7b19ee75d1c" title="Typedef for millisecond timer values.">timeout_t</a> timeout = Timer::inf)<span class="keyword"> const</span>
<a name="l01694"></a>01694 <span class="keyword"> </span>{<span class="keywordflow">return</span> Socket::waitPending(timeout);};
<a name="l01695"></a>01695
<a name="l01700"></a><a class="code" href="a00070.html#a784408e6787a07d7eb2a00239558dd79">01700</a> <span class="keyword">inline</span> <a class="code" href="a00151.html#aba6ee1e3f02c944194264ce25ca47520" title="Get the socket descriptor by casting.">operator socket_t</a>()<span class="keyword"> const</span>
<a name="l01701"></a>01701 <span class="keyword"> </span>{<span class="keywordflow">return</span> so;};
<a name="l01702"></a>01702
<a name="l01707"></a><a class="code" href="a00070.html#a4c5f973f8890e7c74c772466f2c81f4b">01707</a> <span class="keyword">inline</span> socket_t <a class="code" href="a00151.html#a2fbb299804a3921e49303654f03f3eb1" title="Get the socket descriptor by pointer reference.">operator*</a>()<span class="keyword"> const</span>
<a name="l01708"></a>01708 <span class="keyword"> </span>{<span class="keywordflow">return</span> so;};
<a name="l01709"></a>01709
<a name="l01714"></a><a class="code" href="a00070.html#a309ecfc585ce3350929435e9db21e1aa">01714</a> <span class="keyword">inline</span> socket_t getsocket(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<a name="l01715"></a>01715 <span class="keyword"> </span>{<span class="keywordflow">return</span> so;};
<a name="l01716"></a>01716
<a name="l01717"></a>01717 };
<a name="l01718"></a>01718
<a name="l01722"></a><a class="code" href="a00214.html#a1ca2d93a322738c829ff68f92124c2a1">01722</a> <span class="keyword">typedef</span> <a class="code" href="a00151.html" title="A generic socket base class.">Socket</a> <a class="code" href="a00151.html" title="A generic socket base class.">socket</a>;
<a name="l01723"></a>01723
<a name="l01729"></a><a class="code" href="a00214.html#af219737d0331ec303433aa3d4028c8cf">01729</a> <span class="keyword">inline</span> <span class="keyword">struct </span><a class="code" href="a00214.html#af219737d0331ec303433aa3d4028c8cf" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a> *<a class="code" href="a00214.html#af219737d0331ec303433aa3d4028c8cf" title="A convenience function to convert a socket address list into an addrinfo.">addrinfo</a>(<a class="code" href="a00152.html" title="A generic socket address class.">socket::address</a>& address)
<a name="l01730"></a>01730 {<span class="keywordflow">return</span> address.<a class="code" href="a00152.html#ad2a274be9c6343447e1c2187a82e5821" title="Get the full socket address list from the object.">getList</a>();}
<a name="l01731"></a>01731
<a name="l01738"></a><a class="code" href="a00214.html#a808c8560ceaca5f9237fb473c0f748f2">01738</a> <span class="keyword">inline</span> <span class="keyword">struct </span>sockaddr *<a class="code" href="a00214.html#a808c8560ceaca5f9237fb473c0f748f2" title="A convenience function to convert a socket address list into a socket address.">addr</a>(<a class="code" href="a00152.html" title="A generic socket address class.">socket::address</a>& address)
<a name="l01739"></a>01739 {<span class="keywordflow">return</span> address.<a class="code" href="a00152.html#aa28b34434f89118f4b17b046c0c44315" title="Get the first socket address in our address list.">getAddr</a>();}
<a name="l01740"></a>01740
<a name="l01748"></a><a class="code" href="a00214.html#ae8329c8eceb3e760d48253f1c3386623">01748</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="a00214.html#ae8329c8eceb3e760d48253f1c3386623" title="Compare two socket addresses to see if equal.">eq</a>(<span class="keyword">struct</span> sockaddr *s1, <span class="keyword">struct</span> sockaddr *s2)
<a name="l01749"></a>01749 {<span class="keywordflow">return</span> Socket::equal(s1, s2);}
<a name="l01750"></a>01750
<a name="l01758"></a><a class="code" href="a00214.html#a0e1adcdf60fa42958a5e35da9220a636">01758</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="a00214.html#ae8329c8eceb3e760d48253f1c3386623" title="Compare two socket addresses to see if equal.">eq</a>(<span class="keyword">struct</span> sockaddr_storage *s1, <span class="keyword">struct</span> sockaddr_storage *s2)
<a name="l01759"></a>01759 {<span class="keywordflow">return</span> Socket::equal((<span class="keyword">struct</span> sockaddr *)s1, (<span class="keyword">struct</span> sockaddr *)s2);}
<a name="l01760"></a>01760
<a name="l01768"></a><a class="code" href="a00214.html#a742db3229a0512ac26f85c592fc6bdfb">01768</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="a00214.html#a742db3229a0512ac26f85c592fc6bdfb" title="Compare two host addresses to see if equal.">ieq</a>(<span class="keyword">struct</span> sockaddr *s1, <span class="keyword">struct</span> sockaddr *s2)
<a name="l01769"></a>01769 {<span class="keywordflow">return</span> Socket::equalhost(s1, s2);}
<a name="l01770"></a>01770
<a name="l01771"></a>01771 END_NAMESPACE
<a name="l01772"></a>01772
<a name="l01773"></a>01773 <span class="preprocessor">#endif</span>
</pre></div></div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Tue Jul 6 08:22:01 2010 for UCommon by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>
|