OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
13 // limitations under the License. | 13 // limitations under the License. |
14 | 14 |
15 #ifndef CRASHPAD_UTIL_MACH_MACH_MESSAGE_SERVER_H_ | 15 #ifndef CRASHPAD_UTIL_MACH_MACH_MESSAGE_SERVER_H_ |
16 #define CRASHPAD_UTIL_MACH_MACH_MESSAGE_SERVER_H_ | 16 #define CRASHPAD_UTIL_MACH_MACH_MESSAGE_SERVER_H_ |
17 | 17 |
18 #include <mach/mach.h> | 18 #include <mach/mach.h> |
19 | 19 |
| 20 #include <set> |
| 21 |
20 #include "base/basictypes.h" | 22 #include "base/basictypes.h" |
21 | 23 |
22 namespace crashpad { | 24 namespace crashpad { |
23 | 25 |
24 //! \brief Runs a Mach message server to handle a Mach RPC request for MIG | 26 //! \brief Runs a Mach message server to handle a Mach RPC request for MIG |
25 //! servers. | 27 //! servers. |
26 //! | 28 //! |
27 //! The principal entry point to this interface is the static Run() method. | 29 //! The principal entry point to this interface is the static Run() method. |
28 class MachMessageServer { | 30 class MachMessageServer { |
29 public: | 31 public: |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 //! | 63 //! |
62 //! \return `true` on success and `false` on failure, although the caller | 64 //! \return `true` on success and `false` on failure, although the caller |
63 //! ignores the return value. However, the return code to be included in | 65 //! ignores the return value. However, the return code to be included in |
64 //! the reply message should be set as `mig_reply_error_t::RetCode`. The | 66 //! the reply message should be set as `mig_reply_error_t::RetCode`. The |
65 //! non-`void` return value is used for increased compatibility with | 67 //! non-`void` return value is used for increased compatibility with |
66 //! MIG-generated functions. | 68 //! MIG-generated functions. |
67 virtual bool MachMessageServerFunction(const mach_msg_header_t* in, | 69 virtual bool MachMessageServerFunction(const mach_msg_header_t* in, |
68 mach_msg_header_t* out, | 70 mach_msg_header_t* out, |
69 bool* destroy_complex_request) = 0; | 71 bool* destroy_complex_request) = 0; |
70 | 72 |
| 73 //! \return The set of request message Mach message IDs that |
| 74 //! MachMessageServerFunction() is able to handle. |
| 75 virtual std::set<mach_msg_id_t> MachMessageServerRequestIDs() = 0; |
| 76 |
71 //! \return The expected or maximum size, in bytes, of a request message to | 77 //! \return The expected or maximum size, in bytes, of a request message to |
72 //! be received as the \a in parameter of MachMessageServerFunction(). | 78 //! be received as the \a in parameter of MachMessageServerFunction(). |
73 virtual mach_msg_size_t MachMessageServerRequestSize() = 0; | 79 virtual mach_msg_size_t MachMessageServerRequestSize() = 0; |
74 | 80 |
75 //! \return The maximum size, in bytes, of a reply message to be sent via | 81 //! \return The maximum size, in bytes, of a reply message to be sent via |
76 //! the \a out parameter of MachMessageServerFunction(). This value does | 82 //! the \a out parameter of MachMessageServerFunction(). This value does |
77 //! not need to include the size of any trailer to be sent with the | 83 //! not need to include the size of any trailer to be sent with the |
78 //! message. | 84 //! message. |
79 virtual mach_msg_size_t MachMessageServerReplySize() = 0; | 85 virtual mach_msg_size_t MachMessageServerReplySize() = 0; |
80 | 86 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 ReceiveLarge receive_large, | 184 ReceiveLarge receive_large, |
179 mach_msg_timeout_t timeout_ms); | 185 mach_msg_timeout_t timeout_ms); |
180 | 186 |
181 private: | 187 private: |
182 DISALLOW_IMPLICIT_CONSTRUCTORS(MachMessageServer); | 188 DISALLOW_IMPLICIT_CONSTRUCTORS(MachMessageServer); |
183 }; | 189 }; |
184 | 190 |
185 } // namespace crashpad | 191 } // namespace crashpad |
186 | 192 |
187 #endif // CRASHPAD_UTIL_MACH_MACH_MESSAGE_SERVER_H_ | 193 #endif // CRASHPAD_UTIL_MACH_MACH_MESSAGE_SERVER_H_ |
OLD | NEW |