fidl_fuchsia_net_test_realm_common/
fidl_fuchsia_net_test_realm_common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub const MAX_UDP_POLL_LENGTH: u16 = 1024;
12
13/// Standard error codes for the `Controller` protocol.
14#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
15#[repr(u32)]
16pub enum Error {
17    /// The controller encountered an unspecified error while performing the
18    /// desired operation.
19    Internal = 1,
20    /// A hermetic network realm was expected to exist, but no such realm was
21    /// found to be running.
22    HermeticNetworkRealmNotRunning = 2,
23    /// A network interface was expected to exist, but was not found.
24    InterfaceNotFound = 3,
25    /// A stub was expected to exist, but was not found.
26    StubNotRunning = 4,
27    /// At least one argument was not valid.
28    InvalidArguments = 5,
29    /// The relevant component was not found.
30    ComponentNotFound = 6,
31    /// The operation could not be performed within the specified timeout.
32    TimeoutExceeded = 7,
33    /// A ping unexpectedly failed.
34    PingFailed = 8,
35    /// The requested address is not available.
36    AddressNotAvailable = 9,
37    /// The requested address is in use.
38    AddressInUse = 10,
39    /// The resource already exists.
40    AlreadyExists = 11,
41    /// The target address is unreachable (e.g. no route exists to it).
42    AddressUnreachable = 12,
43    /// A DHCPv6 client was expected to be running, but none was found.
44    Dhcpv6ClientNotRunning = 13,
45    /// A DHCPv4 client was expected to be running, but none was found.
46    Dhcpv4ClientNotRunning = 14,
47    /// Failed to shutdown the DHCPv4 client.
48    Dhcpv4ClientShutdownFailed = 15,
49}
50
51impl Error {
52    #[inline]
53    pub fn from_primitive(prim: u32) -> Option<Self> {
54        match prim {
55            1 => Some(Self::Internal),
56            2 => Some(Self::HermeticNetworkRealmNotRunning),
57            3 => Some(Self::InterfaceNotFound),
58            4 => Some(Self::StubNotRunning),
59            5 => Some(Self::InvalidArguments),
60            6 => Some(Self::ComponentNotFound),
61            7 => Some(Self::TimeoutExceeded),
62            8 => Some(Self::PingFailed),
63            9 => Some(Self::AddressNotAvailable),
64            10 => Some(Self::AddressInUse),
65            11 => Some(Self::AlreadyExists),
66            12 => Some(Self::AddressUnreachable),
67            13 => Some(Self::Dhcpv6ClientNotRunning),
68            14 => Some(Self::Dhcpv4ClientNotRunning),
69            15 => Some(Self::Dhcpv4ClientShutdownFailed),
70            _ => None,
71        }
72    }
73
74    #[inline]
75    pub const fn into_primitive(self) -> u32 {
76        self as u32
77    }
78
79    #[deprecated = "Strict enums should not use `is_unknown`"]
80    #[inline]
81    pub fn is_unknown(&self) -> bool {
82        false
83    }
84}
85
86#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
87#[repr(u32)]
88pub enum Netstack {
89    /// Netstack2.
90    V2 = 1,
91    /// Netstack3.
92    V3 = 2,
93}
94
95impl Netstack {
96    #[inline]
97    pub fn from_primitive(prim: u32) -> Option<Self> {
98        match prim {
99            1 => Some(Self::V2),
100            2 => Some(Self::V3),
101            _ => None,
102        }
103    }
104
105    #[inline]
106    pub const fn into_primitive(self) -> u32 {
107        self as u32
108    }
109
110    #[deprecated = "Strict enums should not use `is_unknown`"]
111    #[inline]
112    pub fn is_unknown(&self) -> bool {
113        false
114    }
115}
116
117#[derive(Clone, Debug, PartialEq)]
118pub struct ControllerAddInterfaceRequest {
119    pub mac_address: fidl_fuchsia_net::MacAddress,
120    pub name: String,
121    pub wait_any_ip_address: bool,
122}
123
124impl fidl::Persistable for ControllerAddInterfaceRequest {}
125
126#[derive(Clone, Debug, PartialEq)]
127pub struct ControllerJoinMulticastGroupRequest {
128    pub address: fidl_fuchsia_net::IpAddress,
129    pub interface_id: u64,
130}
131
132impl fidl::Persistable for ControllerJoinMulticastGroupRequest {}
133
134#[derive(Clone, Debug, PartialEq)]
135pub struct ControllerLeaveMulticastGroupRequest {
136    pub address: fidl_fuchsia_net::IpAddress,
137    pub interface_id: u64,
138}
139
140impl fidl::Persistable for ControllerLeaveMulticastGroupRequest {}
141
142#[derive(Clone, Debug, PartialEq)]
143pub struct ControllerPingRequest {
144    pub target: fidl_fuchsia_net::IpAddress,
145    pub payload_length: u16,
146    pub interface_name: Option<String>,
147    pub timeout: i64,
148}
149
150impl fidl::Persistable for ControllerPingRequest {}
151
152#[derive(Clone, Debug, PartialEq)]
153pub struct ControllerPollUdpRequest {
154    pub target: fidl_fuchsia_net::SocketAddress,
155    pub payload: Vec<u8>,
156    pub timeout: i64,
157    pub num_retries: u16,
158}
159
160impl fidl::Persistable for ControllerPollUdpRequest {}
161
162#[derive(Clone, Debug, PartialEq)]
163pub struct ControllerStartDhcpv6ClientRequest {
164    pub params: fidl_fuchsia_net_dhcpv6::NewClientParams,
165}
166
167impl fidl::Persistable for ControllerStartDhcpv6ClientRequest {}
168
169#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
170pub struct ControllerStartHermeticNetworkRealmRequest {
171    pub netstack: Netstack,
172}
173
174impl fidl::Persistable for ControllerStartHermeticNetworkRealmRequest {}
175
176#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
177pub struct ControllerStartStubRequest {
178    pub component_url: String,
179}
180
181impl fidl::Persistable for ControllerStartStubRequest {}
182
183#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
184pub struct ControllerPollUdpResponse {
185    pub payload: Vec<u8>,
186}
187
188impl fidl::Persistable for ControllerPollUdpResponse {}
189
190#[derive(Clone, Debug, Default, PartialEq)]
191pub struct ControllerStartOutOfStackDhcpv4ClientRequest {
192    pub interface_id: Option<u64>,
193    #[doc(hidden)]
194    pub __source_breaking: fidl::marker::SourceBreaking,
195}
196
197impl fidl::Persistable for ControllerStartOutOfStackDhcpv4ClientRequest {}
198
199#[derive(Clone, Debug, Default, PartialEq)]
200pub struct ControllerStopOutOfStackDhcpv4ClientRequest {
201    pub interface_id: Option<u64>,
202    #[doc(hidden)]
203    pub __source_breaking: fidl::marker::SourceBreaking,
204}
205
206impl fidl::Persistable for ControllerStopOutOfStackDhcpv4ClientRequest {}
207
208mod internal {
209    use super::*;
210    unsafe impl fidl::encoding::TypeMarker for Error {
211        type Owned = Self;
212
213        #[inline(always)]
214        fn inline_align(_context: fidl::encoding::Context) -> usize {
215            std::mem::align_of::<u32>()
216        }
217
218        #[inline(always)]
219        fn inline_size(_context: fidl::encoding::Context) -> usize {
220            std::mem::size_of::<u32>()
221        }
222
223        #[inline(always)]
224        fn encode_is_copy() -> bool {
225            true
226        }
227
228        #[inline(always)]
229        fn decode_is_copy() -> bool {
230            false
231        }
232    }
233
234    impl fidl::encoding::ValueTypeMarker for Error {
235        type Borrowed<'a> = Self;
236        #[inline(always)]
237        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
238            *value
239        }
240    }
241
242    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Error {
243        #[inline]
244        unsafe fn encode(
245            self,
246            encoder: &mut fidl::encoding::Encoder<'_, D>,
247            offset: usize,
248            _depth: fidl::encoding::Depth,
249        ) -> fidl::Result<()> {
250            encoder.debug_check_bounds::<Self>(offset);
251            encoder.write_num(self.into_primitive(), offset);
252            Ok(())
253        }
254    }
255
256    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
257        #[inline(always)]
258        fn new_empty() -> Self {
259            Self::Internal
260        }
261
262        #[inline]
263        unsafe fn decode(
264            &mut self,
265            decoder: &mut fidl::encoding::Decoder<'_, D>,
266            offset: usize,
267            _depth: fidl::encoding::Depth,
268        ) -> fidl::Result<()> {
269            decoder.debug_check_bounds::<Self>(offset);
270            let prim = decoder.read_num::<u32>(offset);
271
272            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
273            Ok(())
274        }
275    }
276    unsafe impl fidl::encoding::TypeMarker for Netstack {
277        type Owned = Self;
278
279        #[inline(always)]
280        fn inline_align(_context: fidl::encoding::Context) -> usize {
281            std::mem::align_of::<u32>()
282        }
283
284        #[inline(always)]
285        fn inline_size(_context: fidl::encoding::Context) -> usize {
286            std::mem::size_of::<u32>()
287        }
288
289        #[inline(always)]
290        fn encode_is_copy() -> bool {
291            true
292        }
293
294        #[inline(always)]
295        fn decode_is_copy() -> bool {
296            false
297        }
298    }
299
300    impl fidl::encoding::ValueTypeMarker for Netstack {
301        type Borrowed<'a> = Self;
302        #[inline(always)]
303        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
304            *value
305        }
306    }
307
308    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Netstack {
309        #[inline]
310        unsafe fn encode(
311            self,
312            encoder: &mut fidl::encoding::Encoder<'_, D>,
313            offset: usize,
314            _depth: fidl::encoding::Depth,
315        ) -> fidl::Result<()> {
316            encoder.debug_check_bounds::<Self>(offset);
317            encoder.write_num(self.into_primitive(), offset);
318            Ok(())
319        }
320    }
321
322    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Netstack {
323        #[inline(always)]
324        fn new_empty() -> Self {
325            Self::V2
326        }
327
328        #[inline]
329        unsafe fn decode(
330            &mut self,
331            decoder: &mut fidl::encoding::Decoder<'_, D>,
332            offset: usize,
333            _depth: fidl::encoding::Depth,
334        ) -> fidl::Result<()> {
335            decoder.debug_check_bounds::<Self>(offset);
336            let prim = decoder.read_num::<u32>(offset);
337
338            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
339            Ok(())
340        }
341    }
342
343    impl fidl::encoding::ValueTypeMarker for ControllerAddInterfaceRequest {
344        type Borrowed<'a> = &'a Self;
345        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
346            value
347        }
348    }
349
350    unsafe impl fidl::encoding::TypeMarker for ControllerAddInterfaceRequest {
351        type Owned = Self;
352
353        #[inline(always)]
354        fn inline_align(_context: fidl::encoding::Context) -> usize {
355            8
356        }
357
358        #[inline(always)]
359        fn inline_size(_context: fidl::encoding::Context) -> usize {
360            32
361        }
362    }
363
364    unsafe impl<D: fidl::encoding::ResourceDialect>
365        fidl::encoding::Encode<ControllerAddInterfaceRequest, D>
366        for &ControllerAddInterfaceRequest
367    {
368        #[inline]
369        unsafe fn encode(
370            self,
371            encoder: &mut fidl::encoding::Encoder<'_, D>,
372            offset: usize,
373            _depth: fidl::encoding::Depth,
374        ) -> fidl::Result<()> {
375            encoder.debug_check_bounds::<ControllerAddInterfaceRequest>(offset);
376            // Delegate to tuple encoding.
377            fidl::encoding::Encode::<ControllerAddInterfaceRequest, D>::encode(
378                (
379                    <fidl_fuchsia_net::MacAddress as fidl::encoding::ValueTypeMarker>::borrow(
380                        &self.mac_address,
381                    ),
382                    <fidl::encoding::BoundedString<15> as fidl::encoding::ValueTypeMarker>::borrow(
383                        &self.name,
384                    ),
385                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.wait_any_ip_address),
386                ),
387                encoder,
388                offset,
389                _depth,
390            )
391        }
392    }
393    unsafe impl<
394            D: fidl::encoding::ResourceDialect,
395            T0: fidl::encoding::Encode<fidl_fuchsia_net::MacAddress, D>,
396            T1: fidl::encoding::Encode<fidl::encoding::BoundedString<15>, D>,
397            T2: fidl::encoding::Encode<bool, D>,
398        > fidl::encoding::Encode<ControllerAddInterfaceRequest, D> for (T0, T1, T2)
399    {
400        #[inline]
401        unsafe fn encode(
402            self,
403            encoder: &mut fidl::encoding::Encoder<'_, D>,
404            offset: usize,
405            depth: fidl::encoding::Depth,
406        ) -> fidl::Result<()> {
407            encoder.debug_check_bounds::<ControllerAddInterfaceRequest>(offset);
408            // Zero out padding regions. There's no need to apply masks
409            // because the unmasked parts will be overwritten by fields.
410            unsafe {
411                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
412                (ptr as *mut u64).write_unaligned(0);
413            }
414            unsafe {
415                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
416                (ptr as *mut u64).write_unaligned(0);
417            }
418            // Write the fields.
419            self.0.encode(encoder, offset + 0, depth)?;
420            self.1.encode(encoder, offset + 8, depth)?;
421            self.2.encode(encoder, offset + 24, depth)?;
422            Ok(())
423        }
424    }
425
426    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
427        for ControllerAddInterfaceRequest
428    {
429        #[inline(always)]
430        fn new_empty() -> Self {
431            Self {
432                mac_address: fidl::new_empty!(fidl_fuchsia_net::MacAddress, D),
433                name: fidl::new_empty!(fidl::encoding::BoundedString<15>, D),
434                wait_any_ip_address: fidl::new_empty!(bool, D),
435            }
436        }
437
438        #[inline]
439        unsafe fn decode(
440            &mut self,
441            decoder: &mut fidl::encoding::Decoder<'_, D>,
442            offset: usize,
443            _depth: fidl::encoding::Depth,
444        ) -> fidl::Result<()> {
445            decoder.debug_check_bounds::<Self>(offset);
446            // Verify that padding bytes are zero.
447            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
448            let padval = unsafe { (ptr as *const u64).read_unaligned() };
449            let mask = 0xffff000000000000u64;
450            let maskedval = padval & mask;
451            if maskedval != 0 {
452                return Err(fidl::Error::NonZeroPadding {
453                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
454                });
455            }
456            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
457            let padval = unsafe { (ptr as *const u64).read_unaligned() };
458            let mask = 0xffffffffffffff00u64;
459            let maskedval = padval & mask;
460            if maskedval != 0 {
461                return Err(fidl::Error::NonZeroPadding {
462                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
463                });
464            }
465            fidl::decode!(
466                fidl_fuchsia_net::MacAddress,
467                D,
468                &mut self.mac_address,
469                decoder,
470                offset + 0,
471                _depth
472            )?;
473            fidl::decode!(
474                fidl::encoding::BoundedString<15>,
475                D,
476                &mut self.name,
477                decoder,
478                offset + 8,
479                _depth
480            )?;
481            fidl::decode!(bool, D, &mut self.wait_any_ip_address, decoder, offset + 24, _depth)?;
482            Ok(())
483        }
484    }
485
486    impl fidl::encoding::ValueTypeMarker for ControllerJoinMulticastGroupRequest {
487        type Borrowed<'a> = &'a Self;
488        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
489            value
490        }
491    }
492
493    unsafe impl fidl::encoding::TypeMarker for ControllerJoinMulticastGroupRequest {
494        type Owned = Self;
495
496        #[inline(always)]
497        fn inline_align(_context: fidl::encoding::Context) -> usize {
498            8
499        }
500
501        #[inline(always)]
502        fn inline_size(_context: fidl::encoding::Context) -> usize {
503            24
504        }
505    }
506
507    unsafe impl<D: fidl::encoding::ResourceDialect>
508        fidl::encoding::Encode<ControllerJoinMulticastGroupRequest, D>
509        for &ControllerJoinMulticastGroupRequest
510    {
511        #[inline]
512        unsafe fn encode(
513            self,
514            encoder: &mut fidl::encoding::Encoder<'_, D>,
515            offset: usize,
516            _depth: fidl::encoding::Depth,
517        ) -> fidl::Result<()> {
518            encoder.debug_check_bounds::<ControllerJoinMulticastGroupRequest>(offset);
519            // Delegate to tuple encoding.
520            fidl::encoding::Encode::<ControllerJoinMulticastGroupRequest, D>::encode(
521                (
522                    <fidl_fuchsia_net::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(
523                        &self.address,
524                    ),
525                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.interface_id),
526                ),
527                encoder,
528                offset,
529                _depth,
530            )
531        }
532    }
533    unsafe impl<
534            D: fidl::encoding::ResourceDialect,
535            T0: fidl::encoding::Encode<fidl_fuchsia_net::IpAddress, D>,
536            T1: fidl::encoding::Encode<u64, D>,
537        > fidl::encoding::Encode<ControllerJoinMulticastGroupRequest, D> for (T0, T1)
538    {
539        #[inline]
540        unsafe fn encode(
541            self,
542            encoder: &mut fidl::encoding::Encoder<'_, D>,
543            offset: usize,
544            depth: fidl::encoding::Depth,
545        ) -> fidl::Result<()> {
546            encoder.debug_check_bounds::<ControllerJoinMulticastGroupRequest>(offset);
547            // Zero out padding regions. There's no need to apply masks
548            // because the unmasked parts will be overwritten by fields.
549            // Write the fields.
550            self.0.encode(encoder, offset + 0, depth)?;
551            self.1.encode(encoder, offset + 16, depth)?;
552            Ok(())
553        }
554    }
555
556    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
557        for ControllerJoinMulticastGroupRequest
558    {
559        #[inline(always)]
560        fn new_empty() -> Self {
561            Self {
562                address: fidl::new_empty!(fidl_fuchsia_net::IpAddress, D),
563                interface_id: fidl::new_empty!(u64, D),
564            }
565        }
566
567        #[inline]
568        unsafe fn decode(
569            &mut self,
570            decoder: &mut fidl::encoding::Decoder<'_, D>,
571            offset: usize,
572            _depth: fidl::encoding::Depth,
573        ) -> fidl::Result<()> {
574            decoder.debug_check_bounds::<Self>(offset);
575            // Verify that padding bytes are zero.
576            fidl::decode!(
577                fidl_fuchsia_net::IpAddress,
578                D,
579                &mut self.address,
580                decoder,
581                offset + 0,
582                _depth
583            )?;
584            fidl::decode!(u64, D, &mut self.interface_id, decoder, offset + 16, _depth)?;
585            Ok(())
586        }
587    }
588
589    impl fidl::encoding::ValueTypeMarker for ControllerLeaveMulticastGroupRequest {
590        type Borrowed<'a> = &'a Self;
591        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
592            value
593        }
594    }
595
596    unsafe impl fidl::encoding::TypeMarker for ControllerLeaveMulticastGroupRequest {
597        type Owned = Self;
598
599        #[inline(always)]
600        fn inline_align(_context: fidl::encoding::Context) -> usize {
601            8
602        }
603
604        #[inline(always)]
605        fn inline_size(_context: fidl::encoding::Context) -> usize {
606            24
607        }
608    }
609
610    unsafe impl<D: fidl::encoding::ResourceDialect>
611        fidl::encoding::Encode<ControllerLeaveMulticastGroupRequest, D>
612        for &ControllerLeaveMulticastGroupRequest
613    {
614        #[inline]
615        unsafe fn encode(
616            self,
617            encoder: &mut fidl::encoding::Encoder<'_, D>,
618            offset: usize,
619            _depth: fidl::encoding::Depth,
620        ) -> fidl::Result<()> {
621            encoder.debug_check_bounds::<ControllerLeaveMulticastGroupRequest>(offset);
622            // Delegate to tuple encoding.
623            fidl::encoding::Encode::<ControllerLeaveMulticastGroupRequest, D>::encode(
624                (
625                    <fidl_fuchsia_net::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(
626                        &self.address,
627                    ),
628                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.interface_id),
629                ),
630                encoder,
631                offset,
632                _depth,
633            )
634        }
635    }
636    unsafe impl<
637            D: fidl::encoding::ResourceDialect,
638            T0: fidl::encoding::Encode<fidl_fuchsia_net::IpAddress, D>,
639            T1: fidl::encoding::Encode<u64, D>,
640        > fidl::encoding::Encode<ControllerLeaveMulticastGroupRequest, D> for (T0, T1)
641    {
642        #[inline]
643        unsafe fn encode(
644            self,
645            encoder: &mut fidl::encoding::Encoder<'_, D>,
646            offset: usize,
647            depth: fidl::encoding::Depth,
648        ) -> fidl::Result<()> {
649            encoder.debug_check_bounds::<ControllerLeaveMulticastGroupRequest>(offset);
650            // Zero out padding regions. There's no need to apply masks
651            // because the unmasked parts will be overwritten by fields.
652            // Write the fields.
653            self.0.encode(encoder, offset + 0, depth)?;
654            self.1.encode(encoder, offset + 16, depth)?;
655            Ok(())
656        }
657    }
658
659    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
660        for ControllerLeaveMulticastGroupRequest
661    {
662        #[inline(always)]
663        fn new_empty() -> Self {
664            Self {
665                address: fidl::new_empty!(fidl_fuchsia_net::IpAddress, D),
666                interface_id: fidl::new_empty!(u64, D),
667            }
668        }
669
670        #[inline]
671        unsafe fn decode(
672            &mut self,
673            decoder: &mut fidl::encoding::Decoder<'_, D>,
674            offset: usize,
675            _depth: fidl::encoding::Depth,
676        ) -> fidl::Result<()> {
677            decoder.debug_check_bounds::<Self>(offset);
678            // Verify that padding bytes are zero.
679            fidl::decode!(
680                fidl_fuchsia_net::IpAddress,
681                D,
682                &mut self.address,
683                decoder,
684                offset + 0,
685                _depth
686            )?;
687            fidl::decode!(u64, D, &mut self.interface_id, decoder, offset + 16, _depth)?;
688            Ok(())
689        }
690    }
691
692    impl fidl::encoding::ValueTypeMarker for ControllerPingRequest {
693        type Borrowed<'a> = &'a Self;
694        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
695            value
696        }
697    }
698
699    unsafe impl fidl::encoding::TypeMarker for ControllerPingRequest {
700        type Owned = Self;
701
702        #[inline(always)]
703        fn inline_align(_context: fidl::encoding::Context) -> usize {
704            8
705        }
706
707        #[inline(always)]
708        fn inline_size(_context: fidl::encoding::Context) -> usize {
709            48
710        }
711    }
712
713    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ControllerPingRequest, D>
714        for &ControllerPingRequest
715    {
716        #[inline]
717        unsafe fn encode(
718            self,
719            encoder: &mut fidl::encoding::Encoder<'_, D>,
720            offset: usize,
721            _depth: fidl::encoding::Depth,
722        ) -> fidl::Result<()> {
723            encoder.debug_check_bounds::<ControllerPingRequest>(offset);
724            // Delegate to tuple encoding.
725            fidl::encoding::Encode::<ControllerPingRequest, D>::encode(
726                (
727                    <fidl_fuchsia_net::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(&self.target),
728                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.payload_length),
729                    <fidl::encoding::Optional<fidl::encoding::BoundedString<15>> as fidl::encoding::ValueTypeMarker>::borrow(&self.interface_name),
730                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.timeout),
731                ),
732                encoder, offset, _depth
733            )
734        }
735    }
736    unsafe impl<
737            D: fidl::encoding::ResourceDialect,
738            T0: fidl::encoding::Encode<fidl_fuchsia_net::IpAddress, D>,
739            T1: fidl::encoding::Encode<u16, D>,
740            T2: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<15>>, D>,
741            T3: fidl::encoding::Encode<i64, D>,
742        > fidl::encoding::Encode<ControllerPingRequest, D> for (T0, T1, T2, T3)
743    {
744        #[inline]
745        unsafe fn encode(
746            self,
747            encoder: &mut fidl::encoding::Encoder<'_, D>,
748            offset: usize,
749            depth: fidl::encoding::Depth,
750        ) -> fidl::Result<()> {
751            encoder.debug_check_bounds::<ControllerPingRequest>(offset);
752            // Zero out padding regions. There's no need to apply masks
753            // because the unmasked parts will be overwritten by fields.
754            unsafe {
755                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
756                (ptr as *mut u64).write_unaligned(0);
757            }
758            // Write the fields.
759            self.0.encode(encoder, offset + 0, depth)?;
760            self.1.encode(encoder, offset + 16, depth)?;
761            self.2.encode(encoder, offset + 24, depth)?;
762            self.3.encode(encoder, offset + 40, depth)?;
763            Ok(())
764        }
765    }
766
767    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ControllerPingRequest {
768        #[inline(always)]
769        fn new_empty() -> Self {
770            Self {
771                target: fidl::new_empty!(fidl_fuchsia_net::IpAddress, D),
772                payload_length: fidl::new_empty!(u16, D),
773                interface_name: fidl::new_empty!(
774                    fidl::encoding::Optional<fidl::encoding::BoundedString<15>>,
775                    D
776                ),
777                timeout: fidl::new_empty!(i64, D),
778            }
779        }
780
781        #[inline]
782        unsafe fn decode(
783            &mut self,
784            decoder: &mut fidl::encoding::Decoder<'_, D>,
785            offset: usize,
786            _depth: fidl::encoding::Depth,
787        ) -> fidl::Result<()> {
788            decoder.debug_check_bounds::<Self>(offset);
789            // Verify that padding bytes are zero.
790            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
791            let padval = unsafe { (ptr as *const u64).read_unaligned() };
792            let mask = 0xffffffffffff0000u64;
793            let maskedval = padval & mask;
794            if maskedval != 0 {
795                return Err(fidl::Error::NonZeroPadding {
796                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
797                });
798            }
799            fidl::decode!(
800                fidl_fuchsia_net::IpAddress,
801                D,
802                &mut self.target,
803                decoder,
804                offset + 0,
805                _depth
806            )?;
807            fidl::decode!(u16, D, &mut self.payload_length, decoder, offset + 16, _depth)?;
808            fidl::decode!(
809                fidl::encoding::Optional<fidl::encoding::BoundedString<15>>,
810                D,
811                &mut self.interface_name,
812                decoder,
813                offset + 24,
814                _depth
815            )?;
816            fidl::decode!(i64, D, &mut self.timeout, decoder, offset + 40, _depth)?;
817            Ok(())
818        }
819    }
820
821    impl fidl::encoding::ValueTypeMarker for ControllerPollUdpRequest {
822        type Borrowed<'a> = &'a Self;
823        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
824            value
825        }
826    }
827
828    unsafe impl fidl::encoding::TypeMarker for ControllerPollUdpRequest {
829        type Owned = Self;
830
831        #[inline(always)]
832        fn inline_align(_context: fidl::encoding::Context) -> usize {
833            8
834        }
835
836        #[inline(always)]
837        fn inline_size(_context: fidl::encoding::Context) -> usize {
838            48
839        }
840    }
841
842    unsafe impl<D: fidl::encoding::ResourceDialect>
843        fidl::encoding::Encode<ControllerPollUdpRequest, D> for &ControllerPollUdpRequest
844    {
845        #[inline]
846        unsafe fn encode(
847            self,
848            encoder: &mut fidl::encoding::Encoder<'_, D>,
849            offset: usize,
850            _depth: fidl::encoding::Depth,
851        ) -> fidl::Result<()> {
852            encoder.debug_check_bounds::<ControllerPollUdpRequest>(offset);
853            // Delegate to tuple encoding.
854            fidl::encoding::Encode::<ControllerPollUdpRequest, D>::encode(
855                (
856                    <fidl_fuchsia_net::SocketAddress as fidl::encoding::ValueTypeMarker>::borrow(
857                        &self.target,
858                    ),
859                    <fidl::encoding::Vector<u8, 1024> as fidl::encoding::ValueTypeMarker>::borrow(
860                        &self.payload,
861                    ),
862                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.timeout),
863                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.num_retries),
864                ),
865                encoder,
866                offset,
867                _depth,
868            )
869        }
870    }
871    unsafe impl<
872            D: fidl::encoding::ResourceDialect,
873            T0: fidl::encoding::Encode<fidl_fuchsia_net::SocketAddress, D>,
874            T1: fidl::encoding::Encode<fidl::encoding::Vector<u8, 1024>, D>,
875            T2: fidl::encoding::Encode<i64, D>,
876            T3: fidl::encoding::Encode<u16, D>,
877        > fidl::encoding::Encode<ControllerPollUdpRequest, D> for (T0, T1, T2, T3)
878    {
879        #[inline]
880        unsafe fn encode(
881            self,
882            encoder: &mut fidl::encoding::Encoder<'_, D>,
883            offset: usize,
884            depth: fidl::encoding::Depth,
885        ) -> fidl::Result<()> {
886            encoder.debug_check_bounds::<ControllerPollUdpRequest>(offset);
887            // Zero out padding regions. There's no need to apply masks
888            // because the unmasked parts will be overwritten by fields.
889            unsafe {
890                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
891                (ptr as *mut u64).write_unaligned(0);
892            }
893            // Write the fields.
894            self.0.encode(encoder, offset + 0, depth)?;
895            self.1.encode(encoder, offset + 16, depth)?;
896            self.2.encode(encoder, offset + 32, depth)?;
897            self.3.encode(encoder, offset + 40, depth)?;
898            Ok(())
899        }
900    }
901
902    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
903        for ControllerPollUdpRequest
904    {
905        #[inline(always)]
906        fn new_empty() -> Self {
907            Self {
908                target: fidl::new_empty!(fidl_fuchsia_net::SocketAddress, D),
909                payload: fidl::new_empty!(fidl::encoding::Vector<u8, 1024>, D),
910                timeout: fidl::new_empty!(i64, D),
911                num_retries: fidl::new_empty!(u16, D),
912            }
913        }
914
915        #[inline]
916        unsafe fn decode(
917            &mut self,
918            decoder: &mut fidl::encoding::Decoder<'_, D>,
919            offset: usize,
920            _depth: fidl::encoding::Depth,
921        ) -> fidl::Result<()> {
922            decoder.debug_check_bounds::<Self>(offset);
923            // Verify that padding bytes are zero.
924            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
925            let padval = unsafe { (ptr as *const u64).read_unaligned() };
926            let mask = 0xffffffffffff0000u64;
927            let maskedval = padval & mask;
928            if maskedval != 0 {
929                return Err(fidl::Error::NonZeroPadding {
930                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
931                });
932            }
933            fidl::decode!(
934                fidl_fuchsia_net::SocketAddress,
935                D,
936                &mut self.target,
937                decoder,
938                offset + 0,
939                _depth
940            )?;
941            fidl::decode!(fidl::encoding::Vector<u8, 1024>, D, &mut self.payload, decoder, offset + 16, _depth)?;
942            fidl::decode!(i64, D, &mut self.timeout, decoder, offset + 32, _depth)?;
943            fidl::decode!(u16, D, &mut self.num_retries, decoder, offset + 40, _depth)?;
944            Ok(())
945        }
946    }
947
948    impl fidl::encoding::ValueTypeMarker for ControllerStartDhcpv6ClientRequest {
949        type Borrowed<'a> = &'a Self;
950        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
951            value
952        }
953    }
954
955    unsafe impl fidl::encoding::TypeMarker for ControllerStartDhcpv6ClientRequest {
956        type Owned = Self;
957
958        #[inline(always)]
959        fn inline_align(_context: fidl::encoding::Context) -> usize {
960            8
961        }
962
963        #[inline(always)]
964        fn inline_size(_context: fidl::encoding::Context) -> usize {
965            16
966        }
967    }
968
969    unsafe impl<D: fidl::encoding::ResourceDialect>
970        fidl::encoding::Encode<ControllerStartDhcpv6ClientRequest, D>
971        for &ControllerStartDhcpv6ClientRequest
972    {
973        #[inline]
974        unsafe fn encode(
975            self,
976            encoder: &mut fidl::encoding::Encoder<'_, D>,
977            offset: usize,
978            _depth: fidl::encoding::Depth,
979        ) -> fidl::Result<()> {
980            encoder.debug_check_bounds::<ControllerStartDhcpv6ClientRequest>(offset);
981            // Delegate to tuple encoding.
982            fidl::encoding::Encode::<ControllerStartDhcpv6ClientRequest, D>::encode(
983                (
984                    <fidl_fuchsia_net_dhcpv6::NewClientParams as fidl::encoding::ValueTypeMarker>::borrow(&self.params),
985                ),
986                encoder, offset, _depth
987            )
988        }
989    }
990    unsafe impl<
991            D: fidl::encoding::ResourceDialect,
992            T0: fidl::encoding::Encode<fidl_fuchsia_net_dhcpv6::NewClientParams, D>,
993        > fidl::encoding::Encode<ControllerStartDhcpv6ClientRequest, D> for (T0,)
994    {
995        #[inline]
996        unsafe fn encode(
997            self,
998            encoder: &mut fidl::encoding::Encoder<'_, D>,
999            offset: usize,
1000            depth: fidl::encoding::Depth,
1001        ) -> fidl::Result<()> {
1002            encoder.debug_check_bounds::<ControllerStartDhcpv6ClientRequest>(offset);
1003            // Zero out padding regions. There's no need to apply masks
1004            // because the unmasked parts will be overwritten by fields.
1005            // Write the fields.
1006            self.0.encode(encoder, offset + 0, depth)?;
1007            Ok(())
1008        }
1009    }
1010
1011    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1012        for ControllerStartDhcpv6ClientRequest
1013    {
1014        #[inline(always)]
1015        fn new_empty() -> Self {
1016            Self { params: fidl::new_empty!(fidl_fuchsia_net_dhcpv6::NewClientParams, D) }
1017        }
1018
1019        #[inline]
1020        unsafe fn decode(
1021            &mut self,
1022            decoder: &mut fidl::encoding::Decoder<'_, D>,
1023            offset: usize,
1024            _depth: fidl::encoding::Depth,
1025        ) -> fidl::Result<()> {
1026            decoder.debug_check_bounds::<Self>(offset);
1027            // Verify that padding bytes are zero.
1028            fidl::decode!(
1029                fidl_fuchsia_net_dhcpv6::NewClientParams,
1030                D,
1031                &mut self.params,
1032                decoder,
1033                offset + 0,
1034                _depth
1035            )?;
1036            Ok(())
1037        }
1038    }
1039
1040    impl fidl::encoding::ValueTypeMarker for ControllerStartHermeticNetworkRealmRequest {
1041        type Borrowed<'a> = &'a Self;
1042        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1043            value
1044        }
1045    }
1046
1047    unsafe impl fidl::encoding::TypeMarker for ControllerStartHermeticNetworkRealmRequest {
1048        type Owned = Self;
1049
1050        #[inline(always)]
1051        fn inline_align(_context: fidl::encoding::Context) -> usize {
1052            4
1053        }
1054
1055        #[inline(always)]
1056        fn inline_size(_context: fidl::encoding::Context) -> usize {
1057            4
1058        }
1059    }
1060
1061    unsafe impl<D: fidl::encoding::ResourceDialect>
1062        fidl::encoding::Encode<ControllerStartHermeticNetworkRealmRequest, D>
1063        for &ControllerStartHermeticNetworkRealmRequest
1064    {
1065        #[inline]
1066        unsafe fn encode(
1067            self,
1068            encoder: &mut fidl::encoding::Encoder<'_, D>,
1069            offset: usize,
1070            _depth: fidl::encoding::Depth,
1071        ) -> fidl::Result<()> {
1072            encoder.debug_check_bounds::<ControllerStartHermeticNetworkRealmRequest>(offset);
1073            // Delegate to tuple encoding.
1074            fidl::encoding::Encode::<ControllerStartHermeticNetworkRealmRequest, D>::encode(
1075                (<Netstack as fidl::encoding::ValueTypeMarker>::borrow(&self.netstack),),
1076                encoder,
1077                offset,
1078                _depth,
1079            )
1080        }
1081    }
1082    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Netstack, D>>
1083        fidl::encoding::Encode<ControllerStartHermeticNetworkRealmRequest, D> for (T0,)
1084    {
1085        #[inline]
1086        unsafe fn encode(
1087            self,
1088            encoder: &mut fidl::encoding::Encoder<'_, D>,
1089            offset: usize,
1090            depth: fidl::encoding::Depth,
1091        ) -> fidl::Result<()> {
1092            encoder.debug_check_bounds::<ControllerStartHermeticNetworkRealmRequest>(offset);
1093            // Zero out padding regions. There's no need to apply masks
1094            // because the unmasked parts will be overwritten by fields.
1095            // Write the fields.
1096            self.0.encode(encoder, offset + 0, depth)?;
1097            Ok(())
1098        }
1099    }
1100
1101    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1102        for ControllerStartHermeticNetworkRealmRequest
1103    {
1104        #[inline(always)]
1105        fn new_empty() -> Self {
1106            Self { netstack: fidl::new_empty!(Netstack, D) }
1107        }
1108
1109        #[inline]
1110        unsafe fn decode(
1111            &mut self,
1112            decoder: &mut fidl::encoding::Decoder<'_, D>,
1113            offset: usize,
1114            _depth: fidl::encoding::Depth,
1115        ) -> fidl::Result<()> {
1116            decoder.debug_check_bounds::<Self>(offset);
1117            // Verify that padding bytes are zero.
1118            fidl::decode!(Netstack, D, &mut self.netstack, decoder, offset + 0, _depth)?;
1119            Ok(())
1120        }
1121    }
1122
1123    impl fidl::encoding::ValueTypeMarker for ControllerStartStubRequest {
1124        type Borrowed<'a> = &'a Self;
1125        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1126            value
1127        }
1128    }
1129
1130    unsafe impl fidl::encoding::TypeMarker for ControllerStartStubRequest {
1131        type Owned = Self;
1132
1133        #[inline(always)]
1134        fn inline_align(_context: fidl::encoding::Context) -> usize {
1135            8
1136        }
1137
1138        #[inline(always)]
1139        fn inline_size(_context: fidl::encoding::Context) -> usize {
1140            16
1141        }
1142    }
1143
1144    unsafe impl<D: fidl::encoding::ResourceDialect>
1145        fidl::encoding::Encode<ControllerStartStubRequest, D> for &ControllerStartStubRequest
1146    {
1147        #[inline]
1148        unsafe fn encode(
1149            self,
1150            encoder: &mut fidl::encoding::Encoder<'_, D>,
1151            offset: usize,
1152            _depth: fidl::encoding::Depth,
1153        ) -> fidl::Result<()> {
1154            encoder.debug_check_bounds::<ControllerStartStubRequest>(offset);
1155            // Delegate to tuple encoding.
1156            fidl::encoding::Encode::<ControllerStartStubRequest, D>::encode(
1157                (<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(
1158                    &self.component_url,
1159                ),),
1160                encoder,
1161                offset,
1162                _depth,
1163            )
1164        }
1165    }
1166    unsafe impl<
1167            D: fidl::encoding::ResourceDialect,
1168            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<4096>, D>,
1169        > fidl::encoding::Encode<ControllerStartStubRequest, D> for (T0,)
1170    {
1171        #[inline]
1172        unsafe fn encode(
1173            self,
1174            encoder: &mut fidl::encoding::Encoder<'_, D>,
1175            offset: usize,
1176            depth: fidl::encoding::Depth,
1177        ) -> fidl::Result<()> {
1178            encoder.debug_check_bounds::<ControllerStartStubRequest>(offset);
1179            // Zero out padding regions. There's no need to apply masks
1180            // because the unmasked parts will be overwritten by fields.
1181            // Write the fields.
1182            self.0.encode(encoder, offset + 0, depth)?;
1183            Ok(())
1184        }
1185    }
1186
1187    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1188        for ControllerStartStubRequest
1189    {
1190        #[inline(always)]
1191        fn new_empty() -> Self {
1192            Self { component_url: fidl::new_empty!(fidl::encoding::BoundedString<4096>, D) }
1193        }
1194
1195        #[inline]
1196        unsafe fn decode(
1197            &mut self,
1198            decoder: &mut fidl::encoding::Decoder<'_, D>,
1199            offset: usize,
1200            _depth: fidl::encoding::Depth,
1201        ) -> fidl::Result<()> {
1202            decoder.debug_check_bounds::<Self>(offset);
1203            // Verify that padding bytes are zero.
1204            fidl::decode!(
1205                fidl::encoding::BoundedString<4096>,
1206                D,
1207                &mut self.component_url,
1208                decoder,
1209                offset + 0,
1210                _depth
1211            )?;
1212            Ok(())
1213        }
1214    }
1215
1216    impl fidl::encoding::ValueTypeMarker for ControllerPollUdpResponse {
1217        type Borrowed<'a> = &'a Self;
1218        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1219            value
1220        }
1221    }
1222
1223    unsafe impl fidl::encoding::TypeMarker for ControllerPollUdpResponse {
1224        type Owned = Self;
1225
1226        #[inline(always)]
1227        fn inline_align(_context: fidl::encoding::Context) -> usize {
1228            8
1229        }
1230
1231        #[inline(always)]
1232        fn inline_size(_context: fidl::encoding::Context) -> usize {
1233            16
1234        }
1235    }
1236
1237    unsafe impl<D: fidl::encoding::ResourceDialect>
1238        fidl::encoding::Encode<ControllerPollUdpResponse, D> for &ControllerPollUdpResponse
1239    {
1240        #[inline]
1241        unsafe fn encode(
1242            self,
1243            encoder: &mut fidl::encoding::Encoder<'_, D>,
1244            offset: usize,
1245            _depth: fidl::encoding::Depth,
1246        ) -> fidl::Result<()> {
1247            encoder.debug_check_bounds::<ControllerPollUdpResponse>(offset);
1248            // Delegate to tuple encoding.
1249            fidl::encoding::Encode::<ControllerPollUdpResponse, D>::encode(
1250                (<fidl::encoding::Vector<u8, 1024> as fidl::encoding::ValueTypeMarker>::borrow(
1251                    &self.payload,
1252                ),),
1253                encoder,
1254                offset,
1255                _depth,
1256            )
1257        }
1258    }
1259    unsafe impl<
1260            D: fidl::encoding::ResourceDialect,
1261            T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 1024>, D>,
1262        > fidl::encoding::Encode<ControllerPollUdpResponse, D> for (T0,)
1263    {
1264        #[inline]
1265        unsafe fn encode(
1266            self,
1267            encoder: &mut fidl::encoding::Encoder<'_, D>,
1268            offset: usize,
1269            depth: fidl::encoding::Depth,
1270        ) -> fidl::Result<()> {
1271            encoder.debug_check_bounds::<ControllerPollUdpResponse>(offset);
1272            // Zero out padding regions. There's no need to apply masks
1273            // because the unmasked parts will be overwritten by fields.
1274            // Write the fields.
1275            self.0.encode(encoder, offset + 0, depth)?;
1276            Ok(())
1277        }
1278    }
1279
1280    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1281        for ControllerPollUdpResponse
1282    {
1283        #[inline(always)]
1284        fn new_empty() -> Self {
1285            Self { payload: fidl::new_empty!(fidl::encoding::Vector<u8, 1024>, D) }
1286        }
1287
1288        #[inline]
1289        unsafe fn decode(
1290            &mut self,
1291            decoder: &mut fidl::encoding::Decoder<'_, D>,
1292            offset: usize,
1293            _depth: fidl::encoding::Depth,
1294        ) -> fidl::Result<()> {
1295            decoder.debug_check_bounds::<Self>(offset);
1296            // Verify that padding bytes are zero.
1297            fidl::decode!(fidl::encoding::Vector<u8, 1024>, D, &mut self.payload, decoder, offset + 0, _depth)?;
1298            Ok(())
1299        }
1300    }
1301
1302    impl ControllerStartOutOfStackDhcpv4ClientRequest {
1303        #[inline(always)]
1304        fn max_ordinal_present(&self) -> u64 {
1305            if let Some(_) = self.interface_id {
1306                return 1;
1307            }
1308            0
1309        }
1310    }
1311
1312    impl fidl::encoding::ValueTypeMarker for ControllerStartOutOfStackDhcpv4ClientRequest {
1313        type Borrowed<'a> = &'a Self;
1314        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1315            value
1316        }
1317    }
1318
1319    unsafe impl fidl::encoding::TypeMarker for ControllerStartOutOfStackDhcpv4ClientRequest {
1320        type Owned = Self;
1321
1322        #[inline(always)]
1323        fn inline_align(_context: fidl::encoding::Context) -> usize {
1324            8
1325        }
1326
1327        #[inline(always)]
1328        fn inline_size(_context: fidl::encoding::Context) -> usize {
1329            16
1330        }
1331    }
1332
1333    unsafe impl<D: fidl::encoding::ResourceDialect>
1334        fidl::encoding::Encode<ControllerStartOutOfStackDhcpv4ClientRequest, D>
1335        for &ControllerStartOutOfStackDhcpv4ClientRequest
1336    {
1337        unsafe fn encode(
1338            self,
1339            encoder: &mut fidl::encoding::Encoder<'_, D>,
1340            offset: usize,
1341            mut depth: fidl::encoding::Depth,
1342        ) -> fidl::Result<()> {
1343            encoder.debug_check_bounds::<ControllerStartOutOfStackDhcpv4ClientRequest>(offset);
1344            // Vector header
1345            let max_ordinal: u64 = self.max_ordinal_present();
1346            encoder.write_num(max_ordinal, offset);
1347            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1348            // Calling encoder.out_of_line_offset(0) is not allowed.
1349            if max_ordinal == 0 {
1350                return Ok(());
1351            }
1352            depth.increment()?;
1353            let envelope_size = 8;
1354            let bytes_len = max_ordinal as usize * envelope_size;
1355            #[allow(unused_variables)]
1356            let offset = encoder.out_of_line_offset(bytes_len);
1357            let mut _prev_end_offset: usize = 0;
1358            if 1 > max_ordinal {
1359                return Ok(());
1360            }
1361
1362            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1363            // are envelope_size bytes.
1364            let cur_offset: usize = (1 - 1) * envelope_size;
1365
1366            // Zero reserved fields.
1367            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1368
1369            // Safety:
1370            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1371            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1372            //   envelope_size bytes, there is always sufficient room.
1373            fidl::encoding::encode_in_envelope_optional::<u64, D>(
1374                self.interface_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1375                encoder,
1376                offset + cur_offset,
1377                depth,
1378            )?;
1379
1380            _prev_end_offset = cur_offset + envelope_size;
1381
1382            Ok(())
1383        }
1384    }
1385
1386    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1387        for ControllerStartOutOfStackDhcpv4ClientRequest
1388    {
1389        #[inline(always)]
1390        fn new_empty() -> Self {
1391            Self::default()
1392        }
1393
1394        unsafe fn decode(
1395            &mut self,
1396            decoder: &mut fidl::encoding::Decoder<'_, D>,
1397            offset: usize,
1398            mut depth: fidl::encoding::Depth,
1399        ) -> fidl::Result<()> {
1400            decoder.debug_check_bounds::<Self>(offset);
1401            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1402                None => return Err(fidl::Error::NotNullable),
1403                Some(len) => len,
1404            };
1405            // Calling decoder.out_of_line_offset(0) is not allowed.
1406            if len == 0 {
1407                return Ok(());
1408            };
1409            depth.increment()?;
1410            let envelope_size = 8;
1411            let bytes_len = len * envelope_size;
1412            let offset = decoder.out_of_line_offset(bytes_len)?;
1413            // Decode the envelope for each type.
1414            let mut _next_ordinal_to_read = 0;
1415            let mut next_offset = offset;
1416            let end_offset = offset + bytes_len;
1417            _next_ordinal_to_read += 1;
1418            if next_offset >= end_offset {
1419                return Ok(());
1420            }
1421
1422            // Decode unknown envelopes for gaps in ordinals.
1423            while _next_ordinal_to_read < 1 {
1424                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1425                _next_ordinal_to_read += 1;
1426                next_offset += envelope_size;
1427            }
1428
1429            let next_out_of_line = decoder.next_out_of_line();
1430            let handles_before = decoder.remaining_handles();
1431            if let Some((inlined, num_bytes, num_handles)) =
1432                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1433            {
1434                let member_inline_size =
1435                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1436                if inlined != (member_inline_size <= 4) {
1437                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1438                }
1439                let inner_offset;
1440                let mut inner_depth = depth.clone();
1441                if inlined {
1442                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1443                    inner_offset = next_offset;
1444                } else {
1445                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1446                    inner_depth.increment()?;
1447                }
1448                let val_ref = self.interface_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
1449                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
1450                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1451                {
1452                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1453                }
1454                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1455                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1456                }
1457            }
1458
1459            next_offset += envelope_size;
1460
1461            // Decode the remaining unknown envelopes.
1462            while next_offset < end_offset {
1463                _next_ordinal_to_read += 1;
1464                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1465                next_offset += envelope_size;
1466            }
1467
1468            Ok(())
1469        }
1470    }
1471
1472    impl ControllerStopOutOfStackDhcpv4ClientRequest {
1473        #[inline(always)]
1474        fn max_ordinal_present(&self) -> u64 {
1475            if let Some(_) = self.interface_id {
1476                return 1;
1477            }
1478            0
1479        }
1480    }
1481
1482    impl fidl::encoding::ValueTypeMarker for ControllerStopOutOfStackDhcpv4ClientRequest {
1483        type Borrowed<'a> = &'a Self;
1484        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1485            value
1486        }
1487    }
1488
1489    unsafe impl fidl::encoding::TypeMarker for ControllerStopOutOfStackDhcpv4ClientRequest {
1490        type Owned = Self;
1491
1492        #[inline(always)]
1493        fn inline_align(_context: fidl::encoding::Context) -> usize {
1494            8
1495        }
1496
1497        #[inline(always)]
1498        fn inline_size(_context: fidl::encoding::Context) -> usize {
1499            16
1500        }
1501    }
1502
1503    unsafe impl<D: fidl::encoding::ResourceDialect>
1504        fidl::encoding::Encode<ControllerStopOutOfStackDhcpv4ClientRequest, D>
1505        for &ControllerStopOutOfStackDhcpv4ClientRequest
1506    {
1507        unsafe fn encode(
1508            self,
1509            encoder: &mut fidl::encoding::Encoder<'_, D>,
1510            offset: usize,
1511            mut depth: fidl::encoding::Depth,
1512        ) -> fidl::Result<()> {
1513            encoder.debug_check_bounds::<ControllerStopOutOfStackDhcpv4ClientRequest>(offset);
1514            // Vector header
1515            let max_ordinal: u64 = self.max_ordinal_present();
1516            encoder.write_num(max_ordinal, offset);
1517            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1518            // Calling encoder.out_of_line_offset(0) is not allowed.
1519            if max_ordinal == 0 {
1520                return Ok(());
1521            }
1522            depth.increment()?;
1523            let envelope_size = 8;
1524            let bytes_len = max_ordinal as usize * envelope_size;
1525            #[allow(unused_variables)]
1526            let offset = encoder.out_of_line_offset(bytes_len);
1527            let mut _prev_end_offset: usize = 0;
1528            if 1 > max_ordinal {
1529                return Ok(());
1530            }
1531
1532            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1533            // are envelope_size bytes.
1534            let cur_offset: usize = (1 - 1) * envelope_size;
1535
1536            // Zero reserved fields.
1537            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1538
1539            // Safety:
1540            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1541            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1542            //   envelope_size bytes, there is always sufficient room.
1543            fidl::encoding::encode_in_envelope_optional::<u64, D>(
1544                self.interface_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1545                encoder,
1546                offset + cur_offset,
1547                depth,
1548            )?;
1549
1550            _prev_end_offset = cur_offset + envelope_size;
1551
1552            Ok(())
1553        }
1554    }
1555
1556    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1557        for ControllerStopOutOfStackDhcpv4ClientRequest
1558    {
1559        #[inline(always)]
1560        fn new_empty() -> Self {
1561            Self::default()
1562        }
1563
1564        unsafe fn decode(
1565            &mut self,
1566            decoder: &mut fidl::encoding::Decoder<'_, D>,
1567            offset: usize,
1568            mut depth: fidl::encoding::Depth,
1569        ) -> fidl::Result<()> {
1570            decoder.debug_check_bounds::<Self>(offset);
1571            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1572                None => return Err(fidl::Error::NotNullable),
1573                Some(len) => len,
1574            };
1575            // Calling decoder.out_of_line_offset(0) is not allowed.
1576            if len == 0 {
1577                return Ok(());
1578            };
1579            depth.increment()?;
1580            let envelope_size = 8;
1581            let bytes_len = len * envelope_size;
1582            let offset = decoder.out_of_line_offset(bytes_len)?;
1583            // Decode the envelope for each type.
1584            let mut _next_ordinal_to_read = 0;
1585            let mut next_offset = offset;
1586            let end_offset = offset + bytes_len;
1587            _next_ordinal_to_read += 1;
1588            if next_offset >= end_offset {
1589                return Ok(());
1590            }
1591
1592            // Decode unknown envelopes for gaps in ordinals.
1593            while _next_ordinal_to_read < 1 {
1594                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1595                _next_ordinal_to_read += 1;
1596                next_offset += envelope_size;
1597            }
1598
1599            let next_out_of_line = decoder.next_out_of_line();
1600            let handles_before = decoder.remaining_handles();
1601            if let Some((inlined, num_bytes, num_handles)) =
1602                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1603            {
1604                let member_inline_size =
1605                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1606                if inlined != (member_inline_size <= 4) {
1607                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1608                }
1609                let inner_offset;
1610                let mut inner_depth = depth.clone();
1611                if inlined {
1612                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1613                    inner_offset = next_offset;
1614                } else {
1615                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1616                    inner_depth.increment()?;
1617                }
1618                let val_ref = self.interface_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
1619                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
1620                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1621                {
1622                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1623                }
1624                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1625                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1626                }
1627            }
1628
1629            next_offset += envelope_size;
1630
1631            // Decode the remaining unknown envelopes.
1632            while next_offset < end_offset {
1633                _next_ordinal_to_read += 1;
1634                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1635                next_offset += envelope_size;
1636            }
1637
1638            Ok(())
1639        }
1640    }
1641}