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 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Passenger: Passenger::MessageChannel Class Reference</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.5.8 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="namespacePassenger.html">Passenger</a>::<a class="el" href="classPassenger_1_1MessageChannel.html">MessageChannel</a>
</div>
</div>
<div class="contents">
<h1>Passenger::MessageChannel Class Reference<br>
<small>
[<a class="el" href="group__Support.html">Apache-independent support classes and function</a>]</small>
</h1><!-- doxytag: class="Passenger::MessageChannel" -->Convenience class for I/O operations on file descriptors.
<a href="#_details">More...</a>
<p>
<code>#include <<a class="el" href="MessageChannel_8h-source.html">MessageChannel.h</a>></code>
<p>
<p>
<a href="classPassenger_1_1MessageChannel-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1MessageChannel.html#73e7c9a8e421d29558838176aff02ca4">MessageChannel</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Construct a new <a class="el" href="classPassenger_1_1MessageChannel.html" title="Convenience class for I/O operations on file descriptors.">MessageChannel</a> with no underlying file descriptor. <a href="#73e7c9a8e421d29558838176aff02ca4"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="486b6e74c4d0973eefbcfde65f898ca7"></a><!-- doxytag: member="Passenger::MessageChannel::MessageChannel" ref="486b6e74c4d0973eefbcfde65f898ca7" args="(int fd)" -->
</td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1MessageChannel.html#486b6e74c4d0973eefbcfde65f898ca7">MessageChannel</a> (int fd)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Construct a new <a class="el" href="classPassenger_1_1MessageChannel.html" title="Convenience class for I/O operations on file descriptors.">MessageChannel</a> with the given file descriptor. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1MessageChannel.html#0b1e25dd75783d9753f8a0d1dd42606a">filenum</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the underlying file descriptor. <a href="#0b1e25dd75783d9753f8a0d1dd42606a"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a5ee9617bb17bdeaba30b757ecffa1b5"></a><!-- doxytag: member="Passenger::MessageChannel::connected" ref="a5ee9617bb17bdeaba30b757ecffa1b5" args="() const " -->
bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1MessageChannel.html#a5ee9617bb17bdeaba30b757ecffa1b5">connected</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns whether <a class="el" href="classPassenger_1_1MessageChannel.html#06309e208fc5e10642a2e9bbe0f351eb" title="Close the underlying file descriptor.">close()</a> has been called. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1MessageChannel.html#06309e208fc5e10642a2e9bbe0f351eb">close</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Close the underlying file descriptor. <a href="#06309e208fc5e10642a2e9bbe0f351eb"></a><br></td></tr>
<tr><td class="memTemplParams" nowrap colspan="2">template<typename StringArrayType , typename StringArrayConstIteratorType > </td></tr>
<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">void </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classPassenger_1_1MessageChannel.html#150f68bc47e060dcc6ca35bee047914d">write</a> (const StringArrayType &args)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Send an array message, which consists of the given elements, over the underlying file descriptor. <a href="#150f68bc47e060dcc6ca35bee047914d"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1MessageChannel.html#9ad7a978cf8409e01ab2f0a2b6be5a0a">write</a> (const list< string > &args)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Send an array message, which consists of the given elements, over the underlying file descriptor. <a href="#9ad7a978cf8409e01ab2f0a2b6be5a0a"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1MessageChannel.html#6a9bc5d72715cb7ba0e437c8851ef487">write</a> (const vector< string > &args)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Send an array message, which consists of the given elements, over the underlying file descriptor. <a href="#6a9bc5d72715cb7ba0e437c8851ef487"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1MessageChannel.html#70cc924c1ce7e2cedcbab61155d3aec9">write</a> (const char *name, va_list &ap)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Send an array message, which consists of the given strings, over the underlying file descriptor. <a href="#70cc924c1ce7e2cedcbab61155d3aec9"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1MessageChannel.html#12cce3364023eacbe4fe09006cf3d38d">write</a> (const char *name,...)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Send an array message, which consists of the given strings, over the underlying file descriptor. <a href="#12cce3364023eacbe4fe09006cf3d38d"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1MessageChannel.html#bf02c51a74477650de8d5d5db661063b">writeUint32</a> (unsigned int value)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Write a 32-bit big-endian unsigned integer to the underlying file descriptor. <a href="#bf02c51a74477650de8d5d5db661063b"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1MessageChannel.html#44e01a783c48abadeea0d915b9893bfb">writeScalar</a> (const string &str)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Write a scalar message to the underlying file descriptor. <a href="#44e01a783c48abadeea0d915b9893bfb"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1MessageChannel.html#80977020ef895f3ea790c5d28a333dda">writeScalar</a> (const char *data, unsigned int size)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Write a scalar message to the underlying file descriptor. <a href="#80977020ef895f3ea790c5d28a333dda"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1MessageChannel.html#069314e4c7e1fe8c8ab36e16d2cc5fef">writeRaw</a> (const char *data, unsigned int size)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Send a block of data over the underlying file descriptor. <a href="#069314e4c7e1fe8c8ab36e16d2cc5fef"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1MessageChannel.html#cfa38f4f0e22ec16350b8cc159e8e364">writeRaw</a> (const string &data)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Send a block of data over the underlying file descriptor. <a href="#cfa38f4f0e22ec16350b8cc159e8e364"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1MessageChannel.html#e0c558e07dcc91900016773b2bec38d8">writeFileDescriptor</a> (int fileDescriptor, bool negotiate=true)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Pass a file descriptor. <a href="#e0c558e07dcc91900016773b2bec38d8"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1MessageChannel.html#129659b60d1a663337873d2af944431e">read</a> (vector< string > &args)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Read an array message from the underlying file descriptor. <a href="#129659b60d1a663337873d2af944431e"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1MessageChannel.html#7b0c67852ea8ab455af75b1037c7f8b6">readUint32</a> (unsigned int &value, unsigned long long *timeout=NULL)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Read a 32-bit big-endian unsigned integer from the underlying file descriptor. <a href="#7b0c67852ea8ab455af75b1037c7f8b6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1MessageChannel.html#1f3cf672b566166ed920c2bba4d19604">readScalar</a> (string &output, unsigned int maxSize=0, unsigned long long *timeout=NULL)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Read a scalar message from the underlying file descriptor. <a href="#1f3cf672b566166ed920c2bba4d19604"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1MessageChannel.html#b471dc1888f030e20ed23068a160ec2a">readRaw</a> (void *buf, unsigned int size, unsigned long long *timeout=NULL)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Read exactly <code>size</code> bytes of data from the underlying file descriptor, and put the result in <code>buf</code>. <a href="#b471dc1888f030e20ed23068a160ec2a"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1MessageChannel.html#c2407ed109785b49794989507c570149">waitUntilReadable</a> (unsigned long long *timeout)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Waits at most <code>*timeout</code> milliseconds for the file descriptor to become readable. <a href="#c2407ed109785b49794989507c570149"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1MessageChannel.html#1a28ba9d078f38f2831673092ac9dcbc">readFileDescriptor</a> (bool negotiate=true)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Receive a file descriptor, which had been passed over the underlying file descriptor. <a href="#1a28ba9d078f38f2831673092ac9dcbc"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1MessageChannel.html#eb69bffbbb148c9bc8662e20b416c4e2">setReadTimeout</a> (unsigned int msec)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Set the timeout value for reading data from this channel. <a href="#eb69bffbbb148c9bc8662e20b416c4e2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classPassenger_1_1MessageChannel.html#77c5d7c47f387cf43992ebeb14e3c6c7">setWriteTimeout</a> (unsigned int msec)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Set the timeout value for writing data to this channel. <a href="#77c5d7c47f387cf43992ebeb14e3c6c7"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Convenience class for I/O operations on file descriptors.
<p>
This class provides convenience methods for:<ul>
<li>sending and receiving raw data over a file descriptor.</li><li>sending and receiving messages over a file descriptor.</li><li>file descriptor passing over a Unix socket.</li><li>data size limit enforcement and time constraint enforcement. All of these methods use exceptions for error reporting.</li></ul>
<p>
There are two kinds of messages:<ul>
<li>Array messages. These are just a list of strings, and the message itself has a specific length. The contained strings may not contain NUL characters (<code>'\0'</code>). Note that an array message must have at least one element.</li><li>Scalar messages. These are byte strings which may contain arbitrary binary data. Scalar messages also have a specific length. The protocol is designed to be low overhead, easy to implement and easy to parse.</li></ul>
<p>
<a class="el" href="classPassenger_1_1MessageChannel.html" title="Convenience class for I/O operations on file descriptors.">MessageChannel</a> is to be wrapped around a file descriptor. For example: <div class="fragment"><pre class="fragment"> <span class="keywordtype">int</span> p[2];
pipe(p);
<a class="code" href="classPassenger_1_1MessageChannel.html#73e7c9a8e421d29558838176aff02ca4" title="Construct a new MessageChannel with no underlying file descriptor.">MessageChannel</a> channel1(p[0]);
<a class="code" href="classPassenger_1_1MessageChannel.html#73e7c9a8e421d29558838176aff02ca4" title="Construct a new MessageChannel with no underlying file descriptor.">MessageChannel</a> channel2(p[1]);
<span class="comment">// Send an array message.</span>
channel2.write(<span class="stringliteral">"hello"</span>, <span class="stringliteral">"world !!"</span>, NULL);
list<string> args;
channel1.read(args); <span class="comment">// args now contains { "hello", "world !!" }</span>
<span class="comment">// Send a scalar message.</span>
channel2.writeScalar(<span class="stringliteral">"some long string which can contain arbitrary binary data"</span>);
<span class="keywordtype">string</span> str;
channel1.readScalar(str);
</pre></div><p>
The life time of a <a class="el" href="classPassenger_1_1MessageChannel.html" title="Convenience class for I/O operations on file descriptors.">MessageChannel</a> is independent from that of the wrapped file descriptor. If a <a class="el" href="classPassenger_1_1MessageChannel.html" title="Convenience class for I/O operations on file descriptors.">MessageChannel</a> object is destroyed, the file descriptor is not automatically closed. Call <a class="el" href="classPassenger_1_1MessageChannel.html#06309e208fc5e10642a2e9bbe0f351eb" title="Close the underlying file descriptor.">close()</a> if you want to close the file descriptor.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>I/O operations are not buffered. <p>
Be careful with mixing the sending/receiving of array messages, scalar messages and file descriptors. If you send a collection of any of these in a specific order, then the receiving side must receive them in the exact some order. So suppose you first send a message, then a file descriptor, then a scalar, then the receiving side must first receive a message, then a file descriptor, then a scalar. If the receiving side does things in the wrong order then bad things will happen. <p>
<a class="el" href="classPassenger_1_1MessageChannel.html" title="Convenience class for I/O operations on file descriptors.">MessageChannel</a> is not thread-safe, but is reentrant. <p>
Some methods throw <a class="el" href="classPassenger_1_1SecurityException.html" title="Represents some kind of security error.">SecurityException</a> and <a class="el" href="classPassenger_1_1TimeoutException.html" title="An exception indicating that some timeout expired.">TimeoutException</a>. When these exceptions are thrown, the channel will be left in an inconsistent state because only parts of the data have been read. You should close the channel after having caught these exceptions. </dd></dl>
<hr><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" name="73e7c9a8e421d29558838176aff02ca4"></a><!-- doxytag: member="Passenger::MessageChannel::MessageChannel" ref="73e7c9a8e421d29558838176aff02ca4" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Passenger::MessageChannel::MessageChannel </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Construct a new <a class="el" href="classPassenger_1_1MessageChannel.html" title="Convenience class for I/O operations on file descriptors.">MessageChannel</a> with no underlying file descriptor.
<p>
Thus the resulting <a class="el" href="classPassenger_1_1MessageChannel.html" title="Convenience class for I/O operations on file descriptors.">MessageChannel</a> object will not be usable. This constructor exists to allow one to declare an "empty" <a class="el" href="classPassenger_1_1MessageChannel.html" title="Convenience class for I/O operations on file descriptors.">MessageChannel</a> variable which is to be initialized later.
</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="06309e208fc5e10642a2e9bbe0f351eb"></a><!-- doxytag: member="Passenger::MessageChannel::close" ref="06309e208fc5e10642a2e9bbe0f351eb" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Passenger::MessageChannel::close </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Close the underlying file descriptor.
<p>
If this method is called multiple times, the file descriptor will only be closed the first time.<p>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a></em> </td><td></td></tr>
<tr><td valign="top"></td><td valign="top"><em>boost::thread_interrupted</em> </td><td></td></tr>
</table>
</dl>
<dl class="post" compact><dt><b>Postcondition:</b></dt><dd><a class="el" href="classPassenger_1_1MessageChannel.html#0b1e25dd75783d9753f8a0d1dd42606a" title="Returns the underlying file descriptor.">filenum()</a> == -1 <p>
!connected() </dd></dl>
</div>
</div><p>
<a class="anchor" name="0b1e25dd75783d9753f8a0d1dd42606a"></a><!-- doxytag: member="Passenger::MessageChannel::filenum" ref="0b1e25dd75783d9753f8a0d1dd42606a" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int Passenger::MessageChannel::filenum </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the underlying file descriptor.
<p>
-1 if it has already been closed.
</div>
</div><p>
<a class="anchor" name="129659b60d1a663337873d2af944431e"></a><!-- doxytag: member="Passenger::MessageChannel::read" ref="129659b60d1a663337873d2af944431e" args="(vector< string > &args)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool Passenger::MessageChannel::read </td>
<td>(</td>
<td class="paramtype">vector< string > & </td>
<td class="paramname"> <em>args</em> </td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Read an array message from the underlying file descriptor.
<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>args</em> </td><td>The message will be put in this variable. </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Whether end-of-file has been reached. If so, then the contents of <code>args</code> will be undefined. </dd></dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a></em> </td><td>If an error occured while receiving the message. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>boost::thread_interrupted</em> </td><td></td></tr>
</table>
</dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classPassenger_1_1MessageChannel.html#150f68bc47e060dcc6ca35bee047914d" title="Send an array message, which consists of the given elements, over the underlying...">write()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="1a28ba9d078f38f2831673092ac9dcbc"></a><!-- doxytag: member="Passenger::MessageChannel::readFileDescriptor" ref="1a28ba9d078f38f2831673092ac9dcbc" args="(bool negotiate=true)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int Passenger::MessageChannel::readFileDescriptor </td>
<td>(</td>
<td class="paramtype">bool </td>
<td class="paramname"> <em>negotiate</em> = <code>true</code> </td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Receive a file descriptor, which had been passed over the underlying file descriptor.
<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>negotiate</em> </td><td>See Ruby's MessageChannel::send_io method's comments. </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The passed file descriptor. </dd></dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a></em> </td><td>If something went wrong during the receiving of a file descriptor. Perhaps the underlying file descriptor isn't a Unix socket. </td></tr>
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1IOException.html" title="Represents an error that occured during an I/O operation.">IOException</a></em> </td><td>Whatever was received doesn't seem to be a file descriptor. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>boost::thread_interrupted</em> </td><td></td></tr>
</table>
</dl>
</div>
</div><p>
<a class="anchor" name="b471dc1888f030e20ed23068a160ec2a"></a><!-- doxytag: member="Passenger::MessageChannel::readRaw" ref="b471dc1888f030e20ed23068a160ec2a" args="(void *buf, unsigned int size, unsigned long long *timeout=NULL)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool Passenger::MessageChannel::readRaw </td>
<td>(</td>
<td class="paramtype">void * </td>
<td class="paramname"> <em>buf</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned int </td>
<td class="paramname"> <em>size</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned long long * </td>
<td class="paramname"> <em>timeout</em> = <code>NULL</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Read exactly <code>size</code> bytes of data from the underlying file descriptor, and put the result in <code>buf</code>.
<p>
If end-of-file has been reached, or if end-of-file was encountered before <code>size</code> bytes have been read, then <code>false</code> will be returned. Otherwise (i.e. if the read was successful), <code>true</code> will be returned.<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>buf</em> </td><td>The buffer to place the read data in. This buffer must be at least <code>size</code> bytes long. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>size</em> </td><td>The number of bytes to read. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>timeout</em> </td><td>A pointer to an integer, which specifies the maximum number of milliseconds that may be spent on reading the <code>size</code> bytes of data. If the timeout expired then <a class="el" href="classPassenger_1_1TimeoutException.html" title="An exception indicating that some timeout expired.">TimeoutException</a> will be thrown. If this function returns without throwing an exception, then the total number of milliseconds spent on reading will be deducted from <code>timeout</code>. Pass NULL if you do not want to enforce a timeout. </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Whether reading was successful or whether EOF was reached. </dd></dl>
<dl class="pre" compact><dt><b>Precondition:</b></dt><dd>buf != NULL </dd></dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a></em> </td><td>Something went wrong during reading. </td></tr>
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1TimeoutException.html" title="An exception indicating that some timeout expired.">TimeoutException</a></em> </td><td>Unable to read <code>size</code> bytes of data within <code>timeout</code> milliseconds. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>boost::thread_interrupted</em> </td><td></td></tr>
</table>
</dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classPassenger_1_1MessageChannel.html#069314e4c7e1fe8c8ab36e16d2cc5fef" title="Send a block of data over the underlying file descriptor.">writeRaw()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="1f3cf672b566166ed920c2bba4d19604"></a><!-- doxytag: member="Passenger::MessageChannel::readScalar" ref="1f3cf672b566166ed920c2bba4d19604" args="(string &output, unsigned int maxSize=0, unsigned long long *timeout=NULL)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool Passenger::MessageChannel::readScalar </td>
<td>(</td>
<td class="paramtype">string & </td>
<td class="paramname"> <em>output</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned int </td>
<td class="paramname"> <em>maxSize</em> = <code>0</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned long long * </td>
<td class="paramname"> <em>timeout</em> = <code>NULL</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Read a scalar message from the underlying file descriptor.
<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>output</em> </td><td>The message will be put in here. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>maxSize</em> </td><td>The maximum number of bytes that may be read. If the scalar to read is larger than this, then a <a class="el" href="classPassenger_1_1SecurityException.html" title="Represents some kind of security error.">SecurityException</a> will be thrown. Set to 0 for no size limit. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>timeout</em> </td><td>A pointer to an integer, representing the maximum number of milliseconds to spend on reading the entire scalar. A <a class="el" href="classPassenger_1_1TimeoutException.html" title="An exception indicating that some timeout expired.">TimeoutException</a> will be thrown if unable to read the entire scalar within this time period. If no exception is thrown, the the amount of time spent on waiting will be deducted from <code>*timeout</code>. Pass NULL if you do not want to enforce any time limits. </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Whether end-of-file was reached during reading. </dd></dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a></em> </td><td>An error occured while reading data from the file descriptor. </td></tr>
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1SecurityException.html" title="Represents some kind of security error.">SecurityException</a></em> </td><td>There is more data to read than allowed by maxSize. </td></tr>
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1TimeoutException.html" title="An exception indicating that some timeout expired.">TimeoutException</a></em> </td><td>Unable to read the entire scalar within <code>timeout</code> milliseconds. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>boost::thread_interrupted</em> </td><td></td></tr>
</table>
</dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classPassenger_1_1MessageChannel.html#44e01a783c48abadeea0d915b9893bfb" title="Write a scalar message to the underlying file descriptor.">writeScalar()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="7b0c67852ea8ab455af75b1037c7f8b6"></a><!-- doxytag: member="Passenger::MessageChannel::readUint32" ref="7b0c67852ea8ab455af75b1037c7f8b6" args="(unsigned int &value, unsigned long long *timeout=NULL)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool Passenger::MessageChannel::readUint32 </td>
<td>(</td>
<td class="paramtype">unsigned int & </td>
<td class="paramname"> <em>value</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned long long * </td>
<td class="paramname"> <em>timeout</em> = <code>NULL</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Read a 32-bit big-endian unsigned integer from the underlying file descriptor.
<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>value</em> </td><td>Upon success, the read value will be stored in here. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>timeout</em> </td><td>A pointer to an integer, representing the maximum number of milliseconds to spend on reading the entire integer. A <a class="el" href="classPassenger_1_1TimeoutException.html" title="An exception indicating that some timeout expired.">TimeoutException</a> will be thrown if the timeout expires. If no exception is thrown, the the amount of time spent on waiting will be deducted from <code>*timeout</code>. Pass NULL if you do not want to enforce any time limits. </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>True if a value was read, false if EOF was reached before all data can be read. </dd></dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a></em> </td><td>An error occurred while reading data from the file descriptor. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>boost::thread_interrupted</em> </td><td></td></tr>
</table>
</dl>
</div>
</div><p>
<a class="anchor" name="eb69bffbbb148c9bc8662e20b416c4e2"></a><!-- doxytag: member="Passenger::MessageChannel::setReadTimeout" ref="eb69bffbbb148c9bc8662e20b416c4e2" args="(unsigned int msec)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Passenger::MessageChannel::setReadTimeout </td>
<td>(</td>
<td class="paramtype">unsigned int </td>
<td class="paramname"> <em>msec</em> </td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Set the timeout value for reading data from this channel.
<p>
If no data can be read within the timeout period, then a <a class="el" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a> will be thrown by one of the read methods, with error code EAGAIN or EWOULDBLOCK.<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>msec</em> </td><td>The timeout, in milliseconds. If 0 is given, there will be no timeout. </td></tr>
</table>
</dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a></em> </td><td>Cannot set the timeout. </td></tr>
</table>
</dl>
</div>
</div><p>
<a class="anchor" name="77c5d7c47f387cf43992ebeb14e3c6c7"></a><!-- doxytag: member="Passenger::MessageChannel::setWriteTimeout" ref="77c5d7c47f387cf43992ebeb14e3c6c7" args="(unsigned int msec)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Passenger::MessageChannel::setWriteTimeout </td>
<td>(</td>
<td class="paramtype">unsigned int </td>
<td class="paramname"> <em>msec</em> </td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Set the timeout value for writing data to this channel.
<p>
If no data can be written within the timeout period, then a <a class="el" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a> will be thrown, with error code EAGAIN or EWOULDBLOCK.<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>msec</em> </td><td>The timeout, in milliseconds. If 0 is given, there will be no timeout. </td></tr>
</table>
</dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a></em> </td><td>Cannot set the timeout. </td></tr>
</table>
</dl>
</div>
</div><p>
<a class="anchor" name="c2407ed109785b49794989507c570149"></a><!-- doxytag: member="Passenger::MessageChannel::waitUntilReadable" ref="c2407ed109785b49794989507c570149" args="(unsigned long long *timeout)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool Passenger::MessageChannel::waitUntilReadable </td>
<td>(</td>
<td class="paramtype">unsigned long long * </td>
<td class="paramname"> <em>timeout</em> </td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Waits at most <code>*timeout</code> milliseconds for the file descriptor to become readable.
<p>
Returns true if it become readable within the timeout, false if the timeout expired.<p>
<code>*timeout</code> may be 0, in which case this method will check whether the file descriptor is readable, and immediately returns without waiting.<p>
If no exception is thrown, this method deducts the number of milliseconds that has passed from <code>*timeout</code>.<p>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a></em> </td><td></td></tr>
<tr><td valign="top"></td><td valign="top"><em>boost::thread_interrupted</em> </td><td></td></tr>
</table>
</dl>
</div>
</div><p>
<a class="anchor" name="12cce3364023eacbe4fe09006cf3d38d"></a><!-- doxytag: member="Passenger::MessageChannel::write" ref="12cce3364023eacbe4fe09006cf3d38d" args="(const char *name,...)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Passenger::MessageChannel::write </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"> <em>name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname"> <em>...</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Send an array message, which consists of the given strings, over the underlying file descriptor.
<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>name</em> </td><td>The first element of the message to send. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>...</em> </td><td>Other elements of the message. These *must* be strings, i.e. of type char*. It is also required to terminate this list with a NULL. </td></tr>
</table>
</dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a></em> </td><td>An error occured while writing the data to the file descriptor. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>boost::thread_interrupted</em> </td><td></td></tr>
</table>
</dl>
<dl class="pre" compact><dt><b>Precondition:</b></dt><dd>None of the message elements may contain a NUL character (<code>'\0'</code>). </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classPassenger_1_1MessageChannel.html#129659b60d1a663337873d2af944431e" title="Read an array message from the underlying file descriptor.">read()</a>, <a class="el" href="classPassenger_1_1MessageChannel.html#9ad7a978cf8409e01ab2f0a2b6be5a0a" title="Send an array message, which consists of the given elements, over the underlying...">write(const list<string> &)</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="70cc924c1ce7e2cedcbab61155d3aec9"></a><!-- doxytag: member="Passenger::MessageChannel::write" ref="70cc924c1ce7e2cedcbab61155d3aec9" args="(const char *name, va_list &ap)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Passenger::MessageChannel::write </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"> <em>name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">va_list & </td>
<td class="paramname"> <em>ap</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Send an array message, which consists of the given strings, over the underlying file descriptor.
<p>
Like <code>write(const char *name, ...)</code> but takes a va_list instead.<p>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a></em> </td><td>An error occured while writing the data to the file descriptor. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>boost::thread_interrupted</em> </td><td></td></tr>
</table>
</dl>
<dl class="pre" compact><dt><b>Precondition:</b></dt><dd>None of the message elements may contain a NUL character (<code>'\0'</code>). </dd></dl>
</div>
</div><p>
<a class="anchor" name="6a9bc5d72715cb7ba0e437c8851ef487"></a><!-- doxytag: member="Passenger::MessageChannel::write" ref="6a9bc5d72715cb7ba0e437c8851ef487" args="(const vector< string > &args)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Passenger::MessageChannel::write </td>
<td>(</td>
<td class="paramtype">const vector< string > & </td>
<td class="paramname"> <em>args</em> </td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Send an array message, which consists of the given elements, over the underlying file descriptor.
<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>args</em> </td><td>The message elements. </td></tr>
</table>
</dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a></em> </td><td>An error occured while writing the data to the file descriptor. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>boost::thread_interrupted</em> </td><td></td></tr>
</table>
</dl>
<dl class="pre" compact><dt><b>Precondition:</b></dt><dd>None of the message elements may contain a NUL character (<code>'\0'</code>). </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classPassenger_1_1MessageChannel.html#129659b60d1a663337873d2af944431e" title="Read an array message from the underlying file descriptor.">read()</a>, <a class="el" href="classPassenger_1_1MessageChannel.html#150f68bc47e060dcc6ca35bee047914d" title="Send an array message, which consists of the given elements, over the underlying...">write</a>(const char *, ...) </dd></dl>
</div>
</div><p>
<a class="anchor" name="9ad7a978cf8409e01ab2f0a2b6be5a0a"></a><!-- doxytag: member="Passenger::MessageChannel::write" ref="9ad7a978cf8409e01ab2f0a2b6be5a0a" args="(const list< string > &args)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Passenger::MessageChannel::write </td>
<td>(</td>
<td class="paramtype">const list< string > & </td>
<td class="paramname"> <em>args</em> </td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Send an array message, which consists of the given elements, over the underlying file descriptor.
<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>args</em> </td><td>The message elements. </td></tr>
</table>
</dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a></em> </td><td>An error occured while writing the data to the file descriptor. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>boost::thread_interrupted</em> </td><td></td></tr>
</table>
</dl>
<dl class="pre" compact><dt><b>Precondition:</b></dt><dd>None of the message elements may contain a NUL character (<code>'\0'</code>). </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classPassenger_1_1MessageChannel.html#129659b60d1a663337873d2af944431e" title="Read an array message from the underlying file descriptor.">read()</a>, <a class="el" href="classPassenger_1_1MessageChannel.html#150f68bc47e060dcc6ca35bee047914d" title="Send an array message, which consists of the given elements, over the underlying...">write</a>(const char *, ...) </dd></dl>
</div>
</div><p>
<a class="anchor" name="150f68bc47e060dcc6ca35bee047914d"></a><!-- doxytag: member="Passenger::MessageChannel::write" ref="150f68bc47e060dcc6ca35bee047914d" args="(const StringArrayType &args)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename StringArrayType , typename StringArrayConstIteratorType > </div>
<table class="memname">
<tr>
<td class="memname">void Passenger::MessageChannel::write </td>
<td>(</td>
<td class="paramtype">const StringArrayType & </td>
<td class="paramname"> <em>args</em> </td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Send an array message, which consists of the given elements, over the underlying file descriptor.
<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>args</em> </td><td>An object which contains the message elements. This object must support STL-style iteration, and each iterator must have an std::string as value. Use the StringArrayType and StringArrayConstIteratorType template parameters to specify the exact type names. </td></tr>
</table>
</dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a></em> </td><td>An error occured while writing the data to the file descriptor. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>boost::thread_interrupted</em> </td><td></td></tr>
</table>
</dl>
<dl class="pre" compact><dt><b>Precondition:</b></dt><dd>None of the message elements may contain a NUL character (<code>'\0'</code>). </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classPassenger_1_1MessageChannel.html#129659b60d1a663337873d2af944431e" title="Read an array message from the underlying file descriptor.">read()</a>, <a class="el" href="classPassenger_1_1MessageChannel.html#150f68bc47e060dcc6ca35bee047914d" title="Send an array message, which consists of the given elements, over the underlying...">write</a>(const char *, ...) </dd></dl>
</div>
</div><p>
<a class="anchor" name="e0c558e07dcc91900016773b2bec38d8"></a><!-- doxytag: member="Passenger::MessageChannel::writeFileDescriptor" ref="e0c558e07dcc91900016773b2bec38d8" args="(int fileDescriptor, bool negotiate=true)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Passenger::MessageChannel::writeFileDescriptor </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"> <em>fileDescriptor</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool </td>
<td class="paramname"> <em>negotiate</em> = <code>true</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Pass a file descriptor.
<p>
This only works if the underlying file descriptor is a Unix socket.<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>fileDescriptor</em> </td><td>The file descriptor to pass. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>negotiate</em> </td><td>See Ruby's MessageChannel::send_io method's comments. </td></tr>
</table>
</dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a></em> </td><td>Something went wrong during file descriptor passing. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>boost::thread_interrupted</em> </td><td></td></tr>
</table>
</dl>
<dl class="pre" compact><dt><b>Precondition:</b></dt><dd><code>fileDescriptor >= 0</code> </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classPassenger_1_1MessageChannel.html#1a28ba9d078f38f2831673092ac9dcbc" title="Receive a file descriptor, which had been passed over the underlying file descriptor...">readFileDescriptor()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="cfa38f4f0e22ec16350b8cc159e8e364"></a><!-- doxytag: member="Passenger::MessageChannel::writeRaw" ref="cfa38f4f0e22ec16350b8cc159e8e364" args="(const string &data)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Passenger::MessageChannel::writeRaw </td>
<td>(</td>
<td class="paramtype">const string & </td>
<td class="paramname"> <em>data</em> </td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Send a block of data over the underlying file descriptor.
<p>
This method blocks until everything is sent.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>Security guarantee: this method will not copy the data in memory, so it's safe to use this method to write passwords to the underlying file descriptor.</dd></dl>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>data</em> </td><td>The data to send. </td></tr>
</table>
</dl>
<dl class="pre" compact><dt><b>Precondition:</b></dt><dd><code>data != NULL</code> </dd></dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a></em> </td><td>An error occured while writing the data to the file descriptor. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>boost::thread_interrupted</em> </td><td></td></tr>
</table>
</dl>
</div>
</div><p>
<a class="anchor" name="069314e4c7e1fe8c8ab36e16d2cc5fef"></a><!-- doxytag: member="Passenger::MessageChannel::writeRaw" ref="069314e4c7e1fe8c8ab36e16d2cc5fef" args="(const char *data, unsigned int size)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Passenger::MessageChannel::writeRaw </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"> <em>data</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned int </td>
<td class="paramname"> <em>size</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Send a block of data over the underlying file descriptor.
<p>
This method blocks until everything is sent.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>Security guarantee: this method will not copy the data in memory, so it's safe to use this method to write passwords to the underlying file descriptor.</dd></dl>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>data</em> </td><td>The data to send. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>size</em> </td><td>The number of bytes in <code>data</code>. </td></tr>
</table>
</dl>
<dl class="pre" compact><dt><b>Precondition:</b></dt><dd><code>data != NULL</code> </dd></dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a></em> </td><td>An error occured while writing the data to the file descriptor. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>boost::thread_interrupted</em> </td><td></td></tr>
</table>
</dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classPassenger_1_1MessageChannel.html#b471dc1888f030e20ed23068a160ec2a" title="Read exactly size bytes of data from the underlying file descriptor, and put the...">readRaw()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="80977020ef895f3ea790c5d28a333dda"></a><!-- doxytag: member="Passenger::MessageChannel::writeScalar" ref="80977020ef895f3ea790c5d28a333dda" args="(const char *data, unsigned int size)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Passenger::MessageChannel::writeScalar </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"> <em>data</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned int </td>
<td class="paramname"> <em>size</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Write a scalar message to the underlying file descriptor.
<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>Security guarantee: this method will not copy the data in memory, so it's safe to use this method to write passwords to the underlying file descriptor.</dd></dl>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>data</em> </td><td>The scalar message's content. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>size</em> </td><td>The number of bytes in <code>data</code>. </td></tr>
</table>
</dl>
<dl class="pre" compact><dt><b>Precondition:</b></dt><dd><code>data != NULL</code> </dd></dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a></em> </td><td>An error occured while writing the data to the file descriptor. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>boost::thread_interrupted</em> </td><td></td></tr>
</table>
</dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classPassenger_1_1MessageChannel.html#1f3cf672b566166ed920c2bba4d19604" title="Read a scalar message from the underlying file descriptor.">readScalar()</a>, <a class="el" href="classPassenger_1_1MessageChannel.html#44e01a783c48abadeea0d915b9893bfb" title="Write a scalar message to the underlying file descriptor.">writeScalar(const string &)</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="44e01a783c48abadeea0d915b9893bfb"></a><!-- doxytag: member="Passenger::MessageChannel::writeScalar" ref="44e01a783c48abadeea0d915b9893bfb" args="(const string &str)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Passenger::MessageChannel::writeScalar </td>
<td>(</td>
<td class="paramtype">const string & </td>
<td class="paramname"> <em>str</em> </td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Write a scalar message to the underlying file descriptor.
<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>Security guarantee: this method will not copy the data in memory, so it's safe to use this method to write passwords to the underlying file descriptor.</dd></dl>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>str</em> </td><td>The scalar message's content. </td></tr>
</table>
</dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a></em> </td><td>An error occured while writing the data to the file descriptor. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>boost::thread_interrupted</em> </td><td></td></tr>
</table>
</dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classPassenger_1_1MessageChannel.html#1f3cf672b566166ed920c2bba4d19604" title="Read a scalar message from the underlying file descriptor.">readScalar()</a>, <a class="el" href="classPassenger_1_1MessageChannel.html#80977020ef895f3ea790c5d28a333dda" title="Write a scalar message to the underlying file descriptor.">writeScalar(const char *, unsigned int)</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="bf02c51a74477650de8d5d5db661063b"></a><!-- doxytag: member="Passenger::MessageChannel::writeUint32" ref="bf02c51a74477650de8d5d5db661063b" args="(unsigned int value)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Passenger::MessageChannel::writeUint32 </td>
<td>(</td>
<td class="paramtype">unsigned int </td>
<td class="paramname"> <em>value</em> </td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Write a 32-bit big-endian unsigned integer to the underlying file descriptor.
<p>
<dl compact><dt><b>Exceptions:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em><a class="el" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a></em> </td><td>An error occurred while writing the data to the file descriptor. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>boost::thread_interrupted</em> </td><td></td></tr>
</table>
</dl>
</div>
</div><p>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="MessageChannel_8h-source.html">MessageChannel.h</a></ul>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Feb 21 12:22:48 2010 for Passenger by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
</body>
</html>
|