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     /// Disable Wi-Fi peer-to-peer features.
60     /// WARNING: This flag is for development purpose.
61     #[arg(long)]
62     pub disable_wifi_p2p: bool,
63 
64     /// Use Rust gRPC server.
65     /// WARNING: This flag is for development purpose.
66     #[arg(long)]
67     pub rust_grpc: bool,
68 
69     /// Set the vsock port number to be listened by the frontend grpc server
70     #[arg(short, long)]
71     pub vsock: Option<u16>,
72 
73     /// The name of a config file to load
74     #[arg(long)]
75     pub config: Option<String>,
76 
77     /// Comma separated list of host DNS servers
78     #[arg(long)]
79     pub host_dns: Option<String>,
80 
81     /// Redirect all TCP connections through the specified HTTP/HTTPS proxy.
82     /// Can be one of the following:
83     ///     http://<server>:<port>
84     ///     http://<username>:<password>@<server>:<port>
85     ///     (the 'http://' prefix can be omitted)
86     /// WARNING: This flag is still working in progress.
87     #[arg(long, verbatim_doc_comment)]
88     pub http_proxy: Option<String>,
89 
90     /// Start with test beacons
91     #[arg(long, alias = "test_beacons", overrides_with("no_test_beacons"))]
92     pub test_beacons: bool,
93 
94     /// Do not start with test beacons
95     #[arg(long, alias = "no_test_beacons", overrides_with("test_beacons"))]
96     pub no_test_beacons: bool,
97 
98     /// Disable netsimd from shutting down automatically.
99     /// WARNING: This flag is for development purpose. netsimd will not shutdown without SIGKILL.
100     #[arg(long, alias = "no_shutdown")]
101     pub no_shutdown: bool,
102 
103     /// Entering Verbose mode
104     #[arg(short = 'v', long)]
105     pub verbose: bool,
106 
107     /// Print Netsimd version information
108     #[arg(long)]
109     pub version: bool,
110 }
111