1 //
2 // Copyright (C) 2019 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 #pragma once
17 
18 #include <optional>
19 #include <string>
20 #include <vector>
21 
22 #include <fruit/fruit.h>
23 
24 #include "common/libs/fs/shared_fd.h"
25 #include "common/libs/utils/subprocess.h"
26 #include "host/commands/run_cvd/launch/auto_cmd.h"
27 #include "host/commands/run_cvd/launch/grpc_socket_creator.h"
28 #include "host/commands/run_cvd/launch/log_tee_creator.h"
29 #include "host/commands/run_cvd/launch/snapshot_control_files.h"
30 #include "host/commands/run_cvd/launch/webrtc_recorder.h"
31 #include "host/commands/run_cvd/launch/wmediumd_server.h"
32 #include "host/libs/config/command_source.h"
33 #include "host/libs/config/custom_actions.h"
34 #include "host/libs/config/cuttlefish_config.h"
35 #include "host/libs/config/feature.h"
36 #include "host/libs/config/kernel_log_pipe_provider.h"
37 #include "host/libs/vm_manager/vm_manager.h"
38 
39 namespace cuttlefish {
40 
41 Result<std::optional<MonitorCommand>> UwbConnector(
42     const CuttlefishConfig&, const CuttlefishConfig::InstanceSpecific&);
43 
44 std::optional<MonitorCommand> AutomotiveProxyService(const CuttlefishConfig&);
45 
46 fruit::Component<fruit::Required<const CuttlefishConfig, LogTeeCreator,
47                                  const CuttlefishConfig::InstanceSpecific>>
48 VhostDeviceVsockComponent();
49 
50 Result<std::optional<MonitorCommand>> BluetoothConnector(
51     const CuttlefishConfig&, const CuttlefishConfig::InstanceSpecific&);
52 
53 Result<MonitorCommand> NfcConnector(const CuttlefishConfig&,
54                                     const CuttlefishConfig::InstanceSpecific&);
55 
56 fruit::Component<fruit::Required<const CuttlefishConfig::InstanceSpecific>,
57                  KernelLogPipeProvider>
58 KernelLogMonitorComponent();
59 
60 Result<MonitorCommand> LogcatReceiver(
61     const CuttlefishConfig::InstanceSpecific&);
62 std::string LogcatInfo(const CuttlefishConfig::InstanceSpecific&);
63 
64 Result<std::optional<MonitorCommand>> CasimirControlServer(
65     const CuttlefishConfig&, const CuttlefishConfig::InstanceSpecific&,
66     GrpcSocketCreator&);
67 
68 Result<std::optional<MonitorCommand>> ConsoleForwarder(
69     const CuttlefishConfig::InstanceSpecific&);
70 std::string ConsoleInfo(const CuttlefishConfig::InstanceSpecific&);
71 
72 fruit::Component<fruit::Required<const CuttlefishConfig::InstanceSpecific,
73                                  GrpcSocketCreator>>
74 ControlEnvProxyServerComponent();
75 
76 Result<std::optional<MonitorCommand>> GnssGrpcProxyServer(
77     const CuttlefishConfig::InstanceSpecific&, GrpcSocketCreator&);
78 
79 std::optional<MonitorCommand> MetricsService(const CuttlefishConfig&);
80 
81 fruit::Component<fruit::Required<
82     const CuttlefishConfig, const CuttlefishConfig::EnvironmentSpecific,
83     const CuttlefishConfig::InstanceSpecific, LogTeeCreator, WmediumdServer>>
84 OpenWrtComponent();
85 
86 fruit::Component<fruit::Required<const CuttlefishConfig,
87                                  const CuttlefishConfig::EnvironmentSpecific,
88                                  GrpcSocketCreator>>
89 OpenwrtControlServerComponent();
90 
91 fruit::Component<
92     fruit::Required<const CuttlefishConfig,
93                     const CuttlefishConfig::InstanceSpecific, LogTeeCreator>>
94 RootCanalComponent();
95 
96 Result<std::vector<MonitorCommand>> Casimir(
97     const CuttlefishConfig&, const CuttlefishConfig::InstanceSpecific&,
98     LogTeeCreator&);
99 
100 Result<std::vector<MonitorCommand>> Pica(
101     const CuttlefishConfig&, const CuttlefishConfig::InstanceSpecific&,
102     LogTeeCreator&);
103 
104 MonitorCommand EchoServer(GrpcSocketCreator& grpc_socket);
105 
106 fruit::Component<fruit::Required<const CuttlefishConfig,
107                                  const CuttlefishConfig::InstanceSpecific>>
108 NetsimServerComponent();
109 
110 Result<std::optional<MonitorCommand>> ScreenRecordingServer(GrpcSocketCreator&);
111 
112 Result<MonitorCommand> SecureEnv(const CuttlefishConfig&,
113                                  const CuttlefishConfig::InstanceSpecific&,
114                                  AutoSnapshotControlFiles::Type&,
115                                  KernelLogPipeProvider&);
116 
117 Result<MonitorCommand> TombstoneReceiver(
118     const CuttlefishConfig::InstanceSpecific&);
119 
120 fruit::Component<fruit::Required<
121     const CuttlefishConfig, const CuttlefishConfig::EnvironmentSpecific,
122     const CuttlefishConfig::InstanceSpecific, LogTeeCreator, GrpcSocketCreator>>
123 WmediumdServerComponent();
124 
125 Result<std::optional<MonitorCommand>> ModemSimulator(
126     const CuttlefishConfig::InstanceSpecific&);
127 
128 fruit::Component<
129     fruit::Required<const CuttlefishConfig, KernelLogPipeProvider,
130                     const CuttlefishConfig::InstanceSpecific,
131                     const CustomActionConfigProvider, WebRtcRecorder>>
132 launchStreamerComponent();
133 
134 fruit::Component<WebRtcRecorder> WebRtcRecorderComponent();
135 
136 fruit::Component<
137     fruit::Required<const CuttlefishConfig,
138                     const CuttlefishConfig::InstanceSpecific, LogTeeCreator>>
139 McuComponent();
140 
141 std::optional<MonitorCommand> VhalProxyServer(
142     const CuttlefishConfig&, const CuttlefishConfig::InstanceSpecific&);
143 }  // namespace cuttlefish
144