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_controller.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(
54     const CuttlefishConfig::EnvironmentSpecific&,
55     const CuttlefishConfig::InstanceSpecific&);
56 
57 fruit::Component<fruit::Required<const CuttlefishConfig::InstanceSpecific>,
58                  KernelLogPipeProvider>
59 KernelLogMonitorComponent();
60 
61 Result<MonitorCommand> LogcatReceiver(
62     const CuttlefishConfig::InstanceSpecific&);
63 std::string LogcatInfo(const CuttlefishConfig::InstanceSpecific&);
64 
65 Result<std::optional<MonitorCommand>> CasimirControlServer(
66     const CuttlefishConfig&, const CuttlefishConfig::EnvironmentSpecific&,
67     const CuttlefishConfig::InstanceSpecific&, GrpcSocketCreator&);
68 
69 Result<std::optional<MonitorCommand>> ConsoleForwarder(
70     const CuttlefishConfig::InstanceSpecific&);
71 std::string ConsoleInfo(const CuttlefishConfig::InstanceSpecific&);
72 
73 fruit::Component<fruit::Required<const CuttlefishConfig::InstanceSpecific,
74                                  GrpcSocketCreator>>
75 ControlEnvProxyServerComponent();
76 
77 Result<std::optional<MonitorCommand>> GnssGrpcProxyServer(
78     const CuttlefishConfig::InstanceSpecific&, GrpcSocketCreator&);
79 
80 std::optional<MonitorCommand> MetricsService(const CuttlefishConfig&);
81 
82 fruit::Component<fruit::Required<
83     const CuttlefishConfig, const CuttlefishConfig::EnvironmentSpecific,
84     const CuttlefishConfig::InstanceSpecific, LogTeeCreator, WmediumdServer>>
85 OpenWrtComponent();
86 
87 fruit::Component<fruit::Required<const CuttlefishConfig,
88                                  const CuttlefishConfig::EnvironmentSpecific,
89                                  GrpcSocketCreator>>
90 OpenwrtControlServerComponent();
91 
92 fruit::Component<
93     fruit::Required<const CuttlefishConfig,
94                     const CuttlefishConfig::InstanceSpecific, LogTeeCreator>>
95 RootCanalComponent();
96 
97 Result<std::vector<MonitorCommand>> Casimir(
98     const CuttlefishConfig&, const CuttlefishConfig::EnvironmentSpecific&,
99     const CuttlefishConfig::InstanceSpecific&, LogTeeCreator&);
100 
101 Result<std::vector<MonitorCommand>> Pica(
102     const CuttlefishConfig&, const CuttlefishConfig::InstanceSpecific&,
103     LogTeeCreator&);
104 
105 MonitorCommand EchoServer(GrpcSocketCreator& grpc_socket);
106 
107 fruit::Component<fruit::Required<const CuttlefishConfig,
108                                  const CuttlefishConfig::InstanceSpecific>>
109 NetsimServerComponent();
110 
111 Result<std::optional<MonitorCommand>> ScreenRecordingServer(GrpcSocketCreator&);
112 
113 Result<MonitorCommand> SecureEnv(const CuttlefishConfig&,
114                                  const CuttlefishConfig::InstanceSpecific&,
115                                  AutoSnapshotControlFiles::Type&,
116                                  KernelLogPipeProvider&);
117 
118 Result<MonitorCommand> TombstoneReceiver(
119     const CuttlefishConfig::InstanceSpecific&);
120 
121 fruit::Component<fruit::Required<
122     const CuttlefishConfig, const CuttlefishConfig::EnvironmentSpecific,
123     const CuttlefishConfig::InstanceSpecific, LogTeeCreator, GrpcSocketCreator>>
124 WmediumdServerComponent();
125 
126 Result<std::optional<MonitorCommand>> ModemSimulator(
127     const CuttlefishConfig::InstanceSpecific&);
128 
129 fruit::Component<
130     fruit::Required<const CuttlefishConfig, KernelLogPipeProvider,
131                     const CuttlefishConfig::InstanceSpecific,
132                     const CustomActionConfigProvider, WebRtcController>>
133 launchStreamerComponent();
134 
135 fruit::Component<WebRtcController> WebRtcControllerComponent();
136 
137 fruit::Component<
138     fruit::Required<const CuttlefishConfig,
139                     const CuttlefishConfig::InstanceSpecific, LogTeeCreator>>
140 McuComponent();
141 
142 std::optional<MonitorCommand> VhalProxyServer(
143     const CuttlefishConfig&, const CuttlefishConfig::InstanceSpecific&);
144 }  // namespace cuttlefish
145