- add sources.
[platform/framework/web/crosswalk.git] / src / remoting / host / chromoting_messages.h
1 // Copyright (c) 2012 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 REMOTING_HOST_CHROMOTING_MESSAGES_H_
6 #define REMOTING_HOST_CHROMOTING_MESSAGES_H_
7
8 #include "ipc/ipc_platform_file.h"
9 #include "net/base/ip_endpoint.h"
10 #include "remoting/host/chromoting_param_traits.h"
11 #include "remoting/host/screen_resolution.h"
12 #include "remoting/protocol/transport.h"
13 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
14 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_shape.h"
15
16 #endif  // REMOTING_HOST_CHROMOTING_MESSAGES_H_
17
18 // Multiply-included message file, no traditional include guard.
19 #include "ipc/ipc_message_macros.h"
20
21 #define IPC_MESSAGE_START ChromotingMsgStart
22
23 //-----------------------------------------------------------------------------
24 // Chromoting messages sent from the daemon.
25
26 // Requests the receiving process to crash producing a crash dump. The daemon
27 // sends this message when a fatal error has been detected indicating that
28 // the receiving process misbehaves. The daemon passes the location of the code
29 // that detected the error.
30 IPC_MESSAGE_CONTROL3(ChromotingDaemonMsg_Crash,
31                      std::string /* function_name */,
32                      std::string /* file_name */,
33                      int /* line_number */)
34
35 //-----------------------------------------------------------------------------
36 // Chromoting messages sent from the daemon to the network process.
37
38 // Delivers the host configuration (and updates) to the network process.
39 IPC_MESSAGE_CONTROL1(ChromotingDaemonNetworkMsg_Configuration, std::string)
40
41 // Notifies the network process that the terminal |terminal_id| has been
42 // disconnected from the desktop session.
43 IPC_MESSAGE_CONTROL1(ChromotingDaemonNetworkMsg_TerminalDisconnected,
44                      int /* terminal_id */)
45
46 // Notifies the network process that |terminal_id| is now attached to
47 // a desktop integration process. |desktop_process| is the handle of the desktop
48 // process. |desktop_pipe| is the client end of the desktop-to-network pipe
49 // opened.
50 //
51 // Windows only: |desktop_pipe| has to be duplicated from the desktop process
52 // by the receiver of the message. |desktop_process| is already duplicated by
53 // the sender.
54 IPC_MESSAGE_CONTROL3(ChromotingDaemonNetworkMsg_DesktopAttached,
55                      int /* terminal_id */,
56                      base::ProcessHandle /* desktop_process */,
57                      IPC::PlatformFileForTransit /* desktop_pipe */)
58
59 //-----------------------------------------------------------------------------
60 // Chromoting messages sent from the network to the daemon process.
61
62 // Connects the terminal |terminal_id| (i.e. a remote client) to a desktop
63 // session.
64 IPC_MESSAGE_CONTROL3(ChromotingNetworkHostMsg_ConnectTerminal,
65                      int /* terminal_id */,
66                      remoting::ScreenResolution /* resolution */,
67                      bool /* virtual_terminal */)
68
69 // Disconnects the terminal |terminal_id| from the desktop session it was
70 // connected to.
71 IPC_MESSAGE_CONTROL1(ChromotingNetworkHostMsg_DisconnectTerminal,
72                      int /* terminal_id */)
73
74 // Changes the screen resolution in the given desktop session.
75 IPC_MESSAGE_CONTROL2(ChromotingNetworkDaemonMsg_SetScreenResolution,
76                      int /* terminal_id */,
77                      remoting::ScreenResolution /* resolution */)
78
79 // Serialized remoting::protocol::TransportRoute structure.
80 IPC_STRUCT_BEGIN(SerializedTransportRoute)
81   IPC_STRUCT_MEMBER(int, type)
82   IPC_STRUCT_MEMBER(net::IPAddressNumber, remote_address)
83   IPC_STRUCT_MEMBER(int, remote_port)
84   IPC_STRUCT_MEMBER(net::IPAddressNumber, local_address)
85   IPC_STRUCT_MEMBER(int, local_port)
86 IPC_STRUCT_END()
87
88 // Hosts status notifications (see HostStatusObserver interface) sent by
89 // IpcHostEventLogger.
90 IPC_MESSAGE_CONTROL1(ChromotingNetworkDaemonMsg_AccessDenied,
91                      std::string /* jid */)
92
93 IPC_MESSAGE_CONTROL1(ChromotingNetworkDaemonMsg_ClientAuthenticated,
94                      std::string /* jid */)
95
96 IPC_MESSAGE_CONTROL1(ChromotingNetworkDaemonMsg_ClientConnected,
97                      std::string /* jid */)
98
99 IPC_MESSAGE_CONTROL1(ChromotingNetworkDaemonMsg_ClientDisconnected,
100                      std::string /* jid */)
101
102 IPC_MESSAGE_CONTROL3(ChromotingNetworkDaemonMsg_ClientRouteChange,
103                      std::string /* jid */,
104                      std::string /* channel_name */,
105                      SerializedTransportRoute /* route */)
106
107 IPC_MESSAGE_CONTROL1(ChromotingNetworkDaemonMsg_HostStarted,
108                      std::string /* xmpp_login */)
109
110 IPC_MESSAGE_CONTROL0(ChromotingNetworkDaemonMsg_HostShutdown)
111
112 //-----------------------------------------------------------------------------
113 // Chromoting messages sent from the desktop to the daemon process.
114
115 // Notifies the daemon that a desktop integration process has been initialized.
116 // |desktop_pipe| specifies the client end of the desktop pipe. It is to be
117 // forwarded to the desktop environment stub.
118 //
119 // Windows only: |desktop_pipe| has to be duplicated from the desktop process by
120 // the receiver of the message.
121 IPC_MESSAGE_CONTROL1(ChromotingDesktopDaemonMsg_DesktopAttached,
122                      IPC::PlatformFileForTransit /* desktop_pipe */)
123
124 // Asks the daemon to inject Secure Attention Sequence (SAS) in the session
125 // where the desktop process is running.
126 IPC_MESSAGE_CONTROL0(ChromotingDesktopDaemonMsg_InjectSas)
127
128 //-----------------------------------------------------------------------------
129 // Chromoting messages sent from the desktop to the network process.
130
131 // Notifies the network process that a shared buffer has been created.
132 IPC_MESSAGE_CONTROL3(ChromotingDesktopNetworkMsg_CreateSharedBuffer,
133                      int /* id */,
134                      IPC::PlatformFileForTransit /* handle */,
135                      uint32 /* size */)
136
137 // Request the network process to stop using a shared buffer.
138 IPC_MESSAGE_CONTROL1(ChromotingDesktopNetworkMsg_ReleaseSharedBuffer,
139                      int /* id */)
140
141 IPC_STRUCT_TRAITS_BEGIN(webrtc::MouseCursorShape)
142   IPC_STRUCT_TRAITS_MEMBER(size)
143   IPC_STRUCT_TRAITS_MEMBER(hotspot)
144   IPC_STRUCT_TRAITS_MEMBER(data)
145 IPC_STRUCT_TRAITS_END()
146
147 // Serialized webrtc::DesktopFrame.
148 IPC_STRUCT_BEGIN(SerializedDesktopFrame)
149   // ID of the shared memory buffer containing the pixels.
150   IPC_STRUCT_MEMBER(int, shared_buffer_id)
151
152   // Width of a single row of pixels in bytes.
153   IPC_STRUCT_MEMBER(int, bytes_per_row)
154
155   // Captured region.
156   IPC_STRUCT_MEMBER(std::vector<webrtc::DesktopRect>, dirty_region)
157
158   // Dimensions of the buffer in pixels.
159   IPC_STRUCT_MEMBER(webrtc::DesktopSize, dimensions)
160
161   // Time spent in capture. Unit is in milliseconds.
162   IPC_STRUCT_MEMBER(int, capture_time_ms)
163
164   // Sequence number supplied by client for performance tracking.
165   IPC_STRUCT_MEMBER(int64, client_sequence_number)
166
167   // DPI for this frame.
168   IPC_STRUCT_MEMBER(webrtc::DesktopVector, dpi)
169 IPC_STRUCT_END()
170
171 // Notifies the network process that a shared buffer has been created.
172 IPC_MESSAGE_CONTROL1(ChromotingDesktopNetworkMsg_CaptureCompleted,
173                      SerializedDesktopFrame /* frame */ )
174
175 // Carries a cursor share update from the desktop session agent to the client.
176 IPC_MESSAGE_CONTROL1(ChromotingDesktopNetworkMsg_CursorShapeChanged,
177                      webrtc::MouseCursorShape /* cursor_shape */ )
178
179 // Carries a clipboard event from the desktop session agent to the client.
180 // |serialized_event| is a serialized protocol::ClipboardEvent.
181 IPC_MESSAGE_CONTROL1(ChromotingDesktopNetworkMsg_InjectClipboardEvent,
182                      std::string /* serialized_event */ )
183
184 // Requests the network process to terminate the client session.
185 IPC_MESSAGE_CONTROL0(ChromotingDesktopNetworkMsg_DisconnectSession)
186
187 // Carries an audio packet from the desktop session agent to the client.
188 // |serialized_packet| is a serialized AudioPacket.
189 IPC_MESSAGE_CONTROL1(ChromotingDesktopNetworkMsg_AudioPacket,
190                      std::string /* serialized_packet */ )
191
192 //-----------------------------------------------------------------------------
193 // Chromoting messages sent from the network to the desktop process.
194
195 // Passes the client session data to the desktop session agent and starts it.
196 // This must be the first message received from the host.
197 IPC_MESSAGE_CONTROL3(ChromotingNetworkDesktopMsg_StartSessionAgent,
198                      std::string /* authenticated_jid */,
199                      remoting::ScreenResolution /* resolution */,
200                      bool /* virtual_terminal */)
201
202 IPC_MESSAGE_CONTROL0(ChromotingNetworkDesktopMsg_CaptureFrame)
203
204 // Carries a clipboard event from the client to the desktop session agent.
205 // |serialized_event| is a serialized protocol::ClipboardEvent.
206 IPC_MESSAGE_CONTROL1(ChromotingNetworkDesktopMsg_InjectClipboardEvent,
207                      std::string /* serialized_event */ )
208
209 // Carries a keyboard event from the client to the desktop session agent.
210 // |serialized_event| is a serialized protocol::KeyEvent.
211 IPC_MESSAGE_CONTROL1(ChromotingNetworkDesktopMsg_InjectKeyEvent,
212                      std::string /* serialized_event */ )
213
214 // Carries a mouse event from the client to the desktop session agent.
215 // |serialized_event| is a serialized protocol::MouseEvent.
216 IPC_MESSAGE_CONTROL1(ChromotingNetworkDesktopMsg_InjectMouseEvent,
217                      std::string /* serialized_event */ )
218
219 // Changes the screen resolution in the desktop session.
220 IPC_MESSAGE_CONTROL1(ChromotingNetworkDesktopMsg_SetScreenResolution,
221                      remoting::ScreenResolution /* resolution */)