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