net_cli/opts/
dhcpd.rs

1// Copyright 2021 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5use argh::{ArgsInfo, FromArgs};
6
7use fidl_fuchsia_net_ext::MacAddress as MacAddr;
8use std::net::Ipv4Addr;
9
10#[derive(ArgsInfo, FromArgs, Clone, Debug, PartialEq)]
11#[argh(subcommand, name = "dhcpd")]
12/// commands to control a dhcp server
13pub struct Dhcpd {
14    #[argh(subcommand)]
15    pub dhcpd_cmd: DhcpdEnum,
16}
17
18#[derive(ArgsInfo, FromArgs, Clone, Debug, PartialEq)]
19#[argh(subcommand)]
20pub enum DhcpdEnum {
21    /// Starts the DHCP server.
22    Start(Start),
23    /// Stops the DHCP server.
24    Stop(Stop),
25    /// a primary command to retrieve the value of a DHCP option or server parameter.
26    Get(Get),
27    /// a primary command to set the value of a DHCP option or server parameter.
28    Set(Set),
29    /// a primary command to list the values of all DHCP options or server parameters.
30    List(List),
31    /// a primary command to reset the values of all DHCP options or server parameters.
32    Reset(Reset),
33    /// a primary command to clear the leases maintained by dhcpd.
34    // The value of this variant is required by the argh crate but is not actually used.
35    ClearLeases(ClearLeases),
36}
37
38/// A primary command to start the DHCP server.
39#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
40#[argh(subcommand, name = "start")]
41pub struct Start {}
42
43/// A primary command to stop the DHCP server.
44#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
45#[argh(subcommand, name = "stop")]
46pub struct Stop {}
47
48/// A primary command to retrieve the value of a DHCP option or server parameter.
49#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
50#[argh(subcommand, name = "get")]
51pub struct Get {
52    #[argh(subcommand)]
53    pub arg: GetArg,
54}
55
56/// A primary command to set the value of a DHCP option or server parameter.
57#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
58#[argh(subcommand, name = "set")]
59pub struct Set {
60    #[argh(subcommand)]
61    pub arg: SetArg,
62}
63
64/// A primary command to list the values of all DHCP options or server parameters.
65#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
66#[argh(subcommand, name = "list")]
67pub struct List {
68    #[argh(subcommand)]
69    pub arg: ListArg,
70}
71
72/// A primary command to reset the values of all DHCP options or server parameters.
73#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
74#[argh(subcommand, name = "reset")]
75pub struct Reset {
76    #[argh(subcommand)]
77    pub arg: ResetArg,
78}
79
80/// A primary command to clear the leases maintained by dhcpd.
81#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
82#[argh(subcommand, name = "clear-leases")]
83pub struct ClearLeases {}
84
85#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
86#[argh(subcommand)]
87pub enum GetArg {
88    /// a subcommand to specify retrieving a DHCP option.
89    Option(OptionArg),
90    /// a subcommand to specify retrieving a server parameter.
91    Parameter(ParameterArg),
92}
93/// A primary command argument to set the value of a DHCP option or server parameter.
94#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
95#[argh(subcommand)]
96pub enum SetArg {
97    Option(OptionArg),
98    Parameter(ParameterArg),
99}
100
101/// A primary command argument to list the values of all DHCP options or server parameters.
102#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
103#[argh(subcommand)]
104pub enum ListArg {
105    Option(OptionToken),
106    Parameter(ParameterToken),
107}
108
109/// A primary command argument to reset the values of all DHCP options or server parameters.
110#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
111#[argh(subcommand)]
112pub enum ResetArg {
113    Option(OptionToken),
114    Parameter(ParameterToken),
115}
116
117/// A secondary command indicating a DHCP option argument.
118#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
119#[argh(subcommand, name = "option")]
120pub struct OptionArg {
121    /// the name of the DHCP option to operate on.
122    #[argh(subcommand)]
123    pub name: Option_,
124}
125
126/// A secondary command indicating a server parameter argument.
127#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
128#[argh(subcommand, name = "parameter")]
129pub struct ParameterArg {
130    /// the name of the server parameter to operate on.
131    #[argh(subcommand)]
132    pub name: Parameter,
133}
134/// Perform the command on DHCP options.
135#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
136#[argh(subcommand, name = "option")]
137pub struct OptionToken {}
138
139/// Perform the command on server parameters.
140#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
141#[argh(subcommand, name = "parameter")]
142pub struct ParameterToken {}
143
144/// The name of the DHCP option to operate on.
145#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
146#[argh(subcommand)]
147pub enum Option_ {
148    SubnetMask(SubnetMask),
149    TimeOffset(TimeOffset),
150    Router(Router),
151    TimeServer(TimeServer),
152    NameServer(NameServer),
153    DomainNameServer(DomainNameServer),
154    LogServer(LogServer),
155    CookieServer(CookieServer),
156    LprServer(LprServer),
157    ImpressServer(ImpressServer),
158    ResourceLocationServer(ResourceLocationServer),
159    HostName(HostName),
160    BootFileSize(BootFileSize),
161    MeritDumpFile(MeritDumpFile),
162    DomainName(DomainName),
163    SwapServer(SwapServer),
164    RootPath(RootPath),
165    ExtensionsPath(ExtensionsPath),
166    IpForwarding(IpForwarding),
167    NonLocalSourceRouting(NonLocalSourceRouting),
168    PolicyFilter(PolicyFilter),
169    MaxDatagramReassemblySize(MaxDatagramReassemblySize),
170    DefaultIpTtl(DefaultIpTtl),
171    PathMtuAgingTimeout(PathMtuAgingTimeout),
172    PathMtuPlateauTable(PathMtuPlateauTable),
173    InterfaceMtu(InterfaceMtu),
174    AllSubnetsLocal(AllSubnetsLocal),
175    BroadcastAddress(BroadcastAddress),
176    PerformMaskDiscovery(PerformMaskDiscovery),
177    MaskSupplier(MaskSupplier),
178    PerformRouterDiscovery(PerformRouterDiscovery),
179    RouterSolicitationAddress(RouterSolicitationAddress),
180    StaticRoute(StaticRoute),
181    TrailerEncapsulation(TrailerEncapsulation),
182    ArpCacheTimeout(ArpCacheTimeout),
183    EthernetEncapsulation(EthernetEncapsulation),
184    TcpDefaultTtl(TcpDefaultTtl),
185    TcpKeepaliveInterval(TcpKeepaliveInterval),
186    TcpKeepaliveGarbage(TcpKeepaliveGarbage),
187    NetworkInformationServiceDomain(NetworkInformationServiceDomain),
188    NetworkInformationServers(NetworkInformationServers),
189    NetworkTimeProtocolServers(NetworkTimeProtocolServers),
190    VendorSpecificInformation(VendorSpecificInformation),
191    NetBiosOverTcpipNameServer(NetBiosOverTcpipNameServer),
192    NetBiosOverTcpipDatagramDistributionServer(NetBiosOverTcpipDatagramDistributionServer),
193    NetBiosOverTcpipNodeType(NetBiosOverTcpipNodeType),
194    NetBiosOverTcpipScope(NetBiosOverTcpipScope),
195    XWindowSystemFontServer(XWindowSystemFontServer),
196    XWindowSystemDisplayManager(XWindowSystemDisplayManager),
197    NetworkInformationServicePlusDomain(NetworkInformationServicePlusDomain),
198    NetworkInformationServicePlusServers(NetworkInformationServicePlusServers),
199    MobileIpHomeAgent(MobileIpHomeAgent),
200    SmtpServer(SmtpServer),
201    Pop3Server(Pop3Server),
202    NntpServer(NntpServer),
203    DefaultWwwServer(DefaultWwwServer),
204    DefaultFingerServer(DefaultFingerServer),
205    DefaultIrcServer(DefaultIrcServer),
206    StreettalkServer(StreettalkServer),
207    StreettalkDirectoryAssistanceServer(StreettalkDirectoryAssistanceServer),
208    TftpServerName(TftpServerName),
209    BootfileName(BootfileName),
210    MaxDhcpMessageSize(MaxDhcpMessageSize),
211    RenewalTimeValue(RenewalTimeValue),
212    RebindingTimeValue(RebindingTimeValue),
213}
214
215impl Into<fidl_fuchsia_net_dhcp::OptionCode> for Option_ {
216    fn into(self) -> fidl_fuchsia_net_dhcp::OptionCode {
217        match self {
218            Option_::SubnetMask(_) => fidl_fuchsia_net_dhcp::OptionCode::SubnetMask,
219            Option_::TimeOffset(_) => fidl_fuchsia_net_dhcp::OptionCode::TimeOffset,
220            Option_::Router(_) => fidl_fuchsia_net_dhcp::OptionCode::Router,
221            Option_::TimeServer(_) => fidl_fuchsia_net_dhcp::OptionCode::TimeServer,
222            Option_::NameServer(_) => fidl_fuchsia_net_dhcp::OptionCode::NameServer,
223            Option_::DomainNameServer(_) => fidl_fuchsia_net_dhcp::OptionCode::DomainNameServer,
224            Option_::LogServer(_) => fidl_fuchsia_net_dhcp::OptionCode::LogServer,
225            Option_::CookieServer(_) => fidl_fuchsia_net_dhcp::OptionCode::CookieServer,
226            Option_::LprServer(_) => fidl_fuchsia_net_dhcp::OptionCode::LprServer,
227            Option_::ImpressServer(_) => fidl_fuchsia_net_dhcp::OptionCode::ImpressServer,
228            Option_::ResourceLocationServer(_) => {
229                fidl_fuchsia_net_dhcp::OptionCode::ResourceLocationServer
230            }
231            Option_::HostName(_) => fidl_fuchsia_net_dhcp::OptionCode::HostName,
232            Option_::BootFileSize(_) => fidl_fuchsia_net_dhcp::OptionCode::BootFileSize,
233            Option_::MeritDumpFile(_) => fidl_fuchsia_net_dhcp::OptionCode::MeritDumpFile,
234            Option_::DomainName(_) => fidl_fuchsia_net_dhcp::OptionCode::DomainName,
235            Option_::SwapServer(_) => fidl_fuchsia_net_dhcp::OptionCode::SwapServer,
236            Option_::RootPath(_) => fidl_fuchsia_net_dhcp::OptionCode::RootPath,
237            Option_::ExtensionsPath(_) => fidl_fuchsia_net_dhcp::OptionCode::ExtensionsPath,
238            Option_::IpForwarding(_) => fidl_fuchsia_net_dhcp::OptionCode::IpForwarding,
239            Option_::NonLocalSourceRouting(_) => {
240                fidl_fuchsia_net_dhcp::OptionCode::NonLocalSourceRouting
241            }
242            Option_::PolicyFilter(_) => fidl_fuchsia_net_dhcp::OptionCode::PolicyFilter,
243            Option_::MaxDatagramReassemblySize(_) => {
244                fidl_fuchsia_net_dhcp::OptionCode::MaxDatagramReassemblySize
245            }
246            Option_::DefaultIpTtl(_) => fidl_fuchsia_net_dhcp::OptionCode::DefaultIpTtl,
247            Option_::PathMtuAgingTimeout(_) => {
248                fidl_fuchsia_net_dhcp::OptionCode::PathMtuAgingTimeout
249            }
250            Option_::PathMtuPlateauTable(_) => {
251                fidl_fuchsia_net_dhcp::OptionCode::PathMtuPlateauTable
252            }
253            Option_::InterfaceMtu(_) => fidl_fuchsia_net_dhcp::OptionCode::InterfaceMtu,
254            Option_::AllSubnetsLocal(_) => fidl_fuchsia_net_dhcp::OptionCode::AllSubnetsLocal,
255            Option_::BroadcastAddress(_) => fidl_fuchsia_net_dhcp::OptionCode::BroadcastAddress,
256            Option_::PerformMaskDiscovery(_) => {
257                fidl_fuchsia_net_dhcp::OptionCode::PerformMaskDiscovery
258            }
259            Option_::MaskSupplier(_) => fidl_fuchsia_net_dhcp::OptionCode::MaskSupplier,
260            Option_::PerformRouterDiscovery(_) => {
261                fidl_fuchsia_net_dhcp::OptionCode::PerformRouterDiscovery
262            }
263            Option_::RouterSolicitationAddress(_) => {
264                fidl_fuchsia_net_dhcp::OptionCode::RouterSolicitationAddress
265            }
266            Option_::StaticRoute(_) => fidl_fuchsia_net_dhcp::OptionCode::StaticRoute,
267            Option_::TrailerEncapsulation(_) => {
268                fidl_fuchsia_net_dhcp::OptionCode::TrailerEncapsulation
269            }
270            Option_::ArpCacheTimeout(_) => fidl_fuchsia_net_dhcp::OptionCode::ArpCacheTimeout,
271            Option_::EthernetEncapsulation(_) => {
272                fidl_fuchsia_net_dhcp::OptionCode::EthernetEncapsulation
273            }
274            Option_::TcpDefaultTtl(_) => fidl_fuchsia_net_dhcp::OptionCode::TcpDefaultTtl,
275            Option_::TcpKeepaliveInterval(_) => {
276                fidl_fuchsia_net_dhcp::OptionCode::TcpKeepaliveInterval
277            }
278            Option_::TcpKeepaliveGarbage(_) => {
279                fidl_fuchsia_net_dhcp::OptionCode::TcpKeepaliveGarbage
280            }
281            Option_::NetworkInformationServiceDomain(_) => {
282                fidl_fuchsia_net_dhcp::OptionCode::NetworkInformationServiceDomain
283            }
284            Option_::NetworkInformationServers(_) => {
285                fidl_fuchsia_net_dhcp::OptionCode::NetworkInformationServers
286            }
287            Option_::NetworkTimeProtocolServers(_) => {
288                fidl_fuchsia_net_dhcp::OptionCode::NetworkTimeProtocolServers
289            }
290            Option_::VendorSpecificInformation(_) => {
291                fidl_fuchsia_net_dhcp::OptionCode::VendorSpecificInformation
292            }
293            Option_::NetBiosOverTcpipNameServer(_) => {
294                fidl_fuchsia_net_dhcp::OptionCode::NetbiosOverTcpipNameServer
295            }
296            Option_::NetBiosOverTcpipDatagramDistributionServer(_) => {
297                fidl_fuchsia_net_dhcp::OptionCode::NetbiosOverTcpipDatagramDistributionServer
298            }
299            Option_::NetBiosOverTcpipNodeType(_) => {
300                fidl_fuchsia_net_dhcp::OptionCode::NetbiosOverTcpipNodeType
301            }
302            Option_::NetBiosOverTcpipScope(_) => {
303                fidl_fuchsia_net_dhcp::OptionCode::NetbiosOverTcpipScope
304            }
305            Option_::XWindowSystemFontServer(_) => {
306                fidl_fuchsia_net_dhcp::OptionCode::XWindowSystemFontServer
307            }
308            Option_::XWindowSystemDisplayManager(_) => {
309                fidl_fuchsia_net_dhcp::OptionCode::XWindowSystemDisplayManager
310            }
311            Option_::NetworkInformationServicePlusDomain(_) => {
312                fidl_fuchsia_net_dhcp::OptionCode::NetworkInformationServicePlusDomain
313            }
314            Option_::NetworkInformationServicePlusServers(_) => {
315                fidl_fuchsia_net_dhcp::OptionCode::NetworkInformationServicePlusServers
316            }
317            Option_::MobileIpHomeAgent(_) => fidl_fuchsia_net_dhcp::OptionCode::MobileIpHomeAgent,
318            Option_::SmtpServer(_) => fidl_fuchsia_net_dhcp::OptionCode::SmtpServer,
319            Option_::Pop3Server(_) => fidl_fuchsia_net_dhcp::OptionCode::Pop3Server,
320            Option_::NntpServer(_) => fidl_fuchsia_net_dhcp::OptionCode::NntpServer,
321            Option_::DefaultWwwServer(_) => fidl_fuchsia_net_dhcp::OptionCode::DefaultWwwServer,
322            Option_::DefaultFingerServer(_) => {
323                fidl_fuchsia_net_dhcp::OptionCode::DefaultFingerServer
324            }
325            Option_::DefaultIrcServer(_) => fidl_fuchsia_net_dhcp::OptionCode::DefaultIrcServer,
326            Option_::StreettalkServer(_) => fidl_fuchsia_net_dhcp::OptionCode::StreettalkServer,
327            Option_::StreettalkDirectoryAssistanceServer(_) => {
328                fidl_fuchsia_net_dhcp::OptionCode::StreettalkDirectoryAssistanceServer
329            }
330            Option_::TftpServerName(_) => fidl_fuchsia_net_dhcp::OptionCode::TftpServerName,
331            Option_::BootfileName(_) => fidl_fuchsia_net_dhcp::OptionCode::BootfileName,
332            Option_::MaxDhcpMessageSize(_) => fidl_fuchsia_net_dhcp::OptionCode::MaxDhcpMessageSize,
333            Option_::RenewalTimeValue(_) => fidl_fuchsia_net_dhcp::OptionCode::RenewalTimeValue,
334            Option_::RebindingTimeValue(_) => fidl_fuchsia_net_dhcp::OptionCode::RebindingTimeValue,
335        }
336    }
337}
338
339impl Into<fidl_fuchsia_net_dhcp::Option_> for Option_ {
340    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
341        match self {
342            Option_::SubnetMask(v) => v.into(),
343            Option_::TimeOffset(v) => v.into(),
344            Option_::Router(v) => v.into(),
345            Option_::TimeServer(v) => v.into(),
346            Option_::NameServer(v) => v.into(),
347            Option_::DomainNameServer(v) => v.into(),
348            Option_::LogServer(v) => v.into(),
349            Option_::CookieServer(v) => v.into(),
350            Option_::LprServer(v) => v.into(),
351            Option_::ImpressServer(v) => v.into(),
352            Option_::ResourceLocationServer(v) => v.into(),
353            Option_::HostName(v) => v.into(),
354            Option_::BootFileSize(v) => v.into(),
355            Option_::MeritDumpFile(v) => v.into(),
356            Option_::DomainName(v) => v.into(),
357            Option_::SwapServer(v) => v.into(),
358            Option_::RootPath(v) => v.into(),
359            Option_::ExtensionsPath(v) => v.into(),
360            Option_::IpForwarding(v) => v.into(),
361            Option_::NonLocalSourceRouting(v) => v.into(),
362            Option_::PolicyFilter(v) => v.into(),
363            Option_::MaxDatagramReassemblySize(v) => v.into(),
364            Option_::DefaultIpTtl(v) => v.into(),
365            Option_::PathMtuAgingTimeout(v) => v.into(),
366            Option_::PathMtuPlateauTable(v) => v.into(),
367            Option_::InterfaceMtu(v) => v.into(),
368            Option_::AllSubnetsLocal(v) => v.into(),
369            Option_::BroadcastAddress(v) => v.into(),
370            Option_::PerformMaskDiscovery(v) => v.into(),
371            Option_::MaskSupplier(v) => v.into(),
372            Option_::PerformRouterDiscovery(v) => v.into(),
373            Option_::RouterSolicitationAddress(v) => v.into(),
374            Option_::StaticRoute(v) => v.into(),
375            Option_::TrailerEncapsulation(v) => v.into(),
376            Option_::ArpCacheTimeout(v) => v.into(),
377            Option_::EthernetEncapsulation(v) => v.into(),
378            Option_::TcpDefaultTtl(v) => v.into(),
379            Option_::TcpKeepaliveInterval(v) => v.into(),
380            Option_::TcpKeepaliveGarbage(v) => v.into(),
381            Option_::NetworkInformationServiceDomain(v) => v.into(),
382            Option_::NetworkInformationServers(v) => v.into(),
383            Option_::NetworkTimeProtocolServers(v) => v.into(),
384            Option_::VendorSpecificInformation(v) => v.into(),
385            Option_::NetBiosOverTcpipNameServer(v) => v.into(),
386            Option_::NetBiosOverTcpipDatagramDistributionServer(v) => v.into(),
387            Option_::NetBiosOverTcpipNodeType(v) => v.into(),
388            Option_::NetBiosOverTcpipScope(v) => v.into(),
389            Option_::XWindowSystemFontServer(v) => v.into(),
390            Option_::XWindowSystemDisplayManager(v) => v.into(),
391            Option_::NetworkInformationServicePlusDomain(v) => v.into(),
392            Option_::NetworkInformationServicePlusServers(v) => v.into(),
393            Option_::MobileIpHomeAgent(v) => v.into(),
394            Option_::SmtpServer(v) => v.into(),
395            Option_::Pop3Server(v) => v.into(),
396            Option_::NntpServer(v) => v.into(),
397            Option_::DefaultWwwServer(v) => v.into(),
398            Option_::DefaultFingerServer(v) => v.into(),
399            Option_::DefaultIrcServer(v) => v.into(),
400            Option_::StreettalkServer(v) => v.into(),
401            Option_::StreettalkDirectoryAssistanceServer(v) => v.into(),
402            Option_::TftpServerName(v) => v.into(),
403            Option_::BootfileName(v) => v.into(),
404            Option_::MaxDhcpMessageSize(v) => v.into(),
405            Option_::RenewalTimeValue(v) => v.into(),
406            Option_::RebindingTimeValue(v) => v.into(),
407        }
408    }
409}
410
411/// The client's subnet mask.
412#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
413#[argh(subcommand, name = "subnet-mask")]
414pub struct SubnetMask {
415    /// a 32-bit IPv4 subnet mask.
416    // pub(crate) access to enable unit testing.
417    #[argh(option)]
418    pub(crate) mask: Option<Ipv4Addr>,
419}
420
421impl Into<fidl_fuchsia_net_dhcp::Option_> for SubnetMask {
422    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
423        let mask = self.mask.unwrap_or(Ipv4Addr::new(0, 0, 0, 0));
424        fidl_fuchsia_net_dhcp::Option_::SubnetMask(fidl_fuchsia_net::Ipv4Address {
425            addr: mask.octets(),
426        })
427    }
428}
429
430/// The client's offset from UTC.
431#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
432#[argh(subcommand, name = "time-offset")]
433pub struct TimeOffset {
434    /// the client's offset from UTC in seconds. A positive offset is east of the zero meridian, and
435    /// a negative offset is west of the zero meridian.
436    #[argh(option)]
437    offset: Option<i32>,
438}
439
440impl Into<fidl_fuchsia_net_dhcp::Option_> for TimeOffset {
441    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
442        let offset = self.offset.unwrap_or(0);
443        fidl_fuchsia_net_dhcp::Option_::TimeOffset(offset)
444    }
445}
446
447/// The routers within a client's subnet.
448#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
449#[argh(subcommand, name = "router")]
450pub struct Router {
451    /// a list of the routers in a client's subnet, listed in order of preference.
452    #[argh(option)]
453    routers: Vec<Ipv4Addr>,
454}
455
456impl Into<fidl_fuchsia_net_dhcp::Option_> for Router {
457    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
458        let routers: Vec<fidl_fuchsia_net::Ipv4Address> = self
459            .routers
460            .iter()
461            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
462            .collect();
463        fidl_fuchsia_net_dhcp::Option_::Router(routers)
464    }
465}
466
467/// Time Protocol servers available to the client.
468#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
469#[argh(subcommand, name = "time-server")]
470pub struct TimeServer {
471    /// a list of time servers available to the client, in order of preference.
472    #[argh(option)]
473    time_servers: Vec<Ipv4Addr>,
474}
475
476impl Into<fidl_fuchsia_net_dhcp::Option_> for TimeServer {
477    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
478        let time_servers: Vec<fidl_fuchsia_net::Ipv4Address> = self
479            .time_servers
480            .iter()
481            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
482            .collect();
483        fidl_fuchsia_net_dhcp::Option_::TimeServer(time_servers)
484    }
485}
486
487/// IEN 116 Name servers available to the client.
488#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
489#[argh(subcommand, name = "name-server")]
490pub struct NameServer {
491    /// a list of IEN 116 Name servers available to the client, in order of preference.
492    #[argh(option)]
493    name_servers: Vec<Ipv4Addr>,
494}
495
496impl Into<fidl_fuchsia_net_dhcp::Option_> for NameServer {
497    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
498        let name_servers: Vec<fidl_fuchsia_net::Ipv4Address> = self
499            .name_servers
500            .iter()
501            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
502            .collect();
503        fidl_fuchsia_net_dhcp::Option_::NameServer(name_servers)
504    }
505}
506
507/// Domain Name System servers available to the client.
508#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
509#[argh(subcommand, name = "domain-name-server")]
510pub struct DomainNameServer {
511    /// a list of DNS servers available to the client, in order of preference;
512    #[argh(option)]
513    domain_name_servers: Vec<Ipv4Addr>,
514}
515
516impl Into<fidl_fuchsia_net_dhcp::Option_> for DomainNameServer {
517    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
518        let domain_name_servers: Vec<fidl_fuchsia_net::Ipv4Address> = self
519            .domain_name_servers
520            .iter()
521            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
522            .collect();
523        fidl_fuchsia_net_dhcp::Option_::DomainNameServer(domain_name_servers)
524    }
525}
526
527/// MIT-LCS UDP Log servers available to the client.
528#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
529#[argh(subcommand, name = "log-server")]
530pub struct LogServer {
531    /// a list of MIT-LCS UDP Log servers available to the client, in order of preference.
532    #[argh(option)]
533    log_servers: Vec<Ipv4Addr>,
534}
535
536impl Into<fidl_fuchsia_net_dhcp::Option_> for LogServer {
537    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
538        let log_servers: Vec<fidl_fuchsia_net::Ipv4Address> = self
539            .log_servers
540            .iter()
541            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
542            .collect();
543        fidl_fuchsia_net_dhcp::Option_::LogServer(log_servers)
544    }
545}
546
547/// RFC 865 Cookie servers available to the client.
548#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
549#[argh(subcommand, name = "cookie-server")]
550pub struct CookieServer {
551    /// a list of RFC 865 Cookie servers available to the client, in order of preference.
552    #[argh(option)]
553    cookie_servers: Vec<Ipv4Addr>,
554}
555
556impl Into<fidl_fuchsia_net_dhcp::Option_> for CookieServer {
557    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
558        let cookie_servers: Vec<fidl_fuchsia_net::Ipv4Address> = self
559            .cookie_servers
560            .iter()
561            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
562            .collect();
563        fidl_fuchsia_net_dhcp::Option_::CookieServer(cookie_servers)
564    }
565}
566
567/// RFC 1179 Line Printer servers available to the client.
568#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
569#[argh(subcommand, name = "lpr-server")]
570pub struct LprServer {
571    /// a list of RFC 1179 Line Printer servers available to the client, in order of preference.
572    #[argh(option)]
573    lpr_servers: Vec<Ipv4Addr>,
574}
575
576impl Into<fidl_fuchsia_net_dhcp::Option_> for LprServer {
577    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
578        let lpr_servers: Vec<fidl_fuchsia_net::Ipv4Address> = self
579            .lpr_servers
580            .iter()
581            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
582            .collect();
583        fidl_fuchsia_net_dhcp::Option_::LprServer(lpr_servers)
584    }
585}
586
587/// Imagen Impress servers available to the client.
588#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
589#[argh(subcommand, name = "impress-server")]
590pub struct ImpressServer {
591    /// a list of Imagen Impress servers available to the client, in order of preference.
592    #[argh(option)]
593    impress_servers: Vec<Ipv4Addr>,
594}
595
596impl Into<fidl_fuchsia_net_dhcp::Option_> for ImpressServer {
597    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
598        let impress_servers: Vec<fidl_fuchsia_net::Ipv4Address> = self
599            .impress_servers
600            .iter()
601            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
602            .collect();
603        fidl_fuchsia_net_dhcp::Option_::ImpressServer(impress_servers)
604    }
605}
606
607/// RFC 887 Resource Location servers available to the client.
608#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
609#[argh(subcommand, name = "resource-location-server")]
610pub struct ResourceLocationServer {
611    /// a list of RFC 887 Resource Location servers available to the client, in order of preference.
612    #[argh(option)]
613    resource_location_servers: Vec<Ipv4Addr>,
614}
615
616impl Into<fidl_fuchsia_net_dhcp::Option_> for ResourceLocationServer {
617    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
618        let resource_location_server: Vec<fidl_fuchsia_net::Ipv4Address> = self
619            .resource_location_servers
620            .iter()
621            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
622            .collect();
623        fidl_fuchsia_net_dhcp::Option_::ResourceLocationServer(resource_location_server)
624    }
625}
626
627/// Name of the client.
628#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
629#[argh(subcommand, name = "host-name")]
630pub struct HostName {
631    /// the name of client, which may or may not be qualified with the local domain name.
632    #[argh(option)]
633    name: Option<String>,
634}
635
636impl Into<fidl_fuchsia_net_dhcp::Option_> for HostName {
637    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
638        let name = self.name.unwrap_or_else(|| "".to_string());
639        fidl_fuchsia_net_dhcp::Option_::HostName(name)
640    }
641}
642
643/// Size of the default boot image for the client.
644#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
645#[argh(subcommand, name = "boot-file-size")]
646pub struct BootFileSize {
647    /// the size of the client's default boot image in 512-octet blocks.
648    #[argh(option)]
649    size: Option<u16>,
650}
651
652impl Into<fidl_fuchsia_net_dhcp::Option_> for BootFileSize {
653    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
654        let size = self.size.unwrap_or(0);
655        fidl_fuchsia_net_dhcp::Option_::BootFileSize(size)
656    }
657}
658
659/// Path name of a core dump file.
660#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
661#[argh(subcommand, name = "merit-dump-file")]
662pub struct MeritDumpFile {
663    /// the path name to the client's core dump in the event the client crashes.
664    #[argh(option)]
665    path: Option<String>,
666}
667
668impl Into<fidl_fuchsia_net_dhcp::Option_> for MeritDumpFile {
669    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
670        let path: String = self.path.unwrap_or(String::new());
671        fidl_fuchsia_net_dhcp::Option_::MeritDumpFile(path)
672    }
673}
674
675/// Domain name of the client.
676#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
677#[argh(subcommand, name = "domain-name")]
678pub struct DomainName {
679    /// the client's domain name for use in resolving hostnames in the DNS.
680    #[argh(option)]
681    name: Option<String>,
682}
683
684impl Into<fidl_fuchsia_net_dhcp::Option_> for DomainName {
685    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
686        let name = self.name.unwrap_or(String::new());
687        fidl_fuchsia_net_dhcp::Option_::DomainName(name)
688    }
689}
690
691/// Address of the client's swap server.
692#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
693#[argh(subcommand, name = "swap-server")]
694pub struct SwapServer {
695    /// the address of the client's swap server.
696    #[argh(option)]
697    address: Option<Ipv4Addr>,
698}
699
700impl Into<fidl_fuchsia_net_dhcp::Option_> for SwapServer {
701    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
702        let address = fidl_fuchsia_net::Ipv4Address {
703            addr: self.address.unwrap_or(Ipv4Addr::new(0, 0, 0, 0)).octets(),
704        };
705        fidl_fuchsia_net_dhcp::Option_::SwapServer(address)
706    }
707}
708
709/// Path name to a TFTP-retrievable file containing vendor-extension information.
710#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
711#[argh(subcommand, name = "root-path")]
712pub struct RootPath {
713    /// the path name to a TFTP-retrievable file. This file contains data which can be interpreted
714    /// as the BOOTP vendor-extension field. Unlike the BOOTP vendor-extension field, this file has
715    /// an unconstrained length and any references to Tag 18 are ignored.
716    #[argh(option)]
717    path: Option<String>,
718}
719
720impl Into<fidl_fuchsia_net_dhcp::Option_> for RootPath {
721    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
722        let path = self.path.unwrap_or(String::new());
723        fidl_fuchsia_net_dhcp::Option_::RootPath(path)
724    }
725}
726
727/// Path name to a TFTP-retrievable file containing vendor-extension information.
728#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
729#[argh(subcommand, name = "extensions-path")]
730pub struct ExtensionsPath {
731    /// the path name to a TFTP-retrievable file. This file contains data which can be interpreted
732    /// as the BOOTP vendor-extension field. Unlike the BOOTP vendor-extension field, this file has
733    /// an unconstrained length and any references to Tag 18 are ignored.
734    #[argh(option)]
735    path: Option<String>,
736}
737
738impl Into<fidl_fuchsia_net_dhcp::Option_> for ExtensionsPath {
739    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
740        let path = self.path.unwrap_or(String::new());
741        fidl_fuchsia_net_dhcp::Option_::ExtensionsPath(path)
742    }
743}
744
745/// Flag enabling/disabling IP layer packet forwarding.
746#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
747#[argh(subcommand, name = "ip-forwarding")]
748pub struct IpForwarding {
749    /// a flag which will enabled IP layer packet forwarding when true.
750    #[argh(switch)]
751    enabled: bool,
752}
753
754impl Into<fidl_fuchsia_net_dhcp::Option_> for IpForwarding {
755    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
756        fidl_fuchsia_net_dhcp::Option_::IpForwarding(self.enabled)
757    }
758}
759
760/// Flag enabling/disabling forwarding of IP packets with non-local source routes.
761#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
762#[argh(subcommand, name = "non-local-source-routing")]
763pub struct NonLocalSourceRouting {
764    /// a flag which will enable forwarding of IP packets with non-local source routes.
765    #[argh(switch)]
766    enabled: bool,
767}
768
769impl Into<fidl_fuchsia_net_dhcp::Option_> for NonLocalSourceRouting {
770    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
771        fidl_fuchsia_net_dhcp::Option_::NonLocalSourceRouting(self.enabled)
772    }
773}
774
775/// Policy filters for non-local source routing.
776#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
777#[argh(subcommand, name = "policy-filter")]
778pub struct PolicyFilter {
779    /// a list of IP Address and Subnet Mask pairs. If an incoming source-routed packet has a
780    /// next-hop that does not match one of these pairs, then the packet will be dropped.
781    #[argh(option)]
782    addresses: Vec<Ipv4Addr>,
783}
784
785impl Into<fidl_fuchsia_net_dhcp::Option_> for PolicyFilter {
786    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
787        let addresses: Vec<fidl_fuchsia_net::Ipv4Address> = self
788            .addresses
789            .iter()
790            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
791            .collect();
792        fidl_fuchsia_net_dhcp::Option_::PolicyFilter(addresses)
793    }
794}
795
796/// Maximum sized datagram that the client should be able to reassemble.
797#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
798#[argh(subcommand, name = "max-datagram-reassembly-size")]
799pub struct MaxDatagramReassemblySize {
800    /// the maximum sized datagram that the client should be able to reassemble, in octets. The
801    /// minimum legal value is 576.
802    #[argh(option)]
803    size: Option<u16>,
804}
805
806impl Into<fidl_fuchsia_net_dhcp::Option_> for MaxDatagramReassemblySize {
807    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
808        let size = self.size.unwrap_or(0);
809        fidl_fuchsia_net_dhcp::Option_::MaxDatagramReassemblySize(size)
810    }
811}
812
813/// Default time-to-live to use on outgoing IP datagrams.
814#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
815#[argh(subcommand, name = "default-ip-ttl")]
816pub struct DefaultIpTtl {
817    /// the default time-to-live to use on outgoing IP datagrams. The value must be between 1 and
818    /// 255.
819    #[argh(option)]
820    ttl: Option<u8>,
821}
822
823impl Into<fidl_fuchsia_net_dhcp::Option_> for DefaultIpTtl {
824    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
825        let ttl = self.ttl.unwrap_or(0);
826        fidl_fuchsia_net_dhcp::Option_::DefaultIpTtl(ttl)
827    }
828}
829
830/// Timeout to use when aging Path MTU values.
831#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
832#[argh(subcommand, name = "path-mtu-aging-timeout")]
833pub struct PathMtuAgingTimeout {
834    /// the timeout, in seconds, to be used when again Path MTU values by the mechanism in RFC 1191.
835    #[argh(option)]
836    timeout: Option<u32>,
837}
838
839impl Into<fidl_fuchsia_net_dhcp::Option_> for PathMtuAgingTimeout {
840    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
841        let timeout = self.timeout.unwrap_or(0);
842        fidl_fuchsia_net_dhcp::Option_::PathMtuAgingTimeout(timeout)
843    }
844}
845
846/// Table of MTU sizes for Path MTU Discovery.
847#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
848#[argh(subcommand, name = "path-mtu-plateau-table")]
849pub struct PathMtuPlateauTable {
850    /// A list of MTU sizes, ordered from smallest to largest. The smallest value cannot be smaller
851    /// than 68.
852    #[argh(option)]
853    mtu_sizes: Vec<u16>,
854}
855
856impl Into<fidl_fuchsia_net_dhcp::Option_> for PathMtuPlateauTable {
857    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
858        fidl_fuchsia_net_dhcp::Option_::PathMtuPlateauTable(self.mtu_sizes)
859    }
860}
861
862/// MTU for the client's interface.
863#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
864#[argh(subcommand, name = "interface-mtu")]
865pub struct InterfaceMtu {
866    /// the MTU for the client's interface. Minimum value of 68.
867    #[argh(option)]
868    mtu: Option<u16>,
869}
870
871impl Into<fidl_fuchsia_net_dhcp::Option_> for InterfaceMtu {
872    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
873        let mtu = self.mtu.unwrap_or(0);
874        fidl_fuchsia_net_dhcp::Option_::InterfaceMtu(mtu)
875    }
876}
877
878/// Flag indicating if all subnets of the connected network have the same MTU.
879#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
880#[argh(subcommand, name = "all-subnets-local")]
881pub struct AllSubnetsLocal {
882    /// a flag indicating if all subents of the IP network to which the client is connected have the
883    /// same MTU.
884    #[argh(switch)]
885    local: bool,
886}
887
888impl Into<fidl_fuchsia_net_dhcp::Option_> for AllSubnetsLocal {
889    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
890        fidl_fuchsia_net_dhcp::Option_::AllSubnetsLocal(self.local)
891    }
892}
893
894/// Broadcast address of the client's subnet.
895#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
896#[argh(subcommand, name = "broadcast-address")]
897pub struct BroadcastAddress {
898    /// the broadcast address of the client's subnet. Legal values are defined in RFC 1122.
899    #[argh(option)]
900    addr: Option<Ipv4Addr>,
901}
902
903impl Into<fidl_fuchsia_net_dhcp::Option_> for BroadcastAddress {
904    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
905        let addr = fidl_fuchsia_net::Ipv4Address {
906            addr: self.addr.unwrap_or(Ipv4Addr::new(0, 0, 0, 0)).octets(),
907        };
908        fidl_fuchsia_net_dhcp::Option_::BroadcastAddress(addr)
909    }
910}
911
912/// Flag indicating whether the client should perform subnet mask discovery via ICMP.
913#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
914#[argh(subcommand, name = "perform-mask-discovery")]
915pub struct PerformMaskDiscovery {
916    /// a flag indicating whether the client should perform subnet mask discovery via ICMP.
917    #[argh(switch)]
918    do_discovery: bool,
919}
920
921impl Into<fidl_fuchsia_net_dhcp::Option_> for PerformMaskDiscovery {
922    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
923        fidl_fuchsia_net_dhcp::Option_::PerformMaskDiscovery(self.do_discovery)
924    }
925}
926
927/// Flag indicating whether the client should respond to subnet mask discovery requests via ICMP.
928#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
929#[argh(subcommand, name = "mask-supplier")]
930pub struct MaskSupplier {
931    /// a flag indicating whether the client should respond to subnet mask discovery requests via
932    /// ICMP.
933    #[argh(switch)]
934    supplier: bool,
935}
936
937impl Into<fidl_fuchsia_net_dhcp::Option_> for MaskSupplier {
938    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
939        fidl_fuchsia_net_dhcp::Option_::MaskSupplier(self.supplier)
940    }
941}
942
943/// Flag indicating whether the client should solicit routers using Router Discovery.
944#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
945#[argh(subcommand, name = "perform-router-discovery")]
946pub struct PerformRouterDiscovery {
947    /// A flag indicating whether the client should solicit routers using Router Discovery as
948    /// defined in RFC 1256.
949    #[argh(switch)]
950    do_discovery: bool,
951}
952
953impl Into<fidl_fuchsia_net_dhcp::Option_> for PerformRouterDiscovery {
954    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
955        fidl_fuchsia_net_dhcp::Option_::PerformRouterDiscovery(self.do_discovery)
956    }
957}
958
959/// Destination address for Router Solicitation requests.
960#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
961#[argh(subcommand, name = "router-solicitation-address")]
962pub struct RouterSolicitationAddress {
963    /// the address to which the client should transmit Router Solicitation requests.
964    #[argh(option)]
965    addr: Option<Ipv4Addr>,
966}
967
968impl Into<fidl_fuchsia_net_dhcp::Option_> for RouterSolicitationAddress {
969    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
970        let addr = fidl_fuchsia_net::Ipv4Address {
971            addr: self.addr.unwrap_or(Ipv4Addr::new(0, 0, 0, 0)).octets(),
972        };
973        fidl_fuchsia_net_dhcp::Option_::RouterSolicitationAddress(addr)
974    }
975}
976
977/// Static Routes which the client should put in its routing cache.
978#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
979#[argh(subcommand, name = "static-route")]
980pub struct StaticRoute {
981    /// a list of Destination address/Next-hop address pairs defining static routes for the client's
982    /// routing table. The routes should be listed in descending order of priority. It is illegal
983    /// to use 0.0.0.0 as the destination in a static route.
984    #[argh(option)]
985    routes: Vec<Ipv4Addr>,
986}
987
988impl Into<fidl_fuchsia_net_dhcp::Option_> for StaticRoute {
989    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
990        let routes: Vec<fidl_fuchsia_net::Ipv4Address> = self
991            .routes
992            .iter()
993            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
994            .collect();
995        fidl_fuchsia_net_dhcp::Option_::StaticRoute(routes)
996    }
997}
998
999/// Flag specifying whether the client should negotiate the use of trailers in ARP.
1000#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1001#[argh(subcommand, name = "trailer-encapsulation")]
1002pub struct TrailerEncapsulation {
1003    /// a flag specifying whether the client negotiate the use of trailers when using ARP, per RFC
1004    /// 893.
1005    #[argh(switch)]
1006    trailers: bool,
1007}
1008
1009impl Into<fidl_fuchsia_net_dhcp::Option_> for TrailerEncapsulation {
1010    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1011        fidl_fuchsia_net_dhcp::Option_::TrailerEncapsulation(self.trailers)
1012    }
1013}
1014
1015/// Timeout for ARP cache entries.
1016#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1017#[argh(subcommand, name = "arp-cache-timeout")]
1018pub struct ArpCacheTimeout {
1019    /// the timeout for ARP cache entries, in seconds.
1020    #[argh(option)]
1021    timeout: Option<u32>,
1022}
1023
1024impl Into<fidl_fuchsia_net_dhcp::Option_> for ArpCacheTimeout {
1025    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1026        let timeout = self.timeout.unwrap_or(0);
1027        fidl_fuchsia_net_dhcp::Option_::ArpCacheTimeout(timeout)
1028    }
1029}
1030
1031/// Flag specifying whether the client should use Ethernet v2 or IEEE 802.3 encapsulation.
1032#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1033#[argh(subcommand, name = "ethernet-encapsulation")]
1034pub struct EthernetEncapsulation {
1035    /// a flag specifying that the client should use Ethernet v2 encapsulation when false, and IEEE
1036    /// 802.3 encapsulation when true.
1037    #[argh(switch)]
1038    encapsulate: bool,
1039}
1040
1041impl Into<fidl_fuchsia_net_dhcp::Option_> for EthernetEncapsulation {
1042    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1043        fidl_fuchsia_net_dhcp::Option_::EthernetEncapsulation(self.encapsulate)
1044    }
1045}
1046
1047/// Default time-to-live for outgoing TCP segments.
1048#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1049#[argh(subcommand, name = "tcp-default-ttl")]
1050pub struct TcpDefaultTtl {
1051    /// the default time-to-live that the client should use for outgoing TCP segments. The minimum
1052    /// value is 1.
1053    #[argh(option)]
1054    ttl: Option<u8>,
1055}
1056
1057impl Into<fidl_fuchsia_net_dhcp::Option_> for TcpDefaultTtl {
1058    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1059        let ttl = self.ttl.unwrap_or(0);
1060        fidl_fuchsia_net_dhcp::Option_::TcpDefaultTtl(ttl)
1061    }
1062}
1063
1064/// Interval the client should wait before sending a TCP keepalive message.
1065#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1066#[argh(subcommand, name = "tcp-keepalive-interval")]
1067pub struct TcpKeepaliveInterval {
1068    /// the interval, in seconds, the client should wait before sending a TCP keepalive message. A
1069    /// value of 0 indicates that the client should not send keepalive messages unless specifically
1070    /// requested by an application.
1071    #[argh(option)]
1072    interval: Option<u32>,
1073}
1074
1075impl Into<fidl_fuchsia_net_dhcp::Option_> for TcpKeepaliveInterval {
1076    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1077        let interval = self.interval.unwrap_or(0);
1078        fidl_fuchsia_net_dhcp::Option_::TcpKeepaliveInterval(interval)
1079    }
1080}
1081
1082/// Flag specifying whether the client should send TCP keepalive messages with an octet of garbage.
1083#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1084#[argh(subcommand, name = "tcp-keepalive-garbage")]
1085pub struct TcpKeepaliveGarbage {
1086    /// a flag specifying whether the client should send TCP keepalive messages with an octet of
1087    /// garbage for compatibility with older implementations.
1088    #[argh(switch)]
1089    send_garbage: bool,
1090}
1091
1092impl Into<fidl_fuchsia_net_dhcp::Option_> for TcpKeepaliveGarbage {
1093    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1094        fidl_fuchsia_net_dhcp::Option_::TcpKeepaliveGarbage(self.send_garbage)
1095    }
1096}
1097
1098/// Name of the client's Network Information Service domain.
1099#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1100#[argh(subcommand, name = "network-information-service-domain")]
1101pub struct NetworkInformationServiceDomain {
1102    /// the name of the client's Network Information Service domain.
1103    #[argh(option)]
1104    domain_name: Option<String>,
1105}
1106
1107impl Into<fidl_fuchsia_net_dhcp::Option_> for NetworkInformationServiceDomain {
1108    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1109        let domain_name = self.domain_name.unwrap_or(String::new());
1110        fidl_fuchsia_net_dhcp::Option_::NetworkInformationServiceDomain(domain_name)
1111    }
1112}
1113
1114/// Network Information Service servers available to the client.
1115#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1116#[argh(subcommand, name = "network-information-servers")]
1117pub struct NetworkInformationServers {
1118    /// a list of Network Information Service server addresses available to the client, listed in
1119    /// order of preference.
1120    #[argh(option)]
1121    servers: Vec<Ipv4Addr>,
1122}
1123
1124impl Into<fidl_fuchsia_net_dhcp::Option_> for NetworkInformationServers {
1125    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1126        let servers: Vec<fidl_fuchsia_net::Ipv4Address> = self
1127            .servers
1128            .iter()
1129            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
1130            .collect();
1131        fidl_fuchsia_net_dhcp::Option_::NetworkInformationServers(servers)
1132    }
1133}
1134
1135/// Network Time Protocol servers available to the client.
1136#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1137#[argh(subcommand, name = "network-time-protocol-servers")]
1138pub struct NetworkTimeProtocolServers {
1139    /// a list of Network Time Protocol (NTP) server addresses available to the client, listed in
1140    /// order of preference.
1141    #[argh(option)]
1142    servers: Vec<Ipv4Addr>,
1143}
1144
1145impl Into<fidl_fuchsia_net_dhcp::Option_> for NetworkTimeProtocolServers {
1146    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1147        let servers: Vec<fidl_fuchsia_net::Ipv4Address> = self
1148            .servers
1149            .iter()
1150            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
1151            .collect();
1152        fidl_fuchsia_net_dhcp::Option_::NetworkTimeProtocolServers(servers)
1153    }
1154}
1155
1156/// Option for exchanging vendor-specific information between the DHCP client and DHCP server.
1157#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1158#[argh(subcommand, name = "vendor-specific-information")]
1159pub struct VendorSpecificInformation {
1160    /// an opaque object of octets for exchanging vendor-specific information.
1161    #[argh(option)]
1162    data: Vec<u8>,
1163}
1164
1165impl Into<fidl_fuchsia_net_dhcp::Option_> for VendorSpecificInformation {
1166    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1167        fidl_fuchsia_net_dhcp::Option_::VendorSpecificInformation(self.data)
1168    }
1169}
1170
1171/// NetBIOS name servers available to the client.
1172#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1173#[argh(subcommand, name = "net-bios-over-tcpip-name-server")]
1174pub struct NetBiosOverTcpipNameServer {
1175    /// a list of NetBIOS name server addresses available to the client, listed in order of
1176    /// preference.
1177    #[argh(option)]
1178    servers: Vec<Ipv4Addr>,
1179}
1180
1181impl Into<fidl_fuchsia_net_dhcp::Option_> for NetBiosOverTcpipNameServer {
1182    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1183        let servers: Vec<fidl_fuchsia_net::Ipv4Address> = self
1184            .servers
1185            .iter()
1186            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
1187            .collect();
1188        fidl_fuchsia_net_dhcp::Option_::NetbiosOverTcpipNameServer(servers)
1189    }
1190}
1191
1192/// NetBIOS datagram distribution servers available to the client.
1193#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1194#[argh(subcommand, name = "net-bios-over-tcpip-distribution-server")]
1195pub struct NetBiosOverTcpipDatagramDistributionServer {
1196    /// a list of NetBIOS datagram distribution servers available to the client, listed in order of
1197    /// preference.
1198    #[argh(option)]
1199    servers: Vec<Ipv4Addr>,
1200}
1201
1202impl Into<fidl_fuchsia_net_dhcp::Option_> for NetBiosOverTcpipDatagramDistributionServer {
1203    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1204        let servers: Vec<fidl_fuchsia_net::Ipv4Address> = self
1205            .servers
1206            .iter()
1207            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
1208            .collect();
1209        fidl_fuchsia_net_dhcp::Option_::NetbiosOverTcpipDatagramDistributionServer(servers)
1210    }
1211}
1212
1213/// The NetBIOS node type which should be used by the client.
1214#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1215#[argh(subcommand, name = "net-bios-over-tcpip-node-type")]
1216pub struct NetBiosOverTcpipNodeType {
1217    /// the NetBIOS node type which should be used by the client.
1218    #[argh(subcommand)]
1219    node_type: Option<NodeType>,
1220}
1221
1222impl Into<fidl_fuchsia_net_dhcp::Option_> for NetBiosOverTcpipNodeType {
1223    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1224        let node_type = self.node_type.unwrap_or(NodeType::BNode(BNode {}));
1225        let fidl_node_type = match node_type {
1226            NodeType::BNode(_) => fidl_fuchsia_net_dhcp::NodeTypes::B_NODE,
1227            NodeType::HNode(_) => fidl_fuchsia_net_dhcp::NodeTypes::H_NODE,
1228            NodeType::MNode(_) => fidl_fuchsia_net_dhcp::NodeTypes::M_NODE,
1229            NodeType::PNode(_) => fidl_fuchsia_net_dhcp::NodeTypes::P_NODE,
1230        };
1231        fidl_fuchsia_net_dhcp::Option_::NetbiosOverTcpipNodeType(fidl_node_type)
1232    }
1233}
1234
1235/// NetBIOS scope parameter for the client.
1236#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1237#[argh(subcommand, name = "net-bios-over-tcpip-scope")]
1238pub struct NetBiosOverTcpipScope {
1239    /// the NetBIOS over TCP/IP scope parameter, as defined in RFC 1001, for the client.
1240    #[argh(option)]
1241    scope: Option<String>,
1242}
1243
1244impl Into<fidl_fuchsia_net_dhcp::Option_> for NetBiosOverTcpipScope {
1245    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1246        let scope = self.scope.unwrap_or(String::new());
1247        fidl_fuchsia_net_dhcp::Option_::NetbiosOverTcpipScope(scope)
1248    }
1249}
1250
1251/// X Window System Font servers available to the client.
1252#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1253#[argh(subcommand, name = "x-window-system-font-server")]
1254pub struct XWindowSystemFontServer {
1255    /// a list of X Window System Font server addresses available to the client, listed in order of
1256    /// preference.
1257    #[argh(option)]
1258    servers: Vec<Ipv4Addr>,
1259}
1260
1261impl Into<fidl_fuchsia_net_dhcp::Option_> for XWindowSystemFontServer {
1262    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1263        let servers: Vec<fidl_fuchsia_net::Ipv4Address> = self
1264            .servers
1265            .iter()
1266            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
1267            .collect();
1268        fidl_fuchsia_net_dhcp::Option_::XWindowSystemFontServer(servers)
1269    }
1270}
1271
1272/// X window System Display Manager systems available to the client.
1273#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1274#[argh(subcommand, name = "x-window-system-display-manager")]
1275pub struct XWindowSystemDisplayManager {
1276    /// a list of X Window System Display Manager system addresses available to the client, listed
1277    /// in order of preference.
1278    #[argh(option)]
1279    display_servers: Vec<Ipv4Addr>,
1280}
1281
1282impl Into<fidl_fuchsia_net_dhcp::Option_> for XWindowSystemDisplayManager {
1283    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1284        let display_servers: Vec<fidl_fuchsia_net::Ipv4Address> = self
1285            .display_servers
1286            .iter()
1287            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
1288            .collect();
1289        fidl_fuchsia_net_dhcp::Option_::XWindowSystemDisplayManager(display_servers)
1290    }
1291}
1292
1293/// Network Information System+ domain name.
1294#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1295#[argh(subcommand, name = "network-information-service-plus-domain")]
1296pub struct NetworkInformationServicePlusDomain {
1297    /// the name of the client's Network Information System+ domain.
1298    #[argh(option)]
1299    domain_name: Option<String>,
1300}
1301
1302impl Into<fidl_fuchsia_net_dhcp::Option_> for NetworkInformationServicePlusDomain {
1303    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1304        let domain_name = self.domain_name.unwrap_or(String::new());
1305        fidl_fuchsia_net_dhcp::Option_::NetworkInformationServicePlusDomain(domain_name)
1306    }
1307}
1308
1309/// Network Information System+ servers available to the client.
1310#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1311#[argh(subcommand, name = "network-information-service-plus-servers")]
1312pub struct NetworkInformationServicePlusServers {
1313    /// a list of Network Information System+ server addresses available to the client, listed in
1314    /// order of preference.
1315    #[argh(option)]
1316    servers: Vec<Ipv4Addr>,
1317}
1318
1319impl Into<fidl_fuchsia_net_dhcp::Option_> for NetworkInformationServicePlusServers {
1320    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1321        let servers: Vec<fidl_fuchsia_net::Ipv4Address> = self
1322            .servers
1323            .iter()
1324            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
1325            .collect();
1326        fidl_fuchsia_net_dhcp::Option_::NetworkInformationServicePlusServers(servers)
1327    }
1328}
1329
1330/// Mobile IP home agents available to the client.
1331#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1332#[argh(subcommand, name = "mobile-ip-home-agent")]
1333pub struct MobileIpHomeAgent {
1334    /// a list of mobile IP home agent addresses available to the client, listed in order of
1335    /// preference.
1336    #[argh(option)]
1337    home_agents: Vec<Ipv4Addr>,
1338}
1339
1340impl Into<fidl_fuchsia_net_dhcp::Option_> for MobileIpHomeAgent {
1341    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1342        let home_agents: Vec<fidl_fuchsia_net::Ipv4Address> = self
1343            .home_agents
1344            .iter()
1345            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
1346            .collect();
1347        fidl_fuchsia_net_dhcp::Option_::MobileIpHomeAgent(home_agents)
1348    }
1349}
1350
1351/// SMTP servers available to the client.
1352#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1353#[argh(subcommand, name = "smtp-server")]
1354pub struct SmtpServer {
1355    /// a list of Simple Mail Transport Protocol (SMTP) server address available to the client,
1356    /// listed in order of preference.
1357    #[argh(option)]
1358    smtp_servers: Vec<Ipv4Addr>,
1359}
1360
1361impl Into<fidl_fuchsia_net_dhcp::Option_> for SmtpServer {
1362    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1363        let smtp_servers: Vec<fidl_fuchsia_net::Ipv4Address> = self
1364            .smtp_servers
1365            .iter()
1366            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
1367            .collect();
1368        fidl_fuchsia_net_dhcp::Option_::SmtpServer(smtp_servers)
1369    }
1370}
1371
1372/// POP3 servers available to the client.
1373#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1374#[argh(subcommand, name = "pop3-server")]
1375pub struct Pop3Server {
1376    /// a list of Post Office Protocol (POP3) server addresses available to the client, listed in
1377    /// order of preference.
1378    #[argh(option)]
1379    pop3_servers: Vec<Ipv4Addr>,
1380}
1381
1382impl Into<fidl_fuchsia_net_dhcp::Option_> for Pop3Server {
1383    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1384        let pop3_servers: Vec<fidl_fuchsia_net::Ipv4Address> = self
1385            .pop3_servers
1386            .iter()
1387            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
1388            .collect();
1389        fidl_fuchsia_net_dhcp::Option_::Pop3Server(pop3_servers)
1390    }
1391}
1392
1393/// NNTP servers available to the client.
1394#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1395#[argh(subcommand, name = "nntp-server")]
1396pub struct NntpServer {
1397    /// a list Network News Transport Protocol (NNTP) server addresses available to the client,
1398    /// listed in order of preference.
1399    #[argh(option)]
1400    nntp_servers: Vec<Ipv4Addr>,
1401}
1402
1403impl Into<fidl_fuchsia_net_dhcp::Option_> for NntpServer {
1404    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1405        let nntp_servers: Vec<fidl_fuchsia_net::Ipv4Address> = self
1406            .nntp_servers
1407            .iter()
1408            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
1409            .collect();
1410        fidl_fuchsia_net_dhcp::Option_::NntpServer(nntp_servers)
1411    }
1412}
1413
1414/// Default WWW servers available to the client.
1415#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1416#[argh(subcommand, name = "default-www-server")]
1417pub struct DefaultWwwServer {
1418    /// a list of default World Wide Web (WWW) server addresses available to the client, listed in
1419    /// order of preference.
1420    #[argh(option)]
1421    www_servers: Vec<Ipv4Addr>,
1422}
1423
1424impl Into<fidl_fuchsia_net_dhcp::Option_> for DefaultWwwServer {
1425    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1426        let www_servers: Vec<fidl_fuchsia_net::Ipv4Address> = self
1427            .www_servers
1428            .iter()
1429            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
1430            .collect();
1431        fidl_fuchsia_net_dhcp::Option_::DefaultWwwServer(www_servers)
1432    }
1433}
1434
1435/// Default Finger servers available to the client.
1436#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1437#[argh(subcommand, name = "default-finger-server")]
1438pub struct DefaultFingerServer {
1439    /// a list of default Finger server addresses available to the client, listed in order of
1440    /// preference.
1441    #[argh(option)]
1442    finger_servers: Vec<Ipv4Addr>,
1443}
1444
1445impl Into<fidl_fuchsia_net_dhcp::Option_> for DefaultFingerServer {
1446    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1447        let finger_servers: Vec<fidl_fuchsia_net::Ipv4Address> = self
1448            .finger_servers
1449            .iter()
1450            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
1451            .collect();
1452        fidl_fuchsia_net_dhcp::Option_::DefaultFingerServer(finger_servers)
1453    }
1454}
1455
1456/// Default IRC servers available to the client.
1457#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1458#[argh(subcommand, name = "default-irc-server")]
1459pub struct DefaultIrcServer {
1460    /// a list of Internet Relay Chat server addresses available to the client, listed in order of
1461    /// preference.
1462    #[argh(option)]
1463    irc_servers: Vec<Ipv4Addr>,
1464}
1465
1466impl Into<fidl_fuchsia_net_dhcp::Option_> for DefaultIrcServer {
1467    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1468        let irc_servers: Vec<fidl_fuchsia_net::Ipv4Address> = self
1469            .irc_servers
1470            .iter()
1471            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
1472            .collect();
1473        fidl_fuchsia_net_dhcp::Option_::DefaultIrcServer(irc_servers)
1474    }
1475}
1476
1477/// StreetTalk servers available to the client.
1478#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1479#[argh(subcommand, name = "street-talk-server")]
1480pub struct StreettalkServer {
1481    /// a list of StreetTalk server addresses available to the client, listed in order of
1482    /// preference.
1483    #[argh(option)]
1484    streettalk_servers: Vec<Ipv4Addr>,
1485}
1486
1487impl Into<fidl_fuchsia_net_dhcp::Option_> for StreettalkServer {
1488    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1489        let streettalk_servers: Vec<fidl_fuchsia_net::Ipv4Address> = self
1490            .streettalk_servers
1491            .iter()
1492            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
1493            .collect();
1494        fidl_fuchsia_net_dhcp::Option_::StreettalkServer(streettalk_servers)
1495    }
1496}
1497
1498/// StreetTalk Directory Assistance servers available to the client.
1499#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1500#[argh(subcommand, name = "stda-server")]
1501pub struct StreettalkDirectoryAssistanceServer {
1502    /// a list of StreetTalk Directory Assistance server addresses available to the client, listed
1503    /// in order of preference.
1504    #[argh(option)]
1505    stda_servers: Vec<Ipv4Addr>,
1506}
1507
1508impl Into<fidl_fuchsia_net_dhcp::Option_> for StreettalkDirectoryAssistanceServer {
1509    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1510        let stda_servers: Vec<fidl_fuchsia_net::Ipv4Address> = self
1511            .stda_servers
1512            .iter()
1513            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
1514            .collect();
1515        fidl_fuchsia_net_dhcp::Option_::StreettalkDirectoryAssistanceServer(stda_servers)
1516    }
1517}
1518
1519/// TFTP server available to the client.
1520#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1521#[argh(subcommand, name = "tftp-server-name")]
1522pub struct TftpServerName {
1523    /// the TFTP server name available to the client. This option should be used when the `sname`
1524    /// field has been overloaded to carry options.
1525    #[argh(option)]
1526    name: Option<String>,
1527}
1528
1529impl Into<fidl_fuchsia_net_dhcp::Option_> for TftpServerName {
1530    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1531        let name = self.name.unwrap_or(String::new());
1532        fidl_fuchsia_net_dhcp::Option_::TftpServerName(name)
1533    }
1534}
1535
1536/// Bootfile name for the client.
1537#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1538#[argh(subcommand, name = "bootfile-name")]
1539pub struct BootfileName {
1540    /// the bootfile name for the client. This option should be used when the `file` field has been
1541    /// overloaded to carry options.
1542    #[argh(option)]
1543    name: Option<String>,
1544}
1545
1546impl Into<fidl_fuchsia_net_dhcp::Option_> for BootfileName {
1547    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1548        let name = self.name.unwrap_or(String::new());
1549        fidl_fuchsia_net_dhcp::Option_::BootfileName(name)
1550    }
1551}
1552
1553/// Maximum length of a DHCP message that the participant is willing to accept.
1554#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1555#[argh(subcommand, name = "max-message-size")]
1556pub struct MaxDhcpMessageSize {
1557    /// the maximum length in octets of a DHCP message that the participant is willing to accept.
1558    /// The minimum value is 576.
1559    #[argh(option)]
1560    length: Option<u16>,
1561}
1562
1563impl Into<fidl_fuchsia_net_dhcp::Option_> for MaxDhcpMessageSize {
1564    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1565        let length = self.length.unwrap_or(0);
1566        fidl_fuchsia_net_dhcp::Option_::MaxDhcpMessageSize(length)
1567    }
1568}
1569
1570/// Time interval from address assignment at which the client transitions to a Renewing state.
1571#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1572#[argh(subcommand, name = "renewal-time-value")]
1573pub struct RenewalTimeValue {
1574    /// the time interval, in seconds, after address assignment at which the client will transition
1575    /// to the Renewing state.
1576    #[argh(option)]
1577    interval: Option<u32>,
1578}
1579
1580impl Into<fidl_fuchsia_net_dhcp::Option_> for RenewalTimeValue {
1581    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1582        let interval = self.interval.unwrap_or(0);
1583        fidl_fuchsia_net_dhcp::Option_::RenewalTimeValue(interval)
1584    }
1585}
1586
1587/// Time interval from address assignment at which the client transitions to a Rebinding state.
1588#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1589#[argh(subcommand, name = "rebinding-time-value")]
1590pub struct RebindingTimeValue {
1591    /// the time interval, in seconds, after address assignment at which the client will transition
1592    /// to the Rebinding state.
1593    #[argh(option)]
1594    interval: Option<u32>,
1595}
1596
1597impl Into<fidl_fuchsia_net_dhcp::Option_> for RebindingTimeValue {
1598    fn into(self) -> fidl_fuchsia_net_dhcp::Option_ {
1599        let interval = self.interval.unwrap_or(0);
1600        fidl_fuchsia_net_dhcp::Option_::RebindingTimeValue(interval)
1601    }
1602}
1603
1604/// The name of the server parameter to operate on.
1605#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1606#[argh(subcommand)]
1607pub enum Parameter {
1608    IpAddrs(IpAddrs),
1609    AddressPool(AddressPool),
1610    LeaseLength(LeaseLength),
1611    PermittedMacs(PermittedMacs),
1612    StaticallyAssignedAddrs(StaticallyAssignedAddrs),
1613    ArpProbe(ArpProbe),
1614    BoundDevices(BoundDevices),
1615}
1616
1617impl Into<fidl_fuchsia_net_dhcp::ParameterName> for Parameter {
1618    fn into(self) -> fidl_fuchsia_net_dhcp::ParameterName {
1619        match self {
1620            Parameter::IpAddrs(_) => fidl_fuchsia_net_dhcp::ParameterName::IpAddrs,
1621            Parameter::AddressPool(_) => fidl_fuchsia_net_dhcp::ParameterName::AddressPool,
1622            Parameter::LeaseLength(_) => fidl_fuchsia_net_dhcp::ParameterName::LeaseLength,
1623            Parameter::PermittedMacs(_) => fidl_fuchsia_net_dhcp::ParameterName::PermittedMacs,
1624            Parameter::StaticallyAssignedAddrs(_) => {
1625                fidl_fuchsia_net_dhcp::ParameterName::StaticallyAssignedAddrs
1626            }
1627            Parameter::ArpProbe(_) => fidl_fuchsia_net_dhcp::ParameterName::ArpProbe,
1628            Parameter::BoundDevices(_) => fidl_fuchsia_net_dhcp::ParameterName::BoundDeviceNames,
1629        }
1630    }
1631}
1632
1633impl Into<fidl_fuchsia_net_dhcp::Parameter> for Parameter {
1634    fn into(self) -> fidl_fuchsia_net_dhcp::Parameter {
1635        match self {
1636            Parameter::IpAddrs(v) => v.into(),
1637            Parameter::AddressPool(v) => v.into(),
1638            Parameter::LeaseLength(v) => v.into(),
1639            Parameter::PermittedMacs(v) => v.into(),
1640            Parameter::StaticallyAssignedAddrs(v) => v.into(),
1641            Parameter::ArpProbe(v) => v.into(),
1642            Parameter::BoundDevices(v) => v.into(),
1643        }
1644    }
1645}
1646
1647/// The IPv4 addresses to which the server is bound.
1648#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1649#[argh(subcommand, name = "ip-addrs")]
1650pub struct IpAddrs {
1651    /// A list of IPv4 Addresses to which the server is bound.
1652    #[argh(option)]
1653    addrs: Vec<Ipv4Addr>,
1654}
1655
1656impl Into<fidl_fuchsia_net_dhcp::Parameter> for IpAddrs {
1657    fn into(self) -> fidl_fuchsia_net_dhcp::Parameter {
1658        let addrs: Vec<fidl_fuchsia_net::Ipv4Address> = self
1659            .addrs
1660            .iter()
1661            .map(|addr| fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
1662            .collect();
1663        fidl_fuchsia_net_dhcp::Parameter::IpAddrs(addrs)
1664    }
1665}
1666
1667use crate::opts::parse_netmask_or_prefix_length;
1668
1669/// The pool of addresses which the DHCP server manages.
1670#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1671#[argh(subcommand, name = "address-pool")]
1672pub struct AddressPool {
1673    /// the prefix length of the network's subnet mask
1674    #[argh(option, from_str_fn(parse_netmask_or_prefix_length))]
1675    prefix_length: Option<u8>,
1676    /// the starting address, inclusive, of the range of addresses which the DHCP server
1677    /// will lease to clients
1678    #[argh(option)]
1679    range_start: Option<Ipv4Addr>,
1680    /// the ending address, inclusive, of the range of addresses which the server will
1681    /// to clients
1682    #[argh(option)]
1683    range_stop: Option<Ipv4Addr>,
1684}
1685
1686impl Into<fidl_fuchsia_net_dhcp::Parameter> for AddressPool {
1687    fn into(self) -> fidl_fuchsia_net_dhcp::Parameter {
1688        let Self { prefix_length, range_start, range_stop } = self;
1689        let pool = fidl_fuchsia_net_dhcp::AddressPool {
1690            prefix_length,
1691            range_start: range_start.map(|v| fidl_fuchsia_net::Ipv4Address { addr: v.octets() }),
1692            range_stop: range_stop.map(|v| fidl_fuchsia_net::Ipv4Address { addr: v.octets() }),
1693            ..Default::default()
1694        };
1695        fidl_fuchsia_net_dhcp::Parameter::AddressPool(pool)
1696    }
1697}
1698
1699/// The client MAC addresses which the server will issue leases to.
1700#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1701#[argh(subcommand, name = "permitted-macs")]
1702pub struct PermittedMacs {
1703    /// the client MAC addresses which the server will issue leases to. By default,
1704    /// the server will not have a permitted MAC list, in which case it will attempt to
1705    /// issue a lease to every client which requests one. If permitted_macs has a non-zero length
1706    /// then the server will only respond to lease requests from clients with a MAC in the list.
1707    #[argh(option)]
1708    macs: Vec<MacAddr>,
1709}
1710
1711impl Into<fidl_fuchsia_net_dhcp::Parameter> for PermittedMacs {
1712    fn into(self) -> fidl_fuchsia_net_dhcp::Parameter {
1713        let addrs: Vec<fidl_fuchsia_net::MacAddress> =
1714            self.macs.into_iter().map(fidl_fuchsia_net_ext::MacAddress::into).collect();
1715        fidl_fuchsia_net_dhcp::Parameter::PermittedMacs(addrs)
1716    }
1717}
1718
1719/// Addresses in the AddressPool which will only be leased to specified clients.
1720/// Assigned addresses will be paired with hosts in order, e.g. hosts (A, B, C) and addresses (1, 2, 3)
1721/// pair as ((A, 1), (B, 2), (C, 3)).
1722#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1723#[argh(subcommand, name = "statically-assigned-addrs")]
1724pub struct StaticallyAssignedAddrs {
1725    /// hosts which will be leased the addresses reserved by `assigned_addrs`.
1726    #[argh(option)]
1727    hosts: Vec<MacAddr>,
1728    /// addresses in the AddressPool which will not be leased to clients. Typically, a network
1729    /// administrator will statically assign these addresses to always-on network
1730    /// devices which should always have the same IP address, such as network printers.
1731    #[argh(option)]
1732    assigned_addrs: Vec<Ipv4Addr>,
1733}
1734
1735impl Into<fidl_fuchsia_net_dhcp::Parameter> for StaticallyAssignedAddrs {
1736    fn into(self) -> fidl_fuchsia_net_dhcp::Parameter {
1737        let assignments: Vec<fidl_fuchsia_net_dhcp::StaticAssignment> = self
1738            .hosts
1739            .into_iter()
1740            .zip(self.assigned_addrs)
1741            .map(|(host, addr)| {
1742                (host.into(), fidl_fuchsia_net::Ipv4Address { addr: addr.octets() })
1743            })
1744            .map(|(host, assigned_addr)| fidl_fuchsia_net_dhcp::StaticAssignment {
1745                host: Some(host),
1746                assigned_addr: Some(assigned_addr),
1747                ..Default::default()
1748            })
1749            .collect();
1750        fidl_fuchsia_net_dhcp::Parameter::StaticallyAssignedAddrs(assignments)
1751    }
1752}
1753
1754/// Enables server behavior where the server ARPs an IP address prior to issuing
1755/// it in a lease.
1756#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1757#[argh(subcommand, name = "arp-probe")]
1758pub struct ArpProbe {
1759    /// enables server behavior where the server ARPs an IP address prior to issuing
1760    /// it in a lease. If the server receives a response, the server will mark the
1761    /// address as in-use and try again with a different address. By default, this
1762    /// behavior is disabled.
1763    #[argh(switch)]
1764    enabled: bool,
1765}
1766
1767impl Into<fidl_fuchsia_net_dhcp::Parameter> for ArpProbe {
1768    fn into(self) -> fidl_fuchsia_net_dhcp::Parameter {
1769        fidl_fuchsia_net_dhcp::Parameter::ArpProbe(self.enabled)
1770    }
1771}
1772
1773/// The duration of leases offered by the server.
1774#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1775#[argh(subcommand, name = "lease-length")]
1776pub struct LeaseLength {
1777    /// the default lease length, in seconds, to be issued to clients.
1778    // pub(crate) access to enable unit testing.
1779    #[argh(option)]
1780    pub(crate) default: Option<u32>,
1781    /// the maximum lease length value, in seconds, which the server will issue to clients who
1782    /// have requested a specific lease length. With the default value of 0, the max lease length is
1783    /// equivalent to the default lease length.
1784    // pub(crate) access to enable unit testing.
1785    #[argh(option)]
1786    pub(crate) max: Option<u32>,
1787}
1788
1789impl Into<fidl_fuchsia_net_dhcp::Parameter> for LeaseLength {
1790    fn into(self) -> fidl_fuchsia_net_dhcp::Parameter {
1791        fidl_fuchsia_net_dhcp::Parameter::Lease(fidl_fuchsia_net_dhcp::LeaseLength {
1792            default: self.default,
1793            max: self.max,
1794            ..Default::default()
1795        })
1796    }
1797}
1798
1799/// A NetBIOS over TCP/IP node type as defined in RFC 1001/1002.
1800#[derive(Clone, Copy, Debug, ArgsInfo, FromArgs, PartialEq)]
1801#[argh(subcommand)]
1802pub enum NodeType {
1803    BNode(BNode),
1804    PNode(PNode),
1805    MNode(MNode),
1806    HNode(HNode),
1807}
1808
1809/// A B node type.
1810#[derive(Clone, Copy, Debug, ArgsInfo, FromArgs, PartialEq)]
1811#[argh(subcommand, name = "b-node")]
1812pub struct BNode {}
1813
1814/// A P node type.
1815#[derive(Clone, Copy, Debug, ArgsInfo, FromArgs, PartialEq)]
1816#[argh(subcommand, name = "p-node")]
1817pub struct PNode {}
1818
1819/// A M node type.
1820#[derive(Clone, Copy, Debug, ArgsInfo, FromArgs, PartialEq)]
1821#[argh(subcommand, name = "m-node")]
1822pub struct MNode {}
1823
1824/// A H node type.
1825#[derive(Clone, Copy, Debug, ArgsInfo, FromArgs, PartialEq)]
1826#[argh(subcommand, name = "h-node")]
1827pub struct HNode {}
1828
1829/// The names of the network devices on which the server will listen.
1830#[derive(Clone, Debug, ArgsInfo, FromArgs, PartialEq)]
1831#[argh(subcommand, name = "bound-device-names")]
1832pub struct BoundDevices {
1833    /// the names of the network devices on which the server will listen. If
1834    /// this vector is empty, the server will listen on all devices and will
1835    /// process incoming DHCP messages regardless of the device on which they
1836    /// arrive. If this vector is not empty, then the server will only listen
1837    /// for incoming DHCP messages on the named network devices contained by
1838    /// this vector.
1839    #[argh(positional)]
1840    pub names: Vec<String>,
1841}
1842
1843impl Into<fidl_fuchsia_net_dhcp::Parameter> for BoundDevices {
1844    fn into(self) -> fidl_fuchsia_net_dhcp::Parameter {
1845        fidl_fuchsia_net_dhcp::Parameter::BoundDeviceNames(self.names)
1846    }
1847}