<ahref="#pub-methods">Public Member Functions</a>|
<ahref="classcrashpad_1_1CompositeMachMessageServer-members.html">List of all members</a></div>
<divclass="headertitle">
<divclass="title">crashpad::CompositeMachMessageServer Class Reference</div></div>
</div><!--header-->
<divclass="contents">
<p>Adapts multiple <aclass="el"href="classcrashpad_1_1MachMessageServer_1_1Interface.html"title="A Mach RPC callback interface, called by Run(). ">MachMessageServer::Interface</a> implementations for simultaneous use in a single <aclass="el"href="classcrashpad_1_1MachMessageServer.html#ace981f2e495984f119aa074f7d33bff6"title="Runs a Mach message server to handle a Mach RPC request for MIG servers. ">MachMessageServer::Run()</a> call.
<areahref="classcrashpad_1_1MachMessageServer_1_1Interface.html"title="A Mach RPC callback interface, called by Run(). "alt="crashpad::MachMessageServer::Interface"shape="rect"coords="0,0,286,24"/>
<trclass="memdesc:a1b946d369ddb0c838496dbddd0f6f631"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Adds a handler that messages can be dispatched to based on request message ID. <ahref="#a1b946d369ddb0c838496dbddd0f6f631">More...</a><br/></td></tr>
<divclass="textblock"><p>Adapts multiple <aclass="el"href="classcrashpad_1_1MachMessageServer_1_1Interface.html"title="A Mach RPC callback interface, called by Run(). ">MachMessageServer::Interface</a> implementations for simultaneous use in a single <aclass="el"href="classcrashpad_1_1MachMessageServer.html#ace981f2e495984f119aa074f7d33bff6"title="Runs a Mach message server to handle a Mach RPC request for MIG servers. ">MachMessageServer::Run()</a> call. </p>
<p>This class implements a <aclass="el"href="classcrashpad_1_1MachMessageServer_1_1Interface.html"title="A Mach RPC callback interface, called by Run(). ">MachMessageServer::Interface</a> that contains other other <aclass="el"href="classcrashpad_1_1MachMessageServer_1_1Interface.html"title="A Mach RPC callback interface, called by Run(). ">MachMessageServer::Interface</a> objects.</p>
<p>In some situations, it may be desirable for a Mach message server to handle messages from distinct MIG subsystems with distinct <aclass="el"href="classcrashpad_1_1MachMessageServer_1_1Interface.html"title="A Mach RPC callback interface, called by Run(). ">MachMessageServer::Interface</a> implementations. This may happen if a single receive right is shared for multiple subsystems, or if distinct receive rights are combined in a Mach port set. In these cases, this class performs a first-level demultiplexing to forward request messages to the proper subsystem-level demultiplexers. </p>
</div><h2class="groupheader">Member Function Documentation</h2>
<p>Adds a handler that messages can be dispatched to based on request message ID. </p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramdir">[in]</td><tdclass="paramname">handler</td><td>A <aclass="el"href="classcrashpad_1_1MachMessageServer.html"title="Runs a Mach message server to handle a Mach RPC request for MIG servers. ">MachMessageServer</a> handler. Ownership of this object is not taken. Cycles must not be created between objects. It is invalid to add an object as its own handler.</td></tr>
</table>
</dd>
</dl>
<p>If <em>handler</em> claims to support any request ID that this object is already able to handle, execution will be terminated. </p>
<p>This method is a stand-in for a MIG-generated Mach RPC server “demux” function such as <code>exc_server()</code> and <code>mach_exc_server()</code>. Implementations may call such a function directly. This method is expected to behave exactly as these functions behave.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramdir">[in]</td><tdclass="paramname">in</td><td>The request message, received as a Mach message. Note that this interface uses a <code>const</code> parameter for this purpose, whereas MIG-generated “demux” functions do not. </td></tr>
<tr><tdclass="paramdir">[out]</td><tdclass="paramname">out</td><td>The reply message. The caller allocates storage, and the callee is expected to populate the reply message appropriately. After returning, the caller will send this reply as a Mach message via the message’s reply port. </td></tr>
<tr><tdclass="paramdir">[out]</td><tdclass="paramname">destroy_complex_request</td><td><code>true</code> if a complex request message is to be destroyed even when handled successfully, <code>false</code> otherwise. The traditional behavior is <code>false</code>. In this case, the caller only destroys the request message in <em>in</em> when the reply message in <em>out</em> is not complex and when it indicates a return code other than <code>KERN_SUCCESS</code> or <code>MIG_NO_REPLY</code>. The assumption is that the rights or out-of-line data carried in a complex message may be retained by the server in this situation, and that it is the responsibility of the server to release these resources as needed. However, in many cases, these resources are not needed beyond the duration of a request-reply transaction, and in such cases, it is less error-prone to always have the caller, <aclass="el"href="classcrashpad_1_1MachMessageServer.html#ace981f2e495984f119aa074f7d33bff6"title="Runs a Mach message server to handle a Mach RPC request for MIG servers. ">MachMessageServer::Run()</a>, destroy complex request messages. To choose this behavior, this parameter should be set to <code>true</code>.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd><code>true</code> on success and <code>false</code> on failure, although the caller ignores the return value. However, the return code to be included in the reply message should be set as <code>mig_reply_error_t::RetCode</code>. The non-<code>void</code> return value is used for increased compatibility with MIG-generated functions.</dd></dl>
<p>This implementation forwards the message to an appropriate handler added by <aclass="el"href="classcrashpad_1_1CompositeMachMessageServer.html#a1b946d369ddb0c838496dbddd0f6f631"title="Adds a handler that messages can be dispatched to based on request message ID. ">AddHandler()</a> on the basis of the <em>in</em> request message’s message ID. If no appropriate handler exists, the <em>out</em> reply message is treated as a <code>mig_reply_error_t</code>, its return code is set to <code>MIG_BAD_ID</code>, and <code>false</code> is returned. </p>
<dlclass="section return"><dt>Returns</dt><dd>The maximum size, in bytes, of a reply message to be sent via the <em>out</em> parameter of <aclass="el"href="classcrashpad_1_1CompositeMachMessageServer.html#afe10dd1d12e4cbfe57e040b6939d7f15"title="Handles a Mach RPC request. ">MachMessageServerFunction()</a>. This value does not need to include the size of any trailer to be sent with the message.</dd></dl>
<p>This implementation returns the maximum reply message size of all handlers added by <aclass="el"href="classcrashpad_1_1CompositeMachMessageServer.html#a1b946d369ddb0c838496dbddd0f6f631"title="Adds a handler that messages can be dispatched to based on request message ID. ">AddHandler()</a>. If no handlers are present, returns the size of <code>mig_reply_error_t</code>, the minimum size of a MIG reply message. </p>
<dlclass="section return"><dt>Returns</dt><dd>The set of request message Mach message IDs that <aclass="el"href="classcrashpad_1_1CompositeMachMessageServer.html#afe10dd1d12e4cbfe57e040b6939d7f15"title="Handles a Mach RPC request. ">MachMessageServerFunction()</a> is able to handle.</dd></dl>
<p>This implementation returns the set of all request message Mach message IDs of all handlers added by <aclass="el"href="classcrashpad_1_1CompositeMachMessageServer.html#a1b946d369ddb0c838496dbddd0f6f631"title="Adds a handler that messages can be dispatched to based on request message ID. ">AddHandler()</a>. </p>
<dlclass="section return"><dt>Returns</dt><dd>The expected or maximum size, in bytes, of a request message to be received as the <em>in</em> parameter of <aclass="el"href="classcrashpad_1_1CompositeMachMessageServer.html#afe10dd1d12e4cbfe57e040b6939d7f15"title="Handles a Mach RPC request. ">MachMessageServerFunction()</a>.</dd></dl>
<p>This implementation returns the maximum request message size of all handlers added by <aclass="el"href="classcrashpad_1_1CompositeMachMessageServer.html#a1b946d369ddb0c838496dbddd0f6f631"title="Adds a handler that messages can be dispatched to based on request message ID. ">AddHandler()</a>. If no handlers are present, returns the size of <code>mach_msg_header_t</code>, the minimum size of a MIG request message that can be received for demultiplexing purposes. </p>