| initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 1 | // Copyright 2008, Google Inc. |
| 2 | // All rights reserved. |
| 3 | // |
| 4 | // Redistribution and use in source and binary forms, with or without |
| 5 | // modification, are permitted provided that the following conditions are |
| 6 | // met: |
| 7 | // |
| 8 | // * Redistributions of source code must retain the above copyright |
| 9 | // notice, this list of conditions and the following disclaimer. |
| 10 | // * Redistributions in binary form must reproduce the above |
| 11 | // copyright notice, this list of conditions and the following disclaimer |
| 12 | // in the documentation and/or other materials provided with the |
| 13 | // distribution. |
| 14 | // * Neither the name of Google Inc. nor the names of its |
| 15 | // contributors may be used to endorse or promote products derived from |
| 16 | // this software without specific prior written permission. |
| 17 | // |
| 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 | |
| 30 | // This header is meant to be included in multiple passes, hence no traditional |
| 31 | // header guard. |
| 32 | // |
| 33 | // In the first pass, IPC_MESSAGE_MACROS_ENUMS should be defined, which will |
| 34 | // create enums for each of the messages defined with the IPC_MESSAGE_* macros. |
| 35 | // |
| 36 | // In the second pass, either IPC_MESSAGE_MACROS_DEBUGSTRINGS or |
| 37 | // IPC_MESSAGE_MACROS_CLASSES should be defined (if both, DEBUGSTRINGS takes |
| 38 | // precedence). Only one .cc file should have DEBUGSTRINGS defined, as this |
| 39 | // will create helper functions mapping message types to strings. Having |
| 40 | // CLASSES defined will create classes for each of the messages defined with |
| 41 | // the IPC_MESSAGE_* macros. |
| 42 | // |
| 43 | // "Sync" messages are just synchronous calls, the Send() call doesn't return |
| 44 | // until a reply comes back. Input parameters are first (const TYPE&), and |
| 45 | // To declare a sync message, use the IPC_SYNC_ macros. The numbers at the |
| 46 | // end show how many input/output parameters there are (i.e. 1_2 is 1 in, 2 out). |
| 47 | // The caller does a Send([route id, ], in1, &out1, &out2). |
| 48 | // The receiver's handler function will be |
| 49 | // void OnSyncMessageName(const type1& in1, type2* out1, type3* out2) |
| 50 | // |
| 51 | // |
| 52 | // A caller can also send a synchronous message, while the receiver can respond |
| 53 | // at a later time. This is transparent from the sender's size. The receiver |
| 54 | // needs to use a different handler that takes in a IPC::Message* as the output |
| 55 | // type, stash the message, and when it has the data it can Send the message. |
| 56 | // |
| 57 | // Use the IPC_MESSAGE_HANDLER_DELAY_REPLY macro instead of IPC_MESSAGE_HANDLER |
| 58 | // IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_SyncMessageName, OnSyncMessageName) |
| 59 | // |
| 60 | // The handler function will look like: |
| 61 | // void OnSyncMessageName(const type1& in1, IPC::Message* reply_msg); |
| 62 | // |
| 63 | // Receiver stashes the IPC::Message* pointer, and when it's ready, it does: |
| 64 | // ViewHostMsg_SyncMessageName::WriteReplyParams(reply_msg, out1, out2); |
| 65 | // Send(reply_msg); |
| 66 | |
| 67 | #include "chrome/common/ipc_message_utils.h" |
| 68 | |
| 69 | // Undefine the macros from the previous pass (if any). |
| 70 | #undef IPC_BEGIN_MESSAGES |
| 71 | #undef IPC_END_MESSAGES |
| 72 | #undef IPC_MESSAGE_CONTROL0 |
| 73 | #undef IPC_MESSAGE_CONTROL1 |
| 74 | #undef IPC_MESSAGE_CONTROL2 |
| 75 | #undef IPC_MESSAGE_CONTROL3 |
| 76 | #undef IPC_MESSAGE_CONTROL4 |
| 77 | #undef IPC_MESSAGE_CONTROL5 |
| 78 | #undef IPC_MESSAGE_ROUTED0 |
| 79 | #undef IPC_MESSAGE_ROUTED1 |
| 80 | #undef IPC_MESSAGE_ROUTED2 |
| 81 | #undef IPC_MESSAGE_ROUTED3 |
| 82 | #undef IPC_MESSAGE_ROUTED4 |
| 83 | #undef IPC_MESSAGE_ROUTED5 |
| 84 | #undef IPC_MESSAGE_EMPTY |
| 85 | #undef IPC_SYNC_MESSAGE_CONTROL0_0 |
| 86 | #undef IPC_SYNC_MESSAGE_CONTROL0_1 |
| 87 | #undef IPC_SYNC_MESSAGE_CONTROL0_2 |
| 88 | #undef IPC_SYNC_MESSAGE_CONTROL0_3 |
| 89 | #undef IPC_SYNC_MESSAGE_CONTROL1_0 |
| 90 | #undef IPC_SYNC_MESSAGE_CONTROL1_1 |
| 91 | #undef IPC_SYNC_MESSAGE_CONTROL1_2 |
| 92 | #undef IPC_SYNC_MESSAGE_CONTROL1_3 |
| 93 | #undef IPC_SYNC_MESSAGE_CONTROL2_0 |
| 94 | #undef IPC_SYNC_MESSAGE_CONTROL2_1 |
| 95 | #undef IPC_SYNC_MESSAGE_CONTROL2_2 |
| 96 | #undef IPC_SYNC_MESSAGE_CONTROL2_3 |
| 97 | #undef IPC_SYNC_MESSAGE_CONTROL3_1 |
| 98 | #undef IPC_SYNC_MESSAGE_CONTROL3_2 |
| 99 | #undef IPC_SYNC_MESSAGE_CONTROL3_3 |
| 100 | #undef IPC_SYNC_MESSAGE_CONTROL4_1 |
| 101 | #undef IPC_SYNC_MESSAGE_CONTROL4_2 |
| 102 | #undef IPC_SYNC_MESSAGE_ROUTED0_0 |
| 103 | #undef IPC_SYNC_MESSAGE_ROUTED0_1 |
| 104 | #undef IPC_SYNC_MESSAGE_ROUTED0_2 |
| 105 | #undef IPC_SYNC_MESSAGE_ROUTED0_3 |
| 106 | #undef IPC_SYNC_MESSAGE_ROUTED1_0 |
| 107 | #undef IPC_SYNC_MESSAGE_ROUTED1_1 |
| 108 | #undef IPC_SYNC_MESSAGE_ROUTED1_2 |
| 109 | #undef IPC_SYNC_MESSAGE_ROUTED1_3 |
| 110 | #undef IPC_SYNC_MESSAGE_ROUTED2_0 |
| 111 | #undef IPC_SYNC_MESSAGE_ROUTED2_1 |
| 112 | #undef IPC_SYNC_MESSAGE_ROUTED2_2 |
| 113 | #undef IPC_SYNC_MESSAGE_ROUTED2_3 |
| 114 | #undef IPC_SYNC_MESSAGE_ROUTED3_0 |
| 115 | #undef IPC_SYNC_MESSAGE_ROUTED3_1 |
| 116 | #undef IPC_SYNC_MESSAGE_ROUTED3_2 |
| 117 | #undef IPC_SYNC_MESSAGE_ROUTED3_3 |
| 118 | #undef IPC_SYNC_MESSAGE_ROUTED4_0 |
| 119 | #undef IPC_SYNC_MESSAGE_ROUTED4_1 |
| 120 | |
| 121 | #if defined(IPC_MESSAGE_MACROS_ENUMS) |
| 122 | #undef IPC_MESSAGE_MACROS_ENUMS |
| 123 | |
| 124 | // TODO(jabdelmalek): we're using the lowest 12 bits of type for the message |
| 125 | // id, and the highest 4 bits for the channel type. This constrains us to |
| 126 | // 16 channel types (currently using 8) and 4K messages per type. Should |
| 127 | // really make type be 32 bits, but then we break automation with older Chrome |
| 128 | // builds.. |
| 129 | #define IPC_BEGIN_MESSAGES(label, start) \ |
| 130 | enum label##MsgType { \ |
| 131 | label##Start = start << 12, \ |
| 132 | label##PreStart = (start << 12) - 1, // Do this so that automation messages keep the same id as before |
| 133 | |
| 134 | #define IPC_END_MESSAGES(label) \ |
| 135 | label##End \ |
| 136 | }; |
| 137 | |
| 138 | #define IPC_MESSAGE_CONTROL0(msg_class) \ |
| 139 | msg_class##__ID, |
| 140 | |
| 141 | #define IPC_MESSAGE_CONTROL1(msg_class, type1) \ |
| 142 | msg_class##__ID, |
| 143 | |
| 144 | #define IPC_MESSAGE_CONTROL2(msg_class, type1, type2) \ |
| 145 | msg_class##__ID, |
| 146 | |
| 147 | #define IPC_MESSAGE_CONTROL3(msg_class, type1, type2, type3) \ |
| 148 | msg_class##__ID, |
| 149 | |
| 150 | #define IPC_MESSAGE_CONTROL4(msg_class, type1, type2, type3, type4) \ |
| 151 | msg_class##__ID, |
| 152 | |
| 153 | #define IPC_MESSAGE_CONTROL5(msg_class, type1, type2, type3, type4, type5) \ |
| 154 | msg_class##__ID, |
| 155 | |
| 156 | #define IPC_MESSAGE_ROUTED0(msg_class) \ |
| 157 | msg_class##__ID, |
| 158 | |
| 159 | #define IPC_MESSAGE_ROUTED1(msg_class, type1) \ |
| 160 | msg_class##__ID, |
| 161 | |
| 162 | #define IPC_MESSAGE_ROUTED2(msg_class, type1, type2) \ |
| 163 | msg_class##__ID, |
| 164 | |
| 165 | #define IPC_MESSAGE_ROUTED3(msg_class, type1, type2, type3) \ |
| 166 | msg_class##__ID, |
| 167 | |
| 168 | #define IPC_MESSAGE_ROUTED4(msg_class, type1, type2, type3, type4) \ |
| 169 | msg_class##__ID, |
| 170 | |
| 171 | #define IPC_MESSAGE_ROUTED5(msg_class, type1, type2, type3, type4, type5) \ |
| 172 | msg_class##__ID, |
| 173 | |
| 174 | #define IPC_MESSAGE_EMPTY(msg_class) \ |
| 175 | msg_class##__ID, |
| 176 | |
| 177 | #define IPC_SYNC_MESSAGE_CONTROL0_0(msg_class) \ |
| 178 | msg_class##__ID, |
| 179 | |
| 180 | #define IPC_SYNC_MESSAGE_CONTROL0_1(msg_class, type1_out) \ |
| 181 | msg_class##__ID, |
| 182 | |
| 183 | #define IPC_SYNC_MESSAGE_CONTROL0_2(msg_class, type1_out, type2_out) \ |
| 184 | msg_class##__ID, |
| 185 | |
| 186 | #define IPC_SYNC_MESSAGE_CONTROL0_3(msg_class, type1_out, type2_out, type3_out) \ |
| 187 | msg_class##__ID, |
| 188 | |
| 189 | #define IPC_SYNC_MESSAGE_CONTROL1_0(msg_class, type1_in) \ |
| 190 | msg_class##__ID, |
| 191 | |
| 192 | #define IPC_SYNC_MESSAGE_CONTROL1_1(msg_class, type1_in, type1_out) \ |
| 193 | msg_class##__ID, |
| 194 | |
| 195 | #define IPC_SYNC_MESSAGE_CONTROL1_2(msg_class, type1_in, type1_out, type2_out) \ |
| 196 | msg_class##__ID, |
| 197 | |
| 198 | #define IPC_SYNC_MESSAGE_CONTROL1_3(msg_class, type1_in, type1_out, type2_out, type3_out) \ |
| 199 | msg_class##__ID, |
| 200 | |
| 201 | #define IPC_SYNC_MESSAGE_CONTROL2_0(msg_class, type1_in, type2_in) \ |
| 202 | msg_class##__ID, |
| 203 | |
| 204 | #define IPC_SYNC_MESSAGE_CONTROL2_1(msg_class, type1_in, type2_in, type1_out) \ |
| 205 | msg_class##__ID, |
| 206 | |
| 207 | #define IPC_SYNC_MESSAGE_CONTROL2_2(msg_class, type1_in, type2_in, type1_out, type2_out) \ |
| 208 | msg_class##__ID, |
| 209 | |
| 210 | #define IPC_SYNC_MESSAGE_CONTROL2_3(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) \ |
| 211 | msg_class##__ID, |
| 212 | |
| 213 | #define IPC_SYNC_MESSAGE_CONTROL3_1(msg_class, type1_in, type2_in, type3_in, type1_out) \ |
| 214 | msg_class##__ID, |
| 215 | |
| 216 | #define IPC_SYNC_MESSAGE_CONTROL3_2(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) \ |
| 217 | msg_class##__ID, |
| 218 | |
| 219 | #define IPC_SYNC_MESSAGE_CONTROL3_3(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) \ |
| 220 | msg_class##__ID, |
| 221 | |
| 222 | #define IPC_SYNC_MESSAGE_CONTROL4_1(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) \ |
| 223 | msg_class##__ID, |
| 224 | |
| 225 | #define IPC_SYNC_MESSAGE_CONTROL4_2(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) \ |
| 226 | msg_class##__ID, |
| 227 | |
| 228 | #define IPC_SYNC_MESSAGE_ROUTED0_0(msg_class) \ |
| 229 | msg_class##__ID, |
| 230 | |
| 231 | #define IPC_SYNC_MESSAGE_ROUTED0_1(msg_class, type1_out) \ |
| 232 | msg_class##__ID, |
| 233 | |
| 234 | #define IPC_SYNC_MESSAGE_ROUTED0_2(msg_class, type1_out, type2_out) \ |
| 235 | msg_class##__ID, |
| 236 | |
| 237 | #define IPC_SYNC_MESSAGE_ROUTED0_3(msg_class, type1_out, type2_out, type3_out) \ |
| 238 | msg_class##__ID, |
| 239 | |
| 240 | #define IPC_SYNC_MESSAGE_ROUTED1_0(msg_class, type1_in) \ |
| 241 | msg_class##__ID, |
| 242 | |
| 243 | #define IPC_SYNC_MESSAGE_ROUTED1_1(msg_class, type1_in, type1_out) \ |
| 244 | msg_class##__ID, |
| 245 | |
| 246 | #define IPC_SYNC_MESSAGE_ROUTED1_2(msg_class, type1_in, type1_out, type2_out) \ |
| 247 | msg_class##__ID, |
| 248 | |
| 249 | #define IPC_SYNC_MESSAGE_ROUTED1_3(msg_class, type1_in, type1_out, type2_out, type3_out) \ |
| 250 | msg_class##__ID, |
| 251 | |
| 252 | #define IPC_SYNC_MESSAGE_ROUTED2_0(msg_class, type1_in, type2_in) \ |
| 253 | msg_class##__ID, |
| 254 | |
| 255 | #define IPC_SYNC_MESSAGE_ROUTED2_1(msg_class, type1_in, type2_in, type1_out) \ |
| 256 | msg_class##__ID, |
| 257 | |
| 258 | #define IPC_SYNC_MESSAGE_ROUTED2_2(msg_class, type1_in, type2_in, type1_out, type2_out) \ |
| 259 | msg_class##__ID, |
| 260 | |
| 261 | #define IPC_SYNC_MESSAGE_ROUTED2_3(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) \ |
| 262 | msg_class##__ID, |
| 263 | |
| 264 | #define IPC_SYNC_MESSAGE_ROUTED3_0(msg_class, type1_in, type2_in, type3_in) \ |
| 265 | msg_class##__ID, |
| 266 | |
| 267 | #define IPC_SYNC_MESSAGE_ROUTED3_1(msg_class, type1_in, type2_in, type3_in, type1_out) \ |
| 268 | msg_class##__ID, |
| 269 | |
| 270 | #define IPC_SYNC_MESSAGE_ROUTED3_2(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) \ |
| 271 | msg_class##__ID, |
| 272 | |
| 273 | #define IPC_SYNC_MESSAGE_ROUTED3_3(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) \ |
| 274 | msg_class##__ID, |
| 275 | |
| 276 | #define IPC_SYNC_MESSAGE_ROUTED4_0(msg_class, type1_in, type2_in, type3_in, type4_in) \ |
| 277 | msg_class##__ID, |
| 278 | |
| 279 | #define IPC_SYNC_MESSAGE_ROUTED4_1(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) \ |
| 280 | msg_class##__ID, |
| 281 | |
| 282 | // Message crackers and handlers. |
| 283 | // Prefer to use the IPC_BEGIN_MESSAGE_MAP_EX to the older macros since they |
| 284 | // allow you to detect when a message could not be de-serialized. Usage: |
| 285 | // |
| 286 | // void MyClass::OnMessageReceived(const IPC::Message& msg) { |
| 287 | // bool msg_is_good = false; |
| 288 | // IPC_BEGIN_MESSAGE_MAP_EX(MyClass, msg, msg_is_good) |
| 289 | // IPC_MESSAGE_HANDLER(MsgClassOne, OnMsgClassOne) |
| 290 | // ...more handlers here ... |
| 291 | // IPC_MESSAGE_HANDLER(MsgClassTen, OnMsgClassTen) |
| 292 | // IPC_END_MESSAGE_MAP_EX() |
| 293 | // if (!msg_is_good) { |
| 294 | // // Signal error here or terminate offending process. |
| 295 | // } |
| 296 | // } |
| 297 | |
| 298 | #define IPC_DEFINE_MESSAGE_MAP(class_name) \ |
| 299 | void class_name::OnMessageReceived(const IPC::Message& msg) \ |
| 300 | IPC_BEGIN_MESSAGE_MAP(class_name, msg) |
| 301 | |
| 302 | #define IPC_BEGIN_MESSAGE_MAP_EX(class_name, msg, msg_is_ok) \ |
| 303 | { \ |
| 304 | typedef class_name _IpcMessageHandlerClass; \ |
| 305 | const IPC::Message& ipc_message__ = msg; \ |
| 306 | bool& msg_is_ok__ = msg_is_ok; \ |
| 307 | switch (ipc_message__.type()) { \ |
| 308 | |
| 309 | #define IPC_BEGIN_MESSAGE_MAP(class_name, msg) \ |
| 310 | { \ |
| 311 | typedef class_name _IpcMessageHandlerClass; \ |
| 312 | const IPC::Message& ipc_message__ = msg; \ |
| 313 | bool msg_is_ok__ = true; \ |
| 314 | switch (ipc_message__.type()) { \ |
| 315 | |
| 316 | #define IPC_MESSAGE_FORWARD(msg_class, obj, member_func) \ |
| 317 | case msg_class::ID: \ |
| 318 | msg_is_ok__ = msg_class::Dispatch(&ipc_message__, obj, &member_func); \ |
| 319 | break; |
| 320 | |
| 321 | #define IPC_MESSAGE_HANDLER(msg_class, member_func) \ |
| 322 | IPC_MESSAGE_FORWARD(msg_class, this, _IpcMessageHandlerClass::member_func) |
| 323 | |
| 324 | #define IPC_MESSAGE_FORWARD_DELAY_REPLY(msg_class, obj, member_func) \ |
| 325 | case msg_class::ID: \ |
| 326 | msg_class::DispatchDelayReply(&ipc_message__, obj, &member_func); \ |
| 327 | break; |
| 328 | |
| 329 | #define IPC_MESSAGE_HANDLER_DELAY_REPLY(msg_class, member_func) \ |
| 330 | IPC_MESSAGE_FORWARD_DELAY_REPLY(msg_class, this, _IpcMessageHandlerClass::member_func) |
| 331 | |
| 332 | #define IPC_MESSAGE_HANDLER_GENERIC(msg_class, code) \ |
| 333 | case msg_class::ID: \ |
| 334 | code; \ |
| 335 | break; |
| 336 | |
| 337 | #define IPC_REPLY_HANDLER(func) \ |
| 338 | case IPC_REPLY_ID: \ |
| 339 | func(ipc_message__); \ |
| 340 | break; |
| 341 | |
| 342 | |
| 343 | #define IPC_MESSAGE_UNHANDLED(code) \ |
| 344 | default: \ |
| 345 | code; \ |
| 346 | break; |
| 347 | |
| 348 | #define IPC_MESSAGE_UNHANDLED_ERROR() \ |
| 349 | IPC_MESSAGE_UNHANDLED(NOTREACHED() << \ |
| 350 | "Invalid message with type = " << \ |
| 351 | ipc_message__.type()) |
| 352 | |
| 353 | #define IPC_END_MESSAGE_MAP() \ |
| 354 | DCHECK(msg_is_ok__); \ |
| 355 | } \ |
| 356 | } |
| 357 | |
| 358 | #define IPC_END_MESSAGE_MAP_EX() \ |
| 359 | } \ |
| 360 | } |
| 361 | |
| 362 | #elif defined(IPC_MESSAGE_MACROS_LOG) |
| 363 | #undef IPC_MESSAGE_MACROS_LOG |
| 364 | |
| 365 | #define IPC_BEGIN_MESSAGES(label, start) \ |
| 366 | void label##MsgLog(uint16 type, std::wstring* name, const IPC::Message* msg, std::wstring* params) { \ |
| 367 | switch (type) { |
| 368 | |
| 369 | #define IPC_END_MESSAGES(label) \ |
| 370 | default: \ |
| 371 | if (name) \ |
| 372 | *name = L"[UNKNOWN " L ## #label L" MSG"; \ |
| 373 | } \ |
| 374 | } |
| 375 | |
| 376 | #define IPC_MESSAGE_LOG(msg_class) \ |
| 377 | case msg_class##__ID: \ |
| 378 | if (name) \ |
| 379 | *name = L ## #msg_class; \ |
| 380 | if (msg && params) \ |
| 381 | msg_class::Log(msg, params); \ |
| 382 | break; |
| 383 | |
| 384 | #define IPC_MESSAGE_CONTROL0(msg_class) \ |
| 385 | IPC_MESSAGE_LOG(msg_class) |
| 386 | |
| 387 | #define IPC_MESSAGE_CONTROL1(msg_class, type1) \ |
| 388 | IPC_MESSAGE_LOG(msg_class) |
| 389 | |
| 390 | #define IPC_MESSAGE_CONTROL2(msg_class, type1, type2) \ |
| 391 | IPC_MESSAGE_LOG(msg_class) |
| 392 | |
| 393 | #define IPC_MESSAGE_CONTROL3(msg_class, type1, type2, type3) \ |
| 394 | IPC_MESSAGE_LOG(msg_class) |
| 395 | |
| 396 | #define IPC_MESSAGE_CONTROL4(msg_class, type1, type2, type3, type4) \ |
| 397 | IPC_MESSAGE_LOG(msg_class) |
| 398 | |
| 399 | #define IPC_MESSAGE_CONTROL5(msg_class, type1, type2, type3, type4, type5) \ |
| 400 | IPC_MESSAGE_LOG(msg_class) |
| 401 | |
| 402 | #define IPC_MESSAGE_ROUTED0(msg_class) \ |
| 403 | IPC_MESSAGE_LOG(msg_class) |
| 404 | |
| 405 | #define IPC_MESSAGE_ROUTED1(msg_class, type1) \ |
| 406 | IPC_MESSAGE_LOG(msg_class) |
| 407 | |
| 408 | #define IPC_MESSAGE_ROUTED2(msg_class, type1, type2) \ |
| 409 | IPC_MESSAGE_LOG(msg_class) |
| 410 | |
| 411 | #define IPC_MESSAGE_ROUTED3(msg_class, type1, type2, type3) \ |
| 412 | IPC_MESSAGE_LOG(msg_class) |
| 413 | |
| 414 | #define IPC_MESSAGE_ROUTED4(msg_class, type1, type2, type3, type4) \ |
| 415 | IPC_MESSAGE_LOG(msg_class) |
| 416 | |
| 417 | #define IPC_MESSAGE_ROUTED5(msg_class, type1, type2, type3, type4, type5) \ |
| 418 | IPC_MESSAGE_LOG(msg_class) |
| 419 | |
| 420 | #define IPC_MESSAGE_EMPTY(msg_class) \ |
| 421 | IPC_MESSAGE_LOG(msg_class) |
| 422 | |
| 423 | #define IPC_SYNC_MESSAGE_CONTROL0_0(msg_class) \ |
| 424 | IPC_MESSAGE_LOG(msg_class) |
| 425 | |
| 426 | #define IPC_SYNC_MESSAGE_CONTROL0_1(msg_class, type1_out) \ |
| 427 | IPC_MESSAGE_LOG(msg_class) |
| 428 | |
| 429 | #define IPC_SYNC_MESSAGE_CONTROL0_2(msg_class, type1_out, type2_out) \ |
| 430 | IPC_MESSAGE_LOG(msg_class) |
| 431 | |
| 432 | #define IPC_SYNC_MESSAGE_CONTROL0_3(msg_class, type1_out, type2_out, type3_out) \ |
| 433 | IPC_MESSAGE_LOG(msg_class) |
| 434 | |
| 435 | #define IPC_SYNC_MESSAGE_CONTROL1_0(msg_class, type1_in) \ |
| 436 | IPC_MESSAGE_LOG(msg_class) |
| 437 | |
| 438 | #define IPC_SYNC_MESSAGE_CONTROL1_1(msg_class, type1_in, type1_out) \ |
| 439 | IPC_MESSAGE_LOG(msg_class) |
| 440 | |
| 441 | #define IPC_SYNC_MESSAGE_CONTROL1_2(msg_class, type1_in, type1_out, type2_out) \ |
| 442 | IPC_MESSAGE_LOG(msg_class) |
| 443 | |
| 444 | #define IPC_SYNC_MESSAGE_CONTROL1_3(msg_class, type1_in, type1_out, type2_out, type3_out) \ |
| 445 | IPC_MESSAGE_LOG(msg_class) |
| 446 | |
| 447 | #define IPC_SYNC_MESSAGE_CONTROL2_0(msg_class, type1_in, type2_in) \ |
| 448 | IPC_MESSAGE_LOG(msg_class) |
| 449 | |
| 450 | #define IPC_SYNC_MESSAGE_CONTROL2_1(msg_class, type1_in, type2_in, type1_out) \ |
| 451 | IPC_MESSAGE_LOG(msg_class) |
| 452 | |
| 453 | #define IPC_SYNC_MESSAGE_CONTROL2_2(msg_class, type1_in, type2_in, type1_out, type2_out) \ |
| 454 | IPC_MESSAGE_LOG(msg_class) |
| 455 | |
| 456 | #define IPC_SYNC_MESSAGE_CONTROL2_3(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) \ |
| 457 | IPC_MESSAGE_LOG(msg_class) |
| 458 | |
| 459 | #define IPC_SYNC_MESSAGE_CONTROL3_1(msg_class, type1_in, type2_in, type3_in, type1_out) \ |
| 460 | IPC_MESSAGE_LOG(msg_class) |
| 461 | |
| 462 | #define IPC_SYNC_MESSAGE_CONTROL3_2(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) \ |
| 463 | IPC_MESSAGE_LOG(msg_class) |
| 464 | |
| 465 | #define IPC_SYNC_MESSAGE_CONTROL3_3(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) \ |
| 466 | IPC_MESSAGE_LOG(msg_class) |
| 467 | |
| 468 | #define IPC_SYNC_MESSAGE_CONTROL4_1(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) \ |
| 469 | IPC_MESSAGE_LOG(msg_class) |
| 470 | |
| 471 | #define IPC_SYNC_MESSAGE_CONTROL4_2(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) \ |
| 472 | IPC_MESSAGE_LOG(msg_class) |
| 473 | |
| 474 | #define IPC_SYNC_MESSAGE_ROUTED0_0(msg_class) \ |
| 475 | IPC_MESSAGE_LOG(msg_class) |
| 476 | |
| 477 | #define IPC_SYNC_MESSAGE_ROUTED0_1(msg_class, type1_out) \ |
| 478 | IPC_MESSAGE_LOG(msg_class) |
| 479 | |
| 480 | #define IPC_SYNC_MESSAGE_ROUTED0_2(msg_class, type1_out, type2_out) \ |
| 481 | IPC_MESSAGE_LOG(msg_class) |
| 482 | |
| 483 | #define IPC_SYNC_MESSAGE_ROUTED0_3(msg_class, type1_out, type2_out, type3_out) \ |
| 484 | IPC_MESSAGE_LOG(msg_class) |
| 485 | |
| 486 | #define IPC_SYNC_MESSAGE_ROUTED1_0(msg_class, type1_in) \ |
| 487 | IPC_MESSAGE_LOG(msg_class) |
| 488 | |
| 489 | #define IPC_SYNC_MESSAGE_ROUTED1_1(msg_class, type1_in, type1_out) \ |
| 490 | IPC_MESSAGE_LOG(msg_class) |
| 491 | |
| 492 | #define IPC_SYNC_MESSAGE_ROUTED1_2(msg_class, type1_in, type1_out, type2_out) \ |
| 493 | IPC_MESSAGE_LOG(msg_class) |
| 494 | |
| 495 | #define IPC_SYNC_MESSAGE_ROUTED1_3(msg_class, type1_in, type1_out, type2_out, type3_out) \ |
| 496 | IPC_MESSAGE_LOG(msg_class) |
| 497 | |
| 498 | #define IPC_SYNC_MESSAGE_ROUTED2_0(msg_class, type1_in, type2_in) \ |
| 499 | IPC_MESSAGE_LOG(msg_class) |
| 500 | |
| 501 | #define IPC_SYNC_MESSAGE_ROUTED2_1(msg_class, type1_in, type2_in, type1_out) \ |
| 502 | IPC_MESSAGE_LOG(msg_class) |
| 503 | |
| 504 | #define IPC_SYNC_MESSAGE_ROUTED2_2(msg_class, type1_in, type2_in, type1_out, type2_out) \ |
| 505 | IPC_MESSAGE_LOG(msg_class) |
| 506 | |
| 507 | #define IPC_SYNC_MESSAGE_ROUTED2_3(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) \ |
| 508 | IPC_MESSAGE_LOG(msg_class) |
| 509 | |
| 510 | #define IPC_SYNC_MESSAGE_ROUTED3_0(msg_class, type1_in, type2_in, type3_in) \ |
| 511 | IPC_MESSAGE_LOG(msg_class) |
| 512 | |
| 513 | #define IPC_SYNC_MESSAGE_ROUTED3_1(msg_class, type1_in, type2_in, type3_in, type1_out) \ |
| 514 | IPC_MESSAGE_LOG(msg_class) |
| 515 | |
| 516 | #define IPC_SYNC_MESSAGE_ROUTED3_2(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) \ |
| 517 | IPC_MESSAGE_LOG(msg_class) |
| 518 | |
| 519 | #define IPC_SYNC_MESSAGE_ROUTED3_3(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) \ |
| 520 | IPC_MESSAGE_LOG(msg_class) |
| 521 | |
| 522 | #define IPC_SYNC_MESSAGE_ROUTED4_0(msg_class, type1_in, type2_in, type3_in, type4_in) \ |
| 523 | IPC_MESSAGE_LOG(msg_class) |
| 524 | |
| 525 | #define IPC_SYNC_MESSAGE_ROUTED4_1(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) \ |
| 526 | IPC_MESSAGE_LOG(msg_class) |
| 527 | |
| 528 | #elif defined(IPC_MESSAGE_MACROS_CLASSES) |
| 529 | #undef IPC_MESSAGE_MACROS_CLASSES |
| 530 | |
| 531 | #define IPC_BEGIN_MESSAGES(label, start) |
| 532 | #define IPC_END_MESSAGES(label) |
| 533 | |
| 534 | #define IPC_MESSAGE_CONTROL0(msg_class) \ |
| 535 | class msg_class : public IPC::Message { \ |
| 536 | public: \ |
| 537 | enum { ID = msg_class##__ID }; \ |
| 538 | msg_class() \ |
| 539 | : IPC::Message(MSG_ROUTING_CONTROL, \ |
| 540 | ID, \ |
| 541 | PRIORITY_NORMAL) {} \ |
| 542 | }; |
| 543 | |
| 544 | #define IPC_MESSAGE_CONTROL1(msg_class, type1) \ |
| 545 | class msg_class : public IPC::MessageWithTuple<type1> { \ |
| 546 | public: \ |
| 547 | enum { ID = msg_class##__ID }; \ |
| 548 | msg_class(const type1& arg1) \ |
| 549 | : IPC::MessageWithTuple<type1>(MSG_ROUTING_CONTROL, \ |
| 550 | ID, \ |
| 551 | arg1) {} \ |
| 552 | }; |
| 553 | |
| 554 | #define IPC_MESSAGE_CONTROL2(msg_class, type1, type2) \ |
| 555 | class msg_class : public IPC::MessageWithTuple< Tuple2<type1, type2> > { \ |
| 556 | public: \ |
| 557 | enum { ID = msg_class##__ID }; \ |
| 558 | msg_class(const type1& arg1, const type2& arg2) \ |
| 559 | : IPC::MessageWithTuple< Tuple2<type1, type2> >( \ |
| 560 | MSG_ROUTING_CONTROL, \ |
| 561 | ID, \ |
| 562 | MakeTuple(arg1, arg2)) {} \ |
| 563 | }; |
| 564 | |
| 565 | #define IPC_MESSAGE_CONTROL3(msg_class, type1, type2, type3) \ |
| 566 | class msg_class : \ |
| 567 | public IPC::MessageWithTuple< Tuple3<type1, type2, type3> > { \ |
| 568 | public: \ |
| 569 | enum { ID = msg_class##__ID }; \ |
| 570 | msg_class(const type1& arg1, const type2& arg2, const type3& arg3) \ |
| 571 | : IPC::MessageWithTuple< Tuple3<type1, type2, type3> >( \ |
| 572 | MSG_ROUTING_CONTROL, \ |
| 573 | ID, \ |
| 574 | MakeTuple(arg1, arg2, arg3)) {} \ |
| 575 | }; |
| 576 | |
| 577 | #define IPC_MESSAGE_CONTROL4(msg_class, type1, type2, type3, type4) \ |
| 578 | class msg_class : \ |
| 579 | public IPC::MessageWithTuple< Tuple4<type1, type2, type3, type4> > { \ |
| 580 | public: \ |
| 581 | enum { ID = msg_class##__ID }; \ |
| 582 | msg_class(const type1& arg1, const type2& arg2, const type3& arg3, \ |
| 583 | const type4& arg4) \ |
| 584 | : IPC::MessageWithTuple< Tuple4<type1, type2, type3, type4> >( \ |
| 585 | MSG_ROUTING_CONTROL, \ |
| 586 | ID, \ |
| 587 | MakeTuple(arg1, arg2, arg3, arg4)) {} \ |
| 588 | }; |
| 589 | |
| 590 | #define IPC_MESSAGE_CONTROL5(msg_class, type1, type2, type3, type4, type5) \ |
| 591 | class msg_class : \ |
| 592 | public IPC::MessageWithTuple< Tuple5<type1, type2, type3, type4, type5> > { \ |
| 593 | public: \ |
| 594 | enum { ID = msg_class##__ID }; \ |
| 595 | msg_class(const type1& arg1, const type2& arg2, \ |
| 596 | const type3& arg3, const type4& arg4, const type5& arg5) \ |
| 597 | : IPC::MessageWithTuple< Tuple5<type1, type2, type3, type4, type5> >( \ |
| 598 | MSG_ROUTING_CONTROL, \ |
| 599 | ID, \ |
| 600 | MakeTuple(arg1, arg2, arg3, arg4, arg5)) {} \ |
| 601 | }; |
| 602 | |
| 603 | #define IPC_MESSAGE_ROUTED0(msg_class) \ |
| 604 | class msg_class : public IPC::Message { \ |
| 605 | public: \ |
| 606 | enum { ID = msg_class##__ID }; \ |
| 607 | msg_class(int32 routing_id) \ |
| 608 | : IPC::Message(routing_id, ID, PRIORITY_NORMAL) {} \ |
| 609 | }; |
| 610 | |
| 611 | #define IPC_MESSAGE_ROUTED1(msg_class, type1) \ |
| 612 | class msg_class : public IPC::MessageWithTuple<type1> { \ |
| 613 | public: \ |
| 614 | enum { ID = msg_class##__ID }; \ |
| 615 | msg_class(int32 routing_id, const type1& arg1) \ |
| 616 | : IPC::MessageWithTuple<type1>(routing_id, ID, arg1) {} \ |
| 617 | }; |
| 618 | |
| 619 | #define IPC_MESSAGE_ROUTED2(msg_class, type1, type2) \ |
| 620 | class msg_class : public IPC::MessageWithTuple< Tuple2<type1, type2> > { \ |
| 621 | public: \ |
| 622 | enum { ID = msg_class##__ID }; \ |
| 623 | msg_class(int32 routing_id, const type1& arg1, const type2& arg2) \ |
| 624 | : IPC::MessageWithTuple< Tuple2<type1, type2> >( \ |
| 625 | routing_id, ID, MakeTuple(arg1, arg2)) {} \ |
| 626 | }; |
| 627 | |
| 628 | #define IPC_MESSAGE_ROUTED3(msg_class, type1, type2, type3) \ |
| 629 | class msg_class : \ |
| 630 | public IPC::MessageWithTuple< Tuple3<type1, type2, type3> > { \ |
| 631 | public: \ |
| 632 | enum { ID = msg_class##__ID }; \ |
| 633 | msg_class(int32 routing_id, const type1& arg1, const type2& arg2, \ |
| 634 | const type3& arg3) \ |
| 635 | : IPC::MessageWithTuple< Tuple3<type1, type2, type3> >( \ |
| 636 | routing_id, ID, MakeTuple(arg1, arg2, arg3)) {} \ |
| 637 | }; |
| 638 | |
| 639 | #define IPC_MESSAGE_ROUTED4(msg_class, type1, type2, type3, type4) \ |
| 640 | class msg_class : \ |
| 641 | public IPC::MessageWithTuple< Tuple4<type1, type2, type3, type4> > { \ |
| 642 | public: \ |
| 643 | enum { ID = msg_class##__ID }; \ |
| 644 | msg_class(int32 routing_id, const type1& arg1, const type2& arg2, \ |
| 645 | const type3& arg3, const type4& arg4) \ |
| 646 | : IPC::MessageWithTuple< Tuple4<type1, type2, type3, type4> >( \ |
| 647 | routing_id, ID, MakeTuple(arg1, arg2, arg3, arg4)) {} \ |
| 648 | }; |
| 649 | |
| 650 | #define IPC_MESSAGE_ROUTED5(msg_class, type1, type2, type3, type4, type5) \ |
| 651 | class msg_class : \ |
| 652 | public IPC::MessageWithTuple< Tuple5<type1, type2, type3, type4, type5> > { \ |
| 653 | public: \ |
| 654 | enum { ID = msg_class##__ID }; \ |
| 655 | msg_class(int32 routing_id, const type1& arg1, const type2& arg2, \ |
| 656 | const type3& arg3, const type4& arg4, const type5& arg5) \ |
| 657 | : IPC::MessageWithTuple< Tuple5<type1, type2, type3, type4, type5> >( \ |
| 658 | routing_id, ID, MakeTuple(arg1, arg2, arg3, arg4, arg5)) {} \ |
| 659 | }; |
| 660 | |
| 661 | // Dummy class for now, just to give us the ID field. |
| 662 | #define IPC_MESSAGE_EMPTY(msg_class) \ |
| 663 | class msg_class { \ |
| 664 | public: \ |
| 665 | enum { ID = msg_class##__ID }; \ |
| 666 | static void Log(const IPC::Message* msg, std::wstring* l) {} \ |
| 667 | }; |
| 668 | |
| 669 | #define IPC_SYNC_MESSAGE_CONTROL0_0(msg_class) \ |
| 670 | class msg_class : public IPC::MessageWithReply<Tuple0, Tuple0 > { \ |
| 671 | public: \ |
| 672 | enum { ID = msg_class##__ID }; \ |
| 673 | msg_class() \ |
| 674 | : IPC::MessageWithReply<Tuple0, Tuple0 >( \ |
| 675 | MSG_ROUTING_CONTROL, ID, \ |
| 676 | MakeTuple(), MakeTuple()) {} \ |
| 677 | }; |
| 678 | |
| 679 | #define IPC_SYNC_MESSAGE_CONTROL0_1(msg_class, type1_out) \ |
| 680 | class msg_class : public IPC::MessageWithReply<Tuple0, Tuple1<type1_out&> > { \ |
| 681 | public: \ |
| 682 | enum { ID = msg_class##__ID }; \ |
| 683 | msg_class(type1_out* arg1) \ |
| 684 | : IPC::MessageWithReply<Tuple0, Tuple1<type1_out&> >( \ |
| 685 | MSG_ROUTING_CONTROL, \ |
| 686 | ID, \ |
| 687 | MakeTuple(), MakeRefTuple(*arg1)) {} \ |
| 688 | }; |
| 689 | |
| 690 | #define IPC_SYNC_MESSAGE_CONTROL0_2(msg_class, type1_out, type2_out) \ |
| 691 | class msg_class : \ |
| 692 | public IPC::MessageWithReply<Tuple0, Tuple2<type1_out&, type2_out&> > { \ |
| 693 | public: \ |
| 694 | enum { ID = msg_class##__ID }; \ |
| 695 | msg_class(type1_out* arg1, type2_out* arg2) \ |
| 696 | : IPC::MessageWithReply<Tuple0, Tuple2<type1_out&, type2_out&> >( \ |
| 697 | MSG_ROUTING_CONTROL, \ |
| 698 | ID, \ |
| 699 | MakeTuple(), MakeRefTuple(*arg1, *arg2)) {} \ |
| 700 | }; |
| 701 | |
| 702 | #define IPC_SYNC_MESSAGE_CONTROL0_3(msg_class, type1_out, type2_out, type3_out) \ |
| 703 | class msg_class : \ |
| 704 | public IPC::MessageWithReply<Tuple0, \ |
| 705 | Tuple3<type1_out&, type2_out&, type3_out&> >{ \ |
| 706 | public: \ |
| 707 | enum { ID = msg_class##__ID }; \ |
| 708 | msg_class(type1_out* arg1, type2_out* arg2, type3_out* arg3) \ |
| 709 | : IPC::MessageWithReply<Tuple0, \ |
| 710 | Tuple3<type1_out&, type2_out&, type3_out&> >(MSG_ROUTING_CONTROL, \ |
| 711 | ID, \ |
| 712 | MakeTuple(), MakeRefTuple(*arg1, *arg2, *arg3)) {} \ |
| 713 | }; |
| 714 | |
| 715 | #define IPC_SYNC_MESSAGE_CONTROL1_0(msg_class, type1_in) \ |
| 716 | class msg_class : \ |
| 717 | public IPC::MessageWithReply<type1_in, Tuple0 > { \ |
| 718 | public: \ |
| 719 | enum { ID = msg_class##__ID }; \ |
| 720 | msg_class(const type1_in& arg1) \ |
| 721 | : IPC::MessageWithReply<type1_in, Tuple0 >( \ |
| 722 | MSG_ROUTING_CONTROL, ID, \ |
| 723 | arg1, MakeTuple()) {} \ |
| 724 | }; |
| 725 | |
| 726 | #define IPC_SYNC_MESSAGE_CONTROL1_1(msg_class, type1_in, type1_out) \ |
| 727 | class msg_class : \ |
| 728 | public IPC::MessageWithReply<type1_in, Tuple1<type1_out&> > { \ |
| 729 | public: \ |
| 730 | enum { ID = msg_class##__ID }; \ |
| 731 | msg_class(const type1_in& arg1, type1_out* arg2) \ |
| 732 | : IPC::MessageWithReply<type1_in, Tuple1<type1_out&> >( \ |
| 733 | MSG_ROUTING_CONTROL, ID, \ |
| 734 | arg1, MakeRefTuple(*arg2)) {} \ |
| 735 | }; |
| 736 | |
| 737 | #define IPC_SYNC_MESSAGE_CONTROL1_2(msg_class, type1_in, type1_out, type2_out) \ |
| 738 | class msg_class : \ |
| 739 | public IPC::MessageWithReply<type1_in, Tuple2<type1_out&, type2_out&> > { \ |
| 740 | public: \ |
| 741 | enum { ID = msg_class##__ID }; \ |
| 742 | msg_class(const type1_in& arg1, type1_out* arg2, type2_out* arg3) \ |
| 743 | : IPC::MessageWithReply<type1_in, Tuple2<type1_out&, type2_out&> >( \ |
| 744 | MSG_ROUTING_CONTROL, ID, \ |
| 745 | arg1, MakeRefTuple(*arg2, *arg3)) {} \ |
| 746 | }; |
| 747 | |
| 748 | #define IPC_SYNC_MESSAGE_CONTROL1_3(msg_class, type1_in, type1_out, type2_out, type3_out) \ |
| 749 | class msg_class : \ |
| 750 | public IPC::MessageWithReply<type1_in, \ |
| 751 | Tuple3<type1_out&, type2_out&, type3_out&> >{ \ |
| 752 | public: \ |
| 753 | enum { ID = msg_class##__ID }; \ |
| 754 | msg_class(const type1_in& arg1, type1_out* arg2, type2_out* arg3, type3_out* arg4) \ |
| 755 | : IPC::MessageWithReply<type1_in, \ |
| 756 | Tuple3<type1_out&, type2_out&, type3_out&> >(MSG_ROUTING_CONTROL, \ |
| 757 | ID, \ |
| 758 | arg1, MakeRefTuple(*arg2, *arg3, *arg4)) {} \ |
| 759 | }; |
| 760 | |
| 761 | #define IPC_SYNC_MESSAGE_CONTROL2_0(msg_class, type1_in, type2_in) \ |
| 762 | class msg_class : \ |
| 763 | public IPC::MessageWithReply<Tuple2<type1_in, type2_in>, Tuple0 > { \ |
| 764 | public: \ |
| 765 | enum { ID = msg_class##__ID }; \ |
| 766 | msg_class(const type1_in& arg1, const type2_in& arg2) \ |
| 767 | : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, Tuple0 >( \ |
| 768 | MSG_ROUTING_CONTROL, ID, \ |
| 769 | MakeTuple(arg1, arg2), MakeTuple()) {} \ |
| 770 | }; |
| 771 | |
| 772 | #define IPC_SYNC_MESSAGE_CONTROL2_1(msg_class, type1_in, type2_in, type1_out) \ |
| 773 | class msg_class : \ |
| 774 | public IPC::MessageWithReply<Tuple2<type1_in, type2_in>, Tuple1<type1_out&> > { \ |
| 775 | public: \ |
| 776 | enum { ID = msg_class##__ID }; \ |
| 777 | msg_class(const type1_in& arg1, const type2_in& arg2, type1_out* arg3) \ |
| 778 | : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, Tuple1<type1_out&> >( \ |
| 779 | MSG_ROUTING_CONTROL, ID, \ |
| 780 | MakeTuple(arg1, arg2), MakeRefTuple(*arg3)) {} \ |
| 781 | }; |
| 782 | |
| 783 | #define IPC_SYNC_MESSAGE_CONTROL2_2(msg_class, type1_in, type2_in, type1_out, type2_out) \ |
| 784 | class msg_class : \ |
| 785 | public IPC::MessageWithReply<Tuple2<type1_in, type2_in>, \ |
| 786 | Tuple2<type1_out&, type2_out&> > { \ |
| 787 | public: \ |
| 788 | enum { ID = msg_class##__ID }; \ |
| 789 | msg_class(const type1_in& arg1, const type2_in& arg2, type1_out* arg3, type2_out* arg4) \ |
| 790 | : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, \ |
| 791 | Tuple2<type1_out&, type2_out&> >(MSG_ROUTING_CONTROL, ID, \ |
| 792 | MakeTuple(arg1, arg2), MakeRefTuple(*arg3, *arg4)) {} \ |
| 793 | }; |
| 794 | |
| 795 | #define IPC_SYNC_MESSAGE_CONTROL2_3(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) \ |
| 796 | class msg_class : \ |
| 797 | public IPC::MessageWithReply<Tuple2<type1_in, type2_in>, \ |
| 798 | Tuple3<type1_out&, type2_out&, type3_out&> > { \ |
| 799 | public: \ |
| 800 | enum { ID = msg_class##__ID }; \ |
| 801 | msg_class(const type1_in& arg1, const type2_in& arg2, type1_out* arg3, type2_out* arg4, type3_out* arg5) \ |
| 802 | : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, \ |
| 803 | Tuple3<type1_out&, type2_out&, type3_out&> >(MSG_ROUTING_CONTROL, \ |
| 804 | ID, \ |
| 805 | MakeTuple(arg1, arg2), MakeRefTuple(*arg3, *arg4, *arg5)) {} \ |
| 806 | }; |
| 807 | |
| 808 | #define IPC_SYNC_MESSAGE_CONTROL3_1(msg_class, type1_in, type2_in, type3_in, type1_out) \ |
| 809 | class msg_class : \ |
| 810 | public IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ |
| 811 | Tuple1<type1_out&> > { \ |
| 812 | public: \ |
| 813 | enum { ID = msg_class##__ID }; \ |
| 814 | msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, type1_out* arg4) \ |
| 815 | : IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ |
| 816 | Tuple1<type1_out&> >(MSG_ROUTING_CONTROL, ID, \ |
| 817 | MakeTuple(arg1, arg2, arg3), MakeRefTuple(*arg4)) {} \ |
| 818 | }; |
| 819 | |
| 820 | #define IPC_SYNC_MESSAGE_CONTROL3_2(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) \ |
| 821 | class msg_class : \ |
| 822 | public IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ |
| 823 | Tuple2<type1_out&, type2_out&> > { \ |
| 824 | public: \ |
| 825 | enum { ID = msg_class##__ID }; \ |
| 826 | msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, type1_out* arg4, type2_out* arg5) \ |
| 827 | : IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ |
| 828 | Tuple2<type1_out&, type2_out&> >(MSG_ROUTING_CONTROL, ID, \ |
| 829 | MakeTuple(arg1, arg2, arg3), MakeRefTuple(*arg4, *arg5)) {} \ |
| 830 | }; |
| 831 | |
| 832 | #define IPC_SYNC_MESSAGE_CONTROL3_3(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) \ |
| 833 | class msg_class : \ |
| 834 | public IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ |
| 835 | Tuple3<type1_out&, type2_out&, type3_out&> > { \ |
| 836 | public: \ |
| 837 | enum { ID = msg_class##__ID }; \ |
| 838 | msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, type1_out* arg4, type2_out* arg5, type3_out* arg6) \ |
| 839 | : IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ |
| 840 | Tuple3<type1_out&, type2_out&, type3_out&> >(MSG_ROUTING_CONTROL, \ |
| 841 | ID, \ |
| 842 | MakeTuple(arg1, arg2, arg3), MakeRefTuple(*arg4, *arg5, *arg6)) {} \ |
| 843 | }; |
| 844 | |
| 845 | #define IPC_SYNC_MESSAGE_CONTROL4_1(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) \ |
| 846 | class msg_class : \ |
| 847 | public IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ |
| 848 | Tuple1<type1_out&> > { \ |
| 849 | public: \ |
| 850 | enum { ID = msg_class##__ID }; \ |
| 851 | msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, type1_out* arg6) \ |
| 852 | : IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ |
| 853 | Tuple1<type1_out&> >(MSG_ROUTING_CONTROL, ID, \ |
| 854 | MakeTuple(arg1, arg2, arg3, arg4), MakeRefTuple(*arg6)) {} \ |
| 855 | }; |
| 856 | |
| 857 | #define IPC_SYNC_MESSAGE_CONTROL4_2(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) \ |
| 858 | class msg_class : \ |
| 859 | public IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ |
| 860 | Tuple2<type1_out&, type2_out&> > { \ |
| 861 | public: \ |
| 862 | enum { ID = msg_class##__ID }; \ |
| 863 | msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, type1_out* arg5, type2_out* arg6) \ |
| 864 | : IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ |
| 865 | Tuple2<type1_out&, type2_out&> >(MSG_ROUTING_CONTROL, ID, \ |
| 866 | MakeTuple(arg1, arg2, arg3, arg4), MakeRefTuple(*arg5, *arg6)) {} \ |
| 867 | }; |
| 868 | |
| 869 | #define IPC_SYNC_MESSAGE_ROUTED0_1(msg_class, type1_out) \ |
| 870 | class msg_class : public IPC::MessageWithReply<Tuple0, Tuple1<type1_out&> > { \ |
| 871 | public: \ |
| 872 | enum { ID = msg_class##__ID }; \ |
| 873 | msg_class(int routing_id, type1_out* arg1) \ |
| 874 | : IPC::MessageWithReply<Tuple0, Tuple1<type1_out&> >( \ |
| 875 | routing_id, ID, \ |
| 876 | MakeTuple(), MakeRefTuple(*arg1)) {} \ |
| 877 | }; |
| 878 | |
| 879 | #define IPC_SYNC_MESSAGE_ROUTED0_0(msg_class) \ |
| 880 | class msg_class : public IPC::MessageWithReply<Tuple0, Tuple0 > { \ |
| 881 | public: \ |
| 882 | enum { ID = msg_class##__ID }; \ |
| 883 | msg_class(int routing_id) \ |
| 884 | : IPC::MessageWithReply<Tuple0, Tuple0 >( \ |
| 885 | routing_id, ID, \ |
| 886 | MakeTuple(), MakeTuple()) {} \ |
| 887 | }; |
| 888 | |
| 889 | #define IPC_SYNC_MESSAGE_ROUTED0_2(msg_class, type1_out, type2_out) \ |
| 890 | class msg_class : \ |
| 891 | public IPC::MessageWithReply<Tuple0, Tuple2<type1_out&, type2_out&> > { \ |
| 892 | public: \ |
| 893 | enum { ID = msg_class##__ID }; \ |
| 894 | msg_class(int routing_id, type1_out* arg1, type2_out* arg2) \ |
| 895 | : IPC::MessageWithReply<Tuple0, Tuple2<type1_out&, type2_out&> >( \ |
| 896 | routing_id, ID, \ |
| 897 | MakeTuple(), MakeRefTuple(*arg1, *arg2)) {} \ |
| 898 | }; |
| 899 | |
| 900 | #define IPC_SYNC_MESSAGE_ROUTED0_3(msg_class, type1_out, type2_out, type3_out) \ |
| 901 | class msg_class : \ |
| 902 | public IPC::MessageWithReply<Tuple0, \ |
| 903 | Tuple3<type1_out&, type2_out&, type3_out&> >{ \ |
| 904 | public: \ |
| 905 | enum { ID = msg_class##__ID }; \ |
| 906 | msg_class(int routing_id, type1_out* arg1, type2_out* arg2, type3_out* arg3) \ |
| 907 | : IPC::MessageWithReply<Tuple0, \ |
| 908 | Tuple3<type1_out&, type2_out&, type3_out&> >(routing_id, ID, \ |
| 909 | MakeTuple(), MakeRefTuple(*arg1, *arg2, *arg3)) {} \ |
| 910 | }; |
| 911 | |
| 912 | #define IPC_SYNC_MESSAGE_ROUTED1_0(msg_class, type1_in) \ |
| 913 | class msg_class : \ |
| 914 | public IPC::MessageWithReply<type1_in, Tuple0 > { \ |
| 915 | public: \ |
| 916 | enum { ID = msg_class##__ID }; \ |
| 917 | msg_class(int routing_id, const type1_in& arg1) \ |
| 918 | : IPC::MessageWithReply<type1_in, Tuple0 >( \ |
| 919 | routing_id, ID, \ |
| 920 | arg1, MakeTuple()) {} \ |
| 921 | }; |
| 922 | |
| 923 | #define IPC_SYNC_MESSAGE_ROUTED1_1(msg_class, type1_in, type1_out) \ |
| 924 | class msg_class : \ |
| 925 | public IPC::MessageWithReply<type1_in, Tuple1<type1_out&> > { \ |
| 926 | public: \ |
| 927 | enum { ID = msg_class##__ID }; \ |
| 928 | msg_class(int routing_id, const type1_in& arg1, type1_out* arg2) \ |
| 929 | : IPC::MessageWithReply<type1_in, Tuple1<type1_out&> >( \ |
| 930 | routing_id, ID, \ |
| 931 | arg1, MakeRefTuple(*arg2)) {} \ |
| 932 | }; |
| 933 | |
| 934 | #define IPC_SYNC_MESSAGE_ROUTED1_2(msg_class, type1_in, type1_out, type2_out) \ |
| 935 | class msg_class : \ |
| 936 | public IPC::MessageWithReply<type1_in, Tuple2<type1_out&, type2_out&> > { \ |
| 937 | public: \ |
| 938 | enum { ID = msg_class##__ID }; \ |
| 939 | msg_class(int routing_id, const type1_in& arg1, type1_out* arg2, type2_out* arg3) \ |
| 940 | : IPC::MessageWithReply<type1_in, Tuple2<type1_out&, type2_out&> >( \ |
| 941 | routing_id, ID, \ |
| 942 | arg1, MakeRefTuple(*arg2, *arg3)) {} \ |
| 943 | }; |
| 944 | |
| 945 | #define IPC_SYNC_MESSAGE_ROUTED1_3(msg_class, type1_in, type1_out, type2_out, type3_out) \ |
| 946 | class msg_class : \ |
| 947 | public IPC::MessageWithReply<type1_in, \ |
| 948 | Tuple3<type1_out&, type2_out&, type3_out&> >{ \ |
| 949 | public: \ |
| 950 | enum { ID = msg_class##__ID }; \ |
| 951 | msg_class(int routing_id, const type1_in& arg1, type1_out* arg2, type2_out* arg3, type3_out* arg4) \ |
| 952 | : IPC::MessageWithReply<type1_in, \ |
| 953 | Tuple3<type1_out&, type2_out&, type3_out&> >(routing_id, ID, \ |
| 954 | arg1, MakeRefTuple(*arg2, *arg3, *arg4)) {} \ |
| 955 | }; |
| 956 | |
| 957 | #define IPC_SYNC_MESSAGE_ROUTED2_0(msg_class, type1_in, type2_in) \ |
| 958 | class msg_class : \ |
| 959 | public IPC::MessageWithReply<Tuple2<type1_in, type2_in>, Tuple0 > { \ |
| 960 | public: \ |
| 961 | enum { ID = msg_class##__ID }; \ |
| 962 | msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2) \ |
| 963 | : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, Tuple0 >( \ |
| 964 | routing_id, ID, \ |
| 965 | MakeTuple(arg1, arg2), MakeTuple()) {} \ |
| 966 | }; |
| 967 | |
| 968 | #define IPC_SYNC_MESSAGE_ROUTED2_1(msg_class, type1_in, type2_in, type1_out) \ |
| 969 | class msg_class : \ |
| 970 | public IPC::MessageWithReply<Tuple2<type1_in, type2_in>, Tuple1<type1_out&> > { \ |
| 971 | public: \ |
| 972 | enum { ID = msg_class##__ID }; \ |
| 973 | msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, type1_out* arg3) \ |
| 974 | : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, Tuple1<type1_out&> >( \ |
| 975 | routing_id, ID, \ |
| 976 | MakeTuple(arg1, arg2), MakeRefTuple(*arg3)) {} \ |
| 977 | }; |
| 978 | |
| 979 | #define IPC_SYNC_MESSAGE_ROUTED2_2(msg_class, type1_in, type2_in, type1_out, type2_out) \ |
| 980 | class msg_class : \ |
| 981 | public IPC::MessageWithReply<Tuple2<type1_in, type2_in>, \ |
| 982 | Tuple2<type1_out&, type2_out&> > { \ |
| 983 | public: \ |
| 984 | enum { ID = msg_class##__ID }; \ |
| 985 | msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, type1_out* arg3, type2_out* arg4) \ |
| 986 | : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, \ |
| 987 | Tuple2<type1_out&, type2_out&> >(routing_id, ID, \ |
| 988 | MakeTuple(arg1, arg2), MakeRefTuple(*arg3, *arg4)) {} \ |
| 989 | }; |
| 990 | |
| 991 | #define IPC_SYNC_MESSAGE_ROUTED2_3(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) \ |
| 992 | class msg_class : \ |
| 993 | public IPC::MessageWithReply<Tuple2<type1_in, type2_in>, \ |
| 994 | Tuple3<type1_out&, type2_out&, type3_out&> > { \ |
| 995 | public: \ |
| 996 | enum { ID = msg_class##__ID }; \ |
| 997 | msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, type1_out* arg3, type2_out* arg4, type3_out* arg5) \ |
| 998 | : IPC::MessageWithReply<Tuple2<type1_in, type2_in>, \ |
| 999 | Tuple3<type1_out&, type2_out&, type3_out&> >(routing_id, ID, \ |
| 1000 | MakeTuple(arg1, arg2), MakeRefTuple(*arg3, *arg4, *arg5)) {} \ |
| 1001 | }; |
| 1002 | |
| 1003 | #define IPC_SYNC_MESSAGE_ROUTED3_0(msg_class, type1_in, type2_in, type3_in) \ |
| 1004 | class msg_class : \ |
| 1005 | public IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, Tuple0 > { \ |
| 1006 | public: \ |
| 1007 | enum { ID = msg_class##__ID }; \ |
| 1008 | msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3) \ |
| 1009 | : IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, Tuple0>( \ |
| 1010 | routing_id, ID, \ |
| 1011 | MakeTuple(arg1, arg2, arg3), MakeTuple()) {} \ |
| 1012 | }; |
| 1013 | |
| 1014 | #define IPC_SYNC_MESSAGE_ROUTED3_1(msg_class, type1_in, type2_in, type3_in, type1_out) \ |
| 1015 | class msg_class : \ |
| 1016 | public IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ |
| 1017 | Tuple1<type1_out&> > { \ |
| 1018 | public: \ |
| 1019 | enum { ID = msg_class##__ID }; \ |
| 1020 | msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, type1_out* arg4) \ |
| 1021 | : IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ |
| 1022 | Tuple1<type1_out&> >(routing_id, ID, \ |
| 1023 | MakeTuple(arg1, arg2, arg3), MakeRefTuple(*arg4)) {} \ |
| 1024 | }; |
| 1025 | |
| 1026 | #define IPC_SYNC_MESSAGE_ROUTED3_2(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) \ |
| 1027 | class msg_class : \ |
| 1028 | public IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ |
| 1029 | Tuple2<type1_out&, type2_out&> > { \ |
| 1030 | public: \ |
| 1031 | enum { ID = msg_class##__ID }; \ |
| 1032 | msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, type1_out* arg4, type2_out* arg5) \ |
| 1033 | : IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ |
| 1034 | Tuple2<type1_out&, type2_out&> >(routing_id, ID, \ |
| 1035 | MakeTuple(arg1, arg2, arg3), MakeRefTuple(*arg4, *arg5)) {} \ |
| 1036 | }; |
| 1037 | |
| 1038 | #define IPC_SYNC_MESSAGE_ROUTED3_3(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) \ |
| 1039 | class msg_class : \ |
| 1040 | public IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ |
| 1041 | Tuple3<type1_out&, type2_out&, type3_out&> > { \ |
| 1042 | public: \ |
| 1043 | enum { ID = msg_class##__ID }; \ |
| 1044 | msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, type1_out* arg4, type2_out* arg5, type3_out* arg6) \ |
| 1045 | : IPC::MessageWithReply<Tuple3<type1_in, type2_in, type3_in>, \ |
| 1046 | Tuple3<type1_out&, type2_out&, type3_out&> >(routing_id, ID, \ |
| 1047 | MakeTuple(arg1, arg2, arg3), MakeRefTuple(*arg4, *arg5, *arg6)) {} \ |
| 1048 | }; |
| 1049 | |
| 1050 | #define IPC_SYNC_MESSAGE_ROUTED4_0(msg_class, type1_in, type2_in, type3_in, type4_in) \ |
| 1051 | class msg_class : \ |
| 1052 | public IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ |
| 1053 | Tuple0 > { \ |
| 1054 | public: \ |
| 1055 | enum { ID = msg_class##__ID }; \ |
| 1056 | msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4) \ |
| 1057 | : IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ |
| 1058 | Tuple0 >(routing_id, ID, \ |
| 1059 | MakeTuple(arg1, arg2, arg3, arg4), MakeTuple()) {} \ |
| 1060 | }; |
| 1061 | |
| 1062 | #define IPC_SYNC_MESSAGE_ROUTED4_1(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) \ |
| 1063 | class msg_class : \ |
| 1064 | public IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ |
| 1065 | Tuple1<type1_out&> > { \ |
| 1066 | public: \ |
| 1067 | enum { ID = msg_class##__ID }; \ |
| 1068 | msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, type1_out* arg6) \ |
| 1069 | : IPC::MessageWithReply<Tuple4<type1_in, type2_in, type3_in, type4_in>, \ |
| 1070 | Tuple1<type1_out&> >(routing_id, ID, \ |
| 1071 | MakeTuple(arg1, arg2, arg3, arg4), MakeRefTuple(*arg6)) {} \ |
| 1072 | }; |
| 1073 | |
| 1074 | #endif // #if defined() |