diff options
Diffstat (limited to 'cast/common/channel/proto')
-rw-r--r-- | cast/common/channel/proto/BUILD.gn | 11 | ||||
-rw-r--r-- | cast/common/channel/proto/cast_channel.proto | 99 |
2 files changed, 110 insertions, 0 deletions
diff --git a/cast/common/channel/proto/BUILD.gn b/cast/common/channel/proto/BUILD.gn new file mode 100644 index 00000000..c3bfa439 --- /dev/null +++ b/cast/common/channel/proto/BUILD.gn @@ -0,0 +1,11 @@ +# Copyright 2019 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. + +import("//third_party/protobuf/proto_library.gni") + +proto_library("proto") { + sources = [ + "cast_channel.proto", + ] +} diff --git a/cast/common/channel/proto/cast_channel.proto b/cast/common/channel/proto/cast_channel.proto new file mode 100644 index 00000000..57c7b3f3 --- /dev/null +++ b/cast/common/channel/proto/cast_channel.proto @@ -0,0 +1,99 @@ +// Copyright 2019 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. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; + +package cast.channel; + +message CastMessage { + // Always pass a version of the protocol for future compatibility + // requirements. + enum ProtocolVersion { CASTV2_1_0 = 0; } + required ProtocolVersion protocol_version = 1; + + // source and destination ids identify the origin and destination of the + // message. They are used to route messages between endpoints that share a + // device-to-device channel. + // + // For messages between applications: + // - The sender application id is a unique identifier generated on behalf of + // the sender application. + // - The receiver id is always the the session id for the application. + // + // For messages to or from the sender or receiver platform, the special ids + // 'sender-0' and 'receiver-0' can be used. + // + // For messages intended for all endpoints using a given channel, the + // wildcard destination_id '*' can be used. + required string source_id = 2; + required string destination_id = 3; + + // This is the core multiplexing key. All messages are sent on a namespace + // and endpoints sharing a channel listen on one or more namespaces. The + // namespace defines the protocol and semantics of the message. + required string namespace = 4; + + // Encoding and payload info follows. + + // What type of data do we have in this message. + enum PayloadType { + STRING = 0; + BINARY = 1; + } + required PayloadType payload_type = 5; + + // Depending on payload_type, exactly one of the following optional fields + // will always be set. + optional string payload_utf8 = 6; + optional bytes payload_binary = 7; +} + +enum SignatureAlgorithm { + UNSPECIFIED = 0; + RSASSA_PKCS1v15 = 1; + RSASSA_PSS = 2; +} + +enum HashAlgorithm { + SHA1 = 0; + SHA256 = 1; +} + +// Messages for authentication protocol between a sender and a receiver. +message AuthChallenge { + optional SignatureAlgorithm signature_algorithm = 1 + [default = RSASSA_PKCS1v15]; + optional bytes sender_nonce = 2; + optional HashAlgorithm hash_algorithm = 3 [default = SHA1]; +} + +message AuthResponse { + required bytes signature = 1; + required bytes client_auth_certificate = 2; + repeated bytes intermediate_certificate = 3; + optional SignatureAlgorithm signature_algorithm = 4 + [default = RSASSA_PKCS1v15]; + optional bytes sender_nonce = 5; + optional HashAlgorithm hash_algorithm = 6 [default = SHA1]; + optional bytes crl = 7; +} + +message AuthError { + enum ErrorType { + INTERNAL_ERROR = 0; + NO_TLS = 1; // The underlying connection is not TLS + SIGNATURE_ALGORITHM_UNAVAILABLE = 2; + } + required ErrorType error_type = 1; +} + +message DeviceAuthMessage { + // Request fields + optional AuthChallenge challenge = 1; + // Response fields + optional AuthResponse response = 2; + optional AuthError error = 3; +} |