diff --git a/Cargo.lock b/Cargo.lock index 6e543caca..6a2c54bf8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -22,9 +22,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.68" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" +checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" [[package]] name = "autocfg" @@ -46,9 +46,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cc" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] name = "cfg-if" @@ -70,9 +70,9 @@ dependencies = [ [[package]] name = "either" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "env_logger" @@ -110,13 +110,25 @@ dependencies = [ [[package]] name = "fastrand" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" dependencies = [ "instant", ] +[[package]] +name = "flume" +version = "0.10.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" +dependencies = [ + "futures-core", + "futures-sink", + "pin-project", + "spin", +] + [[package]] name = "foreign-types" version = "0.3.2" @@ -132,6 +144,18 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +[[package]] +name = "futures-core" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" + +[[package]] +name = "futures-sink" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" + [[package]] name = "hashbrown" version = "0.12.3" @@ -140,12 +164,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hermit-abi" -version = "0.2.6" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" [[package]] name = "humantime" @@ -153,6 +174,16 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +[[package]] +name = "if-addrs" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbc0fa01ffc752e9dbc72818cdb072cd028b86be5e09dd04c5a643704fe101a9" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "indexmap" version = "1.9.2" @@ -174,31 +205,31 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e" +checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] name = "is-terminal" -version = "0.4.2" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" +checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857" dependencies = [ "hermit-abi", "io-lifetimes", "rustix", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] name = "itoa" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" +checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" [[package]] name = "lazy_static" @@ -218,6 +249,16 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" +[[package]] +name = "lock_api" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +dependencies = [ + "autocfg", + "scopeguard", +] + [[package]] name = "log" version = "0.4.17" @@ -227,6 +268,19 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "mdns-sd" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2654de111809d3593653cdfde4d05b6f189ce18cec8cf0660908d93f746a43a" +dependencies = [ + "flume", + "if-addrs", + "log", + "polling", + "socket2", +] + [[package]] name = "memchr" version = "2.5.0" @@ -235,9 +289,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "once_cell" -version = "1.17.0" +version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "openssl" @@ -278,17 +332,51 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "pin-project" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "pkg-config" version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +[[package]] +name = "polling" +version = "2.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22122d5ec4f9fe1b3916419b76be1e80bcb93f618d071d2edf841b137b2a2bd6" +dependencies = [ + "autocfg", + "cfg-if", + "libc", + "log", + "wepoll-ffi", + "windows-sys 0.42.0", +] + [[package]] name = "proc-macro2" -version = "1.0.49" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" +checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" dependencies = [ "unicode-ident", ] @@ -379,15 +467,6 @@ version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - [[package]] name = "rust_cast" version = "0.18.1" @@ -397,33 +476,39 @@ dependencies = [ "docopt", "env_logger", "log", + "mdns-sd", "openssl", "protobuf", "protobuf-codegen", "serde", - "serde_derive", "serde_json", ] [[package]] name = "rustix" -version = "0.36.6" +version = "0.36.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4feacf7db682c6c329c4ede12649cd36ecab0f3be5b7d74e6a20304725db4549" +checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc" dependencies = [ "bitflags", "errno", "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] name = "ryu" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" +checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "serde" @@ -447,15 +532,34 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.91" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" +checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76" dependencies = [ "itoa", "ryu", "serde", ] +[[package]] +name = "socket2" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "spin" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dccf47db1b41fa1573ed27ccf5e08e3ca771cb994f776668c5ebda893b248fc" +dependencies = [ + "lock_api", +] + [[package]] name = "strsim" version = "0.10.0" @@ -464,9 +568,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" -version = "1.0.107" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", @@ -475,23 +579,22 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95" dependencies = [ "cfg-if", "fastrand", - "libc", "redox_syscall", - "remove_dir_all", - "winapi", + "rustix", + "windows-sys 0.42.0", ] [[package]] name = "termcolor" -version = "1.1.3" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" dependencies = [ "winapi-util", ] @@ -518,9 +621,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" +checksum = "775c11906edafc97bc378816b94585fbd9a054eabaf86fdd0ced94af449efab7" [[package]] name = "vcpkg" @@ -528,11 +631,20 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" +[[package]] +name = "wepoll-ffi" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb" +dependencies = [ + "cc", +] + [[package]] name = "which" -version = "4.3.0" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b" +checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" dependencies = [ "either", "libc", @@ -585,6 +697,30 @@ dependencies = [ "windows_x86_64_msvc", ] +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.1" diff --git a/Cargo.toml b/Cargo.toml index 08a577e71..f962e8e25 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,17 +22,17 @@ byteorder = "1.4.3" log = "0.4.17" openssl = "0.10.45" protobuf = "=3.2.0" -serde = "1.0.152" -serde_derive = "1.0.152" -serde_json = "1.0.91" +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0.93" [dev-dependencies] ansi_term = "0.12.1" docopt = "1.1.1" env_logger = "0.10.0" +mdns-sd = "0.6.1" [build-dependencies] protobuf-codegen = "=3.2.0" [features] -thread_safe = [] +thread_safe = [] \ No newline at end of file diff --git a/README.md b/README.md index c7c6d1626..e04f09936 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,14 @@ ![Build Status](https://github.com/azasypkin/rust-cast/actions/workflows/ci.yml/badge.svg) # Usage + * [Documentation](https://docs.rs/crate/rust_cast/) -* Try out [Rust Caster](./examples/rust_caster.rs) example to see this crate in action! +* Try out [Rust Caster](examples/rust_caster.rs) example to see this crate in action! # Build -Proto files are taken from [Chromium Open Screen GitHub mirror](https://chromium.googlesource.com/openscreen/+/8cce349b0a595ddf7178d5730e980ace3a1d1a53/cast/common/channel/proto). +Proto files are taken +from [Chromium Open Screen GitHub mirror](https://chromium.googlesource.com/openscreen/+/8cce349b0a595ddf7178d5730e980ace3a1d1a53/cast/common/channel/proto). By default `cargo build` won't try to generate Rust code from the files located at `protobuf/*`, if you want to do that use `GENERATE_PROTO` environment variable during build and make sure you have `protoc` binary in `$PATH`: @@ -20,7 +22,9 @@ $ GENERATE_PROTO=true cargo build ## Generic features -First, you need to figure out the address of the device to connect to. For example, you can use `avahi` with the following command: +First, you need to figure out the address of the device to connect to. For example, you can use `avahi` with the +following command: + ```bash $ avahi-browse -a --resolve ``` @@ -47,9 +51,10 @@ The following app has been stopped: Default Media Receiver (CC1AD845) ``` ## Media features + ```bash // Stream a video. -$ cargo run --example rust_caster -- -a 192.168.0.100 -m http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4 +$ cargo run --example rust_caster -- -a 192.168.0.100 -m https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4 // Stream a video of specific format with buffering. $ cargo run --example rust_caster -- -a 192.168.0.100 -m http://xxx.webm --media-type video/webm --media-stream-type buffered @@ -76,15 +81,16 @@ $ cargo run --example rust_caster -- -a 192.168.0.100 --media-app youtube --medi $ cargo run --example rust_caster -- -a 192.168.0.100 --media-app youtube --media-seek 100 ``` -For all possible values of `--media-type` see [Supported Media for Google Cast](https://developers.google.com/cast/docs/media). +For all possible values of `--media-type` +see [Supported Media for Google Cast](https://developers.google.com/cast/docs/media). # DNS TXT Record description * `md` - Model Name (e.g. "Chromecast"); * `id` - UUID without hyphens of the particular device (e.g. xx12x3x456xx789xx01xx234x56789x0); -* `fn` - Friendly Name of the device (e.g. "Living Room"); +* `fn` - Friendly Name of the device (e.g. "Living Room"); * `rs` - Unknown (recent share???) (e.g. "Youtube TV"); -* `bs` - Uknonwn (e.g. "XX1XXX2X3456"); +* `bs` - Unknown (e.g. "XX1XXX2X3456"); * `st` - Unknown (e.g. "1"); * `ca` - Unknown (e.g. "1234"); * `ic` - Icon path (e.g. "/setup/icon.png"); diff --git a/examples/rust_caster.rs b/examples/rust_caster.rs index 67a318299..ff24dfadd 100644 --- a/examples/rust_caster.rs +++ b/examples/rust_caster.rs @@ -1,18 +1,10 @@ -extern crate ansi_term; -extern crate docopt; -extern crate env_logger; -#[macro_use] -extern crate log; -extern crate rust_cast; -extern crate serde; -#[macro_use] -extern crate serde_derive; - use std::str::FromStr; use ansi_term::Colour::{Green, Red}; - use docopt::Docopt; +use log::error; +use mdns_sd::{ServiceDaemon, ServiceEvent}; +use serde::Deserialize; use rust_cast::{ channels::{ @@ -23,6 +15,7 @@ use rust_cast::{ CastDevice, ChannelMessage, }; +const SERVICE_TYPE: &str = "_googlecast._tcp.local."; const DEFAULT_DESTINATION_ID: &str = "receiver-0"; const USAGE: &str = " @@ -264,6 +257,46 @@ fn play_media( } } +fn discover() -> Option<(String, u16)> { + let mdns = ServiceDaemon::new().expect("Failed to create mDNS daemon."); + + let receiver = mdns + .browse(SERVICE_TYPE) + .expect("Failed to browse mDNS services."); + + while let Ok(event) = receiver.recv() { + match event { + ServiceEvent::ServiceResolved(info) => { + let mut addresses = info + .get_addresses() + .iter() + .map(|address| address.to_string()) + .collect::>(); + println!( + "{}{}", + Green.paint("Resolved a new service: "), + Red.paint(format!( + "{} ({})", + info.get_fullname(), + addresses.join(", ") + )) + ); + + // Based on mDNS crate code we should have at least one address available. + return Some((addresses.remove(0), info.get_port())); + } + other_event => { + println!( + "{}{}", + Green.paint("Received other service event: "), + Red.paint(format!("{:?}", other_event)) + ); + } + } + } + None +} + fn main() { env_logger::init(); @@ -271,15 +304,18 @@ fn main() { .and_then(|d| d.deserialize()) .unwrap_or_else(|e| e.exit()); - if args.flag_address.is_none() { - println!("Please specify Cast Device address!"); - std::process::exit(1); - } + let (address, port) = match args.flag_address { + Some(address) => (address, args.flag_port), + None => { + println!("Cast Device address is not specified, trying to discover..."); + discover().unwrap_or_else(|| { + println!("No Cast device discovered, please specify device address explicitly."); + std::process::exit(1); + }) + } + }; - let cast_device = match CastDevice::connect_without_host_verification( - args.flag_address.unwrap(), - args.flag_port, - ) { + let cast_device = match CastDevice::connect_without_host_verification(address, port) { Ok(cast_device) => cast_device, Err(err) => panic!("Could not establish connection with Cast Device: {:?}", err), }; diff --git a/protobuf/authority_keys.proto b/protobuf/authority_keys.proto index 1fd4f31a5..dc80de82b 100644 --- a/protobuf/authority_keys.proto +++ b/protobuf/authority_keys.proto @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,7 +10,6 @@ option optimize_for = LITE_RUNTIME; // current namespacing of the library. Also, this file should probably be moved // to the public directory. And, all of this will have to be coordinated with a // DEPS roll in Chromium (since Chromium code depends on this). - package cast.channel; message AuthorityKeys { diff --git a/protobuf/cast_channel.proto b/protobuf/cast_channel.proto index 03592fd07..7dd9d3c5a 100644 --- a/protobuf/cast_channel.proto +++ b/protobuf/cast_channel.proto @@ -1,15 +1,15 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 The Chromium Authors // 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; + // TODO(crbug.com/openscreen/90): Rename to openscreen.cast, to update to the // current namespacing of the library. Also, this file should probably be moved // to the public directory. And, all of this will have to be coordinated with a // DEPS roll in Chromium (since Chromium code depends on this). - package cast.channel; message CastMessage { @@ -58,11 +58,14 @@ message CastMessage { // will always be set. optional string payload_utf8 = 6; optional bytes payload_binary = 7; + // --- Begin new 1.1 fields. + // Flag indicating whether there are more chunks to follow for this message. // If the flag is false or is not present, then this is the last (or only) // chunk of the message. optional bool continued = 8; + // If this is a chunk of a larger message, and the remaining length of the // message payload (the sum of the lengths of the payloads of the remaining // chunks) is known, this field will indicate that length. For a given diff --git a/src/cast/authority_keys.rs b/src/cast/authority_keys.rs index f7dd599e7..7128e5f24 100644 --- a/src/cast/authority_keys.rs +++ b/src/cast/authority_keys.rs @@ -1,5 +1,5 @@ -// This file is generated by rust-protobuf 3.2.0. Do not edit -// .proto file is parsed by protoc 3.21.12 +// This file is generated by rust-protobuf 3.3.0. Do not edit +// .proto file is parsed by protoc 24.4 // @generated // https://github.com/rust-lang/rust-clippy/issues/702 @@ -24,10 +24,10 @@ /// Generated files are compatible only with the same version /// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_2_0; +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:cast.channel.AuthorityKeys) +#[derive(PartialEq, Clone, Default, Debug)] pub struct AuthorityKeys { // message fields // @@protoc_insertion_point(field:cast.channel.AuthorityKeys.keys) @@ -124,8 +124,8 @@ impl ::protobuf::Message for AuthorityKeys { /// Nested message and enums of message `AuthorityKeys` pub mod authority_keys { - #[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:cast.channel.AuthorityKeys.Key) + #[derive(PartialEq, Clone, Default, Debug)] pub struct Key { // message fields // @@protoc_insertion_point(field:cast.channel.AuthorityKeys.Key.fingerprint) @@ -251,6 +251,17 @@ pub mod authority_keys { ::std::result::Result::Ok(()) } + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.fingerprint.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.public_key.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { @@ -266,17 +277,6 @@ pub mod authority_keys { my_size } - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.fingerprint.as_ref() { - os.write_bytes(1, v)?; - } - if let Some(v) = self.public_key.as_ref() { - os.write_bytes(2, v)?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } diff --git a/src/cast/cast_channel.rs b/src/cast/cast_channel.rs index e2021f181..c284df083 100644 --- a/src/cast/cast_channel.rs +++ b/src/cast/cast_channel.rs @@ -1,5 +1,5 @@ -// This file is generated by rust-protobuf 3.2.0. Do not edit -// .proto file is parsed by protoc 3.21.12 +// This file is generated by rust-protobuf 3.3.0. Do not edit +// .proto file is parsed by protoc 24.4 // @generated // https://github.com/rust-lang/rust-clippy/issues/702 @@ -24,10 +24,10 @@ /// Generated files are compatible only with the same version /// of protobuf runtime. -const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_2_0; +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:cast.channel.CastMessage) +#[derive(PartialEq, Clone, Default, Debug)] pub struct CastMessage { // message fields // @@protoc_insertion_point(field:cast.channel.CastMessage.protocol_version) @@ -529,6 +529,16 @@ pub mod cast_message { } } + fn from_str(str: &str) -> ::std::option::Option { + match str { + "CASTV2_1_0" => ::std::option::Option::Some(ProtocolVersion::CASTV2_1_0), + "CASTV2_1_1" => ::std::option::Option::Some(ProtocolVersion::CASTV2_1_1), + "CASTV2_1_2" => ::std::option::Option::Some(ProtocolVersion::CASTV2_1_2), + "CASTV2_1_3" => ::std::option::Option::Some(ProtocolVersion::CASTV2_1_3), + _ => ::std::option::Option::None + } + } + const VALUES: &'static [ProtocolVersion] = &[ ProtocolVersion::CASTV2_1_0, ProtocolVersion::CASTV2_1_1, @@ -568,6 +578,14 @@ pub mod cast_message { } } + fn from_str(str: &str) -> ::std::option::Option { + match str { + "STRING" => ::std::option::Option::Some(PayloadType::STRING), + "BINARY" => ::std::option::Option::Some(PayloadType::BINARY), + _ => ::std::option::Option::None + } + } + const VALUES: &'static [PayloadType] = &[ PayloadType::STRING, PayloadType::BINARY, @@ -582,8 +600,8 @@ pub mod cast_message { } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:cast.channel.AuthChallenge) +#[derive(PartialEq,Clone,Default,Debug)] pub struct AuthChallenge { // message fields // @@protoc_insertion_point(field:cast.channel.AuthChallenge.signature_algorithm) @@ -716,6 +734,20 @@ impl ::protobuf::Message for AuthChallenge { ::std::result::Result::Ok(()) } + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.signature_algorithm { + os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; + } + if let Some(v) = self.sender_nonce.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.hash_algorithm { + os.write_enum(3, ::protobuf::EnumOrUnknown::value(&v))?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { @@ -734,20 +766,6 @@ impl ::protobuf::Message for AuthChallenge { my_size } - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { - if let Some(v) = self.signature_algorithm { - os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; - } - if let Some(v) = self.sender_nonce.as_ref() { - os.write_bytes(2, v)?; - } - if let Some(v) = self.hash_algorithm { - os.write_enum(3, ::protobuf::EnumOrUnknown::value(&v))?; - } - os.write_unknown_fields(self.special_fields.unknown_fields())?; - ::std::result::Result::Ok(()) - } - fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } @@ -778,8 +796,8 @@ impl ::protobuf::Message for AuthChallenge { } } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:cast.channel.AuthResponse) +#[derive(PartialEq,Clone,Default,Debug)] pub struct AuthResponse { // message fields // @@protoc_insertion_point(field:cast.channel.AuthResponse.signature) @@ -1140,8 +1158,8 @@ impl ::protobuf::Message for AuthResponse { } } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:cast.channel.AuthError) +#[derive(PartialEq, Clone, Default, Debug)] pub struct AuthError { // message fields // @@protoc_insertion_point(field:cast.channel.AuthError.error_type) @@ -1284,6 +1302,15 @@ pub mod auth_error { } } + fn from_str(str: &str) -> ::std::option::Option { + match str { + "INTERNAL_ERROR" => ::std::option::Option::Some(ErrorType::INTERNAL_ERROR), + "NO_TLS" => ::std::option::Option::Some(ErrorType::NO_TLS), + "SIGNATURE_ALGORITHM_UNAVAILABLE" => ::std::option::Option::Some(ErrorType::SIGNATURE_ALGORITHM_UNAVAILABLE), + _ => ::std::option::Option::None + } + } + const VALUES: &'static [ErrorType] = &[ ErrorType::INTERNAL_ERROR, ErrorType::NO_TLS, @@ -1299,8 +1326,8 @@ pub mod auth_error { } -#[derive(PartialEq,Clone,Default,Debug)] // @@protoc_insertion_point(message:cast.channel.DeviceAuthMessage) +#[derive(PartialEq,Clone,Default,Debug)] pub struct DeviceAuthMessage { // message fields // @@protoc_insertion_point(field:cast.channel.DeviceAuthMessage.challenge) @@ -1460,6 +1487,15 @@ impl ::protobuf::Enum for SignatureAlgorithm { } } + fn from_str(str: &str) -> ::std::option::Option { + match str { + "UNSPECIFIED" => ::std::option::Option::Some(SignatureAlgorithm::UNSPECIFIED), + "RSASSA_PKCS1v15" => ::std::option::Option::Some(SignatureAlgorithm::RSASSA_PKCS1v15), + "RSASSA_PSS" => ::std::option::Option::Some(SignatureAlgorithm::RSASSA_PSS), + _ => ::std::option::Option::None + } + } + const VALUES: &'static [SignatureAlgorithm] = &[ SignatureAlgorithm::UNSPECIFIED, SignatureAlgorithm::RSASSA_PKCS1v15, @@ -1498,6 +1534,14 @@ impl ::protobuf::Enum for HashAlgorithm { } } + fn from_str(str: &str) -> ::std::option::Option { + match str { + "SHA1" => ::std::option::Option::Some(HashAlgorithm::SHA1), + "SHA256" => ::std::option::Option::Some(HashAlgorithm::SHA256), + _ => ::std::option::Option::None + } + } + const VALUES: &'static [HashAlgorithm] = &[ HashAlgorithm::SHA1, HashAlgorithm::SHA256, @@ -1509,4 +1553,3 @@ impl ::std::default::Default for HashAlgorithm { HashAlgorithm::SHA1 } } - diff --git a/src/cast/proxies.rs b/src/cast/proxies.rs index b7133ccfb..2c1d9a330 100644 --- a/src/cast/proxies.rs +++ b/src/cast/proxies.rs @@ -1,6 +1,6 @@ /// Proxy classes for the `connection` channel. pub mod connection { - use serde_derive::Serialize; + use serde::Serialize; #[derive(Serialize, Debug)] pub struct ConnectionRequest { @@ -13,7 +13,7 @@ pub mod connection { /// Proxy classes for the `heartbeat` channel. pub mod heartbeat { - use serde_derive::Serialize; + use serde::Serialize; #[derive(Serialize, Debug)] pub struct HeartBeatRequest { @@ -24,7 +24,7 @@ pub mod heartbeat { /// Proxy classes for the `media` channel. pub mod media { - use serde_derive::{Deserialize, Serialize}; + use serde::{Deserialize, Serialize}; #[derive(Serialize, Debug)] pub struct GetStatusRequest { @@ -286,9 +286,10 @@ pub mod media { /// Proxy classes for the `receiver` channel. pub mod receiver { - use serde_derive::{Deserialize, Serialize}; use std::borrow::Cow; + use serde::{Deserialize, Serialize}; + #[derive(Serialize, Debug)] pub struct AppLaunchRequest { #[serde(rename = "requestId")]