OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MOJO_EDK_SYSTEM_PORTS_EVENT_H_ | 5 #ifndef MOJO_EDK_SYSTEM_PORTS_EVENT_H_ |
6 #define MOJO_EDK_SYSTEM_PORTS_EVENT_H_ | 6 #define MOJO_EDK_SYSTEM_PORTS_EVENT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "mojo/edk/system/ports/message.h" | 10 #include "mojo/edk/system/ports/message.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 uint64_t last_sequence_num_to_receive; | 27 uint64_t last_sequence_num_to_receive; |
28 bool peer_closed; | 28 bool peer_closed; |
29 }; | 29 }; |
30 | 30 |
31 enum struct EventType : uint32_t { | 31 enum struct EventType : uint32_t { |
32 kUser, | 32 kUser, |
33 kPortAccepted, | 33 kPortAccepted, |
34 kObserveProxy, | 34 kObserveProxy, |
35 kObserveProxyAck, | 35 kObserveProxyAck, |
36 kObserveClosure, | 36 kObserveClosure, |
| 37 kMergePort, |
37 }; | 38 }; |
38 | 39 |
39 struct EventHeader { | 40 struct EventHeader { |
40 EventType type; | 41 EventType type; |
41 uint32_t padding; | 42 uint32_t padding; |
42 PortName port_name; | 43 PortName port_name; |
43 }; | 44 }; |
44 | 45 |
45 struct UserEventData { | 46 struct UserEventData { |
46 uint64_t sequence_num; | 47 uint64_t sequence_num; |
47 uint32_t num_ports; | 48 uint32_t num_ports; |
48 uint32_t padding; | 49 uint32_t padding; |
49 }; | 50 }; |
50 | 51 |
51 struct ObserveProxyEventData { | 52 struct ObserveProxyEventData { |
52 NodeName proxy_node_name; | 53 NodeName proxy_node_name; |
53 PortName proxy_port_name; | 54 PortName proxy_port_name; |
54 NodeName proxy_to_node_name; | 55 NodeName proxy_to_node_name; |
55 PortName proxy_to_port_name; | 56 PortName proxy_to_port_name; |
56 }; | 57 }; |
57 | 58 |
58 struct ObserveProxyAckEventData { | 59 struct ObserveProxyAckEventData { |
59 uint64_t last_sequence_num; | 60 uint64_t last_sequence_num; |
60 }; | 61 }; |
61 | 62 |
62 struct ObserveClosureEventData { | 63 struct ObserveClosureEventData { |
63 uint64_t last_sequence_num; | 64 uint64_t last_sequence_num; |
64 }; | 65 }; |
65 | 66 |
| 67 struct MergePortEventData { |
| 68 PortName new_port_name; |
| 69 PortDescriptor new_port_descriptor; |
| 70 }; |
| 71 |
66 inline const EventHeader* GetEventHeader(const Message& message) { | 72 inline const EventHeader* GetEventHeader(const Message& message) { |
67 return static_cast<const EventHeader*>(message.header_bytes()); | 73 return static_cast<const EventHeader*>(message.header_bytes()); |
68 } | 74 } |
69 | 75 |
70 inline EventHeader* GetMutableEventHeader(Message* message) { | 76 inline EventHeader* GetMutableEventHeader(Message* message) { |
71 return static_cast<EventHeader*>(message->mutable_header_bytes()); | 77 return static_cast<EventHeader*>(message->mutable_header_bytes()); |
72 } | 78 } |
73 | 79 |
74 template <typename EventData> | 80 template <typename EventData> |
75 inline const EventData* GetEventData(const Message& message) { | 81 inline const EventData* GetEventData(const Message& message) { |
(...skipping 14 matching lines...) Expand all Loading... |
90 | 96 |
91 inline PortDescriptor* GetMutablePortDescriptors(UserEventData* event) { | 97 inline PortDescriptor* GetMutablePortDescriptors(UserEventData* event) { |
92 return reinterpret_cast<PortDescriptor*>(reinterpret_cast<char*>(event + 1)); | 98 return reinterpret_cast<PortDescriptor*>(reinterpret_cast<char*>(event + 1)); |
93 } | 99 } |
94 | 100 |
95 } // namespace ports | 101 } // namespace ports |
96 } // namespace edk | 102 } // namespace edk |
97 } // namespace mojo | 103 } // namespace mojo |
98 | 104 |
99 #endif // MOJO_EDK_SYSTEM_PORTS_EVENT_H_ | 105 #endif // MOJO_EDK_SYSTEM_PORTS_EVENT_H_ |
OLD | NEW |