summaryrefslogtreecommitdiffstats
path: root/remoting/proto
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-18 20:09:50 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-18 20:09:50 +0000
commite976a17124ab2fc3df0947867ca1941e9245e627 (patch)
treedf335eb26b1822d135964fe14a6ec6ef72692dd7 /remoting/proto
parent41dd4a311c4c683367201bfe876a2d6f220e5319 (diff)
downloadchromium_src-e976a17124ab2fc3df0947867ca1941e9245e627.zip
chromium_src-e976a17124ab2fc3df0947867ca1941e9245e627.tar.gz
chromium_src-e976a17124ab2fc3df0947867ca1941e9245e627.tar.bz2
Move chromotocol.proto to remoting/protocol
Move the proto file and split it into multiple smaller proto files. BUG=None TEST=None Review URL: http://codereview.chromium.org/3808002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62965 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/proto')
-rw-r--r--remoting/proto/chromotocol.gyp83
-rw-r--r--remoting/proto/control.proto13
-rw-r--r--remoting/proto/event.proto202
-rw-r--r--remoting/proto/internal.proto38
-rw-r--r--remoting/proto/trace.gyp80
-rw-r--r--remoting/proto/trace.proto37
6 files changed, 453 insertions, 0 deletions
diff --git a/remoting/proto/chromotocol.gyp b/remoting/proto/chromotocol.gyp
new file mode 100644
index 0000000..3d55d21
--- /dev/null
+++ b/remoting/proto/chromotocol.gyp
@@ -0,0 +1,83 @@
+# Copyright (c) 2010 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'variables': {
+ 'chromium_code': 1,
+ 'out_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out/remoting/proto',
+ },
+ 'targets': [
+ {
+ # Protobuf compiler / generate rule for chromoting.proto.
+ 'target_name': 'chromotocol_proto',
+ 'type': 'none',
+ 'sources': [
+ 'control.proto',
+ 'event.proto',
+ 'internal.proto',
+ ],
+ 'rules': [
+ {
+ 'rule_name': 'genproto',
+ 'extension': 'proto',
+ 'inputs': [
+ '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)',
+ ],
+ 'outputs': [
+ '<(out_dir)/<(RULE_INPUT_ROOT).pb.cc',
+ '<(out_dir)/<(RULE_INPUT_ROOT).pb.h',
+ ],
+ 'action': [
+ '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)',
+ '--proto_path=.',
+ './<(RULE_INPUT_ROOT)<(RULE_INPUT_EXT)',
+ '--cpp_out=<(out_dir)',
+ ],
+ 'message': 'Generating C++ and Python code from <(RULE_INPUT_PATH)',
+ },
+ ],
+ 'dependencies': [
+ '<(DEPTH)/third_party/protobuf/protobuf.gyp:protoc#host',
+ ],
+ 'direct_dependent_settings': {
+ 'include_dirs': [
+ '<(SHARED_INTERMEDIATE_DIR)/protoc_out',
+ ],
+ },
+ # This target exports a hard dependency because it generates header
+ # files.
+ 'hard_dependency': 1,
+ },
+
+ {
+ 'target_name': 'chromotocol_proto_lib',
+ 'type': '<(library)',
+ 'export_dependent_settings': [
+ '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite',
+ 'chromotocol_proto',
+ ],
+ 'dependencies': [
+ '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite',
+ 'chromotocol_proto',
+ ],
+ # This target exports a hard dependency because depedents require
+ # chromotocol_proto to compile.
+ 'hard_dependency': 1,
+ 'sources': [
+ '<(out_dir)/control.pb.cc',
+ '<(out_dir)/control.pb.h',
+ '<(out_dir)/event.pb.cc',
+ '<(out_dir)/event.pb.h',
+ '<(out_dir)/internal.pb.cc',
+ '<(out_dir)/internal.pb.h',
+ ],
+ },
+ ],
+}
+
+# Local Variables:
+# tab-width:2
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/remoting/proto/control.proto b/remoting/proto/control.proto
new file mode 100644
index 0000000..df0787c
--- /dev/null
+++ b/remoting/proto/control.proto
@@ -0,0 +1,13 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Protocol for control messages.
+
+syntax = "proto2";
+
+option optimize_for = LITE_RUNTIME;
+
+package remoting;
+
+// TODO(hclam): Define control messages. \ No newline at end of file
diff --git a/remoting/proto/event.proto b/remoting/proto/event.proto
new file mode 100644
index 0000000..b961335
--- /dev/null
+++ b/remoting/proto/event.proto
@@ -0,0 +1,202 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Protocol for event messages.
+
+syntax = "proto2";
+
+option optimize_for = LITE_RUNTIME;
+
+package remoting;
+
+// A message that gets sent to the client after the client is connected to the
+// host. It contains information that the client needs to know about the host.
+// NEXT ID: 3
+message InitClientMessage {
+ required int32 width = 1;
+ required int32 height = 2;
+}
+
+// A message to denote the beginning of an update stream. It will be followed
+// by 0 or more UpdateStreamPacketMessages and then a EndUpdateStreamMessage.
+// NEXT ID: 1
+message BeginUpdateStreamMessage {
+}
+
+// A message to denote the end of an update stream.
+// NEXT ID: 1
+message EndUpdateStreamMessage {
+}
+
+// Identifies how the image was encoded.
+enum UpdateStreamEncoding {
+ EncodingInvalid = -1;
+ EncodingNone = 0;
+ EncodingZlib = 1;
+ EncodingVp8 = 2;
+}
+
+// Identifies the pixel format.
+// Note that this list should match exactly the same as
+// media::VideoFrame::Format in media/base/video_frame.h.
+enum PixelFormat {
+ PixelFormatInvalid = 0;
+ PixelFormatRgb555 = 1;
+ PixelFormatRgb565 = 2;
+ PixelFormatRgb24 = 3;
+ PixelFormatRgb32 = 4;
+ PixelFormatRgba = 5;
+ PixelFormatYv12 = 6;
+ PixelFormatYv16 = 7;
+ PixelFormatNv12 = 8;
+ PixelFormatEmpty = 9;
+ PixelFormatAscii = 10;
+}
+
+// A message that denotes the beginning of an updating rectangle in an update
+// stream packet.
+// NEXT ID: 6
+message UpdateStreamBeginRect {
+ // X,Y coordinates (in screen pixels) for origin of this update.
+ required int32 x = 1;
+ required int32 y = 2;
+
+ // Width, height (in screen pixels) for this update.
+ required int32 width = 3;
+ required int32 height = 4;
+
+ // The encoding used for this image update.
+ optional UpdateStreamEncoding encoding = 5 [default=EncodingNone];
+
+ // The pixel format of this image.
+ optional PixelFormat pixel_format = 6 [default=PixelFormatRgb24];
+}
+
+// A message that contains partial data for updating an rectangle in an
+// update stream packet.
+// NEXT ID: 3
+message UpdateStreamRectData {
+ // The sequence number of the partial data for updating a rectangle.
+ optional int32 sequence_number = 1 [default=0];
+
+ // The partial data for updating a rectangle.
+ required bytes data = 2;
+}
+
+// A message that denotes the end of an updating rectangle.
+// NEXT ID: 1
+message UpdateStreamEndRect {
+}
+
+// A message to denote a partial update stream.
+// NEXT ID: 4
+message UpdateStreamPacketMessage {
+ optional UpdateStreamBeginRect begin_rect = 1;
+ optional UpdateStreamRectData rect_data = 2;
+ optional UpdateStreamEndRect end_rect = 3;
+}
+
+// TODO(ajwong): Determine if these fields should be optional or required.
+message RectangleFormat {
+ // X,Y coordinates (in screen pixels) for origin of this update.
+ required int32 x = 1;
+ required int32 y = 2;
+
+ // Width, height (in screen pixels) for this update.
+ required int32 width = 3;
+ required int32 height = 4;
+
+ // The encoding used for this image update.
+ optional UpdateStreamEncoding encoding = 5 [default = EncodingInvalid];
+
+ // The pixel format of this image.
+ optional PixelFormat pixel_format = 6 [default = PixelFormatRgb24];
+}
+
+message RectangleUpdatePacket {
+ // Bitmasks for use in the flags field below.
+ //
+ // The encoder may fragment one update into multiple packets depending on
+ // how the encoder outputs data. Thus, one update can logically consist of
+ // multiple packets. The FIRST_PACKET and LAST_PACKET flags are used to
+ // indicate the start and end of a logical update. Here are notable
+ // consequences:
+ // * Both FIRST_PACKET and LAST_PACKET may be set if an update is only
+ // one packet long.
+ // * The RectangleFormat is only supplied in a FIRST_PACKET.
+ // * An local update cannot change format between a FIRST_PACKET and
+ // a LAST_PACKET.
+ // * All packets in one logical update must be processed in order, and
+ // packets may not be skipped.
+ enum Flags {
+ FIRST_PACKET = 1;
+ LAST_PACKET = 2;
+ }
+ optional int32 flags = 1 [default = 0];
+
+ // The sequence number of the partial data for updating a rectangle.
+ optional int32 sequence_number = 2 [default = 0];
+
+ // This is provided on the first packet of the rectangle data, when
+ // the flags has FIRST_PACKET set.
+ optional RectangleFormat format = 3;
+
+ optional bytes encoded_rect = 4;
+}
+
+// Defines a keyboard event.
+// NEXT ID: 3
+message KeyEvent {
+ // The POSIX key code.
+ required int32 key = 1;
+ required bool pressed = 2;
+}
+
+// Sets the absolute position of the mouse cursor.
+// dimension of the screen area.
+// NEXT ID: 3
+message MouseSetPositionEvent {
+ required int32 x = 1;
+ required int32 y = 2;
+
+ // Windows sets absolute mouse pointer positions as a relative value to
+ // the screen size. So pass the screen size to make this calculation easier.
+ optional int32 width = 3;
+ optional int32 height = 4;
+}
+
+// Adjust the position of the mouse cursor by an offset.
+// NEXT ID: 3
+message MouseMoveEvent {
+ required int32 offset_x = 1;
+ required int32 offset_y = 2;
+}
+
+// Motion of the mouse wheel.
+// TODO(garykac): What are units here? How many units correspond to a single
+// wheel click? On Windows, one click (WHEEL_DELTA) is 120 wheel units.
+// NEXT ID: 3
+message MouseWheelEvent {
+ required int32 offset_x = 1;
+ required int32 offset_y = 2;
+}
+
+enum MouseButton {
+ MouseButtonUndefined = 0;
+ MouseButtonLeft = 1;
+ MouseButtonMiddle = 2;
+ MouseButtonRight = 3;
+}
+
+// Mouse button is pressed down.
+// NEXT ID: 2
+message MouseDownEvent {
+ required MouseButton button = 1;
+}
+
+// Mouse button is released.
+// NEXT ID: 2
+message MouseUpEvent {
+ required MouseButton button = 1;
+}
diff --git a/remoting/proto/internal.proto b/remoting/proto/internal.proto
new file mode 100644
index 0000000..b98b696
--- /dev/null
+++ b/remoting/proto/internal.proto
@@ -0,0 +1,38 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Internal messages as a unit for transmission in the wire.
+
+syntax = "proto2";
+
+import "control.proto";
+import "event.proto";
+
+option optimize_for = LITE_RUNTIME;
+
+package remoting;
+
+// Defines the message that is sent from the host to the client.
+// Only one of these messages should be present.
+// NEXT ID: 5
+message ChromotingHostMessage {
+ optional InitClientMessage init_client= 1;
+ optional BeginUpdateStreamMessage begin_update_stream = 2;
+ optional EndUpdateStreamMessage end_update_stream = 3;
+ optional UpdateStreamPacketMessage update_stream_packet = 4;
+
+ optional RectangleUpdatePacket rectangle_update = 5;
+}
+
+// Defines the message that is sent from the client to the host.
+// Only one of the optional messages should be present.
+// NEXT ID: 7
+message ChromotingClientMessage {
+ optional KeyEvent key_event = 1;
+ optional MouseSetPositionEvent mouse_set_position_event = 2;
+ optional MouseMoveEvent mouse_move_event = 3;
+ optional MouseWheelEvent mouse_wheel_event = 4;
+ optional MouseDownEvent mouse_down_event = 5;
+ optional MouseUpEvent mouse_up_event = 6;
+}
diff --git a/remoting/proto/trace.gyp b/remoting/proto/trace.gyp
new file mode 100644
index 0000000..a417a5b
--- /dev/null
+++ b/remoting/proto/trace.gyp
@@ -0,0 +1,80 @@
+# Copyright (c) 2010 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'variables': {
+ 'chromium_code': 1,
+ 'out_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out/remoting/proto',
+ },
+ 'targets': [
+ {
+ # Protobuf compiler / generate rule for trace.proto.
+ 'target_name': 'trace_proto',
+ 'type': 'none',
+ 'sources': [
+ 'trace.proto',
+ ],
+ 'rules': [
+ {
+ 'rule_name': 'genproto',
+ 'extension': 'proto',
+ 'inputs': [
+ '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)',
+ ],
+ 'outputs': [
+ '<(PRODUCT_DIR)/pyproto/<(RULE_INPUT_ROOT)_pb/'
+ '<(RULE_INPUT_ROOT)_pb2.py',
+ '<(out_dir)/<(RULE_INPUT_ROOT).pb.cc',
+ '<(out_dir)/<(RULE_INPUT_ROOT).pb.h',
+ ],
+ 'action': [
+ '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)',
+ '--proto_path=.',
+ './<(RULE_INPUT_ROOT)<(RULE_INPUT_EXT)',
+ '--cpp_out=<(out_dir)',
+ '--python_out=<(PRODUCT_DIR)/pyproto/<(RULE_INPUT_ROOT)_pb',
+ ],
+ 'message': 'Generating C++ and Python code from <(RULE_INPUT_PATH)',
+ },
+ ],
+ 'dependencies': [
+ '<(DEPTH)/third_party/protobuf/protobuf.gyp:protoc#host',
+ ],
+ # This target exports a hard dependency because it generates header
+ # files.
+ 'hard_dependency': 1,
+ },
+
+ {
+ 'target_name': 'trace_proto_lib',
+ 'type': '<(library)',
+ 'export_dependent_settings': [
+ '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite',
+ 'trace_proto',
+ ],
+ 'dependencies': [
+ '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite',
+ 'trace_proto',
+ ],
+ # This target exports a hard dependency because depedents require
+ # chromotocol_proto to compile.
+ 'hard_dependency': 1,
+ 'direct_dependent_settings': {
+ 'include_dirs': [
+ '<(SHARED_INTERMEDIATE_DIR)/protoc_out',
+ ],
+ },
+ 'sources': [
+ '<(out_dir)/trace.pb.cc',
+ '<(out_dir)/trace.pb.h',
+ ],
+ },
+ ],
+}
+
+# Local Variables:
+# tab-width:2
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/remoting/proto/trace.proto b/remoting/proto/trace.proto
new file mode 100644
index 0000000..dbbabcf
--- /dev/null
+++ b/remoting/proto/trace.proto
@@ -0,0 +1,37 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Protocol buffers for creating performance traces on requests.
+
+syntax = "proto2";
+
+option optimize_for = LITE_RUNTIME;
+
+package remoting;
+
+// Represents one entry in the TraceBuffer below. Collates information that
+// would be useful for analyzing the performance in a program trace.
+message TraceRecord {
+ required string annotation = 1;
+ required int64 timestamp = 2; // In micros from epoch.
+
+ // -- Information for constructing a distributed trace. --
+ // TODO(ajwong): Decide which of these are useful, and remove rest.
+
+ // Identifies the machine.
+ optional int64 source_id = 3 [ default = -1 ];
+
+ // Identifies the thread on the machine.
+ optional fixed64 thread_id = 4;
+
+ // Estimated skew from master clock.
+ optional int64 clock_skew = 5 [ default = 0 ];
+}
+
+// Protocol buffer used for collecting stats, and performance data.
+message TraceBuffer {
+ required string name = 1; // Name of this trace.
+ repeated TraceRecord record = 2;
+}
+