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. 30IPC_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. 39IPC_MESSAGE_CONTROL1(ChromotingDaemonNetworkMsg_Configuration, std::string) 40 41// Initializes the pairing registry on Windows. The passed key handles are 42// already duplicated by the sender. 43IPC_MESSAGE_CONTROL2(ChromotingDaemonNetworkMsg_InitializePairingRegistry, 44 IPC::PlatformFileForTransit /* privileged_key */, 45 IPC::PlatformFileForTransit /* unprivileged_key */) 46 47// Notifies the network process that the terminal |terminal_id| has been 48// disconnected from the desktop session. 49IPC_MESSAGE_CONTROL1(ChromotingDaemonNetworkMsg_TerminalDisconnected, 50 int /* terminal_id */) 51 52// Notifies the network process that |terminal_id| is now attached to 53// a desktop integration process. |desktop_process| is the handle of the desktop 54// process. |desktop_pipe| is the client end of the desktop-to-network pipe 55// opened. 56// 57// Windows only: |desktop_pipe| has to be duplicated from the desktop process 58// by the receiver of the message. |desktop_process| is already duplicated by 59// the sender. 60IPC_MESSAGE_CONTROL3(ChromotingDaemonNetworkMsg_DesktopAttached, 61 int /* terminal_id */, 62 base::ProcessHandle /* desktop_process */, 63 IPC::PlatformFileForTransit /* desktop_pipe */) 64 65//----------------------------------------------------------------------------- 66// Chromoting messages sent from the network to the daemon process. 67 68// Connects the terminal |terminal_id| (i.e. a remote client) to a desktop 69// session. 70IPC_MESSAGE_CONTROL3(ChromotingNetworkHostMsg_ConnectTerminal, 71 int /* terminal_id */, 72 remoting::ScreenResolution /* resolution */, 73 bool /* virtual_terminal */) 74 75// Disconnects the terminal |terminal_id| from the desktop session it was 76// connected to. 77IPC_MESSAGE_CONTROL1(ChromotingNetworkHostMsg_DisconnectTerminal, 78 int /* terminal_id */) 79 80// Changes the screen resolution in the given desktop session. 81IPC_MESSAGE_CONTROL2(ChromotingNetworkDaemonMsg_SetScreenResolution, 82 int /* terminal_id */, 83 remoting::ScreenResolution /* resolution */) 84 85// Serialized remoting::protocol::TransportRoute structure. 86IPC_STRUCT_BEGIN(SerializedTransportRoute) 87 IPC_STRUCT_MEMBER(int, type) 88 IPC_STRUCT_MEMBER(net::IPAddressNumber, remote_address) 89 IPC_STRUCT_MEMBER(int, remote_port) 90 IPC_STRUCT_MEMBER(net::IPAddressNumber, local_address) 91 IPC_STRUCT_MEMBER(int, local_port) 92IPC_STRUCT_END() 93 94// Hosts status notifications (see HostStatusObserver interface) sent by 95// IpcHostEventLogger. 96IPC_MESSAGE_CONTROL1(ChromotingNetworkDaemonMsg_AccessDenied, 97 std::string /* jid */) 98 99IPC_MESSAGE_CONTROL1(ChromotingNetworkDaemonMsg_ClientAuthenticated, 100 std::string /* jid */) 101 102IPC_MESSAGE_CONTROL1(ChromotingNetworkDaemonMsg_ClientConnected, 103 std::string /* jid */) 104 105IPC_MESSAGE_CONTROL1(ChromotingNetworkDaemonMsg_ClientDisconnected, 106 std::string /* jid */) 107 108IPC_MESSAGE_CONTROL3(ChromotingNetworkDaemonMsg_ClientRouteChange, 109 std::string /* jid */, 110 std::string /* channel_name */, 111 SerializedTransportRoute /* route */) 112 113IPC_MESSAGE_CONTROL1(ChromotingNetworkDaemonMsg_HostStarted, 114 std::string /* xmpp_login */) 115 116IPC_MESSAGE_CONTROL0(ChromotingNetworkDaemonMsg_HostShutdown) 117 118//----------------------------------------------------------------------------- 119// Chromoting messages sent from the desktop to the daemon process. 120 121// Notifies the daemon that a desktop integration process has been initialized. 122// |desktop_pipe| specifies the client end of the desktop pipe. It is to be 123// forwarded to the desktop environment stub. 124// 125// Windows only: |desktop_pipe| has to be duplicated from the desktop process by 126// the receiver of the message. 127IPC_MESSAGE_CONTROL1(ChromotingDesktopDaemonMsg_DesktopAttached, 128 IPC::PlatformFileForTransit /* desktop_pipe */) 129 130// Asks the daemon to inject Secure Attention Sequence (SAS) in the session 131// where the desktop process is running. 132IPC_MESSAGE_CONTROL0(ChromotingDesktopDaemonMsg_InjectSas) 133 134//----------------------------------------------------------------------------- 135// Chromoting messages sent from the desktop to the network process. 136 137// Notifies the network process that a shared buffer has been created. 138IPC_MESSAGE_CONTROL3(ChromotingDesktopNetworkMsg_CreateSharedBuffer, 139 int /* id */, 140 IPC::PlatformFileForTransit /* handle */, 141 uint32 /* size */) 142 143// Request the network process to stop using a shared buffer. 144IPC_MESSAGE_CONTROL1(ChromotingDesktopNetworkMsg_ReleaseSharedBuffer, 145 int /* id */) 146 147IPC_STRUCT_TRAITS_BEGIN(webrtc::MouseCursorShape) 148 IPC_STRUCT_TRAITS_MEMBER(size) 149 IPC_STRUCT_TRAITS_MEMBER(hotspot) 150 IPC_STRUCT_TRAITS_MEMBER(data) 151IPC_STRUCT_TRAITS_END() 152 153// Serialized webrtc::DesktopFrame. 154IPC_STRUCT_BEGIN(SerializedDesktopFrame) 155 // ID of the shared memory buffer containing the pixels. 156 IPC_STRUCT_MEMBER(int, shared_buffer_id) 157 158 // Width of a single row of pixels in bytes. 159 IPC_STRUCT_MEMBER(int, bytes_per_row) 160 161 // Captured region. 162 IPC_STRUCT_MEMBER(std::vector<webrtc::DesktopRect>, dirty_region) 163 164 // Dimensions of the buffer in pixels. 165 IPC_STRUCT_MEMBER(webrtc::DesktopSize, dimensions) 166 167 // Time spent in capture. Unit is in milliseconds. 168 IPC_STRUCT_MEMBER(int, capture_time_ms) 169 170 // Sequence number supplied by client for performance tracking. 171 IPC_STRUCT_MEMBER(int64, client_sequence_number) 172 173 // DPI for this frame. 174 IPC_STRUCT_MEMBER(webrtc::DesktopVector, dpi) 175IPC_STRUCT_END() 176 177// Notifies the network process that a shared buffer has been created. 178IPC_MESSAGE_CONTROL1(ChromotingDesktopNetworkMsg_CaptureCompleted, 179 SerializedDesktopFrame /* frame */ ) 180 181// Carries a cursor share update from the desktop session agent to the client. 182IPC_MESSAGE_CONTROL1(ChromotingDesktopNetworkMsg_CursorShapeChanged, 183 webrtc::MouseCursorShape /* cursor_shape */ ) 184 185// Carries a clipboard event from the desktop session agent to the client. 186// |serialized_event| is a serialized protocol::ClipboardEvent. 187IPC_MESSAGE_CONTROL1(ChromotingDesktopNetworkMsg_InjectClipboardEvent, 188 std::string /* serialized_event */ ) 189 190// Requests the network process to terminate the client session. 191IPC_MESSAGE_CONTROL0(ChromotingDesktopNetworkMsg_DisconnectSession) 192 193// Carries an audio packet from the desktop session agent to the client. 194// |serialized_packet| is a serialized AudioPacket. 195IPC_MESSAGE_CONTROL1(ChromotingDesktopNetworkMsg_AudioPacket, 196 std::string /* serialized_packet */ ) 197 198//----------------------------------------------------------------------------- 199// Chromoting messages sent from the network to the desktop process. 200 201// Passes the client session data to the desktop session agent and starts it. 202// This must be the first message received from the host. 203IPC_MESSAGE_CONTROL3(ChromotingNetworkDesktopMsg_StartSessionAgent, 204 std::string /* authenticated_jid */, 205 remoting::ScreenResolution /* resolution */, 206 bool /* virtual_terminal */) 207 208IPC_MESSAGE_CONTROL0(ChromotingNetworkDesktopMsg_CaptureFrame) 209 210// Carries a clipboard event from the client to the desktop session agent. 211// |serialized_event| is a serialized protocol::ClipboardEvent. 212IPC_MESSAGE_CONTROL1(ChromotingNetworkDesktopMsg_InjectClipboardEvent, 213 std::string /* serialized_event */ ) 214 215// Carries a keyboard event from the client to the desktop session agent. 216// |serialized_event| is a serialized protocol::KeyEvent. 217IPC_MESSAGE_CONTROL1(ChromotingNetworkDesktopMsg_InjectKeyEvent, 218 std::string /* serialized_event */ ) 219 220// Carries a keyboard event from the client to the desktop session agent. 221// |serialized_event| is a serialized protocol::TextEvent. 222IPC_MESSAGE_CONTROL1(ChromotingNetworkDesktopMsg_InjectTextEvent, 223 std::string /* serialized_event */ ) 224 225// Carries a mouse event from the client to the desktop session agent. 226// |serialized_event| is a serialized protocol::MouseEvent. 227IPC_MESSAGE_CONTROL1(ChromotingNetworkDesktopMsg_InjectMouseEvent, 228 std::string /* serialized_event */ ) 229 230// Changes the screen resolution in the desktop session. 231IPC_MESSAGE_CONTROL1(ChromotingNetworkDesktopMsg_SetScreenResolution, 232 remoting::ScreenResolution /* resolution */) 233