From d4ec766ca8d7eedaed43b02614eca0fb879187a7 Mon Sep 17 00:00:00 2001 From: Hans Bakker Date: Thu, 28 May 2015 20:14:31 +0200 Subject: [PATCH 1/2] Update protobuf to version 3 Generate new protobuf-scripts from https://chromium.googlesource.com/chromium/src.git/+/master/extensions/common/api/cast_channel Update socket-reading code in socket_client to work with python3 (byte-arrays are not strings in python3) --- chromecast_protobuf/README.md | 1 + chromecast_protobuf/authority_keys.proto | 13 + chromecast_protobuf/cast_channel.proto | 77 +++ chromecast_protobuf/logging.proto | 134 ++++ pychromecast/authority_keys_pb2.py | 118 ++++ pychromecast/cast_channel_pb2.py | 250 ++++--- pychromecast/logging_pb2.py | 809 +++++++++++++++++++++++ pychromecast/socket_client.py | 25 +- requirements.txt | 2 +- 9 files changed, 1337 insertions(+), 92 deletions(-) create mode 100644 chromecast_protobuf/README.md create mode 100644 chromecast_protobuf/authority_keys.proto create mode 100644 chromecast_protobuf/cast_channel.proto create mode 100644 chromecast_protobuf/logging.proto create mode 100644 pychromecast/authority_keys_pb2.py create mode 100644 pychromecast/logging_pb2.py diff --git a/chromecast_protobuf/README.md b/chromecast_protobuf/README.md new file mode 100644 index 000000000..a345567e6 --- /dev/null +++ b/chromecast_protobuf/README.md @@ -0,0 +1 @@ +These files were imported from https://chromium.googlesource.com/chromium/src.git/+/master/extensions/common/api/cast_channel to generate the \_pb2.py-files. \ No newline at end of file diff --git a/chromecast_protobuf/authority_keys.proto b/chromecast_protobuf/authority_keys.proto new file mode 100644 index 000000000..d33e9fdc3 --- /dev/null +++ b/chromecast_protobuf/authority_keys.proto @@ -0,0 +1,13 @@ +// Copyright 2014 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 extensions.core_api.cast_channel.proto; +message AuthorityKeys { + message Key { + required bytes fingerprint = 1; + required bytes public_key = 2; + } + repeated Key keys = 1; +} \ No newline at end of file diff --git a/chromecast_protobuf/cast_channel.proto b/chromecast_protobuf/cast_channel.proto new file mode 100644 index 000000000..57174fd3d --- /dev/null +++ b/chromecast_protobuf/cast_channel.proto @@ -0,0 +1,77 @@ +// Copyright 2014 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 extensions.core_api.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; +} +// Messages for authentication protocol between a sender and a receiver. +message AuthChallenge { + optional SignatureAlgorithm signature_algorithm = 1 + [default = RSASSA_PKCS1v15]; +} +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]; +} +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; +} \ No newline at end of file diff --git a/chromecast_protobuf/logging.proto b/chromecast_protobuf/logging.proto new file mode 100644 index 000000000..c5a901dfe --- /dev/null +++ b/chromecast_protobuf/logging.proto @@ -0,0 +1,134 @@ +// Copyright 2014 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 extensions.core_api.cast_channel.proto; +enum EventType { + EVENT_TYPE_UNKNOWN = 0; + CAST_SOCKET_CREATED = 1; + READY_STATE_CHANGED = 2; + CONNECTION_STATE_CHANGED = 3; + READ_STATE_CHANGED = 4; + WRITE_STATE_CHANGED = 5; + ERROR_STATE_CHANGED = 6; + CONNECT_FAILED = 7; + TCP_SOCKET_CONNECT = 8; // Logged with RV. + TCP_SOCKET_SET_KEEP_ALIVE = 9; + SSL_CERT_WHITELISTED = 10; + SSL_SOCKET_CONNECT = 11; // Logged with RV. + SSL_INFO_OBTAINED = 12; + DER_ENCODED_CERT_OBTAIN = 13; // Logged with RV. + RECEIVED_CHALLENGE_REPLY = 14; + AUTH_CHALLENGE_REPLY = 15; + CONNECT_TIMED_OUT = 16; + SEND_MESSAGE_FAILED = 17; + MESSAGE_ENQUEUED = 18; // Message + SOCKET_WRITE = 19; // Logged with RV. + MESSAGE_WRITTEN = 20; // Message + SOCKET_READ = 21; // Logged with RV. + MESSAGE_READ = 22; // Message + SOCKET_CLOSED = 25; + SSL_CERT_EXCESSIVE_LIFETIME = 26; + CHANNEL_POLICY_ENFORCED = 27; + TCP_SOCKET_CONNECT_COMPLETE = 28; // Logged with RV. + SSL_SOCKET_CONNECT_COMPLETE = 29; // Logged with RV. + SSL_SOCKET_CONNECT_FAILED = 30; // Logged with RV. + SEND_AUTH_CHALLENGE_FAILED = 31; // Logged with RV. + AUTH_CHALLENGE_REPLY_INVALID = 32; + PING_WRITE_ERROR = 33; // Logged with RV. +} +enum ChannelAuth { + // SSL over TCP. + SSL = 1; + // SSL over TCP with challenge and receiver signature verification. + SSL_VERIFIED = 2; +} +enum ReadyState { + READY_STATE_NONE = 1; + READY_STATE_CONNECTING = 2; + READY_STATE_OPEN = 3; + READY_STATE_CLOSING = 4; + READY_STATE_CLOSED = 5; +} +enum ConnectionState { + CONN_STATE_NONE = 1; + CONN_STATE_TCP_CONNECT = 2; + CONN_STATE_TCP_CONNECT_COMPLETE = 3; + CONN_STATE_SSL_CONNECT = 4; + CONN_STATE_SSL_CONNECT_COMPLETE = 5; + CONN_STATE_AUTH_CHALLENGE_SEND = 6; + CONN_STATE_AUTH_CHALLENGE_SEND_COMPLETE = 7; + CONN_STATE_AUTH_CHALLENGE_REPLY_COMPLETE = 8; +} +enum ReadState { + READ_STATE_NONE = 1; + READ_STATE_READ = 2; + READ_STATE_READ_COMPLETE = 3; + READ_STATE_DO_CALLBACK = 4; + READ_STATE_ERROR = 5; +} +enum WriteState { + WRITE_STATE_NONE = 1; + WRITE_STATE_WRITE = 2; + WRITE_STATE_WRITE_COMPLETE = 3; + WRITE_STATE_DO_CALLBACK = 4; + WRITE_STATE_ERROR = 5; +} +enum ErrorState { + CHANNEL_ERROR_NONE = 1; + CHANNEL_ERROR_CHANNEL_NOT_OPEN = 2; + CHANNEL_ERROR_AUTHENTICATION_ERROR = 3; + CHANNEL_ERROR_CONNECT_ERROR = 4; + CHANNEL_ERROR_SOCKET_ERROR = 5; + CHANNEL_ERROR_TRANSPORT_ERROR = 6; + CHANNEL_ERROR_INVALID_MESSAGE = 7; + CHANNEL_ERROR_INVALID_CHANNEL_ID = 8; + CHANNEL_ERROR_CONNECT_TIMEOUT = 9; + CHANNEL_ERROR_UNKNOWN = 10; +} +enum ChallengeReplyErrorType { + CHALLENGE_REPLY_ERROR_NONE = 1; + CHALLENGE_REPLY_ERROR_PEER_CERT_EMPTY = 2; + CHALLENGE_REPLY_ERROR_WRONG_PAYLOAD_TYPE = 3; + CHALLENGE_REPLY_ERROR_NO_PAYLOAD = 4; + CHALLENGE_REPLY_ERROR_PAYLOAD_PARSING_FAILED = 5; + CHALLENGE_REPLY_ERROR_MESSAGE_ERROR = 6; + CHALLENGE_REPLY_ERROR_NO_RESPONSE = 7; + CHALLENGE_REPLY_ERROR_FINGERPRINT_NOT_FOUND = 8; + CHALLENGE_REPLY_ERROR_CERT_PARSING_FAILED = 9; + CHALLENGE_REPLY_ERROR_CERT_NOT_SIGNED_BY_TRUSTED_CA = 10; + CHALLENGE_REPLY_ERROR_CANNOT_EXTRACT_PUBLIC_KEY = 11; + CHALLENGE_REPLY_ERROR_SIGNED_BLOBS_MISMATCH = 12; +} +message SocketEvent { + // Required + optional EventType type = 1; + optional int64 timestamp_micros = 2; + optional string details = 3; + optional int32 net_return_value = 4; + optional string message_namespace = 5; + optional ReadyState ready_state = 6; + optional ConnectionState connection_state = 7; + optional ReadState read_state = 8; + optional WriteState write_state = 9; + optional ErrorState error_state = 10; + optional ChallengeReplyErrorType challenge_reply_error_type = 11; + optional int32 nss_error_code = 12; +} +message AggregatedSocketEvent { + optional int32 id = 1; + optional int32 endpoint_id = 2; + optional ChannelAuth channel_auth_type = 3; + repeated SocketEvent socket_event = 4; + optional int64 bytes_read = 5; + optional int64 bytes_written = 6; +} +message Log { + // Each AggregatedSocketEvent represents events recorded for a socket. + repeated AggregatedSocketEvent aggregated_socket_event = 1; + // Number of socket log entries evicted by the logger due to size constraints. + optional int32 num_evicted_aggregated_socket_events = 2; + // Number of event log entries evicted by the logger due to size constraints. + optional int32 num_evicted_socket_events = 3; +} \ No newline at end of file diff --git a/pychromecast/authority_keys_pb2.py b/pychromecast/authority_keys_pb2.py new file mode 100644 index 000000000..82684c13e --- /dev/null +++ b/pychromecast/authority_keys_pb2.py @@ -0,0 +1,118 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: authority_keys.proto + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='authority_keys.proto', + package='extensions.core_api.cast_channel.proto', + syntax='proto2', + serialized_pb=_b('\n\x14\x61uthority_keys.proto\x12&extensions.core_api.cast_channel.proto\"\x88\x01\n\rAuthorityKeys\x12G\n\x04keys\x18\x01 \x03(\x0b\x32\x39.extensions.core_api.cast_channel.proto.AuthorityKeys.Key\x1a.\n\x03Key\x12\x13\n\x0b\x66ingerprint\x18\x01 \x02(\x0c\x12\x12\n\npublic_key\x18\x02 \x02(\x0c\x42\x02H\x03') +) +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + + + + +_AUTHORITYKEYS_KEY = _descriptor.Descriptor( + name='Key', + full_name='extensions.core_api.cast_channel.proto.AuthorityKeys.Key', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='fingerprint', full_name='extensions.core_api.cast_channel.proto.AuthorityKeys.Key.fingerprint', index=0, + number=1, type=12, cpp_type=9, label=2, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='public_key', full_name='extensions.core_api.cast_channel.proto.AuthorityKeys.Key.public_key', index=1, + number=2, type=12, cpp_type=9, label=2, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=155, + serialized_end=201, +) + +_AUTHORITYKEYS = _descriptor.Descriptor( + name='AuthorityKeys', + full_name='extensions.core_api.cast_channel.proto.AuthorityKeys', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='keys', full_name='extensions.core_api.cast_channel.proto.AuthorityKeys.keys', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[_AUTHORITYKEYS_KEY, ], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=65, + serialized_end=201, +) + +_AUTHORITYKEYS_KEY.containing_type = _AUTHORITYKEYS +_AUTHORITYKEYS.fields_by_name['keys'].message_type = _AUTHORITYKEYS_KEY +DESCRIPTOR.message_types_by_name['AuthorityKeys'] = _AUTHORITYKEYS + +AuthorityKeys = _reflection.GeneratedProtocolMessageType('AuthorityKeys', (_message.Message,), dict( + + Key = _reflection.GeneratedProtocolMessageType('Key', (_message.Message,), dict( + DESCRIPTOR = _AUTHORITYKEYS_KEY, + __module__ = 'authority_keys_pb2' + # @@protoc_insertion_point(class_scope:extensions.core_api.cast_channel.proto.AuthorityKeys.Key) + )) + , + DESCRIPTOR = _AUTHORITYKEYS, + __module__ = 'authority_keys_pb2' + # @@protoc_insertion_point(class_scope:extensions.core_api.cast_channel.proto.AuthorityKeys) + )) +_sym_db.RegisterMessage(AuthorityKeys) +_sym_db.RegisterMessage(AuthorityKeys.Key) + + +DESCRIPTOR.has_options = True +DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('H\003')) +# @@protoc_insertion_point(module_scope) diff --git a/pychromecast/cast_channel_pb2.py b/pychromecast/cast_channel_pb2.py index b9b084dee..1893718f7 100644 --- a/pychromecast/cast_channel_pb2.py +++ b/pychromecast/cast_channel_pb2.py @@ -1,25 +1,64 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: cast_channel.proto +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database from google.protobuf import descriptor_pb2 # @@protoc_insertion_point(imports) +_sym_db = _symbol_database.Default() + DESCRIPTOR = _descriptor.FileDescriptor( name='cast_channel.proto', - package='extensions.api.cast_channel', - serialized_pb='\n\x12\x63\x61st_channel.proto\x12\x1b\x65xtensions.api.cast_channel\"\xe3\x02\n\x0b\x43\x61stMessage\x12R\n\x10protocol_version\x18\x01 \x02(\x0e\x32\x38.extensions.api.cast_channel.CastMessage.ProtocolVersion\x12\x11\n\tsource_id\x18\x02 \x02(\t\x12\x16\n\x0e\x64\x65stination_id\x18\x03 \x02(\t\x12\x11\n\tnamespace\x18\x04 \x02(\t\x12J\n\x0cpayload_type\x18\x05 \x02(\x0e\x32\x34.extensions.api.cast_channel.CastMessage.PayloadType\x12\x14\n\x0cpayload_utf8\x18\x06 \x01(\t\x12\x16\n\x0epayload_binary\x18\x07 \x01(\x0c\"!\n\x0fProtocolVersion\x12\x0e\n\nCASTV2_1_0\x10\x00\"%\n\x0bPayloadType\x12\n\n\x06STRING\x10\x00\x12\n\n\x06\x42INARY\x10\x01\"\x0f\n\rAuthChallenge\"B\n\x0c\x41uthResponse\x12\x11\n\tsignature\x18\x01 \x02(\x0c\x12\x1f\n\x17\x63lient_auth_certificate\x18\x02 \x02(\x0c\"~\n\tAuthError\x12\x44\n\nerror_type\x18\x01 \x02(\x0e\x32\x30.extensions.api.cast_channel.AuthError.ErrorType\"+\n\tErrorType\x12\x12\n\x0eINTERNAL_ERROR\x10\x00\x12\n\n\x06NO_TLS\x10\x01\"\xc6\x01\n\x11\x44\x65viceAuthMessage\x12=\n\tchallenge\x18\x01 \x01(\x0b\x32*.extensions.api.cast_channel.AuthChallenge\x12;\n\x08response\x18\x02 \x01(\x0b\x32).extensions.api.cast_channel.AuthResponse\x12\x35\n\x05\x65rror\x18\x03 \x01(\x0b\x32&.extensions.api.cast_channel.AuthErrorB\x02H\x03') + package='extensions.core_api.cast_channel', + syntax='proto2', + serialized_pb=_b('\n\x12\x63\x61st_channel.proto\x12 extensions.core_api.cast_channel\"\xed\x02\n\x0b\x43\x61stMessage\x12W\n\x10protocol_version\x18\x01 \x02(\x0e\x32=.extensions.core_api.cast_channel.CastMessage.ProtocolVersion\x12\x11\n\tsource_id\x18\x02 \x02(\t\x12\x16\n\x0e\x64\x65stination_id\x18\x03 \x02(\t\x12\x11\n\tnamespace\x18\x04 \x02(\t\x12O\n\x0cpayload_type\x18\x05 \x02(\x0e\x32\x39.extensions.core_api.cast_channel.CastMessage.PayloadType\x12\x14\n\x0cpayload_utf8\x18\x06 \x01(\t\x12\x16\n\x0epayload_binary\x18\x07 \x01(\x0c\"!\n\x0fProtocolVersion\x12\x0e\n\nCASTV2_1_0\x10\x00\"%\n\x0bPayloadType\x12\n\n\x06STRING\x10\x00\x12\n\n\x06\x42INARY\x10\x01\"s\n\rAuthChallenge\x12\x62\n\x13signature_algorithm\x18\x01 \x01(\x0e\x32\x34.extensions.core_api.cast_channel.SignatureAlgorithm:\x0fRSASSA_PKCS1v15\"\xc8\x01\n\x0c\x41uthResponse\x12\x11\n\tsignature\x18\x01 \x02(\x0c\x12\x1f\n\x17\x63lient_auth_certificate\x18\x02 \x02(\x0c\x12 \n\x18intermediate_certificate\x18\x03 \x03(\x0c\x12\x62\n\x13signature_algorithm\x18\x04 \x01(\x0e\x32\x34.extensions.core_api.cast_channel.SignatureAlgorithm:\x0fRSASSA_PKCS1v15\"\xa8\x01\n\tAuthError\x12I\n\nerror_type\x18\x01 \x02(\x0e\x32\x35.extensions.core_api.cast_channel.AuthError.ErrorType\"P\n\tErrorType\x12\x12\n\x0eINTERNAL_ERROR\x10\x00\x12\n\n\x06NO_TLS\x10\x01\x12#\n\x1fSIGNATURE_ALGORITHM_UNAVAILABLE\x10\x02\"\xd5\x01\n\x11\x44\x65viceAuthMessage\x12\x42\n\tchallenge\x18\x01 \x01(\x0b\x32/.extensions.core_api.cast_channel.AuthChallenge\x12@\n\x08response\x18\x02 \x01(\x0b\x32..extensions.core_api.cast_channel.AuthResponse\x12:\n\x05\x65rror\x18\x03 \x01(\x0b\x32+.extensions.core_api.cast_channel.AuthError*J\n\x12SignatureAlgorithm\x12\x0f\n\x0bUNSPECIFIED\x10\x00\x12\x13\n\x0fRSASSA_PKCS1v15\x10\x01\x12\x0e\n\nRSASSA_PSS\x10\x02\x42\x02H\x03') +) +_sym_db.RegisterFileDescriptor(DESCRIPTOR) +_SIGNATUREALGORITHM = _descriptor.EnumDescriptor( + name='SignatureAlgorithm', + full_name='extensions.core_api.cast_channel.SignatureAlgorithm', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='UNSPECIFIED', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='RSASSA_PKCS1v15', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='RSASSA_PSS', index=2, number=2, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=1131, + serialized_end=1205, +) +_sym_db.RegisterEnumDescriptor(_SIGNATUREALGORITHM) + +SignatureAlgorithm = enum_type_wrapper.EnumTypeWrapper(_SIGNATUREALGORITHM) +UNSPECIFIED = 0 +RSASSA_PKCS1v15 = 1 +RSASSA_PSS = 2 _CASTMESSAGE_PROTOCOLVERSION = _descriptor.EnumDescriptor( name='ProtocolVersion', - full_name='extensions.api.cast_channel.CastMessage.ProtocolVersion', + full_name='extensions.core_api.cast_channel.CastMessage.ProtocolVersion', filename=None, file=DESCRIPTOR, values=[ @@ -30,13 +69,14 @@ ], containing_type=None, options=None, - serialized_start=335, - serialized_end=368, + serialized_start=350, + serialized_end=383, ) +_sym_db.RegisterEnumDescriptor(_CASTMESSAGE_PROTOCOLVERSION) _CASTMESSAGE_PAYLOADTYPE = _descriptor.EnumDescriptor( name='PayloadType', - full_name='extensions.api.cast_channel.CastMessage.PayloadType', + full_name='extensions.core_api.cast_channel.CastMessage.PayloadType', filename=None, file=DESCRIPTOR, values=[ @@ -51,13 +91,14 @@ ], containing_type=None, options=None, - serialized_start=370, - serialized_end=407, + serialized_start=385, + serialized_end=422, ) +_sym_db.RegisterEnumDescriptor(_CASTMESSAGE_PAYLOADTYPE) _AUTHERROR_ERRORTYPE = _descriptor.EnumDescriptor( name='ErrorType', - full_name='extensions.api.cast_channel.AuthError.ErrorType', + full_name='extensions.core_api.cast_channel.AuthError.ErrorType', filename=None, file=DESCRIPTOR, values=[ @@ -69,67 +110,72 @@ name='NO_TLS', index=1, number=1, options=None, type=None), + _descriptor.EnumValueDescriptor( + name='SIGNATURE_ALGORITHM_UNAVAILABLE', index=2, number=2, + options=None, + type=None), ], containing_type=None, options=None, - serialized_start=577, - serialized_end=620, + serialized_start=833, + serialized_end=913, ) +_sym_db.RegisterEnumDescriptor(_AUTHERROR_ERRORTYPE) _CASTMESSAGE = _descriptor.Descriptor( name='CastMessage', - full_name='extensions.api.cast_channel.CastMessage', + full_name='extensions.core_api.cast_channel.CastMessage', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( - name='protocol_version', full_name='extensions.api.cast_channel.CastMessage.protocol_version', index=0, + name='protocol_version', full_name='extensions.core_api.cast_channel.CastMessage.protocol_version', index=0, number=1, type=14, cpp_type=8, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( - name='source_id', full_name='extensions.api.cast_channel.CastMessage.source_id', index=1, + name='source_id', full_name='extensions.core_api.cast_channel.CastMessage.source_id', index=1, number=2, type=9, cpp_type=9, label=2, - has_default_value=False, default_value=unicode("", "utf-8"), + has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( - name='destination_id', full_name='extensions.api.cast_channel.CastMessage.destination_id', index=2, + name='destination_id', full_name='extensions.core_api.cast_channel.CastMessage.destination_id', index=2, number=3, type=9, cpp_type=9, label=2, - has_default_value=False, default_value=unicode("", "utf-8"), + has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( - name='namespace', full_name='extensions.api.cast_channel.CastMessage.namespace', index=3, + name='namespace', full_name='extensions.core_api.cast_channel.CastMessage.namespace', index=3, number=4, type=9, cpp_type=9, label=2, - has_default_value=False, default_value=unicode("", "utf-8"), + has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( - name='payload_type', full_name='extensions.api.cast_channel.CastMessage.payload_type', index=4, + name='payload_type', full_name='extensions.core_api.cast_channel.CastMessage.payload_type', index=4, number=5, type=14, cpp_type=8, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( - name='payload_utf8', full_name='extensions.api.cast_channel.CastMessage.payload_utf8', index=5, + name='payload_utf8', full_name='extensions.core_api.cast_channel.CastMessage.payload_utf8', index=5, number=6, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=unicode("", "utf-8"), + has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( - name='payload_binary', full_name='extensions.api.cast_channel.CastMessage.payload_binary', index=6, + name='payload_binary', full_name='extensions.core_api.cast_channel.CastMessage.payload_binary', index=6, number=7, type=12, cpp_type=9, label=1, - has_default_value=False, default_value="", + has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), @@ -143,19 +189,29 @@ ], options=None, is_extendable=False, + syntax='proto2', extension_ranges=[], - serialized_start=52, - serialized_end=407, + oneofs=[ + ], + serialized_start=57, + serialized_end=422, ) _AUTHCHALLENGE = _descriptor.Descriptor( name='AuthChallenge', - full_name='extensions.api.cast_channel.AuthChallenge', + full_name='extensions.core_api.cast_channel.AuthChallenge', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ + _descriptor.FieldDescriptor( + name='signature_algorithm', full_name='extensions.core_api.cast_channel.AuthChallenge.signature_algorithm', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=True, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), ], extensions=[ ], @@ -164,30 +220,47 @@ ], options=None, is_extendable=False, + syntax='proto2', extension_ranges=[], - serialized_start=409, - serialized_end=424, + oneofs=[ + ], + serialized_start=424, + serialized_end=539, ) _AUTHRESPONSE = _descriptor.Descriptor( name='AuthResponse', - full_name='extensions.api.cast_channel.AuthResponse', + full_name='extensions.core_api.cast_channel.AuthResponse', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( - name='signature', full_name='extensions.api.cast_channel.AuthResponse.signature', index=0, + name='signature', full_name='extensions.core_api.cast_channel.AuthResponse.signature', index=0, number=1, type=12, cpp_type=9, label=2, - has_default_value=False, default_value="", + has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( - name='client_auth_certificate', full_name='extensions.api.cast_channel.AuthResponse.client_auth_certificate', index=1, + name='client_auth_certificate', full_name='extensions.core_api.cast_channel.AuthResponse.client_auth_certificate', index=1, number=2, type=12, cpp_type=9, label=2, - has_default_value=False, default_value="", + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='intermediate_certificate', full_name='extensions.core_api.cast_channel.AuthResponse.intermediate_certificate', index=2, + number=3, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='signature_algorithm', full_name='extensions.core_api.cast_channel.AuthResponse.signature_algorithm', index=3, + number=4, type=14, cpp_type=8, label=1, + has_default_value=True, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), @@ -199,21 +272,24 @@ ], options=None, is_extendable=False, + syntax='proto2', extension_ranges=[], - serialized_start=426, - serialized_end=492, + oneofs=[ + ], + serialized_start=542, + serialized_end=742, ) _AUTHERROR = _descriptor.Descriptor( name='AuthError', - full_name='extensions.api.cast_channel.AuthError', + full_name='extensions.core_api.cast_channel.AuthError', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( - name='error_type', full_name='extensions.api.cast_channel.AuthError.error_type', index=0, + name='error_type', full_name='extensions.core_api.cast_channel.AuthError.error_type', index=0, number=1, type=14, cpp_type=8, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, @@ -228,35 +304,38 @@ ], options=None, is_extendable=False, + syntax='proto2', extension_ranges=[], - serialized_start=494, - serialized_end=620, + oneofs=[ + ], + serialized_start=745, + serialized_end=913, ) _DEVICEAUTHMESSAGE = _descriptor.Descriptor( name='DeviceAuthMessage', - full_name='extensions.api.cast_channel.DeviceAuthMessage', + full_name='extensions.core_api.cast_channel.DeviceAuthMessage', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( - name='challenge', full_name='extensions.api.cast_channel.DeviceAuthMessage.challenge', index=0, + name='challenge', full_name='extensions.core_api.cast_channel.DeviceAuthMessage.challenge', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( - name='response', full_name='extensions.api.cast_channel.DeviceAuthMessage.response', index=1, + name='response', full_name='extensions.core_api.cast_channel.DeviceAuthMessage.response', index=1, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( - name='error', full_name='extensions.api.cast_channel.DeviceAuthMessage.error', index=2, + name='error', full_name='extensions.core_api.cast_channel.DeviceAuthMessage.error', index=2, number=3, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -270,17 +349,22 @@ ], options=None, is_extendable=False, + syntax='proto2', extension_ranges=[], - serialized_start=623, - serialized_end=821, + oneofs=[ + ], + serialized_start=916, + serialized_end=1129, ) _CASTMESSAGE.fields_by_name['protocol_version'].enum_type = _CASTMESSAGE_PROTOCOLVERSION _CASTMESSAGE.fields_by_name['payload_type'].enum_type = _CASTMESSAGE_PAYLOADTYPE -_CASTMESSAGE_PROTOCOLVERSION.containing_type = _CASTMESSAGE; -_CASTMESSAGE_PAYLOADTYPE.containing_type = _CASTMESSAGE; +_CASTMESSAGE_PROTOCOLVERSION.containing_type = _CASTMESSAGE +_CASTMESSAGE_PAYLOADTYPE.containing_type = _CASTMESSAGE +_AUTHCHALLENGE.fields_by_name['signature_algorithm'].enum_type = _SIGNATUREALGORITHM +_AUTHRESPONSE.fields_by_name['signature_algorithm'].enum_type = _SIGNATUREALGORITHM _AUTHERROR.fields_by_name['error_type'].enum_type = _AUTHERROR_ERRORTYPE -_AUTHERROR_ERRORTYPE.containing_type = _AUTHERROR; +_AUTHERROR_ERRORTYPE.containing_type = _AUTHERROR _DEVICEAUTHMESSAGE.fields_by_name['challenge'].message_type = _AUTHCHALLENGE _DEVICEAUTHMESSAGE.fields_by_name['response'].message_type = _AUTHRESPONSE _DEVICEAUTHMESSAGE.fields_by_name['error'].message_type = _AUTHERROR @@ -289,38 +373,44 @@ DESCRIPTOR.message_types_by_name['AuthResponse'] = _AUTHRESPONSE DESCRIPTOR.message_types_by_name['AuthError'] = _AUTHERROR DESCRIPTOR.message_types_by_name['DeviceAuthMessage'] = _DEVICEAUTHMESSAGE - -class CastMessage(_message.Message): - __metaclass__ = _reflection.GeneratedProtocolMessageType - DESCRIPTOR = _CASTMESSAGE - - # @@protoc_insertion_point(class_scope:extensions.api.cast_channel.CastMessage) - -class AuthChallenge(_message.Message): - __metaclass__ = _reflection.GeneratedProtocolMessageType - DESCRIPTOR = _AUTHCHALLENGE - - # @@protoc_insertion_point(class_scope:extensions.api.cast_channel.AuthChallenge) - -class AuthResponse(_message.Message): - __metaclass__ = _reflection.GeneratedProtocolMessageType - DESCRIPTOR = _AUTHRESPONSE - - # @@protoc_insertion_point(class_scope:extensions.api.cast_channel.AuthResponse) - -class AuthError(_message.Message): - __metaclass__ = _reflection.GeneratedProtocolMessageType - DESCRIPTOR = _AUTHERROR - - # @@protoc_insertion_point(class_scope:extensions.api.cast_channel.AuthError) - -class DeviceAuthMessage(_message.Message): - __metaclass__ = _reflection.GeneratedProtocolMessageType - DESCRIPTOR = _DEVICEAUTHMESSAGE - - # @@protoc_insertion_point(class_scope:extensions.api.cast_channel.DeviceAuthMessage) +DESCRIPTOR.enum_types_by_name['SignatureAlgorithm'] = _SIGNATUREALGORITHM + +CastMessage = _reflection.GeneratedProtocolMessageType('CastMessage', (_message.Message,), dict( + DESCRIPTOR = _CASTMESSAGE, + __module__ = 'cast_channel_pb2' + # @@protoc_insertion_point(class_scope:extensions.core_api.cast_channel.CastMessage) + )) +_sym_db.RegisterMessage(CastMessage) + +AuthChallenge = _reflection.GeneratedProtocolMessageType('AuthChallenge', (_message.Message,), dict( + DESCRIPTOR = _AUTHCHALLENGE, + __module__ = 'cast_channel_pb2' + # @@protoc_insertion_point(class_scope:extensions.core_api.cast_channel.AuthChallenge) + )) +_sym_db.RegisterMessage(AuthChallenge) + +AuthResponse = _reflection.GeneratedProtocolMessageType('AuthResponse', (_message.Message,), dict( + DESCRIPTOR = _AUTHRESPONSE, + __module__ = 'cast_channel_pb2' + # @@protoc_insertion_point(class_scope:extensions.core_api.cast_channel.AuthResponse) + )) +_sym_db.RegisterMessage(AuthResponse) + +AuthError = _reflection.GeneratedProtocolMessageType('AuthError', (_message.Message,), dict( + DESCRIPTOR = _AUTHERROR, + __module__ = 'cast_channel_pb2' + # @@protoc_insertion_point(class_scope:extensions.core_api.cast_channel.AuthError) + )) +_sym_db.RegisterMessage(AuthError) + +DeviceAuthMessage = _reflection.GeneratedProtocolMessageType('DeviceAuthMessage', (_message.Message,), dict( + DESCRIPTOR = _DEVICEAUTHMESSAGE, + __module__ = 'cast_channel_pb2' + # @@protoc_insertion_point(class_scope:extensions.core_api.cast_channel.DeviceAuthMessage) + )) +_sym_db.RegisterMessage(DeviceAuthMessage) DESCRIPTOR.has_options = True -DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), 'H\003') +DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('H\003')) # @@protoc_insertion_point(module_scope) diff --git a/pychromecast/logging_pb2.py b/pychromecast/logging_pb2.py new file mode 100644 index 000000000..b0971da19 --- /dev/null +++ b/pychromecast/logging_pb2.py @@ -0,0 +1,809 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: logging.proto + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='logging.proto', + package='extensions.core_api.cast_channel.proto', + syntax='proto2', + serialized_pb=_b('\n\rlogging.proto\x12&extensions.core_api.cast_channel.proto\"\xa0\x05\n\x0bSocketEvent\x12?\n\x04type\x18\x01 \x01(\x0e\x32\x31.extensions.core_api.cast_channel.proto.EventType\x12\x18\n\x10timestamp_micros\x18\x02 \x01(\x03\x12\x0f\n\x07\x64\x65tails\x18\x03 \x01(\t\x12\x18\n\x10net_return_value\x18\x04 \x01(\x05\x12\x19\n\x11message_namespace\x18\x05 \x01(\t\x12G\n\x0bready_state\x18\x06 \x01(\x0e\x32\x32.extensions.core_api.cast_channel.proto.ReadyState\x12Q\n\x10\x63onnection_state\x18\x07 \x01(\x0e\x32\x37.extensions.core_api.cast_channel.proto.ConnectionState\x12\x45\n\nread_state\x18\x08 \x01(\x0e\x32\x31.extensions.core_api.cast_channel.proto.ReadState\x12G\n\x0bwrite_state\x18\t \x01(\x0e\x32\x32.extensions.core_api.cast_channel.proto.WriteState\x12G\n\x0b\x65rror_state\x18\n \x01(\x0e\x32\x32.extensions.core_api.cast_channel.proto.ErrorState\x12\x63\n\x1a\x63hallenge_reply_error_type\x18\x0b \x01(\x0e\x32?.extensions.core_api.cast_channel.proto.ChallengeReplyErrorType\x12\x16\n\x0enss_error_code\x18\x0c \x01(\x05\"\xfe\x01\n\x15\x41ggregatedSocketEvent\x12\n\n\x02id\x18\x01 \x01(\x05\x12\x13\n\x0b\x65ndpoint_id\x18\x02 \x01(\x05\x12N\n\x11\x63hannel_auth_type\x18\x03 \x01(\x0e\x32\x33.extensions.core_api.cast_channel.proto.ChannelAuth\x12I\n\x0csocket_event\x18\x04 \x03(\x0b\x32\x33.extensions.core_api.cast_channel.proto.SocketEvent\x12\x12\n\nbytes_read\x18\x05 \x01(\x03\x12\x15\n\rbytes_written\x18\x06 \x01(\x03\"\xb6\x01\n\x03Log\x12^\n\x17\x61ggregated_socket_event\x18\x01 \x03(\x0b\x32=.extensions.core_api.cast_channel.proto.AggregatedSocketEvent\x12,\n$num_evicted_aggregated_socket_events\x18\x02 \x01(\x05\x12!\n\x19num_evicted_socket_events\x18\x03 \x01(\x05*\xc0\x06\n\tEventType\x12\x16\n\x12\x45VENT_TYPE_UNKNOWN\x10\x00\x12\x17\n\x13\x43\x41ST_SOCKET_CREATED\x10\x01\x12\x17\n\x13READY_STATE_CHANGED\x10\x02\x12\x1c\n\x18\x43ONNECTION_STATE_CHANGED\x10\x03\x12\x16\n\x12READ_STATE_CHANGED\x10\x04\x12\x17\n\x13WRITE_STATE_CHANGED\x10\x05\x12\x17\n\x13\x45RROR_STATE_CHANGED\x10\x06\x12\x12\n\x0e\x43ONNECT_FAILED\x10\x07\x12\x16\n\x12TCP_SOCKET_CONNECT\x10\x08\x12\x1d\n\x19TCP_SOCKET_SET_KEEP_ALIVE\x10\t\x12\x18\n\x14SSL_CERT_WHITELISTED\x10\n\x12\x16\n\x12SSL_SOCKET_CONNECT\x10\x0b\x12\x15\n\x11SSL_INFO_OBTAINED\x10\x0c\x12\x1b\n\x17\x44\x45R_ENCODED_CERT_OBTAIN\x10\r\x12\x1c\n\x18RECEIVED_CHALLENGE_REPLY\x10\x0e\x12\x18\n\x14\x41UTH_CHALLENGE_REPLY\x10\x0f\x12\x15\n\x11\x43ONNECT_TIMED_OUT\x10\x10\x12\x17\n\x13SEND_MESSAGE_FAILED\x10\x11\x12\x14\n\x10MESSAGE_ENQUEUED\x10\x12\x12\x10\n\x0cSOCKET_WRITE\x10\x13\x12\x13\n\x0fMESSAGE_WRITTEN\x10\x14\x12\x0f\n\x0bSOCKET_READ\x10\x15\x12\x10\n\x0cMESSAGE_READ\x10\x16\x12\x11\n\rSOCKET_CLOSED\x10\x19\x12\x1f\n\x1bSSL_CERT_EXCESSIVE_LIFETIME\x10\x1a\x12\x1b\n\x17\x43HANNEL_POLICY_ENFORCED\x10\x1b\x12\x1f\n\x1bTCP_SOCKET_CONNECT_COMPLETE\x10\x1c\x12\x1f\n\x1bSSL_SOCKET_CONNECT_COMPLETE\x10\x1d\x12\x1d\n\x19SSL_SOCKET_CONNECT_FAILED\x10\x1e\x12\x1e\n\x1aSEND_AUTH_CHALLENGE_FAILED\x10\x1f\x12 \n\x1c\x41UTH_CHALLENGE_REPLY_INVALID\x10 \x12\x14\n\x10PING_WRITE_ERROR\x10!*(\n\x0b\x43hannelAuth\x12\x07\n\x03SSL\x10\x01\x12\x10\n\x0cSSL_VERIFIED\x10\x02*\x85\x01\n\nReadyState\x12\x14\n\x10READY_STATE_NONE\x10\x01\x12\x1a\n\x16READY_STATE_CONNECTING\x10\x02\x12\x14\n\x10READY_STATE_OPEN\x10\x03\x12\x17\n\x13READY_STATE_CLOSING\x10\x04\x12\x16\n\x12READY_STATE_CLOSED\x10\x05*\xa7\x02\n\x0f\x43onnectionState\x12\x13\n\x0f\x43ONN_STATE_NONE\x10\x01\x12\x1a\n\x16\x43ONN_STATE_TCP_CONNECT\x10\x02\x12#\n\x1f\x43ONN_STATE_TCP_CONNECT_COMPLETE\x10\x03\x12\x1a\n\x16\x43ONN_STATE_SSL_CONNECT\x10\x04\x12#\n\x1f\x43ONN_STATE_SSL_CONNECT_COMPLETE\x10\x05\x12\"\n\x1e\x43ONN_STATE_AUTH_CHALLENGE_SEND\x10\x06\x12+\n\'CONN_STATE_AUTH_CHALLENGE_SEND_COMPLETE\x10\x07\x12,\n(CONN_STATE_AUTH_CHALLENGE_REPLY_COMPLETE\x10\x08*\x85\x01\n\tReadState\x12\x13\n\x0fREAD_STATE_NONE\x10\x01\x12\x13\n\x0fREAD_STATE_READ\x10\x02\x12\x1c\n\x18READ_STATE_READ_COMPLETE\x10\x03\x12\x1a\n\x16READ_STATE_DO_CALLBACK\x10\x04\x12\x14\n\x10READ_STATE_ERROR\x10\x05*\x8d\x01\n\nWriteState\x12\x14\n\x10WRITE_STATE_NONE\x10\x01\x12\x15\n\x11WRITE_STATE_WRITE\x10\x02\x12\x1e\n\x1aWRITE_STATE_WRITE_COMPLETE\x10\x03\x12\x1b\n\x17WRITE_STATE_DO_CALLBACK\x10\x04\x12\x15\n\x11WRITE_STATE_ERROR\x10\x05*\xdb\x02\n\nErrorState\x12\x16\n\x12\x43HANNEL_ERROR_NONE\x10\x01\x12\"\n\x1e\x43HANNEL_ERROR_CHANNEL_NOT_OPEN\x10\x02\x12&\n\"CHANNEL_ERROR_AUTHENTICATION_ERROR\x10\x03\x12\x1f\n\x1b\x43HANNEL_ERROR_CONNECT_ERROR\x10\x04\x12\x1e\n\x1a\x43HANNEL_ERROR_SOCKET_ERROR\x10\x05\x12!\n\x1d\x43HANNEL_ERROR_TRANSPORT_ERROR\x10\x06\x12!\n\x1d\x43HANNEL_ERROR_INVALID_MESSAGE\x10\x07\x12$\n CHANNEL_ERROR_INVALID_CHANNEL_ID\x10\x08\x12!\n\x1d\x43HANNEL_ERROR_CONNECT_TIMEOUT\x10\t\x12\x19\n\x15\x43HANNEL_ERROR_UNKNOWN\x10\n*\xb9\x04\n\x17\x43hallengeReplyErrorType\x12\x1e\n\x1a\x43HALLENGE_REPLY_ERROR_NONE\x10\x01\x12)\n%CHALLENGE_REPLY_ERROR_PEER_CERT_EMPTY\x10\x02\x12,\n(CHALLENGE_REPLY_ERROR_WRONG_PAYLOAD_TYPE\x10\x03\x12$\n CHALLENGE_REPLY_ERROR_NO_PAYLOAD\x10\x04\x12\x30\n,CHALLENGE_REPLY_ERROR_PAYLOAD_PARSING_FAILED\x10\x05\x12\'\n#CHALLENGE_REPLY_ERROR_MESSAGE_ERROR\x10\x06\x12%\n!CHALLENGE_REPLY_ERROR_NO_RESPONSE\x10\x07\x12/\n+CHALLENGE_REPLY_ERROR_FINGERPRINT_NOT_FOUND\x10\x08\x12-\n)CHALLENGE_REPLY_ERROR_CERT_PARSING_FAILED\x10\t\x12\x37\n3CHALLENGE_REPLY_ERROR_CERT_NOT_SIGNED_BY_TRUSTED_CA\x10\n\x12\x33\n/CHALLENGE_REPLY_ERROR_CANNOT_EXTRACT_PUBLIC_KEY\x10\x0b\x12/\n+CHALLENGE_REPLY_ERROR_SIGNED_BLOBS_MISMATCH\x10\x0c\x42\x02H\x03') +) +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +_EVENTTYPE = _descriptor.EnumDescriptor( + name='EventType', + full_name='extensions.core_api.cast_channel.proto.EventType', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='EVENT_TYPE_UNKNOWN', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CAST_SOCKET_CREATED', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='READY_STATE_CHANGED', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CONNECTION_STATE_CHANGED', index=3, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='READ_STATE_CHANGED', index=4, number=4, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='WRITE_STATE_CHANGED', index=5, number=5, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ERROR_STATE_CHANGED', index=6, number=6, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CONNECT_FAILED', index=7, number=7, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='TCP_SOCKET_CONNECT', index=8, number=8, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='TCP_SOCKET_SET_KEEP_ALIVE', index=9, number=9, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SSL_CERT_WHITELISTED', index=10, number=10, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SSL_SOCKET_CONNECT', index=11, number=11, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SSL_INFO_OBTAINED', index=12, number=12, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DER_ENCODED_CERT_OBTAIN', index=13, number=13, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='RECEIVED_CHALLENGE_REPLY', index=14, number=14, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='AUTH_CHALLENGE_REPLY', index=15, number=15, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CONNECT_TIMED_OUT', index=16, number=16, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SEND_MESSAGE_FAILED', index=17, number=17, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='MESSAGE_ENQUEUED', index=18, number=18, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SOCKET_WRITE', index=19, number=19, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='MESSAGE_WRITTEN', index=20, number=20, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SOCKET_READ', index=21, number=21, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='MESSAGE_READ', index=22, number=22, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SOCKET_CLOSED', index=23, number=25, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SSL_CERT_EXCESSIVE_LIFETIME', index=24, number=26, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CHANNEL_POLICY_ENFORCED', index=25, number=27, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='TCP_SOCKET_CONNECT_COMPLETE', index=26, number=28, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SSL_SOCKET_CONNECT_COMPLETE', index=27, number=29, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SSL_SOCKET_CONNECT_FAILED', index=28, number=30, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SEND_AUTH_CHALLENGE_FAILED', index=29, number=31, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='AUTH_CHALLENGE_REPLY_INVALID', index=30, number=32, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='PING_WRITE_ERROR', index=31, number=33, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=1175, + serialized_end=2007, +) +_sym_db.RegisterEnumDescriptor(_EVENTTYPE) + +EventType = enum_type_wrapper.EnumTypeWrapper(_EVENTTYPE) +_CHANNELAUTH = _descriptor.EnumDescriptor( + name='ChannelAuth', + full_name='extensions.core_api.cast_channel.proto.ChannelAuth', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='SSL', index=0, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SSL_VERIFIED', index=1, number=2, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=2009, + serialized_end=2049, +) +_sym_db.RegisterEnumDescriptor(_CHANNELAUTH) + +ChannelAuth = enum_type_wrapper.EnumTypeWrapper(_CHANNELAUTH) +_READYSTATE = _descriptor.EnumDescriptor( + name='ReadyState', + full_name='extensions.core_api.cast_channel.proto.ReadyState', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='READY_STATE_NONE', index=0, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='READY_STATE_CONNECTING', index=1, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='READY_STATE_OPEN', index=2, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='READY_STATE_CLOSING', index=3, number=4, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='READY_STATE_CLOSED', index=4, number=5, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=2052, + serialized_end=2185, +) +_sym_db.RegisterEnumDescriptor(_READYSTATE) + +ReadyState = enum_type_wrapper.EnumTypeWrapper(_READYSTATE) +_CONNECTIONSTATE = _descriptor.EnumDescriptor( + name='ConnectionState', + full_name='extensions.core_api.cast_channel.proto.ConnectionState', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='CONN_STATE_NONE', index=0, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CONN_STATE_TCP_CONNECT', index=1, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CONN_STATE_TCP_CONNECT_COMPLETE', index=2, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CONN_STATE_SSL_CONNECT', index=3, number=4, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CONN_STATE_SSL_CONNECT_COMPLETE', index=4, number=5, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CONN_STATE_AUTH_CHALLENGE_SEND', index=5, number=6, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CONN_STATE_AUTH_CHALLENGE_SEND_COMPLETE', index=6, number=7, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CONN_STATE_AUTH_CHALLENGE_REPLY_COMPLETE', index=7, number=8, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=2188, + serialized_end=2483, +) +_sym_db.RegisterEnumDescriptor(_CONNECTIONSTATE) + +ConnectionState = enum_type_wrapper.EnumTypeWrapper(_CONNECTIONSTATE) +_READSTATE = _descriptor.EnumDescriptor( + name='ReadState', + full_name='extensions.core_api.cast_channel.proto.ReadState', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='READ_STATE_NONE', index=0, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='READ_STATE_READ', index=1, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='READ_STATE_READ_COMPLETE', index=2, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='READ_STATE_DO_CALLBACK', index=3, number=4, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='READ_STATE_ERROR', index=4, number=5, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=2486, + serialized_end=2619, +) +_sym_db.RegisterEnumDescriptor(_READSTATE) + +ReadState = enum_type_wrapper.EnumTypeWrapper(_READSTATE) +_WRITESTATE = _descriptor.EnumDescriptor( + name='WriteState', + full_name='extensions.core_api.cast_channel.proto.WriteState', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='WRITE_STATE_NONE', index=0, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='WRITE_STATE_WRITE', index=1, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='WRITE_STATE_WRITE_COMPLETE', index=2, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='WRITE_STATE_DO_CALLBACK', index=3, number=4, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='WRITE_STATE_ERROR', index=4, number=5, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=2622, + serialized_end=2763, +) +_sym_db.RegisterEnumDescriptor(_WRITESTATE) + +WriteState = enum_type_wrapper.EnumTypeWrapper(_WRITESTATE) +_ERRORSTATE = _descriptor.EnumDescriptor( + name='ErrorState', + full_name='extensions.core_api.cast_channel.proto.ErrorState', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='CHANNEL_ERROR_NONE', index=0, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CHANNEL_ERROR_CHANNEL_NOT_OPEN', index=1, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CHANNEL_ERROR_AUTHENTICATION_ERROR', index=2, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CHANNEL_ERROR_CONNECT_ERROR', index=3, number=4, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CHANNEL_ERROR_SOCKET_ERROR', index=4, number=5, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CHANNEL_ERROR_TRANSPORT_ERROR', index=5, number=6, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CHANNEL_ERROR_INVALID_MESSAGE', index=6, number=7, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CHANNEL_ERROR_INVALID_CHANNEL_ID', index=7, number=8, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CHANNEL_ERROR_CONNECT_TIMEOUT', index=8, number=9, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CHANNEL_ERROR_UNKNOWN', index=9, number=10, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=2766, + serialized_end=3113, +) +_sym_db.RegisterEnumDescriptor(_ERRORSTATE) + +ErrorState = enum_type_wrapper.EnumTypeWrapper(_ERRORSTATE) +_CHALLENGEREPLYERRORTYPE = _descriptor.EnumDescriptor( + name='ChallengeReplyErrorType', + full_name='extensions.core_api.cast_channel.proto.ChallengeReplyErrorType', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='CHALLENGE_REPLY_ERROR_NONE', index=0, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CHALLENGE_REPLY_ERROR_PEER_CERT_EMPTY', index=1, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CHALLENGE_REPLY_ERROR_WRONG_PAYLOAD_TYPE', index=2, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CHALLENGE_REPLY_ERROR_NO_PAYLOAD', index=3, number=4, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CHALLENGE_REPLY_ERROR_PAYLOAD_PARSING_FAILED', index=4, number=5, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CHALLENGE_REPLY_ERROR_MESSAGE_ERROR', index=5, number=6, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CHALLENGE_REPLY_ERROR_NO_RESPONSE', index=6, number=7, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CHALLENGE_REPLY_ERROR_FINGERPRINT_NOT_FOUND', index=7, number=8, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CHALLENGE_REPLY_ERROR_CERT_PARSING_FAILED', index=8, number=9, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CHALLENGE_REPLY_ERROR_CERT_NOT_SIGNED_BY_TRUSTED_CA', index=9, number=10, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CHALLENGE_REPLY_ERROR_CANNOT_EXTRACT_PUBLIC_KEY', index=10, number=11, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CHALLENGE_REPLY_ERROR_SIGNED_BLOBS_MISMATCH', index=11, number=12, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=3116, + serialized_end=3685, +) +_sym_db.RegisterEnumDescriptor(_CHALLENGEREPLYERRORTYPE) + +ChallengeReplyErrorType = enum_type_wrapper.EnumTypeWrapper(_CHALLENGEREPLYERRORTYPE) +EVENT_TYPE_UNKNOWN = 0 +CAST_SOCKET_CREATED = 1 +READY_STATE_CHANGED = 2 +CONNECTION_STATE_CHANGED = 3 +READ_STATE_CHANGED = 4 +WRITE_STATE_CHANGED = 5 +ERROR_STATE_CHANGED = 6 +CONNECT_FAILED = 7 +TCP_SOCKET_CONNECT = 8 +TCP_SOCKET_SET_KEEP_ALIVE = 9 +SSL_CERT_WHITELISTED = 10 +SSL_SOCKET_CONNECT = 11 +SSL_INFO_OBTAINED = 12 +DER_ENCODED_CERT_OBTAIN = 13 +RECEIVED_CHALLENGE_REPLY = 14 +AUTH_CHALLENGE_REPLY = 15 +CONNECT_TIMED_OUT = 16 +SEND_MESSAGE_FAILED = 17 +MESSAGE_ENQUEUED = 18 +SOCKET_WRITE = 19 +MESSAGE_WRITTEN = 20 +SOCKET_READ = 21 +MESSAGE_READ = 22 +SOCKET_CLOSED = 25 +SSL_CERT_EXCESSIVE_LIFETIME = 26 +CHANNEL_POLICY_ENFORCED = 27 +TCP_SOCKET_CONNECT_COMPLETE = 28 +SSL_SOCKET_CONNECT_COMPLETE = 29 +SSL_SOCKET_CONNECT_FAILED = 30 +SEND_AUTH_CHALLENGE_FAILED = 31 +AUTH_CHALLENGE_REPLY_INVALID = 32 +PING_WRITE_ERROR = 33 +SSL = 1 +SSL_VERIFIED = 2 +READY_STATE_NONE = 1 +READY_STATE_CONNECTING = 2 +READY_STATE_OPEN = 3 +READY_STATE_CLOSING = 4 +READY_STATE_CLOSED = 5 +CONN_STATE_NONE = 1 +CONN_STATE_TCP_CONNECT = 2 +CONN_STATE_TCP_CONNECT_COMPLETE = 3 +CONN_STATE_SSL_CONNECT = 4 +CONN_STATE_SSL_CONNECT_COMPLETE = 5 +CONN_STATE_AUTH_CHALLENGE_SEND = 6 +CONN_STATE_AUTH_CHALLENGE_SEND_COMPLETE = 7 +CONN_STATE_AUTH_CHALLENGE_REPLY_COMPLETE = 8 +READ_STATE_NONE = 1 +READ_STATE_READ = 2 +READ_STATE_READ_COMPLETE = 3 +READ_STATE_DO_CALLBACK = 4 +READ_STATE_ERROR = 5 +WRITE_STATE_NONE = 1 +WRITE_STATE_WRITE = 2 +WRITE_STATE_WRITE_COMPLETE = 3 +WRITE_STATE_DO_CALLBACK = 4 +WRITE_STATE_ERROR = 5 +CHANNEL_ERROR_NONE = 1 +CHANNEL_ERROR_CHANNEL_NOT_OPEN = 2 +CHANNEL_ERROR_AUTHENTICATION_ERROR = 3 +CHANNEL_ERROR_CONNECT_ERROR = 4 +CHANNEL_ERROR_SOCKET_ERROR = 5 +CHANNEL_ERROR_TRANSPORT_ERROR = 6 +CHANNEL_ERROR_INVALID_MESSAGE = 7 +CHANNEL_ERROR_INVALID_CHANNEL_ID = 8 +CHANNEL_ERROR_CONNECT_TIMEOUT = 9 +CHANNEL_ERROR_UNKNOWN = 10 +CHALLENGE_REPLY_ERROR_NONE = 1 +CHALLENGE_REPLY_ERROR_PEER_CERT_EMPTY = 2 +CHALLENGE_REPLY_ERROR_WRONG_PAYLOAD_TYPE = 3 +CHALLENGE_REPLY_ERROR_NO_PAYLOAD = 4 +CHALLENGE_REPLY_ERROR_PAYLOAD_PARSING_FAILED = 5 +CHALLENGE_REPLY_ERROR_MESSAGE_ERROR = 6 +CHALLENGE_REPLY_ERROR_NO_RESPONSE = 7 +CHALLENGE_REPLY_ERROR_FINGERPRINT_NOT_FOUND = 8 +CHALLENGE_REPLY_ERROR_CERT_PARSING_FAILED = 9 +CHALLENGE_REPLY_ERROR_CERT_NOT_SIGNED_BY_TRUSTED_CA = 10 +CHALLENGE_REPLY_ERROR_CANNOT_EXTRACT_PUBLIC_KEY = 11 +CHALLENGE_REPLY_ERROR_SIGNED_BLOBS_MISMATCH = 12 + + + +_SOCKETEVENT = _descriptor.Descriptor( + name='SocketEvent', + full_name='extensions.core_api.cast_channel.proto.SocketEvent', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='type', full_name='extensions.core_api.cast_channel.proto.SocketEvent.type', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='timestamp_micros', full_name='extensions.core_api.cast_channel.proto.SocketEvent.timestamp_micros', index=1, + number=2, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='details', full_name='extensions.core_api.cast_channel.proto.SocketEvent.details', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='net_return_value', full_name='extensions.core_api.cast_channel.proto.SocketEvent.net_return_value', index=3, + number=4, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='message_namespace', full_name='extensions.core_api.cast_channel.proto.SocketEvent.message_namespace', index=4, + number=5, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='ready_state', full_name='extensions.core_api.cast_channel.proto.SocketEvent.ready_state', index=5, + number=6, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='connection_state', full_name='extensions.core_api.cast_channel.proto.SocketEvent.connection_state', index=6, + number=7, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='read_state', full_name='extensions.core_api.cast_channel.proto.SocketEvent.read_state', index=7, + number=8, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='write_state', full_name='extensions.core_api.cast_channel.proto.SocketEvent.write_state', index=8, + number=9, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='error_state', full_name='extensions.core_api.cast_channel.proto.SocketEvent.error_state', index=9, + number=10, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='challenge_reply_error_type', full_name='extensions.core_api.cast_channel.proto.SocketEvent.challenge_reply_error_type', index=10, + number=11, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='nss_error_code', full_name='extensions.core_api.cast_channel.proto.SocketEvent.nss_error_code', index=11, + number=12, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=58, + serialized_end=730, +) + + +_AGGREGATEDSOCKETEVENT = _descriptor.Descriptor( + name='AggregatedSocketEvent', + full_name='extensions.core_api.cast_channel.proto.AggregatedSocketEvent', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='id', full_name='extensions.core_api.cast_channel.proto.AggregatedSocketEvent.id', index=0, + number=1, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='endpoint_id', full_name='extensions.core_api.cast_channel.proto.AggregatedSocketEvent.endpoint_id', index=1, + number=2, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='channel_auth_type', full_name='extensions.core_api.cast_channel.proto.AggregatedSocketEvent.channel_auth_type', index=2, + number=3, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=1, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='socket_event', full_name='extensions.core_api.cast_channel.proto.AggregatedSocketEvent.socket_event', index=3, + number=4, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='bytes_read', full_name='extensions.core_api.cast_channel.proto.AggregatedSocketEvent.bytes_read', index=4, + number=5, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='bytes_written', full_name='extensions.core_api.cast_channel.proto.AggregatedSocketEvent.bytes_written', index=5, + number=6, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=733, + serialized_end=987, +) + + +_LOG = _descriptor.Descriptor( + name='Log', + full_name='extensions.core_api.cast_channel.proto.Log', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='aggregated_socket_event', full_name='extensions.core_api.cast_channel.proto.Log.aggregated_socket_event', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='num_evicted_aggregated_socket_events', full_name='extensions.core_api.cast_channel.proto.Log.num_evicted_aggregated_socket_events', index=1, + number=2, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='num_evicted_socket_events', full_name='extensions.core_api.cast_channel.proto.Log.num_evicted_socket_events', index=2, + number=3, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=990, + serialized_end=1172, +) + +_SOCKETEVENT.fields_by_name['type'].enum_type = _EVENTTYPE +_SOCKETEVENT.fields_by_name['ready_state'].enum_type = _READYSTATE +_SOCKETEVENT.fields_by_name['connection_state'].enum_type = _CONNECTIONSTATE +_SOCKETEVENT.fields_by_name['read_state'].enum_type = _READSTATE +_SOCKETEVENT.fields_by_name['write_state'].enum_type = _WRITESTATE +_SOCKETEVENT.fields_by_name['error_state'].enum_type = _ERRORSTATE +_SOCKETEVENT.fields_by_name['challenge_reply_error_type'].enum_type = _CHALLENGEREPLYERRORTYPE +_AGGREGATEDSOCKETEVENT.fields_by_name['channel_auth_type'].enum_type = _CHANNELAUTH +_AGGREGATEDSOCKETEVENT.fields_by_name['socket_event'].message_type = _SOCKETEVENT +_LOG.fields_by_name['aggregated_socket_event'].message_type = _AGGREGATEDSOCKETEVENT +DESCRIPTOR.message_types_by_name['SocketEvent'] = _SOCKETEVENT +DESCRIPTOR.message_types_by_name['AggregatedSocketEvent'] = _AGGREGATEDSOCKETEVENT +DESCRIPTOR.message_types_by_name['Log'] = _LOG +DESCRIPTOR.enum_types_by_name['EventType'] = _EVENTTYPE +DESCRIPTOR.enum_types_by_name['ChannelAuth'] = _CHANNELAUTH +DESCRIPTOR.enum_types_by_name['ReadyState'] = _READYSTATE +DESCRIPTOR.enum_types_by_name['ConnectionState'] = _CONNECTIONSTATE +DESCRIPTOR.enum_types_by_name['ReadState'] = _READSTATE +DESCRIPTOR.enum_types_by_name['WriteState'] = _WRITESTATE +DESCRIPTOR.enum_types_by_name['ErrorState'] = _ERRORSTATE +DESCRIPTOR.enum_types_by_name['ChallengeReplyErrorType'] = _CHALLENGEREPLYERRORTYPE + +SocketEvent = _reflection.GeneratedProtocolMessageType('SocketEvent', (_message.Message,), dict( + DESCRIPTOR = _SOCKETEVENT, + __module__ = 'logging_pb2' + # @@protoc_insertion_point(class_scope:extensions.core_api.cast_channel.proto.SocketEvent) + )) +_sym_db.RegisterMessage(SocketEvent) + +AggregatedSocketEvent = _reflection.GeneratedProtocolMessageType('AggregatedSocketEvent', (_message.Message,), dict( + DESCRIPTOR = _AGGREGATEDSOCKETEVENT, + __module__ = 'logging_pb2' + # @@protoc_insertion_point(class_scope:extensions.core_api.cast_channel.proto.AggregatedSocketEvent) + )) +_sym_db.RegisterMessage(AggregatedSocketEvent) + +Log = _reflection.GeneratedProtocolMessageType('Log', (_message.Message,), dict( + DESCRIPTOR = _LOG, + __module__ = 'logging_pb2' + # @@protoc_insertion_point(class_scope:extensions.core_api.cast_channel.proto.Log) + )) +_sym_db.RegisterMessage(Log) + + +DESCRIPTOR.has_options = True +DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('H\003')) +# @@protoc_insertion_point(module_scope) diff --git a/pychromecast/socket_client.py b/pychromecast/socket_client.py index 5d530d894..0dd8baa44 100644 --- a/pychromecast/socket_client.py +++ b/pychromecast/socket_client.py @@ -232,7 +232,7 @@ def run(self): if not handled: self.logger.warning("Message unhandled: {}".format( _message_to_string(message, data))) - except Exception, e: + except Exception as e: self.logger.exception(u"Exception {} caught while sending message to controller {}: {}".format( e, type(self._handlers[message.namespace]).__name__, _message_to_string(message, data))) @@ -262,22 +262,25 @@ def run(self): self.socket.close() + def _read_bytes_from_socket(self, msglen): + chunks = [] + bytes_recd = 0 + while bytes_recd < msglen: + chunk = self.socket.recv(min(msglen - bytes_recd, 2048)) + if chunk == b'': + raise RuntimeError("socket connection broken") + chunks.append(chunk) + bytes_recd += len(chunk) + return b''.join(chunks) + def _read_message(self): """ Reads a message from the socket and converts it to a message. """ # first 4 bytes is Big-Endian payload length - payload_info = "" - - while len(payload_info) < 4: - frag = self.socket.recv(1) - payload_info += frag - + payload_info = self._read_bytes_from_socket(4); read_len = unpack(">I", payload_info)[0] # now read the payload - payload = "" - while len(payload) < read_len: - frag = self.socket.recv(2048) - payload += frag + payload = self._read_bytes_from_socket(read_len); # pylint: disable=no-member message = cast_channel_pb2.CastMessage() diff --git a/requirements.txt b/requirements.txt index f58cf9a2e..8926f0f0b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ requests>=2.0 -protobuf>=2.5.0 +protobuf>=3.0.0a2 zeroconf>=0.16.0 From a9f798d3cc25f9d69b6e5aaaaf362a7567d57793 Mon Sep 17 00:00:00 2001 From: Hans Bakker Date: Thu, 28 May 2015 23:25:12 +0200 Subject: [PATCH 2/2] Exclude generated protobuf files from pylint --- pylintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pylintrc b/pylintrc index 0a2af07f8..75ea7175e 100644 --- a/pylintrc +++ b/pylintrc @@ -1,5 +1,5 @@ [MASTER] -ignore=cast_channel_pb2.py +ignore=cast_channel_pb2.py,authority_keys_pb2.py,logging_pb2.py reports=no disable=locally-disabled