• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2022 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package netsim.packet;
18
19import "hci_packet.proto";
20import "startup.proto";
21
22/**
23 * This is the packet service for the network simulator.
24 *
25 * Android Virtual Devices (AVDs) and accessory devices use this service to
26 * connect to the network simulator and pass packets back and forth.
27 *
28 * AVDs running in a guest VM are built with virtual controllers for each radio
29 * chip. These controllers route chip requests to host emulators (qemu and
30 * crosvm) using virtio and from there they are forwarded to this gRpc service.
31 *
32 * This setup provides a transparent radio environment across AVDs and
33 * accessories because the network simulator contains libraries to emulate
34 * Bluetooth, 80211MAC, UWB, and Rtt chips.
35 *
36 */
37service PacketStreamer {
38  // Attach a virtual radio controller to the network simulation.
39  rpc StreamPackets(stream PacketRequest) returns (stream PacketResponse);
40}
41
42message PacketRequest {
43  // The pattern of oneof in a stream from grpc/load_balancer.proto
44  oneof request_type {
45    // This message should be sent on the first request to the network
46    // simulator. Specifies the device name and chip type for the packet stream.
47    netsim.startup.ChipInfo initial_info = 1;
48    // The streamed data for an attached hci radio chip
49    HCIPacket hci_packet = 2;
50    // The streamed data for other radio chips
51    bytes packet = 3;
52  }
53}
54
55message PacketResponse {
56  oneof response_type {
57    // Error during streaming
58    string error = 1;
59    // The streamed data for an attached hci radio chip
60    HCIPacket hci_packet = 2;
61    // The streamed data for other radio chips
62    bytes packet = 3;
63  }
64}
65