aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShuo Wang Hsu <shuohsu@google.com>2023-12-18 17:25:12 -0800
committerShuo Wang Hsu <shuohsu@google.com>2024-01-04 20:20:41 +0000
commit17d98abfa2d7609e28d065e74fd8de2e6d38cbe6 (patch)
tree667a2121b31b8d69745842320807e2727f0378af
parent7265d2ed3e7b58cc70a2b4fb7c4f86f52ba8ce7c (diff)
downloadnetsim-17d98abfa2d7609e28d065e74fd8de2e6d38cbe6.tar.gz
netsim grpcio test usage in rust
test server starts server at localhost:50051 test client reads netsim.ini by default and also takes custom server address as argument to be directed towards the test server. Note: This is currently only working for Soong builds and disabled for non-Soong builds. Test: m netsim_test_server Test: out/host/linux-x86/bin/netsim_test_server Test: m netsim_test_client Test: out/host/linux-x86/bin/netsim_test_client localhost:50051 Bug: 274599544 Change-Id: Idbd028aa741df6213e331c64b4dc08e2545379de
-rw-r--r--Android.bp25
-rw-r--r--rust/frontend/Cargo.toml23
-rw-r--r--rust/frontend/src/netsim_test_client.rs30
-rw-r--r--rust/frontend/src/netsim_test_server.rs117
-rw-r--r--rust/proto/src/frontend.rs219
-rw-r--r--rust/proto/src/frontend_grpc.rs558
-rw-r--r--rust/proto/src/lib.rs5
-rwxr-xr-xscripts/proto_update.sh7
8 files changed, 982 insertions, 2 deletions
diff --git a/Android.bp b/Android.bp
index 512e8d2..8d0f679 100644
--- a/Android.bp
+++ b/Android.bp
@@ -302,10 +302,12 @@ cc_test_host {
rust_library_host {
name: "libnetsim_proto",
+ features: ["cuttlefish"],
crate_name: "netsim_proto",
srcs: ["rust/proto/src/lib.rs"],
rustlibs: [
"libprotobuf",
+ "libgrpcio",
],
}
@@ -404,3 +406,26 @@ rust_binary_host {
"libnetsim_cli",
],
}
+
+rust_binary_host {
+ name: "netsim_test_client",
+ srcs: ["rust/frontend/src/netsim_test_client.rs"],
+ rustlibs: [
+ "libgrpcio",
+ "libnetsim_proto",
+ "libprotobuf",
+ "libnetsim_common",
+ ],
+}
+
+rust_binary_host {
+ name: "netsim_test_server",
+ srcs: ["rust/frontend/src/netsim_test_server.rs"],
+ rustlibs: [
+ "libgrpcio",
+ "libnetsim_proto",
+ "libprotobuf",
+ "libnetsim_common",
+ "libfutures",
+ ],
+}
diff --git a/rust/frontend/Cargo.toml b/rust/frontend/Cargo.toml
new file mode 100644
index 0000000..9d5f308
--- /dev/null
+++ b/rust/frontend/Cargo.toml
@@ -0,0 +1,23 @@
+[package]
+name = "frontend"
+version = "0.1.0"
+edition = "2021"
+
+[dependencies]
+protobuf = "3.2.0"
+protoc-grpcio = "3.0.0"
+protoc-rust = "2.27"
+grpcio = "0.13.0"
+grpcio-sys = "0.12.1"
+futures = "0.3.26"
+
+##[build-dependencies]
+##protoc-grpcio = "3.0.0"
+
+##[[bin]]
+##name = "server"
+##path = "src/server.rs"
+
+##[[bin]]
+##name = "netsim-grpc"
+##path = "src/client.rs" \ No newline at end of file
diff --git a/rust/frontend/src/netsim_test_client.rs b/rust/frontend/src/netsim_test_client.rs
new file mode 100644
index 0000000..b65d256
--- /dev/null
+++ b/rust/frontend/src/netsim_test_client.rs
@@ -0,0 +1,30 @@
+//! netsim Rust grpc test client
+
+use std::env;
+use std::sync::Arc;
+
+use grpcio::{ChannelBuilder, EnvBuilder};
+use netsim_common::util::os_utils::get_server_address;
+use netsim_proto::frontend_grpc::FrontendServiceClient;
+
+fn main() {
+ let args: Vec<String> = env::args().collect();
+ let server_addr: String = if args.len() > 1 {
+ args[1].to_owned()
+ } else {
+ match get_server_address(1) {
+ Some(addr) => addr,
+ None => {
+ println!("Unable to get server address.");
+ return;
+ }
+ }
+ };
+ let env = Arc::new(EnvBuilder::new().build());
+
+ let ch = ChannelBuilder::new(env).connect(&server_addr);
+ let client = FrontendServiceClient::new(ch);
+
+ let reply = client.get_version(&::protobuf::well_known_types::empty::Empty::new()).unwrap();
+ println!("Version: {}", reply.version);
+}
diff --git a/rust/frontend/src/netsim_test_server.rs b/rust/frontend/src/netsim_test_server.rs
new file mode 100644
index 0000000..6cbf4f9
--- /dev/null
+++ b/rust/frontend/src/netsim_test_server.rs
@@ -0,0 +1,117 @@
+//! netsim Rust grpc test server
+use std::io::Read;
+use std::sync::Arc;
+use std::{io, thread};
+
+use futures::channel::oneshot;
+use futures::executor::block_on;
+use futures::prelude::*;
+use grpcio::{
+ ChannelBuilder, Environment, ResourceQuota, RpcContext, ServerBuilder, ServerCredentials,
+ UnarySink,
+};
+
+use netsim_proto::frontend::VersionResponse;
+use netsim_proto::frontend_grpc::{create_frontend_service, FrontendService};
+
+#[derive(Clone)]
+struct FrontendClient;
+
+impl FrontendService for FrontendClient {
+ fn get_version(
+ &mut self,
+ ctx: RpcContext<'_>,
+ req: protobuf::well_known_types::empty::Empty,
+ sink: UnarySink<VersionResponse>,
+ ) {
+ let response = VersionResponse {
+ version: "netsim test server version 0.0.1".to_string(),
+ ..Default::default()
+ };
+ let f = sink
+ .success(response)
+ .map_err(move |e| eprintln!("failed to reply {:?}: {:?}", req, e))
+ .map(|_| ());
+ ctx.spawn(f)
+ }
+
+ fn list_device(
+ &mut self,
+ _ctx: grpcio::RpcContext,
+ _req: protobuf::well_known_types::empty::Empty,
+ _sink: grpcio::UnarySink<netsim_proto::frontend::ListDeviceResponse>,
+ ) {
+ todo!()
+ }
+
+ fn patch_device(
+ &mut self,
+ _ctx: grpcio::RpcContext,
+ _req: netsim_proto::frontend::PatchDeviceRequest,
+ _sink: grpcio::UnarySink<protobuf::well_known_types::empty::Empty>,
+ ) {
+ todo!()
+ }
+
+ fn reset(
+ &mut self,
+ _ctx: grpcio::RpcContext,
+ _req: protobuf::well_known_types::empty::Empty,
+ _sink: grpcio::UnarySink<protobuf::well_known_types::empty::Empty>,
+ ) {
+ todo!()
+ }
+
+ fn patch_capture(
+ &mut self,
+ _ctx: grpcio::RpcContext,
+ _req: netsim_proto::frontend::PatchCaptureRequest,
+ _sink: grpcio::UnarySink<protobuf::well_known_types::empty::Empty>,
+ ) {
+ todo!()
+ }
+
+ fn list_capture(
+ &mut self,
+ _ctx: grpcio::RpcContext,
+ _req: protobuf::well_known_types::empty::Empty,
+ _sink: grpcio::UnarySink<netsim_proto::frontend::ListCaptureResponse>,
+ ) {
+ todo!()
+ }
+
+ fn get_capture(
+ &mut self,
+ _ctx: grpcio::RpcContext,
+ _req: netsim_proto::frontend::GetCaptureRequest,
+ _sink: grpcio::ServerStreamingSink<netsim_proto::frontend::GetCaptureResponse>,
+ ) {
+ todo!()
+ }
+}
+
+fn main() {
+ let env = Arc::new(Environment::new(1));
+ let service = create_frontend_service(FrontendClient);
+
+ let quota = ResourceQuota::new(Some("HelloServerQuota")).resize_memory(1024 * 1024);
+ let ch_builder = ChannelBuilder::new(env.clone()).set_resource_quota(quota);
+
+ let mut server = ServerBuilder::new(env)
+ .register_service(service)
+ .channel_args(ch_builder.build_args())
+ .build()
+ .unwrap();
+ let port = server.add_listening_port("127.0.0.1:50051", ServerCredentials::insecure()).unwrap();
+ server.start();
+ println!("listening on port {}", port);
+
+ let (tx, rx) = oneshot::channel();
+ thread::spawn(move || {
+ println!("Press ENTER to exit...");
+ let _ = io::stdin().read(&mut [0]).unwrap();
+ tx.send(())
+ });
+ let _ = block_on(rx);
+ let _ = block_on(server.shutdown());
+}
diff --git a/rust/proto/src/frontend.rs b/rust/proto/src/frontend.rs
index 053533b..a0227b3 100644
--- a/rust/proto/src/frontend.rs
+++ b/rust/proto/src/frontend.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
+// .proto file is parsed by protoc --rust-out=...
// @generated
// https://github.com/rust-lang/rust-clippy/issues/702
@@ -25,10 +25,14 @@
/// of protobuf runtime.
const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_2_0;
+/// Response of GetVersion.
+///
+/// Returns the version of the netsim service
#[derive(PartialEq,Clone,Default,Debug)]
// @@protoc_insertion_point(message:netsim.frontend.VersionResponse)
pub struct VersionResponse {
// message fields
+ /// Version of netsim service
// @@protoc_insertion_point(field:netsim.frontend.VersionResponse.version)
pub version: ::std::string::String,
// special fields
@@ -147,10 +151,15 @@ impl ::protobuf::reflect::ProtobufValue for VersionResponse {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
}
+/// Request of CreateDevice.
+///
+/// CreateDevice is only used for built-in devices.
#[derive(PartialEq,Clone,Default,Debug)]
// @@protoc_insertion_point(message:netsim.frontend.CreateDeviceRequest)
pub struct CreateDeviceRequest {
// message fields
+ /// DeviceCreate proto for creation. Check DeviceCreate in model.proto for more
+ /// detail.
// @@protoc_insertion_point(field:netsim.frontend.CreateDeviceRequest.device)
pub device: ::protobuf::MessageField<super::model::DeviceCreate>,
// special fields
@@ -270,10 +279,14 @@ impl ::protobuf::reflect::ProtobufValue for CreateDeviceRequest {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
}
+/// Response of CreateDevice.
+///
+/// Returns the device created in netsim
#[derive(PartialEq,Clone,Default,Debug)]
// @@protoc_insertion_point(message:netsim.frontend.CreateDeviceResponse)
pub struct CreateDeviceResponse {
// message fields
+ /// Device proto
// @@protoc_insertion_point(field:netsim.frontend.CreateDeviceResponse.device)
pub device: ::protobuf::MessageField<super::model::Device>,
// special fields
@@ -393,10 +406,14 @@ impl ::protobuf::reflect::ProtobufValue for CreateDeviceResponse {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
}
+/// Request of DeleteDevice.
+///
+/// DeleteDevice is only used for built-in device.
#[derive(PartialEq,Clone,Default,Debug)]
// @@protoc_insertion_point(message:netsim.frontend.DeleteChipRequest)
pub struct DeleteChipRequest {
// message fields
+ /// Device Identifier
// @@protoc_insertion_point(field:netsim.frontend.DeleteChipRequest.id)
pub id: u32,
// special fields
@@ -515,10 +532,16 @@ impl ::protobuf::reflect::ProtobufValue for DeleteChipRequest {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
}
+/// Request of PatchDevice.
+///
+/// You may patch the device position, orientation, and the radio states.
+/// For built-in devices, you may patch the specific configurations.
#[derive(PartialEq,Clone,Default,Debug)]
// @@protoc_insertion_point(message:netsim.frontend.PatchDeviceRequest)
pub struct PatchDeviceRequest {
// message fields
+ /// Device proto. You must include either the id or name field to have
+ /// a successful patch.
// @@protoc_insertion_point(field:netsim.frontend.PatchDeviceRequest.device)
pub device: ::protobuf::MessageField<super::model::Device>,
// special fields
@@ -638,12 +661,20 @@ impl ::protobuf::reflect::ProtobufValue for PatchDeviceRequest {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
}
+/// Response for ListDevice request.
+///
+/// Returns the emulators and accessory devices that are connected to
+/// the network simulator.
#[derive(PartialEq,Clone,Default,Debug)]
// @@protoc_insertion_point(message:netsim.frontend.ListDeviceResponse)
pub struct ListDeviceResponse {
// message fields
+ /// List of Device protos
// @@protoc_insertion_point(field:netsim.frontend.ListDeviceResponse.devices)
pub devices: ::std::vec::Vec<super::model::Device>,
+ /// Last modified timestamp for device resource.
+ /// The timestamp will be updated if devices state has changed (except for
+ /// packet counts)
// @@protoc_insertion_point(field:netsim.frontend.ListDeviceResponse.last_modified)
pub last_modified: ::protobuf::MessageField<::protobuf::well_known_types::timestamp::Timestamp>,
// special fields
@@ -780,10 +811,14 @@ impl ::protobuf::reflect::ProtobufValue for ListDeviceResponse {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
}
+/// Request for SubscribeDevice.
#[derive(PartialEq,Clone,Default,Debug)]
// @@protoc_insertion_point(message:netsim.frontend.SubscribeDeviceRequest)
pub struct SubscribeDeviceRequest {
// message fields
+ /// The SubscribeDevice will immediately return if the
+ /// provided last_modified timestamp is prior to the current last_modified
+ /// timestamp in device resource.
// @@protoc_insertion_point(field:netsim.frontend.SubscribeDeviceRequest.last_modified)
pub last_modified: ::protobuf::MessageField<::protobuf::well_known_types::timestamp::Timestamp>,
// special fields
@@ -903,6 +938,7 @@ impl ::protobuf::reflect::ProtobufValue for SubscribeDeviceRequest {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
}
+/// Response for SubscribeDevice request.
#[derive(PartialEq,Clone,Default,Debug)]
// @@protoc_insertion_point(message:netsim.frontend.SubscribeDeviceResponse)
pub struct SubscribeDeviceResponse {
@@ -1182,12 +1218,15 @@ pub mod subscribe_device_response {
}
}
+/// Request of PatchCapture.
#[derive(PartialEq,Clone,Default,Debug)]
// @@protoc_insertion_point(message:netsim.frontend.PatchCaptureRequest)
pub struct PatchCaptureRequest {
// message fields
+ /// Capture Identifier
// @@protoc_insertion_point(field:netsim.frontend.PatchCaptureRequest.id)
pub id: u32,
+ /// PatchCapture proto
// @@protoc_insertion_point(field:netsim.frontend.PatchCaptureRequest.patch)
pub patch: ::protobuf::MessageField<patch_capture_request::PatchCapture>,
// special fields
@@ -1325,10 +1364,13 @@ impl ::protobuf::reflect::ProtobufValue for PatchCaptureRequest {
/// Nested message and enums of message `PatchCaptureRequest`
pub mod patch_capture_request {
+ /// Body of PatchCapture that will be channeled into
+ /// body for HandleCaptureCxx
#[derive(PartialEq,Clone,Default,Debug)]
// @@protoc_insertion_point(message:netsim.frontend.PatchCaptureRequest.PatchCapture)
pub struct PatchCapture {
// message fields
+ /// Capture state
// @@protoc_insertion_point(field:netsim.frontend.PatchCaptureRequest.PatchCapture.state)
pub state: ::protobuf::EnumOrUnknown<super::super::model::State>,
// special fields
@@ -1448,10 +1490,14 @@ pub mod patch_capture_request {
}
}
+/// Response of ListCapture
+///
+/// Returns all capture information of devices connected to netsim.
#[derive(PartialEq,Clone,Default,Debug)]
// @@protoc_insertion_point(message:netsim.frontend.ListCaptureResponse)
pub struct ListCaptureResponse {
// message fields
+ /// List of Capture protos
// @@protoc_insertion_point(field:netsim.frontend.ListCaptureResponse.captures)
pub captures: ::std::vec::Vec<super::model::Capture>,
// special fields
@@ -1571,10 +1617,12 @@ impl ::protobuf::reflect::ProtobufValue for ListCaptureResponse {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
}
+/// Request of GetCapture
#[derive(PartialEq,Clone,Default,Debug)]
// @@protoc_insertion_point(message:netsim.frontend.GetCaptureRequest)
pub struct GetCaptureRequest {
// message fields
+ /// Capture Identifier
// @@protoc_insertion_point(field:netsim.frontend.GetCaptureRequest.id)
pub id: u32,
// special fields
@@ -1693,10 +1741,15 @@ impl ::protobuf::reflect::ProtobufValue for GetCaptureRequest {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
}
+/// Response of GetCapture
+///
+/// Returns a max of 1024 bytes of capture file.
+/// GetCapture will be returning a stream of GetCaptureResponse
#[derive(PartialEq,Clone,Default,Debug)]
// @@protoc_insertion_point(message:netsim.frontend.GetCaptureResponse)
pub struct GetCaptureResponse {
// message fields
+ /// Max of 1024 bytes of capture file
// @@protoc_insertion_point(field:netsim.frontend.GetCaptureResponse.capture_stream)
pub capture_stream: ::std::vec::Vec<u8>,
// special fields
@@ -1854,7 +1907,169 @@ static file_descriptor_proto_data: &'static [u8] = b"\
reRequest\x1a\x16.google.protobuf.Empty\x12K\n\x0bListCapture\x12\x16.go\
ogle.protobuf.Empty\x1a$.netsim.frontend.ListCaptureResponse\x12W\n\nGet\
Capture\x12\".netsim.frontend.GetCaptureRequest\x1a#.netsim.frontend.Get\
- CaptureResponse0\x01b\x06proto3\
+ CaptureResponse0\x01J\xdc)\n\x07\x12\x05\x0e\0\xb3\x01\x01\n\xd2\x04\n\
+ \x01\x0c\x12\x03\x0e\0\x122\xc7\x04\x20Copyright\x202022\x20The\x20Andro\
+ id\x20Open\x20Source\x20Project\n\n\x20Licensed\x20under\x20the\x20Apach\
+ e\x20License,\x20Version\x202.0\x20(the\x20\"License\");\n\x20you\x20may\
+ \x20not\x20use\x20this\x20file\x20except\x20in\x20compliance\x20with\x20\
+ the\x20License.\n\x20You\x20may\x20obtain\x20a\x20copy\x20of\x20the\x20L\
+ icense\x20at\n\n\x20\x20\x20\x20\x20\x20http://www.apache.org/licenses/L\
+ ICENSE-2.0\n\n\x20Unless\x20required\x20by\x20applicable\x20law\x20or\
+ \x20agreed\x20to\x20in\x20writing,\x20software\n\x20distributed\x20under\
+ \x20the\x20License\x20is\x20distributed\x20on\x20an\x20\"AS\x20IS\"\x20B\
+ ASIS,\n\x20WITHOUT\x20WARRANTIES\x20OR\x20CONDITIONS\x20OF\x20ANY\x20KIN\
+ D,\x20either\x20express\x20or\x20implied.\n\x20See\x20the\x20License\x20\
+ for\x20the\x20specific\x20language\x20governing\x20permissions\x20and\n\
+ \x20limitations\x20under\x20the\x20License.\n\n\x08\n\x01\x02\x12\x03\
+ \x10\0\x18\n\t\n\x02\x03\0\x12\x03\x12\0%\n\t\n\x02\x03\x01\x12\x03\x13\
+ \0)\n\t\n\x02\x03\x02\x12\x03\x14\0\x1c\n\xe2\x02\n\x02\x06\0\x12\x04!\0\
+ B\x01\x1a\xd5\x02*\n\x20The\x20frontend\x20service\x20for\x20the\x20netw\
+ ork\x20simulator.\n\n\x20The\x20network\x20simulator\x20interconnects\
+ \x20virtual\x20radio\x20controllers\x20on\x20emulated\n\x20android\x20an\
+ d\x20accessory\x20devices\x20to\x20allows\x20control\x20of\x20the\x20top\
+ ology,\x20device\n\x20positions,\x20and\x20RF\x20characteristics.\n\n\
+ \x20Clients\x20of\x20the\x20frontend\x20service\x20include\x20a\x20Comma\
+ nd\x20Line\x20Interface\x20(cli),\x20Mobly\n\x20scripts,\x20and\x20a\x20\
+ web\x20UI.\n\n\n\n\n\x03\x06\0\x01\x12\x03!\x08\x17\n5\n\x04\x06\0\x02\0\
+ \x12\x03#\x02B\x1a(\x20Get\x20the\x20version\x20of\x20the\x20netsim\x20s\
+ ervice.\n\n\x0c\n\x05\x06\0\x02\0\x01\x12\x03#\x06\x10\n\x0c\n\x05\x06\0\
+ \x02\0\x02\x12\x03#\x11&\n\x0c\n\x05\x06\0\x02\0\x03\x12\x03#1@\n&\n\x04\
+ \x06\0\x02\x01\x12\x03&\x02G\x1a\x19\x20Create\x20a\x20builtin\x20device\
+ \n\n\x0c\n\x05\x06\0\x02\x01\x01\x12\x03&\x06\x12\n\x0c\n\x05\x06\0\x02\
+ \x01\x02\x12\x03&\x13&\n\x0c\n\x05\x06\0\x02\x01\x03\x12\x03&1E\nX\n\x04\
+ \x06\0\x02\x02\x12\x03)\x02D\x1aK\x20Delete\x20a\x20builtin\x20chip.\x20\
+ Implicitly\x20deletes\x20devices\x20which\x20contain\x20no\x20chips.\n\n\
+ \x0c\n\x05\x06\0\x02\x02\x01\x12\x03)\x06\x10\n\x0c\n\x05\x06\0\x02\x02\
+ \x02\x12\x03)\x11\"\n\x0c\n\x05\x06\0\x02\x02\x03\x12\x03)-B\n\x1d\n\x04\
+ \x06\0\x02\x03\x12\x03,\x02F\x1a\x10\x20Patch\x20a\x20device\n\n\x0c\n\
+ \x05\x06\0\x02\x03\x01\x12\x03,\x06\x11\n\x0c\n\x05\x06\0\x02\x03\x02\
+ \x12\x03,\x12$\n\x0c\n\x05\x06\0\x02\x03\x03\x12\x03,/D\n!\n\x04\x06\0\
+ \x02\x04\x12\x03/\x02C\x1a\x14\x20Reset\x20all\x20devices.\n\n\x0c\n\x05\
+ \x06\0\x02\x04\x01\x12\x03/\x06\x0b\n\x0c\n\x05\x06\0\x02\x04\x02\x12\
+ \x03/\x0c!\n\x0c\n\x05\x06\0\x02\x04\x03\x12\x03/,A\n$\n\x04\x06\0\x02\
+ \x05\x12\x032\x02E\x1a\x17\x20Get\x20a\x20list\x20of\x20devices\n\n\x0c\
+ \n\x05\x06\0\x02\x05\x01\x12\x032\x06\x10\n\x0c\n\x05\x06\0\x02\x05\x02\
+ \x12\x032\x11&\n\x0c\n\x05\x06\0\x02\x05\x03\x12\x0321C\n\xa4\x01\n\x04\
+ \x06\0\x02\x06\x12\x037\x02P\x1a\x96\x01\x20Get\x20a\x20list\x20of\x20de\
+ vices\x20when\x20a\x20device\x20event\x20is\x20published.\n\x20Waits\x20\
+ for\x20device\x20event\x20up\x20to\x2015\x20seconds\x20and\x20returns\
+ \x20Error\x20response\x20if\x20no\n\x20event\x20is\x20received\n\n\x0c\n\
+ \x05\x06\0\x02\x06\x01\x12\x037\x06\x15\n\x0c\n\x05\x06\0\x02\x06\x02\
+ \x12\x037\x16,\n\x0c\n\x05\x06\0\x02\x06\x03\x12\x0377N\nt\n\x04\x06\0\
+ \x02\x07\x12\x03;\x02H\x1ag\x20Patch\x20a\x20Capture\x20source\x20to\x20\
+ turn\x20capture\x20on/off.\n\x20When\x20turned\x20on\x20the\x20old\x20ca\
+ pture\x20contents\x20are\x20replaced.\n\n\x0c\n\x05\x06\0\x02\x07\x01\
+ \x12\x03;\x06\x12\n\x0c\n\x05\x06\0\x02\x07\x02\x12\x03;\x13&\n\x0c\n\
+ \x05\x06\0\x02\x07\x03\x12\x03;1F\n?\n\x04\x06\0\x02\x08\x12\x03>\x02G\
+ \x1a2\x20List\x20all\x20Captures\x20currently\x20connected\x20on\x20nets\
+ im.\n\n\x0c\n\x05\x06\0\x02\x08\x01\x12\x03>\x06\x11\n\x0c\n\x05\x06\0\
+ \x02\x08\x02\x12\x03>\x12'\n\x0c\n\x05\x06\0\x02\x08\x03\x12\x03>2E\nM\n\
+ \x04\x06\0\x02\t\x12\x03A\x02H\x1a@\x20Retrieve\x20the\x20contents\x20of\
+ \x20the\x20packet\x20capture\x20as\x20streaming\x20bytes\n\n\x0c\n\x05\
+ \x06\0\x02\t\x01\x12\x03A\x06\x10\n\x0c\n\x05\x06\0\x02\t\x02\x12\x03A\
+ \x11\"\n\x0c\n\x05\x06\0\x02\t\x06\x12\x03A-3\n\x0c\n\x05\x06\0\x02\t\
+ \x03\x12\x03A4F\nQ\n\x02\x04\0\x12\x04G\0J\x01\x1aE\x20Response\x20of\
+ \x20GetVersion.\n\n\x20Returns\x20the\x20version\x20of\x20the\x20netsim\
+ \x20service\n\n\n\n\x03\x04\0\x01\x12\x03G\x08\x17\n(\n\x04\x04\0\x02\0\
+ \x12\x03I\x02\x15\x1a\x1b\x20Version\x20of\x20netsim\x20service\n\n\x0c\
+ \n\x05\x04\0\x02\0\x05\x12\x03I\x02\x08\n\x0c\n\x05\x04\0\x02\0\x01\x12\
+ \x03I\t\x10\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03I\x13\x14\nX\n\x02\x04\
+ \x01\x12\x04O\0S\x01\x1aL\x20Request\x20of\x20CreateDevice.\n\n\x20Creat\
+ eDevice\x20is\x20only\x20used\x20for\x20built-in\x20devices.\n\n\n\n\x03\
+ \x04\x01\x01\x12\x03O\x08\x1b\nc\n\x04\x04\x01\x02\0\x12\x03R\x02'\x1aV\
+ \x20DeviceCreate\x20proto\x20for\x20creation.\x20Check\x20DeviceCreate\
+ \x20in\x20model.proto\x20for\x20more\n\x20detail.\n\n\x0c\n\x05\x04\x01\
+ \x02\0\x06\x12\x03R\x02\x1b\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03R\x1c\"\
+ \n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03R%&\nN\n\x02\x04\x02\x12\x04X\0[\
+ \x01\x1aB\x20Response\x20of\x20CreateDevice.\n\n\x20Returns\x20the\x20de\
+ vice\x20created\x20in\x20netsim\n\n\n\n\x03\x04\x02\x01\x12\x03X\x08\x1c\
+ \n\x1b\n\x04\x04\x02\x02\0\x12\x03Z\x02!\x1a\x0e\x20Device\x20proto\n\n\
+ \x0c\n\x05\x04\x02\x02\0\x06\x12\x03Z\x02\x15\n\x0c\n\x05\x04\x02\x02\0\
+ \x01\x12\x03Z\x16\x1c\n\x0c\n\x05\x04\x02\x02\0\x03\x12\x03Z\x1f\x20\nW\
+ \n\x02\x04\x03\x12\x04`\0c\x01\x1aK\x20Request\x20of\x20DeleteDevice.\n\
+ \n\x20DeleteDevice\x20is\x20only\x20used\x20for\x20built-in\x20device.\n\
+ \n\n\n\x03\x04\x03\x01\x12\x03`\x08\x19\n\x20\n\x04\x04\x03\x02\0\x12\
+ \x03b\x02\x10\x1a\x13\x20Device\x20Identifier\n\n\x0c\n\x05\x04\x03\x02\
+ \0\x05\x12\x03b\x02\x08\n\x0c\n\x05\x04\x03\x02\0\x01\x12\x03b\t\x0b\n\
+ \x0c\n\x05\x04\x03\x02\0\x03\x12\x03b\x0e\x0f\n\xb0\x01\n\x02\x04\x04\
+ \x12\x04i\0m\x01\x1a\xa3\x01\x20Request\x20of\x20PatchDevice.\n\n\x20You\
+ \x20may\x20patch\x20the\x20device\x20position,\x20orientation,\x20and\
+ \x20the\x20radio\x20states.\n\x20For\x20built-in\x20devices,\x20you\x20m\
+ ay\x20patch\x20the\x20specific\x20configurations.\n\n\n\n\x03\x04\x04\
+ \x01\x12\x03i\x08\x1a\nf\n\x04\x04\x04\x02\0\x12\x03l\x02!\x1aY\x20Devic\
+ e\x20proto.\x20You\x20must\x20include\x20either\x20the\x20id\x20or\x20na\
+ me\x20field\x20to\x20have\n\x20a\x20successful\x20patch.\n\n\x0c\n\x05\
+ \x04\x04\x02\0\x06\x12\x03l\x02\x15\n\x0c\n\x05\x04\x04\x02\0\x01\x12\
+ \x03l\x16\x1c\n\x0c\n\x05\x04\x04\x02\0\x03\x12\x03l\x1f\x20\n\x8a\x01\n\
+ \x02\x04\x05\x12\x04s\0z\x01\x1a~\x20Response\x20for\x20ListDevice\x20re\
+ quest.\n\n\x20Returns\x20the\x20emulators\x20and\x20accessory\x20devices\
+ \x20that\x20are\x20connected\x20to\n\x20the\x20network\x20simulator.\n\n\
+ \n\n\x03\x04\x05\x01\x12\x03s\x08\x1a\n$\n\x04\x04\x05\x02\0\x12\x03u\
+ \x02+\x1a\x17\x20List\x20of\x20Device\x20protos\n\n\x0c\n\x05\x04\x05\
+ \x02\0\x04\x12\x03u\x02\n\n\x0c\n\x05\x04\x05\x02\0\x06\x12\x03u\x0b\x1e\
+ \n\x0c\n\x05\x04\x05\x02\0\x01\x12\x03u\x1f&\n\x0c\n\x05\x04\x05\x02\0\
+ \x03\x12\x03u)*\n\x94\x01\n\x04\x04\x05\x02\x01\x12\x03y\x02.\x1a\x86\
+ \x01\x20Last\x20modified\x20timestamp\x20for\x20device\x20resource.\n\
+ \x20The\x20timestamp\x20will\x20be\x20updated\x20if\x20devices\x20state\
+ \x20has\x20changed\x20(except\x20for\n\x20packet\x20counts)\n\n\x0c\n\
+ \x05\x04\x05\x02\x01\x06\x12\x03y\x02\x1b\n\x0c\n\x05\x04\x05\x02\x01\
+ \x01\x12\x03y\x1c)\n\x0c\n\x05\x04\x05\x02\x01\x03\x12\x03y,-\n+\n\x02\
+ \x04\x06\x12\x05}\0\x82\x01\x01\x1a\x1e\x20Request\x20for\x20SubscribeDe\
+ vice.\n\n\n\n\x03\x04\x06\x01\x12\x03}\x08\x1e\n\xaa\x01\n\x04\x04\x06\
+ \x02\0\x12\x04\x81\x01\x027\x1a\x9b\x01\x20The\x20SubscribeDevice\x20wil\
+ l\x20immediately\x20return\x20if\x20the\n\x20provided\x20last_modified\
+ \x20timestamp\x20is\x20prior\x20to\x20the\x20current\x20last_modified\n\
+ \x20timestamp\x20in\x20device\x20resource.\n\n\r\n\x05\x04\x06\x02\0\x04\
+ \x12\x04\x81\x01\x02\n\n\r\n\x05\x04\x06\x02\0\x06\x12\x04\x81\x01\x0b$\
+ \n\r\n\x05\x04\x06\x02\0\x01\x12\x04\x81\x01%2\n\r\n\x05\x04\x06\x02\0\
+ \x03\x12\x04\x81\x0156\n5\n\x02\x04\x07\x12\x06\x85\x01\0\x8d\x01\x01\
+ \x1a'\x20Response\x20for\x20SubscribeDevice\x20request.\n\n\x0b\n\x03\
+ \x04\x07\x01\x12\x04\x85\x01\x08\x1f\nD\n\x04\x04\x07\x08\0\x12\x06\x87\
+ \x01\x02\x8c\x01\x03\x1a4\x20Will\x20return\x20ListDeviceResponse\x20or\
+ \x20an\x20EmptyResponse\n\n\r\n\x05\x04\x07\x08\0\x01\x12\x04\x87\x01\
+ \x08\x10\n'\n\x04\x04\x07\x02\0\x12\x04\x89\x01\x040\x1a\x19\x20Response\
+ \x20for\x20ListDevice\n\n\r\n\x05\x04\x07\x02\0\x06\x12\x04\x89\x01\x04\
+ \x16\n\r\n\x05\x04\x07\x02\0\x01\x12\x04\x89\x01\x17+\n\r\n\x05\x04\x07\
+ \x02\0\x03\x12\x04\x89\x01./\n\x1e\n\x04\x04\x07\x02\x01\x12\x04\x8b\x01\
+ \x04-\x1a\x10\x20Empty\x20Response\n\n\r\n\x05\x04\x07\x02\x01\x06\x12\
+ \x04\x8b\x01\x04\x19\n\r\n\x05\x04\x07\x02\x01\x01\x12\x04\x8b\x01\x1a(\
+ \n\r\n\x05\x04\x07\x02\x01\x03\x12\x04\x8b\x01+,\n(\n\x02\x04\x08\x12\
+ \x06\x90\x01\0\x9c\x01\x01\x1a\x1a\x20Request\x20of\x20PatchCapture.\n\n\
+ \x0b\n\x03\x04\x08\x01\x12\x04\x90\x01\x08\x1b\n\"\n\x04\x04\x08\x02\0\
+ \x12\x04\x92\x01\x02\x10\x1a\x14\x20Capture\x20Identifier\n\n\r\n\x05\
+ \x04\x08\x02\0\x05\x12\x04\x92\x01\x02\x08\n\r\n\x05\x04\x08\x02\0\x01\
+ \x12\x04\x92\x01\t\x0b\n\r\n\x05\x04\x08\x02\0\x03\x12\x04\x92\x01\x0e\
+ \x0f\n]\n\x04\x04\x08\x03\0\x12\x06\x96\x01\x02\x99\x01\x03\x1aM\x20Body\
+ \x20of\x20PatchCapture\x20that\x20will\x20be\x20channeled\x20into\n\x20b\
+ ody\x20for\x20HandleCaptureCxx\n\n\r\n\x05\x04\x08\x03\0\x01\x12\x04\x96\
+ \x01\n\x16\n\x1f\n\x06\x04\x08\x03\0\x02\0\x12\x04\x98\x01\x04!\x1a\x0f\
+ \x20Capture\x20state\n\n\x0f\n\x07\x04\x08\x03\0\x02\0\x06\x12\x04\x98\
+ \x01\x04\x16\n\x0f\n\x07\x04\x08\x03\0\x02\0\x01\x12\x04\x98\x01\x17\x1c\
+ \n\x0f\n\x07\x04\x08\x03\0\x02\0\x03\x12\x04\x98\x01\x1f\x20\n\"\n\x04\
+ \x04\x08\x02\x01\x12\x04\x9b\x01\x02\x19\x1a\x14\x20PatchCapture\x20prot\
+ o\n\n\r\n\x05\x04\x08\x02\x01\x06\x12\x04\x9b\x01\x02\x0e\n\r\n\x05\x04\
+ \x08\x02\x01\x01\x12\x04\x9b\x01\x0f\x14\n\r\n\x05\x04\x08\x02\x01\x03\
+ \x12\x04\x9b\x01\x17\x18\ni\n\x02\x04\t\x12\x06\xa1\x01\0\xa4\x01\x01\
+ \x1a[\x20Response\x20of\x20ListCapture\n\n\x20Returns\x20all\x20capture\
+ \x20information\x20of\x20devices\x20connected\x20to\x20netsim.\n\n\x0b\n\
+ \x03\x04\t\x01\x12\x04\xa1\x01\x08\x1b\n&\n\x04\x04\t\x02\0\x12\x04\xa3\
+ \x01\x02-\x1a\x18\x20List\x20of\x20Capture\x20protos\n\n\r\n\x05\x04\t\
+ \x02\0\x04\x12\x04\xa3\x01\x02\n\n\r\n\x05\x04\t\x02\0\x06\x12\x04\xa3\
+ \x01\x0b\x1f\n\r\n\x05\x04\t\x02\0\x01\x12\x04\xa3\x01\x20(\n\r\n\x05\
+ \x04\t\x02\0\x03\x12\x04\xa3\x01+,\n%\n\x02\x04\n\x12\x06\xa7\x01\0\xaa\
+ \x01\x01\x1a\x17\x20Request\x20of\x20GetCapture\n\n\x0b\n\x03\x04\n\x01\
+ \x12\x04\xa7\x01\x08\x19\n\"\n\x04\x04\n\x02\0\x12\x04\xa9\x01\x02\x10\
+ \x1a\x14\x20Capture\x20Identifier\n\n\r\n\x05\x04\n\x02\0\x05\x12\x04\
+ \xa9\x01\x02\x08\n\r\n\x05\x04\n\x02\0\x01\x12\x04\xa9\x01\t\x0b\n\r\n\
+ \x05\x04\n\x02\0\x03\x12\x04\xa9\x01\x0e\x0f\n\x93\x01\n\x02\x04\x0b\x12\
+ \x06\xb0\x01\0\xb3\x01\x01\x1a\x84\x01\x20Response\x20of\x20GetCapture\n\
+ \n\x20Returns\x20a\x20max\x20of\x201024\x20bytes\x20of\x20capture\x20fil\
+ e.\n\x20GetCapture\x20will\x20be\x20returning\x20a\x20stream\x20of\x20Ge\
+ tCaptureResponse\n\n\x0b\n\x03\x04\x0b\x01\x12\x04\xb0\x01\x08\x1a\n1\n\
+ \x04\x04\x0b\x02\0\x12\x04\xb2\x01\x02\x1b\x1a#\x20Max\x20of\x201024\x20\
+ bytes\x20of\x20capture\x20file\n\n\r\n\x05\x04\x0b\x02\0\x05\x12\x04\xb2\
+ \x01\x02\x07\n\r\n\x05\x04\x0b\x02\0\x01\x12\x04\xb2\x01\x08\x16\n\r\n\
+ \x05\x04\x0b\x02\0\x03\x12\x04\xb2\x01\x19\x1ab\x06proto3\
";
/// `FileDescriptorProto` object which was a source for this generated file
diff --git a/rust/proto/src/frontend_grpc.rs b/rust/proto/src/frontend_grpc.rs
new file mode 100644
index 0000000..f1e60ed
--- /dev/null
+++ b/rust/proto/src/frontend_grpc.rs
@@ -0,0 +1,558 @@
+// This file is generated. Do not edit
+// @generated
+
+// https://github.com/Manishearth/rust-clippy/issues/702
+#![allow(unknown_lints)]
+#![allow(clippy::all)]
+#![allow(box_pointers)]
+#![allow(dead_code)]
+#![allow(missing_docs)]
+#![allow(non_camel_case_types)]
+#![allow(non_snake_case)]
+#![allow(non_upper_case_globals)]
+#![allow(trivial_casts)]
+#![allow(unsafe_code)]
+#![allow(unused_imports)]
+#![allow(unused_results)]
+
+const METHOD_FRONTEND_SERVICE_GET_VERSION: ::grpcio::Method<
+ super::empty::Empty,
+ super::frontend::VersionResponse,
+> = ::grpcio::Method {
+ ty: ::grpcio::MethodType::Unary,
+ name: "/netsim.frontend.FrontendService/GetVersion",
+ req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
+ resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
+};
+
+const METHOD_FRONTEND_SERVICE_CREATE_DEVICE: ::grpcio::Method<
+ super::frontend::CreateDeviceRequest,
+ super::frontend::CreateDeviceResponse,
+> = ::grpcio::Method {
+ ty: ::grpcio::MethodType::Unary,
+ name: "/netsim.frontend.FrontendService/CreateDevice",
+ req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
+ resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
+};
+
+const METHOD_FRONTEND_SERVICE_DELETE_CHIP: ::grpcio::Method<
+ super::frontend::DeleteChipRequest,
+ super::empty::Empty,
+> = ::grpcio::Method {
+ ty: ::grpcio::MethodType::Unary,
+ name: "/netsim.frontend.FrontendService/DeleteChip",
+ req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
+ resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
+};
+
+const METHOD_FRONTEND_SERVICE_PATCH_DEVICE: ::grpcio::Method<
+ super::frontend::PatchDeviceRequest,
+ super::empty::Empty,
+> = ::grpcio::Method {
+ ty: ::grpcio::MethodType::Unary,
+ name: "/netsim.frontend.FrontendService/PatchDevice",
+ req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
+ resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
+};
+
+const METHOD_FRONTEND_SERVICE_RESET: ::grpcio::Method<super::empty::Empty, super::empty::Empty> =
+ ::grpcio::Method {
+ ty: ::grpcio::MethodType::Unary,
+ name: "/netsim.frontend.FrontendService/Reset",
+ req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
+ resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
+ };
+
+const METHOD_FRONTEND_SERVICE_LIST_DEVICE: ::grpcio::Method<
+ super::empty::Empty,
+ super::frontend::ListDeviceResponse,
+> = ::grpcio::Method {
+ ty: ::grpcio::MethodType::Unary,
+ name: "/netsim.frontend.FrontendService/ListDevice",
+ req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
+ resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
+};
+
+const METHOD_FRONTEND_SERVICE_SUBSCRIBE_DEVICE: ::grpcio::Method<
+ super::frontend::SubscribeDeviceRequest,
+ super::frontend::SubscribeDeviceResponse,
+> = ::grpcio::Method {
+ ty: ::grpcio::MethodType::Unary,
+ name: "/netsim.frontend.FrontendService/SubscribeDevice",
+ req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
+ resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
+};
+
+const METHOD_FRONTEND_SERVICE_PATCH_CAPTURE: ::grpcio::Method<
+ super::frontend::PatchCaptureRequest,
+ super::empty::Empty,
+> = ::grpcio::Method {
+ ty: ::grpcio::MethodType::Unary,
+ name: "/netsim.frontend.FrontendService/PatchCapture",
+ req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
+ resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
+};
+
+const METHOD_FRONTEND_SERVICE_LIST_CAPTURE: ::grpcio::Method<
+ super::empty::Empty,
+ super::frontend::ListCaptureResponse,
+> = ::grpcio::Method {
+ ty: ::grpcio::MethodType::Unary,
+ name: "/netsim.frontend.FrontendService/ListCapture",
+ req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
+ resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
+};
+
+const METHOD_FRONTEND_SERVICE_GET_CAPTURE: ::grpcio::Method<
+ super::frontend::GetCaptureRequest,
+ super::frontend::GetCaptureResponse,
+> = ::grpcio::Method {
+ ty: ::grpcio::MethodType::ServerStreaming,
+ name: "/netsim.frontend.FrontendService/GetCapture",
+ req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
+ resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
+};
+
+#[derive(Clone)]
+pub struct FrontendServiceClient {
+ pub client: ::grpcio::Client,
+}
+
+impl FrontendServiceClient {
+ pub fn new(channel: ::grpcio::Channel) -> Self {
+ FrontendServiceClient { client: ::grpcio::Client::new(channel) }
+ }
+
+ pub fn get_version_opt(
+ &self,
+ req: &super::empty::Empty,
+ opt: ::grpcio::CallOption,
+ ) -> ::grpcio::Result<super::frontend::VersionResponse> {
+ self.client.unary_call(&METHOD_FRONTEND_SERVICE_GET_VERSION, req, opt)
+ }
+
+ pub fn get_version(
+ &self,
+ req: &super::empty::Empty,
+ ) -> ::grpcio::Result<super::frontend::VersionResponse> {
+ self.get_version_opt(req, ::grpcio::CallOption::default())
+ }
+
+ pub fn get_version_async_opt(
+ &self,
+ req: &super::empty::Empty,
+ opt: ::grpcio::CallOption,
+ ) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::frontend::VersionResponse>> {
+ self.client.unary_call_async(&METHOD_FRONTEND_SERVICE_GET_VERSION, req, opt)
+ }
+
+ pub fn get_version_async(
+ &self,
+ req: &super::empty::Empty,
+ ) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::frontend::VersionResponse>> {
+ self.get_version_async_opt(req, ::grpcio::CallOption::default())
+ }
+
+ pub fn create_device_opt(
+ &self,
+ req: &super::frontend::CreateDeviceRequest,
+ opt: ::grpcio::CallOption,
+ ) -> ::grpcio::Result<super::frontend::CreateDeviceResponse> {
+ self.client.unary_call(&METHOD_FRONTEND_SERVICE_CREATE_DEVICE, req, opt)
+ }
+
+ pub fn create_device(
+ &self,
+ req: &super::frontend::CreateDeviceRequest,
+ ) -> ::grpcio::Result<super::frontend::CreateDeviceResponse> {
+ self.create_device_opt(req, ::grpcio::CallOption::default())
+ }
+
+ pub fn create_device_async_opt(
+ &self,
+ req: &super::frontend::CreateDeviceRequest,
+ opt: ::grpcio::CallOption,
+ ) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::frontend::CreateDeviceResponse>>
+ {
+ self.client.unary_call_async(&METHOD_FRONTEND_SERVICE_CREATE_DEVICE, req, opt)
+ }
+
+ pub fn create_device_async(
+ &self,
+ req: &super::frontend::CreateDeviceRequest,
+ ) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::frontend::CreateDeviceResponse>>
+ {
+ self.create_device_async_opt(req, ::grpcio::CallOption::default())
+ }
+
+ pub fn delete_chip_opt(
+ &self,
+ req: &super::frontend::DeleteChipRequest,
+ opt: ::grpcio::CallOption,
+ ) -> ::grpcio::Result<super::empty::Empty> {
+ self.client.unary_call(&METHOD_FRONTEND_SERVICE_DELETE_CHIP, req, opt)
+ }
+
+ pub fn delete_chip(
+ &self,
+ req: &super::frontend::DeleteChipRequest,
+ ) -> ::grpcio::Result<super::empty::Empty> {
+ self.delete_chip_opt(req, ::grpcio::CallOption::default())
+ }
+
+ pub fn delete_chip_async_opt(
+ &self,
+ req: &super::frontend::DeleteChipRequest,
+ opt: ::grpcio::CallOption,
+ ) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::empty::Empty>> {
+ self.client.unary_call_async(&METHOD_FRONTEND_SERVICE_DELETE_CHIP, req, opt)
+ }
+
+ pub fn delete_chip_async(
+ &self,
+ req: &super::frontend::DeleteChipRequest,
+ ) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::empty::Empty>> {
+ self.delete_chip_async_opt(req, ::grpcio::CallOption::default())
+ }
+
+ pub fn patch_device_opt(
+ &self,
+ req: &super::frontend::PatchDeviceRequest,
+ opt: ::grpcio::CallOption,
+ ) -> ::grpcio::Result<super::empty::Empty> {
+ self.client.unary_call(&METHOD_FRONTEND_SERVICE_PATCH_DEVICE, req, opt)
+ }
+
+ pub fn patch_device(
+ &self,
+ req: &super::frontend::PatchDeviceRequest,
+ ) -> ::grpcio::Result<super::empty::Empty> {
+ self.patch_device_opt(req, ::grpcio::CallOption::default())
+ }
+
+ pub fn patch_device_async_opt(
+ &self,
+ req: &super::frontend::PatchDeviceRequest,
+ opt: ::grpcio::CallOption,
+ ) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::empty::Empty>> {
+ self.client.unary_call_async(&METHOD_FRONTEND_SERVICE_PATCH_DEVICE, req, opt)
+ }
+
+ pub fn patch_device_async(
+ &self,
+ req: &super::frontend::PatchDeviceRequest,
+ ) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::empty::Empty>> {
+ self.patch_device_async_opt(req, ::grpcio::CallOption::default())
+ }
+
+ pub fn reset_opt(
+ &self,
+ req: &super::empty::Empty,
+ opt: ::grpcio::CallOption,
+ ) -> ::grpcio::Result<super::empty::Empty> {
+ self.client.unary_call(&METHOD_FRONTEND_SERVICE_RESET, req, opt)
+ }
+
+ pub fn reset(&self, req: &super::empty::Empty) -> ::grpcio::Result<super::empty::Empty> {
+ self.reset_opt(req, ::grpcio::CallOption::default())
+ }
+
+ pub fn reset_async_opt(
+ &self,
+ req: &super::empty::Empty,
+ opt: ::grpcio::CallOption,
+ ) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::empty::Empty>> {
+ self.client.unary_call_async(&METHOD_FRONTEND_SERVICE_RESET, req, opt)
+ }
+
+ pub fn reset_async(
+ &self,
+ req: &super::empty::Empty,
+ ) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::empty::Empty>> {
+ self.reset_async_opt(req, ::grpcio::CallOption::default())
+ }
+
+ pub fn list_device_opt(
+ &self,
+ req: &super::empty::Empty,
+ opt: ::grpcio::CallOption,
+ ) -> ::grpcio::Result<super::frontend::ListDeviceResponse> {
+ self.client.unary_call(&METHOD_FRONTEND_SERVICE_LIST_DEVICE, req, opt)
+ }
+
+ pub fn list_device(
+ &self,
+ req: &super::empty::Empty,
+ ) -> ::grpcio::Result<super::frontend::ListDeviceResponse> {
+ self.list_device_opt(req, ::grpcio::CallOption::default())
+ }
+
+ pub fn list_device_async_opt(
+ &self,
+ req: &super::empty::Empty,
+ opt: ::grpcio::CallOption,
+ ) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::frontend::ListDeviceResponse>> {
+ self.client.unary_call_async(&METHOD_FRONTEND_SERVICE_LIST_DEVICE, req, opt)
+ }
+
+ pub fn list_device_async(
+ &self,
+ req: &super::empty::Empty,
+ ) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::frontend::ListDeviceResponse>> {
+ self.list_device_async_opt(req, ::grpcio::CallOption::default())
+ }
+
+ pub fn subscribe_device_opt(
+ &self,
+ req: &super::frontend::SubscribeDeviceRequest,
+ opt: ::grpcio::CallOption,
+ ) -> ::grpcio::Result<super::frontend::SubscribeDeviceResponse> {
+ self.client.unary_call(&METHOD_FRONTEND_SERVICE_SUBSCRIBE_DEVICE, req, opt)
+ }
+
+ pub fn subscribe_device(
+ &self,
+ req: &super::frontend::SubscribeDeviceRequest,
+ ) -> ::grpcio::Result<super::frontend::SubscribeDeviceResponse> {
+ self.subscribe_device_opt(req, ::grpcio::CallOption::default())
+ }
+
+ pub fn subscribe_device_async_opt(
+ &self,
+ req: &super::frontend::SubscribeDeviceRequest,
+ opt: ::grpcio::CallOption,
+ ) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::frontend::SubscribeDeviceResponse>>
+ {
+ self.client.unary_call_async(&METHOD_FRONTEND_SERVICE_SUBSCRIBE_DEVICE, req, opt)
+ }
+
+ pub fn subscribe_device_async(
+ &self,
+ req: &super::frontend::SubscribeDeviceRequest,
+ ) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::frontend::SubscribeDeviceResponse>>
+ {
+ self.subscribe_device_async_opt(req, ::grpcio::CallOption::default())
+ }
+
+ pub fn patch_capture_opt(
+ &self,
+ req: &super::frontend::PatchCaptureRequest,
+ opt: ::grpcio::CallOption,
+ ) -> ::grpcio::Result<super::empty::Empty> {
+ self.client.unary_call(&METHOD_FRONTEND_SERVICE_PATCH_CAPTURE, req, opt)
+ }
+
+ pub fn patch_capture(
+ &self,
+ req: &super::frontend::PatchCaptureRequest,
+ ) -> ::grpcio::Result<super::empty::Empty> {
+ self.patch_capture_opt(req, ::grpcio::CallOption::default())
+ }
+
+ pub fn patch_capture_async_opt(
+ &self,
+ req: &super::frontend::PatchCaptureRequest,
+ opt: ::grpcio::CallOption,
+ ) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::empty::Empty>> {
+ self.client.unary_call_async(&METHOD_FRONTEND_SERVICE_PATCH_CAPTURE, req, opt)
+ }
+
+ pub fn patch_capture_async(
+ &self,
+ req: &super::frontend::PatchCaptureRequest,
+ ) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::empty::Empty>> {
+ self.patch_capture_async_opt(req, ::grpcio::CallOption::default())
+ }
+
+ pub fn list_capture_opt(
+ &self,
+ req: &super::empty::Empty,
+ opt: ::grpcio::CallOption,
+ ) -> ::grpcio::Result<super::frontend::ListCaptureResponse> {
+ self.client.unary_call(&METHOD_FRONTEND_SERVICE_LIST_CAPTURE, req, opt)
+ }
+
+ pub fn list_capture(
+ &self,
+ req: &super::empty::Empty,
+ ) -> ::grpcio::Result<super::frontend::ListCaptureResponse> {
+ self.list_capture_opt(req, ::grpcio::CallOption::default())
+ }
+
+ pub fn list_capture_async_opt(
+ &self,
+ req: &super::empty::Empty,
+ opt: ::grpcio::CallOption,
+ ) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::frontend::ListCaptureResponse>> {
+ self.client.unary_call_async(&METHOD_FRONTEND_SERVICE_LIST_CAPTURE, req, opt)
+ }
+
+ pub fn list_capture_async(
+ &self,
+ req: &super::empty::Empty,
+ ) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::frontend::ListCaptureResponse>> {
+ self.list_capture_async_opt(req, ::grpcio::CallOption::default())
+ }
+
+ pub fn get_capture_opt(
+ &self,
+ req: &super::frontend::GetCaptureRequest,
+ opt: ::grpcio::CallOption,
+ ) -> ::grpcio::Result<::grpcio::ClientSStreamReceiver<super::frontend::GetCaptureResponse>>
+ {
+ self.client.server_streaming(&METHOD_FRONTEND_SERVICE_GET_CAPTURE, req, opt)
+ }
+
+ pub fn get_capture(
+ &self,
+ req: &super::frontend::GetCaptureRequest,
+ ) -> ::grpcio::Result<::grpcio::ClientSStreamReceiver<super::frontend::GetCaptureResponse>>
+ {
+ self.get_capture_opt(req, ::grpcio::CallOption::default())
+ }
+ pub fn spawn<F>(&self, f: F)
+ where
+ F: ::std::future::Future<Output = ()> + Send + 'static,
+ {
+ self.client.spawn(f)
+ }
+}
+
+pub trait FrontendService {
+ fn get_version(
+ &mut self,
+ ctx: ::grpcio::RpcContext,
+ _req: super::empty::Empty,
+ sink: ::grpcio::UnarySink<super::frontend::VersionResponse>,
+ ) {
+ grpcio::unimplemented_call!(ctx, sink)
+ }
+ fn create_device(
+ &mut self,
+ ctx: ::grpcio::RpcContext,
+ _req: super::frontend::CreateDeviceRequest,
+ sink: ::grpcio::UnarySink<super::frontend::CreateDeviceResponse>,
+ ) {
+ grpcio::unimplemented_call!(ctx, sink)
+ }
+ fn delete_chip(
+ &mut self,
+ ctx: ::grpcio::RpcContext,
+ _req: super::frontend::DeleteChipRequest,
+ sink: ::grpcio::UnarySink<super::empty::Empty>,
+ ) {
+ grpcio::unimplemented_call!(ctx, sink)
+ }
+ fn patch_device(
+ &mut self,
+ ctx: ::grpcio::RpcContext,
+ _req: super::frontend::PatchDeviceRequest,
+ sink: ::grpcio::UnarySink<super::empty::Empty>,
+ ) {
+ grpcio::unimplemented_call!(ctx, sink)
+ }
+ fn reset(
+ &mut self,
+ ctx: ::grpcio::RpcContext,
+ _req: super::empty::Empty,
+ sink: ::grpcio::UnarySink<super::empty::Empty>,
+ ) {
+ grpcio::unimplemented_call!(ctx, sink)
+ }
+ fn list_device(
+ &mut self,
+ ctx: ::grpcio::RpcContext,
+ _req: super::empty::Empty,
+ sink: ::grpcio::UnarySink<super::frontend::ListDeviceResponse>,
+ ) {
+ grpcio::unimplemented_call!(ctx, sink)
+ }
+ fn subscribe_device(
+ &mut self,
+ ctx: ::grpcio::RpcContext,
+ _req: super::frontend::SubscribeDeviceRequest,
+ sink: ::grpcio::UnarySink<super::frontend::SubscribeDeviceResponse>,
+ ) {
+ grpcio::unimplemented_call!(ctx, sink)
+ }
+ fn patch_capture(
+ &mut self,
+ ctx: ::grpcio::RpcContext,
+ _req: super::frontend::PatchCaptureRequest,
+ sink: ::grpcio::UnarySink<super::empty::Empty>,
+ ) {
+ grpcio::unimplemented_call!(ctx, sink)
+ }
+ fn list_capture(
+ &mut self,
+ ctx: ::grpcio::RpcContext,
+ _req: super::empty::Empty,
+ sink: ::grpcio::UnarySink<super::frontend::ListCaptureResponse>,
+ ) {
+ grpcio::unimplemented_call!(ctx, sink)
+ }
+ fn get_capture(
+ &mut self,
+ ctx: ::grpcio::RpcContext,
+ _req: super::frontend::GetCaptureRequest,
+ sink: ::grpcio::ServerStreamingSink<super::frontend::GetCaptureResponse>,
+ ) {
+ grpcio::unimplemented_call!(ctx, sink)
+ }
+}
+
+pub fn create_frontend_service<S: FrontendService + Send + Clone + 'static>(
+ s: S,
+) -> ::grpcio::Service {
+ let mut builder = ::grpcio::ServiceBuilder::new();
+ let mut instance = s.clone();
+ builder = builder
+ .add_unary_handler(&METHOD_FRONTEND_SERVICE_GET_VERSION, move |ctx, req, resp| {
+ instance.get_version(ctx, req, resp)
+ });
+ let mut instance = s.clone();
+ builder = builder
+ .add_unary_handler(&METHOD_FRONTEND_SERVICE_CREATE_DEVICE, move |ctx, req, resp| {
+ instance.create_device(ctx, req, resp)
+ });
+ let mut instance = s.clone();
+ builder = builder
+ .add_unary_handler(&METHOD_FRONTEND_SERVICE_DELETE_CHIP, move |ctx, req, resp| {
+ instance.delete_chip(ctx, req, resp)
+ });
+ let mut instance = s.clone();
+ builder = builder
+ .add_unary_handler(&METHOD_FRONTEND_SERVICE_PATCH_DEVICE, move |ctx, req, resp| {
+ instance.patch_device(ctx, req, resp)
+ });
+ let mut instance = s.clone();
+ builder = builder.add_unary_handler(&METHOD_FRONTEND_SERVICE_RESET, move |ctx, req, resp| {
+ instance.reset(ctx, req, resp)
+ });
+ let mut instance = s.clone();
+ builder = builder
+ .add_unary_handler(&METHOD_FRONTEND_SERVICE_LIST_DEVICE, move |ctx, req, resp| {
+ instance.list_device(ctx, req, resp)
+ });
+ let mut instance = s.clone();
+ builder = builder
+ .add_unary_handler(&METHOD_FRONTEND_SERVICE_SUBSCRIBE_DEVICE, move |ctx, req, resp| {
+ instance.subscribe_device(ctx, req, resp)
+ });
+ let mut instance = s.clone();
+ builder = builder
+ .add_unary_handler(&METHOD_FRONTEND_SERVICE_PATCH_CAPTURE, move |ctx, req, resp| {
+ instance.patch_capture(ctx, req, resp)
+ });
+ let mut instance = s.clone();
+ builder = builder
+ .add_unary_handler(&METHOD_FRONTEND_SERVICE_LIST_CAPTURE, move |ctx, req, resp| {
+ instance.list_capture(ctx, req, resp)
+ });
+ let mut instance = s;
+ builder = builder.add_server_streaming_handler(
+ &METHOD_FRONTEND_SERVICE_GET_CAPTURE,
+ move |ctx, req, resp| instance.get_capture(ctx, req, resp),
+ );
+ builder.build()
+}
diff --git a/rust/proto/src/lib.rs b/rust/proto/src/lib.rs
index c9eb9ec..8397ff6 100644
--- a/rust/proto/src/lib.rs
+++ b/rust/proto/src/lib.rs
@@ -14,11 +14,16 @@
// limitations under the License.
//! protobuf library for netsim
+#[cfg(feature = "cuttlefish")]
+use protobuf::well_known_types::empty;
pub mod common;
pub mod config;
pub mod configuration;
pub mod frontend;
+// TODO: Remove feature check once crate dependency is resolved
+#[cfg(feature = "cuttlefish")]
+pub mod frontend_grpc;
pub mod hci_packet;
pub mod model;
pub mod packet_streamer;
diff --git a/scripts/proto_update.sh b/scripts/proto_update.sh
index 1062b91..6353465 100755
--- a/scripts/proto_update.sh
+++ b/scripts/proto_update.sh
@@ -40,6 +40,13 @@ export CARGO_HOME=$REPO/objs/rust/.cargo
cd $REPO
cargo build --manifest-path $CARGO
+# run protoc command to generate grpc proto rust files
+# Possibly need to install compilers:
+# $ cargo install protobuf-codegen
+# $ cargo install grpcio-compiler
+# TODO: Need to add required crate mappings to work in emu-master-dev
+# protoc --rust_out=./rust/proto/src --grpc_out=./rust/proto/src --plugin=protoc-gen-grpc=`which grpc_rust_plugin` -I./proto -I../../external/protobuf/src -I../../packages/modules/Bluetooth/tools/rootcanal/proto ./proto/netsim/frontend.proto
+
# Undo changed to Cargo.toml
git checkout $CARGO