xref: /aosp_15_r20/tools/netsim/rust/daemon/src/args.rs (revision cf78ab8cffb8fc9207af348f23af247fb04370a6)
1 // Copyright 2023 Google LLC
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 //     https://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 
15 use clap::Parser;
16 
17 #[derive(Debug, Parser)]
18 pub struct NetsimdArgs {
19     /// File descriptor start up info proto
20     #[arg(short = 's', long, alias = "fd_startup_str")]
21     pub fd_startup_str: Option<String>,
22 
23     /// Disable grpc server for CLI
24     #[arg(long, alias = "no_cli_ui")]
25     pub no_cli_ui: bool,
26 
27     /// Disable web server
28     #[arg(long, alias = "no_web_ui")]
29     pub no_web_ui: bool,
30 
31     /// Enable packet capture
32     #[arg(long)]
33     pub pcap: bool,
34 
35     /// Disable Address Reuse for test model
36     #[arg(long, alias = "disable_address_reuse")]
37     pub disable_address_reuse: bool,
38 
39     /// Set custom hci port
40     #[arg(long, alias = "hci_port")]
41     pub hci_port: Option<u32>,
42 
43     /// Enables connector mode to forward packets to another instance.
44     #[arg(short, long, alias = "connector_instance", visible_alias = "connector_instance_num")]
45     pub connector_instance: Option<u16>,
46 
47     /// Netsimd instance number
48     #[arg(short, long, visible_alias = "instance_num")]
49     pub instance: Option<u16>,
50 
51     /// Set whether log messages go to stderr instead of logfiles
52     #[arg(short, long)]
53     pub logtostderr: bool,
54 
55     /// Enable development mode. This will include additional features
56     #[arg(short, long)]
57     pub dev: bool,
58 
59     /// Forwards mDNS from the host to the guest, allowing emulator to discover mDNS services running on the host.
60     ///
61     /// # Limitations
62     /// * Currently only supports a single emulator.
63     /// * May impact Wi-Fi connectivity between emulators.
64     #[arg(long, verbatim_doc_comment)]
65     pub forward_host_mdns: bool,
66 
67     /// Set the vsock port number to be listened by the frontend grpc server
68     #[arg(short, long)]
69     pub vsock: Option<u16>,
70 
71     /// The name of a config file to load
72     #[arg(long)]
73     pub config: Option<String>,
74 
75     /// Comma separated list of host DNS servers
76     #[arg(long)]
77     pub host_dns: Option<String>,
78 
79     /// Redirect all TCP connections through the specified HTTP/HTTPS proxy.
80     /// Can be one of the following:
81     ///     http://<server>:<port>
82     ///     http://<username>:<password>@<server>:<port>
83     ///     (the 'http://' prefix can be omitted)
84     /// WARNING: This flag is still working in progress.
85     #[arg(long, verbatim_doc_comment)]
86     #[cfg_attr(not(feature = "cuttlefish"), arg(env = "http_proxy"))]
87     pub http_proxy: Option<String>,
88 
89     // Use TAP interface instead of libslirp for Wi-Fi
90     /// WARNING: This flag is still working in progress.
91     #[arg(long)]
92     pub wifi_tap: Option<String>,
93 
94     /// Start with test beacons
95     #[arg(long, alias = "test_beacons", overrides_with("no_test_beacons"))]
96     pub test_beacons: bool,
97 
98     /// Do not start with test beacons
99     #[arg(long, alias = "no_test_beacons", overrides_with("test_beacons"))]
100     pub no_test_beacons: bool,
101 
102     /// Disable netsimd from shutting down automatically.
103     /// WARNING: This flag is for development purpose. netsimd will not shutdown without SIGKILL.
104     #[arg(long, alias = "no_shutdown")]
105     pub no_shutdown: bool,
106 
107     /// Entering Verbose mode
108     #[arg(short = 'v', long)]
109     pub verbose: bool,
110 
111     /// Print Netsimd version information
112     #[arg(long)]
113     pub version: bool,
114 }
115