OLD | NEW |
| (Empty) |
1 // Copyright 2015 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. | |
4 | |
5 #ifndef MOJO_EDK_SYSTEM_TOKEN_SERIALIZER_MESSAGES_WIN_H_ | |
6 #define MOJO_EDK_SYSTEM_TOKEN_SERIALIZER_MESSAGES_WIN_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include "base/compiler_specific.h" | |
11 | |
12 namespace mojo { | |
13 namespace edk { | |
14 | |
15 // This header defines the message format between ChildTokenSerializer and | |
16 // ParentTokenSerializer. | |
17 | |
18 enum MessageId { | |
19 // The reply is two HANDLEs. | |
20 CREATE_PLATFORM_CHANNEL_PAIR = 0, | |
21 // The reply is tokens of the same count of passed in handles. | |
22 HANDLE_TO_TOKEN, | |
23 // The reply is handles of the same count of passed in tokens. | |
24 TOKEN_TO_HANDLE, | |
25 }; | |
26 | |
27 // Definitions of the raw bytes sent between ChildTokenSerializer and | |
28 // ParentTokenSerializer. | |
29 | |
30 struct ALIGNAS(4) TokenSerializerMessage { | |
31 uint32_t size; | |
32 MessageId id; | |
33 // Data, if any, follows. | |
34 union { | |
35 HANDLE handles[1]; // If HANDLE_TO_TOKEN. | |
36 uint64_t tokens[1]; // If TOKEN_TO_HANDLE. | |
37 }; | |
38 }; | |
39 | |
40 const int kTokenSerializerMessageHeaderSize = | |
41 sizeof(uint32_t) + sizeof(MessageId); | |
42 | |
43 } // namespace edk | |
44 } // namespace mojo | |
45 | |
46 #endif // MOJO_EDK_SYSTEM_TOKEN_SERIALIZER_MESSAGES_WIN_H_ | |
OLD | NEW |