• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /**
18  * packet_hub is a central point for packet transfer between HCI, UWB, WiFi
19  * facades and gRPC and socket transports.
20  *
21  * It allows a single point for:
22  * - statistics collection
23  * - pcap trace management
24  * - inspection/analysis (NYI)
25  */
26 
27 #pragma once
28 
29 // Use gRPC HCI PacketType definitions so we don't expose Rootcanal's version
30 // outside of the Bluetooth Facade.
31 #include "common.pb.h"
32 #include "hci_packet.pb.h"
33 #include "rust/cxx.h"
34 
35 namespace netsim {
36 namespace packet_hub {
37 
38 /* Handle packet request/response for the Bluetooth Facade which may come over
39    different transports. */
40 
41 void HandleRequest(common::ChipKind kind, uint32_t facade_id,
42                    const std::vector<uint8_t> &packet,
43                    packet::HCIPacket_PacketType packet_type);
44 
45 void HandleRequestCxx(uint32_t kind, uint32_t facade_id,
46                       const rust::Vec<uint8_t> &packet, uint8_t packet_type);
47 
48 void HandleBtResponse(uint32_t facade_id,
49                       packet::HCIPacket_PacketType packet_type,
50                       const std::shared_ptr<std::vector<uint8_t>> &packet);
51 
52 void HandleWifiResponse(uint32_t facade_id,
53                         const std::shared_ptr<std::vector<uint8_t>> &packet);
54 
55 }  // namespace packet_hub
56 }  // namespace netsim
57