fidl_fuchsia_posix_socket_raw__common/
fidl_fuchsia_posix_socket_raw__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
11/// The protocol a raw socket may be associated with.
12pub type Protocol = u8;
13
14pub const SOCKET_PROTOCOL_NAME: &str = "fuchsia.posix.socket.raw/Socket";
15
16#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
17pub struct Empty;
18
19impl fidl::Persistable for Empty {}
20
21/// A filter for ICMPv6 types.
22#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
23#[repr(C)]
24pub struct Icmpv6Filter {
25    /// Indicates whether or not an ICMPv6 type should be blocked.
26    ///
27    /// Each bit index encodes an ICMPv6 type; bit 0 in `blocked_types[0]` holds
28    /// the flag for ICMPv6 type 0 and bit 31 in `blocked_types[7]` holds the
29    /// flag for ICMPv6 type 255.
30    ///
31    /// Equivalent to Linux's `icmp6_filter.icmp6_filt`.
32    pub blocked_types: [u32; 8],
33}
34
35impl fidl::Persistable for Icmpv6Filter {}
36
37#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
38pub struct ProviderSocketRequest {
39    pub domain: fidl_fuchsia_posix_socket__common::Domain,
40    pub proto: ProtocolAssociation,
41}
42
43impl fidl::Persistable for ProviderSocketRequest {}
44
45#[derive(Clone, Debug, PartialEq)]
46pub struct ProviderSocketWithOptionsRequest {
47    pub domain: fidl_fuchsia_posix_socket__common::Domain,
48    pub proto: ProtocolAssociation,
49    pub opts: fidl_fuchsia_posix_socket__common::SocketCreationOptions,
50}
51
52impl fidl::Persistable for ProviderSocketWithOptionsRequest {}
53
54#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
55pub struct SocketRecvMsgRequest {
56    pub want_addr: bool,
57    pub data_len: u32,
58    pub want_control: bool,
59    pub flags: fidl_fuchsia_posix_socket__common::RecvMsgFlags,
60}
61
62impl fidl::Persistable for SocketRecvMsgRequest {}
63
64#[derive(Clone, Debug, PartialEq)]
65pub struct SocketSendMsgRequest {
66    pub addr: Option<Box<fidl_fuchsia_net__common::SocketAddress>>,
67    pub data: Vec<u8>,
68    pub control: fidl_fuchsia_posix_socket__common::NetworkSocketSendControlData,
69    pub flags: fidl_fuchsia_posix_socket__common::SendMsgFlags,
70}
71
72impl fidl::Persistable for SocketSendMsgRequest {}
73
74#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
75#[repr(C)]
76pub struct SocketSetIcmpv6FilterRequest {
77    pub filter: Icmpv6Filter,
78}
79
80impl fidl::Persistable for SocketSetIcmpv6FilterRequest {}
81
82#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
83pub struct SocketSetIpHeaderIncludedRequest {
84    pub value: bool,
85}
86
87impl fidl::Persistable for SocketSetIpHeaderIncludedRequest {}
88
89#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
90pub struct SocketSetIpv6ChecksumRequest {
91    pub config: Ipv6ChecksumConfiguration,
92}
93
94impl fidl::Persistable for SocketSetIpv6ChecksumRequest {}
95
96#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
97#[repr(C)]
98pub struct SocketGetIcmpv6FilterResponse {
99    pub filter: Icmpv6Filter,
100}
101
102impl fidl::Persistable for SocketGetIcmpv6FilterResponse {}
103
104#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
105pub struct SocketGetInfoResponse {
106    pub domain: fidl_fuchsia_posix_socket__common::Domain,
107    pub proto: ProtocolAssociation,
108}
109
110impl fidl::Persistable for SocketGetInfoResponse {}
111
112#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
113pub struct SocketGetIpHeaderIncludedResponse {
114    pub value: bool,
115}
116
117impl fidl::Persistable for SocketGetIpHeaderIncludedResponse {}
118
119#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
120pub struct SocketGetIpv6ChecksumResponse {
121    pub config: Ipv6ChecksumConfiguration,
122}
123
124impl fidl::Persistable for SocketGetIpv6ChecksumResponse {}
125
126#[derive(Clone, Debug, PartialEq)]
127pub struct SocketRecvMsgResponse {
128    pub addr: Option<Box<fidl_fuchsia_net__common::SocketAddress>>,
129    pub data: Vec<u8>,
130    pub control: fidl_fuchsia_posix_socket__common::NetworkSocketRecvControlData,
131    pub truncated: u32,
132}
133
134impl fidl::Persistable for SocketRecvMsgResponse {}
135
136/// IPv6 socket checksum configuration.
137#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
138pub enum Ipv6ChecksumConfiguration {
139    /// Indicates that the stack should not calculate checksums for outgoing
140    /// packets and valiate checksums for incoming packets.
141    Disabled(Empty),
142    /// Indicates that the stack should calculate checksums for outgoing packets
143    /// and validate checksums for incoming packets.
144    ///
145    /// `offset` indicates where the checksum is found in the IPv6 packet's
146    /// payload.
147    ///
148    /// The offset must be aligned to the size of an internet checksum as
149    /// specified in RFC 1071. That is, the offset must be 2-byte aligned.
150    Offset(i32),
151}
152
153impl Ipv6ChecksumConfiguration {
154    #[inline]
155    pub fn ordinal(&self) -> u64 {
156        match *self {
157            Self::Disabled(_) => 1,
158            Self::Offset(_) => 2,
159        }
160    }
161}
162
163impl fidl::Persistable for Ipv6ChecksumConfiguration {}
164
165/// The protocol a raw socket is associated with.
166#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
167pub enum ProtocolAssociation {
168    /// Indicates no association with any protocol.
169    ///
170    /// The socket will not receive packets. Sent packets must include the
171    /// network header.
172    Unassociated(Empty),
173    /// The associated protocol.
174    ///
175    /// The socket may only send and receive network packets for the associated
176    /// protocol.
177    Associated(u8),
178}
179
180impl ProtocolAssociation {
181    #[inline]
182    pub fn ordinal(&self) -> u64 {
183        match *self {
184            Self::Unassociated(_) => 1,
185            Self::Associated(_) => 2,
186        }
187    }
188}
189
190impl fidl::Persistable for ProtocolAssociation {}
191
192pub mod provider_ordinals {
193    pub const SOCKET: u64 = 0xdfa6a591ab48fd1;
194    pub const SOCKET_WITH_OPTIONS: u64 = 0x34cd6e7e82c46f85;
195}
196
197pub mod socket_ordinals {
198    pub const CLONE: u64 = 0x20d8a7aba2168a79;
199    pub const CLOSE: u64 = 0x5ac5d459ad7f657e;
200    pub const QUERY: u64 = 0x2658edee9decfc06;
201    pub const SET_REUSE_ADDRESS: u64 = 0x1fd74ee8b9a4a876;
202    pub const GET_REUSE_ADDRESS: u64 = 0x67b7206b8d1bc0a5;
203    pub const GET_ERROR: u64 = 0x5aad39b33e5f6ebb;
204    pub const SET_BROADCAST: u64 = 0x6023e081ce3cd947;
205    pub const GET_BROADCAST: u64 = 0x68796fc556f9780d;
206    pub const SET_SEND_BUFFER: u64 = 0x756eac32d73a7a70;
207    pub const GET_SEND_BUFFER: u64 = 0x78a52fd9c7b2410b;
208    pub const SET_RECEIVE_BUFFER: u64 = 0x6b0cf2f1919c7001;
209    pub const GET_RECEIVE_BUFFER: u64 = 0x14c1a4b64f709e5c;
210    pub const SET_KEEP_ALIVE: u64 = 0x572df8f0b920d2c7;
211    pub const GET_KEEP_ALIVE: u64 = 0x2dd29d3215f2c9d2;
212    pub const SET_OUT_OF_BAND_INLINE: u64 = 0x3ecb49968bee439;
213    pub const GET_OUT_OF_BAND_INLINE: u64 = 0x348c1ab3aeca1745;
214    pub const SET_NO_CHECK: u64 = 0x6bbf00c53a4c78c2;
215    pub const GET_NO_CHECK: u64 = 0x2cd4249286417694;
216    pub const SET_LINGER: u64 = 0x45386351246e998e;
217    pub const GET_LINGER: u64 = 0x48eb20fc5ccb0e45;
218    pub const SET_REUSE_PORT: u64 = 0x24dd3e5cb36d9ccb;
219    pub const GET_REUSE_PORT: u64 = 0x7a112c1ab54ff828;
220    pub const GET_ACCEPT_CONN: u64 = 0x67ce6db6c2ec8966;
221    pub const SET_BIND_TO_DEVICE: u64 = 0x2118b483f28aafc4;
222    pub const GET_BIND_TO_DEVICE: u64 = 0x1ab1fbf0ef7906c8;
223    pub const SET_BIND_TO_INTERFACE_INDEX: u64 = 0x6e387a0def00821;
224    pub const GET_BIND_TO_INTERFACE_INDEX: u64 = 0x59c31dd3e3078295;
225    pub const SET_TIMESTAMP: u64 = 0x285d6516c263d839;
226    pub const GET_TIMESTAMP: u64 = 0x49f2fffbbcc2bd27;
227    pub const SET_MARK: u64 = 0x6ead6de09f653236;
228    pub const GET_MARK: u64 = 0x57a2752c61d93d47;
229    pub const GET_COOKIE: u64 = 0x2c2f47fd8f924e52;
230    pub const BIND: u64 = 0x4bc6400ae92125d;
231    pub const CONNECT: u64 = 0x5f05f19bfdd38871;
232    pub const DISCONNECT: u64 = 0x74e63b91f7b29b2;
233    pub const GET_SOCK_NAME: u64 = 0x475f23f84a1a4f85;
234    pub const GET_PEER_NAME: u64 = 0x1ffecf4bd5b6432e;
235    pub const SHUTDOWN: u64 = 0x247f38b6db68c336;
236    pub const SET_IP_TYPE_OF_SERVICE: u64 = 0x995c600475b6d46;
237    pub const GET_IP_TYPE_OF_SERVICE: u64 = 0x3814a04259f75fcb;
238    pub const SET_IP_TTL: u64 = 0x29e2424b433ae1ef;
239    pub const GET_IP_TTL: u64 = 0x47e47fa1f24da471;
240    pub const SET_IP_PACKET_INFO: u64 = 0x392d16bee20c0e16;
241    pub const GET_IP_PACKET_INFO: u64 = 0x54b505f242280740;
242    pub const SET_IP_RECEIVE_TYPE_OF_SERVICE: u64 = 0x6c4f6714995f84ef;
243    pub const GET_IP_RECEIVE_TYPE_OF_SERVICE: u64 = 0x4158ba7dc2795960;
244    pub const SET_IP_RECEIVE_TTL: u64 = 0x46f15be0ce0ab82b;
245    pub const GET_IP_RECEIVE_TTL: u64 = 0x678ddd5a5dfa2eb5;
246    pub const SET_IP_MULTICAST_INTERFACE: u64 = 0x752fbfa9b12befe;
247    pub const GET_IP_MULTICAST_INTERFACE: u64 = 0x320bd14c4df046c4;
248    pub const SET_IP_MULTICAST_TTL: u64 = 0x63134d53772916a1;
249    pub const GET_IP_MULTICAST_TTL: u64 = 0x4665cd378f39e1a;
250    pub const SET_IP_MULTICAST_LOOPBACK: u64 = 0x20c55c11f00943ea;
251    pub const GET_IP_MULTICAST_LOOPBACK: u64 = 0x3b6b26ff558298f2;
252    pub const ADD_IP_MEMBERSHIP: u64 = 0x76bc7df115a3b4d0;
253    pub const DROP_IP_MEMBERSHIP: u64 = 0x2888f3099188d03;
254    pub const SET_IP_TRANSPARENT: u64 = 0x1ae532b0c066e3a0;
255    pub const GET_IP_TRANSPARENT: u64 = 0x51d43695962ebfb5;
256    pub const SET_IP_RECEIVE_ORIGINAL_DESTINATION_ADDRESS: u64 = 0x4722b4ce52f7840;
257    pub const GET_IP_RECEIVE_ORIGINAL_DESTINATION_ADDRESS: u64 = 0x2a0e7dc5d6bfdfe9;
258    pub const ADD_IPV6_MEMBERSHIP: u64 = 0x7c94727acb4ea4b3;
259    pub const DROP_IPV6_MEMBERSHIP: u64 = 0x42104c70ccaba304;
260    pub const SET_IPV6_MULTICAST_INTERFACE: u64 = 0x135f76db3774ab3b;
261    pub const GET_IPV6_MULTICAST_INTERFACE: u64 = 0x1f26fcdd348f1882;
262    pub const SET_IPV6_UNICAST_HOPS: u64 = 0x157d51e98f462859;
263    pub const GET_IPV6_UNICAST_HOPS: u64 = 0x21f4641cad8bd8d2;
264    pub const SET_IPV6_RECEIVE_HOP_LIMIT: u64 = 0x5c24808ed2e84a1e;
265    pub const GET_IPV6_RECEIVE_HOP_LIMIT: u64 = 0x341e06689885b4c0;
266    pub const SET_IPV6_MULTICAST_HOPS: u64 = 0x25b9cd4d181f82c1;
267    pub const GET_IPV6_MULTICAST_HOPS: u64 = 0x52916948a365012a;
268    pub const SET_IPV6_MULTICAST_LOOPBACK: u64 = 0x55701c409ff41b40;
269    pub const GET_IPV6_MULTICAST_LOOPBACK: u64 = 0x4415b701fde319c3;
270    pub const SET_IPV6_ONLY: u64 = 0x4873f1364758cbba;
271    pub const GET_IPV6_ONLY: u64 = 0x4aa3340a1a26b89c;
272    pub const SET_IPV6_RECEIVE_TRAFFIC_CLASS: u64 = 0x58f07c8788d099a0;
273    pub const GET_IPV6_RECEIVE_TRAFFIC_CLASS: u64 = 0x2e334df1da553ffa;
274    pub const SET_IPV6_TRAFFIC_CLASS: u64 = 0x6af077800c5a0b4f;
275    pub const GET_IPV6_TRAFFIC_CLASS: u64 = 0x6baf6eed8fc2f04;
276    pub const SET_IPV6_RECEIVE_PACKET_INFO: u64 = 0x19259775b1a92768;
277    pub const GET_IPV6_RECEIVE_PACKET_INFO: u64 = 0x7acd4a2775baec75;
278    pub const GET_ORIGINAL_DESTINATION: u64 = 0x38bf28f0dafdbac0;
279    pub const DESCRIBE: u64 = 0x335706eccf54a135;
280    pub const RECV_MSG: u64 = 0x1dfb695351d3aa1d;
281    pub const SEND_MSG: u64 = 0x2cf1eac9a7fc8958;
282    pub const GET_INFO: u64 = 0x39676f75aec339ba;
283    pub const SET_IP_HEADER_INCLUDED: u64 = 0x5d06a606d95e8f3;
284    pub const GET_IP_HEADER_INCLUDED: u64 = 0x76125ad1f4d175f6;
285    pub const SET_ICMPV6_FILTER: u64 = 0x4ebea92a43ae68a9;
286    pub const GET_ICMPV6_FILTER: u64 = 0x43bd4f3bc0970ace;
287    pub const SET_IPV6_CHECKSUM: u64 = 0x18b7809577199cb4;
288    pub const GET_IPV6_CHECKSUM: u64 = 0x1847bf5b2d263dd;
289}
290
291mod internal {
292    use super::*;
293
294    impl fidl::encoding::ValueTypeMarker for Empty {
295        type Borrowed<'a> = &'a Self;
296        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
297            value
298        }
299    }
300
301    unsafe impl fidl::encoding::TypeMarker for Empty {
302        type Owned = Self;
303
304        #[inline(always)]
305        fn inline_align(_context: fidl::encoding::Context) -> usize {
306            1
307        }
308
309        #[inline(always)]
310        fn inline_size(_context: fidl::encoding::Context) -> usize {
311            1
312        }
313    }
314
315    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Empty, D> for &Empty {
316        #[inline]
317        unsafe fn encode(
318            self,
319            encoder: &mut fidl::encoding::Encoder<'_, D>,
320            offset: usize,
321            _depth: fidl::encoding::Depth,
322        ) -> fidl::Result<()> {
323            encoder.debug_check_bounds::<Empty>(offset);
324            encoder.write_num(0u8, offset);
325            Ok(())
326        }
327    }
328
329    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Empty {
330        #[inline(always)]
331        fn new_empty() -> Self {
332            Self
333        }
334
335        #[inline]
336        unsafe fn decode(
337            &mut self,
338            decoder: &mut fidl::encoding::Decoder<'_, D>,
339            offset: usize,
340            _depth: fidl::encoding::Depth,
341        ) -> fidl::Result<()> {
342            decoder.debug_check_bounds::<Self>(offset);
343            match decoder.read_num::<u8>(offset) {
344                0 => Ok(()),
345                _ => Err(fidl::Error::Invalid),
346            }
347        }
348    }
349
350    impl fidl::encoding::ValueTypeMarker for Icmpv6Filter {
351        type Borrowed<'a> = &'a Self;
352        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
353            value
354        }
355    }
356
357    unsafe impl fidl::encoding::TypeMarker for Icmpv6Filter {
358        type Owned = Self;
359
360        #[inline(always)]
361        fn inline_align(_context: fidl::encoding::Context) -> usize {
362            4
363        }
364
365        #[inline(always)]
366        fn inline_size(_context: fidl::encoding::Context) -> usize {
367            32
368        }
369        #[inline(always)]
370        fn encode_is_copy() -> bool {
371            true
372        }
373
374        #[inline(always)]
375        fn decode_is_copy() -> bool {
376            true
377        }
378    }
379
380    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Icmpv6Filter, D>
381        for &Icmpv6Filter
382    {
383        #[inline]
384        unsafe fn encode(
385            self,
386            encoder: &mut fidl::encoding::Encoder<'_, D>,
387            offset: usize,
388            _depth: fidl::encoding::Depth,
389        ) -> fidl::Result<()> {
390            encoder.debug_check_bounds::<Icmpv6Filter>(offset);
391            unsafe {
392                // Copy the object into the buffer.
393                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
394                (buf_ptr as *mut Icmpv6Filter)
395                    .write_unaligned((self as *const Icmpv6Filter).read());
396                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
397                // done second because the memcpy will write garbage to these bytes.
398            }
399            Ok(())
400        }
401    }
402    unsafe impl<
403            D: fidl::encoding::ResourceDialect,
404            T0: fidl::encoding::Encode<fidl::encoding::Array<u32, 8>, D>,
405        > fidl::encoding::Encode<Icmpv6Filter, D> for (T0,)
406    {
407        #[inline]
408        unsafe fn encode(
409            self,
410            encoder: &mut fidl::encoding::Encoder<'_, D>,
411            offset: usize,
412            depth: fidl::encoding::Depth,
413        ) -> fidl::Result<()> {
414            encoder.debug_check_bounds::<Icmpv6Filter>(offset);
415            // Zero out padding regions. There's no need to apply masks
416            // because the unmasked parts will be overwritten by fields.
417            // Write the fields.
418            self.0.encode(encoder, offset + 0, depth)?;
419            Ok(())
420        }
421    }
422
423    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Icmpv6Filter {
424        #[inline(always)]
425        fn new_empty() -> Self {
426            Self { blocked_types: fidl::new_empty!(fidl::encoding::Array<u32, 8>, D) }
427        }
428
429        #[inline]
430        unsafe fn decode(
431            &mut self,
432            decoder: &mut fidl::encoding::Decoder<'_, D>,
433            offset: usize,
434            _depth: fidl::encoding::Depth,
435        ) -> fidl::Result<()> {
436            decoder.debug_check_bounds::<Self>(offset);
437            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
438            // Verify that padding bytes are zero.
439            // Copy from the buffer into the object.
440            unsafe {
441                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 32);
442            }
443            Ok(())
444        }
445    }
446
447    impl fidl::encoding::ValueTypeMarker for ProviderSocketRequest {
448        type Borrowed<'a> = &'a Self;
449        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
450            value
451        }
452    }
453
454    unsafe impl fidl::encoding::TypeMarker for ProviderSocketRequest {
455        type Owned = Self;
456
457        #[inline(always)]
458        fn inline_align(_context: fidl::encoding::Context) -> usize {
459            8
460        }
461
462        #[inline(always)]
463        fn inline_size(_context: fidl::encoding::Context) -> usize {
464            24
465        }
466    }
467
468    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ProviderSocketRequest, D>
469        for &ProviderSocketRequest
470    {
471        #[inline]
472        unsafe fn encode(
473            self,
474            encoder: &mut fidl::encoding::Encoder<'_, D>,
475            offset: usize,
476            _depth: fidl::encoding::Depth,
477        ) -> fidl::Result<()> {
478            encoder.debug_check_bounds::<ProviderSocketRequest>(offset);
479            // Delegate to tuple encoding.
480            fidl::encoding::Encode::<ProviderSocketRequest, D>::encode(
481                (
482                    <fidl_fuchsia_posix_socket__common::Domain as fidl::encoding::ValueTypeMarker>::borrow(&self.domain),
483                    <ProtocolAssociation as fidl::encoding::ValueTypeMarker>::borrow(&self.proto),
484                ),
485                encoder, offset, _depth
486            )
487        }
488    }
489    unsafe impl<
490            D: fidl::encoding::ResourceDialect,
491            T0: fidl::encoding::Encode<fidl_fuchsia_posix_socket__common::Domain, D>,
492            T1: fidl::encoding::Encode<ProtocolAssociation, D>,
493        > fidl::encoding::Encode<ProviderSocketRequest, D> for (T0, T1)
494    {
495        #[inline]
496        unsafe fn encode(
497            self,
498            encoder: &mut fidl::encoding::Encoder<'_, D>,
499            offset: usize,
500            depth: fidl::encoding::Depth,
501        ) -> fidl::Result<()> {
502            encoder.debug_check_bounds::<ProviderSocketRequest>(offset);
503            // Zero out padding regions. There's no need to apply masks
504            // because the unmasked parts will be overwritten by fields.
505            unsafe {
506                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
507                (ptr as *mut u64).write_unaligned(0);
508            }
509            // Write the fields.
510            self.0.encode(encoder, offset + 0, depth)?;
511            self.1.encode(encoder, offset + 8, depth)?;
512            Ok(())
513        }
514    }
515
516    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ProviderSocketRequest {
517        #[inline(always)]
518        fn new_empty() -> Self {
519            Self {
520                domain: fidl::new_empty!(fidl_fuchsia_posix_socket__common::Domain, D),
521                proto: fidl::new_empty!(ProtocolAssociation, D),
522            }
523        }
524
525        #[inline]
526        unsafe fn decode(
527            &mut self,
528            decoder: &mut fidl::encoding::Decoder<'_, D>,
529            offset: usize,
530            _depth: fidl::encoding::Depth,
531        ) -> fidl::Result<()> {
532            decoder.debug_check_bounds::<Self>(offset);
533            // Verify that padding bytes are zero.
534            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
535            let padval = unsafe { (ptr as *const u64).read_unaligned() };
536            let mask = 0xffffffffffff0000u64;
537            let maskedval = padval & mask;
538            if maskedval != 0 {
539                return Err(fidl::Error::NonZeroPadding {
540                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
541                });
542            }
543            fidl::decode!(
544                fidl_fuchsia_posix_socket__common::Domain,
545                D,
546                &mut self.domain,
547                decoder,
548                offset + 0,
549                _depth
550            )?;
551            fidl::decode!(ProtocolAssociation, D, &mut self.proto, decoder, offset + 8, _depth)?;
552            Ok(())
553        }
554    }
555
556    impl fidl::encoding::ValueTypeMarker for ProviderSocketWithOptionsRequest {
557        type Borrowed<'a> = &'a Self;
558        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
559            value
560        }
561    }
562
563    unsafe impl fidl::encoding::TypeMarker for ProviderSocketWithOptionsRequest {
564        type Owned = Self;
565
566        #[inline(always)]
567        fn inline_align(_context: fidl::encoding::Context) -> usize {
568            8
569        }
570
571        #[inline(always)]
572        fn inline_size(_context: fidl::encoding::Context) -> usize {
573            40
574        }
575    }
576
577    unsafe impl<D: fidl::encoding::ResourceDialect>
578        fidl::encoding::Encode<ProviderSocketWithOptionsRequest, D>
579        for &ProviderSocketWithOptionsRequest
580    {
581        #[inline]
582        unsafe fn encode(
583            self,
584            encoder: &mut fidl::encoding::Encoder<'_, D>,
585            offset: usize,
586            _depth: fidl::encoding::Depth,
587        ) -> fidl::Result<()> {
588            encoder.debug_check_bounds::<ProviderSocketWithOptionsRequest>(offset);
589            // Delegate to tuple encoding.
590            fidl::encoding::Encode::<ProviderSocketWithOptionsRequest, D>::encode(
591                (
592                    <fidl_fuchsia_posix_socket__common::Domain as fidl::encoding::ValueTypeMarker>::borrow(&self.domain),
593                    <ProtocolAssociation as fidl::encoding::ValueTypeMarker>::borrow(&self.proto),
594                    <fidl_fuchsia_posix_socket__common::SocketCreationOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.opts),
595                ),
596                encoder, offset, _depth
597            )
598        }
599    }
600    unsafe impl<
601            D: fidl::encoding::ResourceDialect,
602            T0: fidl::encoding::Encode<fidl_fuchsia_posix_socket__common::Domain, D>,
603            T1: fidl::encoding::Encode<ProtocolAssociation, D>,
604            T2: fidl::encoding::Encode<fidl_fuchsia_posix_socket__common::SocketCreationOptions, D>,
605        > fidl::encoding::Encode<ProviderSocketWithOptionsRequest, D> for (T0, T1, T2)
606    {
607        #[inline]
608        unsafe fn encode(
609            self,
610            encoder: &mut fidl::encoding::Encoder<'_, D>,
611            offset: usize,
612            depth: fidl::encoding::Depth,
613        ) -> fidl::Result<()> {
614            encoder.debug_check_bounds::<ProviderSocketWithOptionsRequest>(offset);
615            // Zero out padding regions. There's no need to apply masks
616            // because the unmasked parts will be overwritten by fields.
617            unsafe {
618                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
619                (ptr as *mut u64).write_unaligned(0);
620            }
621            // Write the fields.
622            self.0.encode(encoder, offset + 0, depth)?;
623            self.1.encode(encoder, offset + 8, depth)?;
624            self.2.encode(encoder, offset + 24, depth)?;
625            Ok(())
626        }
627    }
628
629    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
630        for ProviderSocketWithOptionsRequest
631    {
632        #[inline(always)]
633        fn new_empty() -> Self {
634            Self {
635                domain: fidl::new_empty!(fidl_fuchsia_posix_socket__common::Domain, D),
636                proto: fidl::new_empty!(ProtocolAssociation, D),
637                opts: fidl::new_empty!(fidl_fuchsia_posix_socket__common::SocketCreationOptions, D),
638            }
639        }
640
641        #[inline]
642        unsafe fn decode(
643            &mut self,
644            decoder: &mut fidl::encoding::Decoder<'_, D>,
645            offset: usize,
646            _depth: fidl::encoding::Depth,
647        ) -> fidl::Result<()> {
648            decoder.debug_check_bounds::<Self>(offset);
649            // Verify that padding bytes are zero.
650            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
651            let padval = unsafe { (ptr as *const u64).read_unaligned() };
652            let mask = 0xffffffffffff0000u64;
653            let maskedval = padval & mask;
654            if maskedval != 0 {
655                return Err(fidl::Error::NonZeroPadding {
656                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
657                });
658            }
659            fidl::decode!(
660                fidl_fuchsia_posix_socket__common::Domain,
661                D,
662                &mut self.domain,
663                decoder,
664                offset + 0,
665                _depth
666            )?;
667            fidl::decode!(ProtocolAssociation, D, &mut self.proto, decoder, offset + 8, _depth)?;
668            fidl::decode!(
669                fidl_fuchsia_posix_socket__common::SocketCreationOptions,
670                D,
671                &mut self.opts,
672                decoder,
673                offset + 24,
674                _depth
675            )?;
676            Ok(())
677        }
678    }
679
680    impl fidl::encoding::ValueTypeMarker for SocketRecvMsgRequest {
681        type Borrowed<'a> = &'a Self;
682        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
683            value
684        }
685    }
686
687    unsafe impl fidl::encoding::TypeMarker for SocketRecvMsgRequest {
688        type Owned = Self;
689
690        #[inline(always)]
691        fn inline_align(_context: fidl::encoding::Context) -> usize {
692            4
693        }
694
695        #[inline(always)]
696        fn inline_size(_context: fidl::encoding::Context) -> usize {
697            12
698        }
699    }
700
701    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SocketRecvMsgRequest, D>
702        for &SocketRecvMsgRequest
703    {
704        #[inline]
705        unsafe fn encode(
706            self,
707            encoder: &mut fidl::encoding::Encoder<'_, D>,
708            offset: usize,
709            _depth: fidl::encoding::Depth,
710        ) -> fidl::Result<()> {
711            encoder.debug_check_bounds::<SocketRecvMsgRequest>(offset);
712            // Delegate to tuple encoding.
713            fidl::encoding::Encode::<SocketRecvMsgRequest, D>::encode(
714                (
715                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.want_addr),
716                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.data_len),
717                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.want_control),
718                    <fidl_fuchsia_posix_socket__common::RecvMsgFlags as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),
719                ),
720                encoder, offset, _depth
721            )
722        }
723    }
724    unsafe impl<
725            D: fidl::encoding::ResourceDialect,
726            T0: fidl::encoding::Encode<bool, D>,
727            T1: fidl::encoding::Encode<u32, D>,
728            T2: fidl::encoding::Encode<bool, D>,
729            T3: fidl::encoding::Encode<fidl_fuchsia_posix_socket__common::RecvMsgFlags, D>,
730        > fidl::encoding::Encode<SocketRecvMsgRequest, D> for (T0, T1, T2, T3)
731    {
732        #[inline]
733        unsafe fn encode(
734            self,
735            encoder: &mut fidl::encoding::Encoder<'_, D>,
736            offset: usize,
737            depth: fidl::encoding::Depth,
738        ) -> fidl::Result<()> {
739            encoder.debug_check_bounds::<SocketRecvMsgRequest>(offset);
740            // Zero out padding regions. There's no need to apply masks
741            // because the unmasked parts will be overwritten by fields.
742            unsafe {
743                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
744                (ptr as *mut u32).write_unaligned(0);
745            }
746            unsafe {
747                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
748                (ptr as *mut u32).write_unaligned(0);
749            }
750            // Write the fields.
751            self.0.encode(encoder, offset + 0, depth)?;
752            self.1.encode(encoder, offset + 4, depth)?;
753            self.2.encode(encoder, offset + 8, depth)?;
754            self.3.encode(encoder, offset + 10, depth)?;
755            Ok(())
756        }
757    }
758
759    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketRecvMsgRequest {
760        #[inline(always)]
761        fn new_empty() -> Self {
762            Self {
763                want_addr: fidl::new_empty!(bool, D),
764                data_len: fidl::new_empty!(u32, D),
765                want_control: fidl::new_empty!(bool, D),
766                flags: fidl::new_empty!(fidl_fuchsia_posix_socket__common::RecvMsgFlags, D),
767            }
768        }
769
770        #[inline]
771        unsafe fn decode(
772            &mut self,
773            decoder: &mut fidl::encoding::Decoder<'_, D>,
774            offset: usize,
775            _depth: fidl::encoding::Depth,
776        ) -> fidl::Result<()> {
777            decoder.debug_check_bounds::<Self>(offset);
778            // Verify that padding bytes are zero.
779            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
780            let padval = unsafe { (ptr as *const u32).read_unaligned() };
781            let mask = 0xffffff00u32;
782            let maskedval = padval & mask;
783            if maskedval != 0 {
784                return Err(fidl::Error::NonZeroPadding {
785                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
786                });
787            }
788            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
789            let padval = unsafe { (ptr as *const u32).read_unaligned() };
790            let mask = 0xff00u32;
791            let maskedval = padval & mask;
792            if maskedval != 0 {
793                return Err(fidl::Error::NonZeroPadding {
794                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
795                });
796            }
797            fidl::decode!(bool, D, &mut self.want_addr, decoder, offset + 0, _depth)?;
798            fidl::decode!(u32, D, &mut self.data_len, decoder, offset + 4, _depth)?;
799            fidl::decode!(bool, D, &mut self.want_control, decoder, offset + 8, _depth)?;
800            fidl::decode!(
801                fidl_fuchsia_posix_socket__common::RecvMsgFlags,
802                D,
803                &mut self.flags,
804                decoder,
805                offset + 10,
806                _depth
807            )?;
808            Ok(())
809        }
810    }
811
812    impl fidl::encoding::ValueTypeMarker for SocketSendMsgRequest {
813        type Borrowed<'a> = &'a Self;
814        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
815            value
816        }
817    }
818
819    unsafe impl fidl::encoding::TypeMarker for SocketSendMsgRequest {
820        type Owned = Self;
821
822        #[inline(always)]
823        fn inline_align(_context: fidl::encoding::Context) -> usize {
824            8
825        }
826
827        #[inline(always)]
828        fn inline_size(_context: fidl::encoding::Context) -> usize {
829            56
830        }
831    }
832
833    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SocketSendMsgRequest, D>
834        for &SocketSendMsgRequest
835    {
836        #[inline]
837        unsafe fn encode(
838            self,
839            encoder: &mut fidl::encoding::Encoder<'_, D>,
840            offset: usize,
841            _depth: fidl::encoding::Depth,
842        ) -> fidl::Result<()> {
843            encoder.debug_check_bounds::<SocketSendMsgRequest>(offset);
844            // Delegate to tuple encoding.
845            fidl::encoding::Encode::<SocketSendMsgRequest, D>::encode(
846                (
847                    <fidl::encoding::OptionalUnion<fidl_fuchsia_net__common::SocketAddress> as fidl::encoding::ValueTypeMarker>::borrow(&self.addr),
848                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
849                    <fidl_fuchsia_posix_socket__common::NetworkSocketSendControlData as fidl::encoding::ValueTypeMarker>::borrow(&self.control),
850                    <fidl_fuchsia_posix_socket__common::SendMsgFlags as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),
851                ),
852                encoder, offset, _depth
853            )
854        }
855    }
856    unsafe impl<
857            D: fidl::encoding::ResourceDialect,
858            T0: fidl::encoding::Encode<
859                fidl::encoding::OptionalUnion<fidl_fuchsia_net__common::SocketAddress>,
860                D,
861            >,
862            T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
863            T2: fidl::encoding::Encode<
864                fidl_fuchsia_posix_socket__common::NetworkSocketSendControlData,
865                D,
866            >,
867            T3: fidl::encoding::Encode<fidl_fuchsia_posix_socket__common::SendMsgFlags, D>,
868        > fidl::encoding::Encode<SocketSendMsgRequest, D> for (T0, T1, T2, T3)
869    {
870        #[inline]
871        unsafe fn encode(
872            self,
873            encoder: &mut fidl::encoding::Encoder<'_, D>,
874            offset: usize,
875            depth: fidl::encoding::Depth,
876        ) -> fidl::Result<()> {
877            encoder.debug_check_bounds::<SocketSendMsgRequest>(offset);
878            // Zero out padding regions. There's no need to apply masks
879            // because the unmasked parts will be overwritten by fields.
880            unsafe {
881                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
882                (ptr as *mut u64).write_unaligned(0);
883            }
884            // Write the fields.
885            self.0.encode(encoder, offset + 0, depth)?;
886            self.1.encode(encoder, offset + 16, depth)?;
887            self.2.encode(encoder, offset + 32, depth)?;
888            self.3.encode(encoder, offset + 48, depth)?;
889            Ok(())
890        }
891    }
892
893    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketSendMsgRequest {
894        #[inline(always)]
895        fn new_empty() -> Self {
896            Self {
897                addr: fidl::new_empty!(
898                    fidl::encoding::OptionalUnion<fidl_fuchsia_net__common::SocketAddress>,
899                    D
900                ),
901                data: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
902                control: fidl::new_empty!(
903                    fidl_fuchsia_posix_socket__common::NetworkSocketSendControlData,
904                    D
905                ),
906                flags: fidl::new_empty!(fidl_fuchsia_posix_socket__common::SendMsgFlags, D),
907            }
908        }
909
910        #[inline]
911        unsafe fn decode(
912            &mut self,
913            decoder: &mut fidl::encoding::Decoder<'_, D>,
914            offset: usize,
915            _depth: fidl::encoding::Depth,
916        ) -> fidl::Result<()> {
917            decoder.debug_check_bounds::<Self>(offset);
918            // Verify that padding bytes are zero.
919            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
920            let padval = unsafe { (ptr as *const u64).read_unaligned() };
921            let mask = 0xffffffffffff0000u64;
922            let maskedval = padval & mask;
923            if maskedval != 0 {
924                return Err(fidl::Error::NonZeroPadding {
925                    padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
926                });
927            }
928            fidl::decode!(
929                fidl::encoding::OptionalUnion<fidl_fuchsia_net__common::SocketAddress>,
930                D,
931                &mut self.addr,
932                decoder,
933                offset + 0,
934                _depth
935            )?;
936            fidl::decode!(
937                fidl::encoding::UnboundedVector<u8>,
938                D,
939                &mut self.data,
940                decoder,
941                offset + 16,
942                _depth
943            )?;
944            fidl::decode!(
945                fidl_fuchsia_posix_socket__common::NetworkSocketSendControlData,
946                D,
947                &mut self.control,
948                decoder,
949                offset + 32,
950                _depth
951            )?;
952            fidl::decode!(
953                fidl_fuchsia_posix_socket__common::SendMsgFlags,
954                D,
955                &mut self.flags,
956                decoder,
957                offset + 48,
958                _depth
959            )?;
960            Ok(())
961        }
962    }
963
964    impl fidl::encoding::ValueTypeMarker for SocketSetIcmpv6FilterRequest {
965        type Borrowed<'a> = &'a Self;
966        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
967            value
968        }
969    }
970
971    unsafe impl fidl::encoding::TypeMarker for SocketSetIcmpv6FilterRequest {
972        type Owned = Self;
973
974        #[inline(always)]
975        fn inline_align(_context: fidl::encoding::Context) -> usize {
976            4
977        }
978
979        #[inline(always)]
980        fn inline_size(_context: fidl::encoding::Context) -> usize {
981            32
982        }
983        #[inline(always)]
984        fn encode_is_copy() -> bool {
985            true
986        }
987
988        #[inline(always)]
989        fn decode_is_copy() -> bool {
990            true
991        }
992    }
993
994    unsafe impl<D: fidl::encoding::ResourceDialect>
995        fidl::encoding::Encode<SocketSetIcmpv6FilterRequest, D> for &SocketSetIcmpv6FilterRequest
996    {
997        #[inline]
998        unsafe fn encode(
999            self,
1000            encoder: &mut fidl::encoding::Encoder<'_, D>,
1001            offset: usize,
1002            _depth: fidl::encoding::Depth,
1003        ) -> fidl::Result<()> {
1004            encoder.debug_check_bounds::<SocketSetIcmpv6FilterRequest>(offset);
1005            unsafe {
1006                // Copy the object into the buffer.
1007                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1008                (buf_ptr as *mut SocketSetIcmpv6FilterRequest)
1009                    .write_unaligned((self as *const SocketSetIcmpv6FilterRequest).read());
1010                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1011                // done second because the memcpy will write garbage to these bytes.
1012            }
1013            Ok(())
1014        }
1015    }
1016    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Icmpv6Filter, D>>
1017        fidl::encoding::Encode<SocketSetIcmpv6FilterRequest, D> for (T0,)
1018    {
1019        #[inline]
1020        unsafe fn encode(
1021            self,
1022            encoder: &mut fidl::encoding::Encoder<'_, D>,
1023            offset: usize,
1024            depth: fidl::encoding::Depth,
1025        ) -> fidl::Result<()> {
1026            encoder.debug_check_bounds::<SocketSetIcmpv6FilterRequest>(offset);
1027            // Zero out padding regions. There's no need to apply masks
1028            // because the unmasked parts will be overwritten by fields.
1029            // Write the fields.
1030            self.0.encode(encoder, offset + 0, depth)?;
1031            Ok(())
1032        }
1033    }
1034
1035    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1036        for SocketSetIcmpv6FilterRequest
1037    {
1038        #[inline(always)]
1039        fn new_empty() -> Self {
1040            Self { filter: fidl::new_empty!(Icmpv6Filter, D) }
1041        }
1042
1043        #[inline]
1044        unsafe fn decode(
1045            &mut self,
1046            decoder: &mut fidl::encoding::Decoder<'_, D>,
1047            offset: usize,
1048            _depth: fidl::encoding::Depth,
1049        ) -> fidl::Result<()> {
1050            decoder.debug_check_bounds::<Self>(offset);
1051            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1052            // Verify that padding bytes are zero.
1053            // Copy from the buffer into the object.
1054            unsafe {
1055                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 32);
1056            }
1057            Ok(())
1058        }
1059    }
1060
1061    impl fidl::encoding::ValueTypeMarker for SocketSetIpHeaderIncludedRequest {
1062        type Borrowed<'a> = &'a Self;
1063        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1064            value
1065        }
1066    }
1067
1068    unsafe impl fidl::encoding::TypeMarker for SocketSetIpHeaderIncludedRequest {
1069        type Owned = Self;
1070
1071        #[inline(always)]
1072        fn inline_align(_context: fidl::encoding::Context) -> usize {
1073            1
1074        }
1075
1076        #[inline(always)]
1077        fn inline_size(_context: fidl::encoding::Context) -> usize {
1078            1
1079        }
1080    }
1081
1082    unsafe impl<D: fidl::encoding::ResourceDialect>
1083        fidl::encoding::Encode<SocketSetIpHeaderIncludedRequest, D>
1084        for &SocketSetIpHeaderIncludedRequest
1085    {
1086        #[inline]
1087        unsafe fn encode(
1088            self,
1089            encoder: &mut fidl::encoding::Encoder<'_, D>,
1090            offset: usize,
1091            _depth: fidl::encoding::Depth,
1092        ) -> fidl::Result<()> {
1093            encoder.debug_check_bounds::<SocketSetIpHeaderIncludedRequest>(offset);
1094            // Delegate to tuple encoding.
1095            fidl::encoding::Encode::<SocketSetIpHeaderIncludedRequest, D>::encode(
1096                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.value),),
1097                encoder,
1098                offset,
1099                _depth,
1100            )
1101        }
1102    }
1103    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1104        fidl::encoding::Encode<SocketSetIpHeaderIncludedRequest, D> for (T0,)
1105    {
1106        #[inline]
1107        unsafe fn encode(
1108            self,
1109            encoder: &mut fidl::encoding::Encoder<'_, D>,
1110            offset: usize,
1111            depth: fidl::encoding::Depth,
1112        ) -> fidl::Result<()> {
1113            encoder.debug_check_bounds::<SocketSetIpHeaderIncludedRequest>(offset);
1114            // Zero out padding regions. There's no need to apply masks
1115            // because the unmasked parts will be overwritten by fields.
1116            // Write the fields.
1117            self.0.encode(encoder, offset + 0, depth)?;
1118            Ok(())
1119        }
1120    }
1121
1122    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1123        for SocketSetIpHeaderIncludedRequest
1124    {
1125        #[inline(always)]
1126        fn new_empty() -> Self {
1127            Self { value: fidl::new_empty!(bool, D) }
1128        }
1129
1130        #[inline]
1131        unsafe fn decode(
1132            &mut self,
1133            decoder: &mut fidl::encoding::Decoder<'_, D>,
1134            offset: usize,
1135            _depth: fidl::encoding::Depth,
1136        ) -> fidl::Result<()> {
1137            decoder.debug_check_bounds::<Self>(offset);
1138            // Verify that padding bytes are zero.
1139            fidl::decode!(bool, D, &mut self.value, decoder, offset + 0, _depth)?;
1140            Ok(())
1141        }
1142    }
1143
1144    impl fidl::encoding::ValueTypeMarker for SocketSetIpv6ChecksumRequest {
1145        type Borrowed<'a> = &'a Self;
1146        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1147            value
1148        }
1149    }
1150
1151    unsafe impl fidl::encoding::TypeMarker for SocketSetIpv6ChecksumRequest {
1152        type Owned = Self;
1153
1154        #[inline(always)]
1155        fn inline_align(_context: fidl::encoding::Context) -> usize {
1156            8
1157        }
1158
1159        #[inline(always)]
1160        fn inline_size(_context: fidl::encoding::Context) -> usize {
1161            16
1162        }
1163    }
1164
1165    unsafe impl<D: fidl::encoding::ResourceDialect>
1166        fidl::encoding::Encode<SocketSetIpv6ChecksumRequest, D> for &SocketSetIpv6ChecksumRequest
1167    {
1168        #[inline]
1169        unsafe fn encode(
1170            self,
1171            encoder: &mut fidl::encoding::Encoder<'_, D>,
1172            offset: usize,
1173            _depth: fidl::encoding::Depth,
1174        ) -> fidl::Result<()> {
1175            encoder.debug_check_bounds::<SocketSetIpv6ChecksumRequest>(offset);
1176            // Delegate to tuple encoding.
1177            fidl::encoding::Encode::<SocketSetIpv6ChecksumRequest, D>::encode(
1178                (<Ipv6ChecksumConfiguration as fidl::encoding::ValueTypeMarker>::borrow(
1179                    &self.config,
1180                ),),
1181                encoder,
1182                offset,
1183                _depth,
1184            )
1185        }
1186    }
1187    unsafe impl<
1188            D: fidl::encoding::ResourceDialect,
1189            T0: fidl::encoding::Encode<Ipv6ChecksumConfiguration, D>,
1190        > fidl::encoding::Encode<SocketSetIpv6ChecksumRequest, D> for (T0,)
1191    {
1192        #[inline]
1193        unsafe fn encode(
1194            self,
1195            encoder: &mut fidl::encoding::Encoder<'_, D>,
1196            offset: usize,
1197            depth: fidl::encoding::Depth,
1198        ) -> fidl::Result<()> {
1199            encoder.debug_check_bounds::<SocketSetIpv6ChecksumRequest>(offset);
1200            // Zero out padding regions. There's no need to apply masks
1201            // because the unmasked parts will be overwritten by fields.
1202            // Write the fields.
1203            self.0.encode(encoder, offset + 0, depth)?;
1204            Ok(())
1205        }
1206    }
1207
1208    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1209        for SocketSetIpv6ChecksumRequest
1210    {
1211        #[inline(always)]
1212        fn new_empty() -> Self {
1213            Self { config: fidl::new_empty!(Ipv6ChecksumConfiguration, D) }
1214        }
1215
1216        #[inline]
1217        unsafe fn decode(
1218            &mut self,
1219            decoder: &mut fidl::encoding::Decoder<'_, D>,
1220            offset: usize,
1221            _depth: fidl::encoding::Depth,
1222        ) -> fidl::Result<()> {
1223            decoder.debug_check_bounds::<Self>(offset);
1224            // Verify that padding bytes are zero.
1225            fidl::decode!(
1226                Ipv6ChecksumConfiguration,
1227                D,
1228                &mut self.config,
1229                decoder,
1230                offset + 0,
1231                _depth
1232            )?;
1233            Ok(())
1234        }
1235    }
1236
1237    impl fidl::encoding::ValueTypeMarker for SocketGetIcmpv6FilterResponse {
1238        type Borrowed<'a> = &'a Self;
1239        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1240            value
1241        }
1242    }
1243
1244    unsafe impl fidl::encoding::TypeMarker for SocketGetIcmpv6FilterResponse {
1245        type Owned = Self;
1246
1247        #[inline(always)]
1248        fn inline_align(_context: fidl::encoding::Context) -> usize {
1249            4
1250        }
1251
1252        #[inline(always)]
1253        fn inline_size(_context: fidl::encoding::Context) -> usize {
1254            32
1255        }
1256        #[inline(always)]
1257        fn encode_is_copy() -> bool {
1258            true
1259        }
1260
1261        #[inline(always)]
1262        fn decode_is_copy() -> bool {
1263            true
1264        }
1265    }
1266
1267    unsafe impl<D: fidl::encoding::ResourceDialect>
1268        fidl::encoding::Encode<SocketGetIcmpv6FilterResponse, D>
1269        for &SocketGetIcmpv6FilterResponse
1270    {
1271        #[inline]
1272        unsafe fn encode(
1273            self,
1274            encoder: &mut fidl::encoding::Encoder<'_, D>,
1275            offset: usize,
1276            _depth: fidl::encoding::Depth,
1277        ) -> fidl::Result<()> {
1278            encoder.debug_check_bounds::<SocketGetIcmpv6FilterResponse>(offset);
1279            unsafe {
1280                // Copy the object into the buffer.
1281                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1282                (buf_ptr as *mut SocketGetIcmpv6FilterResponse)
1283                    .write_unaligned((self as *const SocketGetIcmpv6FilterResponse).read());
1284                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1285                // done second because the memcpy will write garbage to these bytes.
1286            }
1287            Ok(())
1288        }
1289    }
1290    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Icmpv6Filter, D>>
1291        fidl::encoding::Encode<SocketGetIcmpv6FilterResponse, D> for (T0,)
1292    {
1293        #[inline]
1294        unsafe fn encode(
1295            self,
1296            encoder: &mut fidl::encoding::Encoder<'_, D>,
1297            offset: usize,
1298            depth: fidl::encoding::Depth,
1299        ) -> fidl::Result<()> {
1300            encoder.debug_check_bounds::<SocketGetIcmpv6FilterResponse>(offset);
1301            // Zero out padding regions. There's no need to apply masks
1302            // because the unmasked parts will be overwritten by fields.
1303            // Write the fields.
1304            self.0.encode(encoder, offset + 0, depth)?;
1305            Ok(())
1306        }
1307    }
1308
1309    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1310        for SocketGetIcmpv6FilterResponse
1311    {
1312        #[inline(always)]
1313        fn new_empty() -> Self {
1314            Self { filter: fidl::new_empty!(Icmpv6Filter, D) }
1315        }
1316
1317        #[inline]
1318        unsafe fn decode(
1319            &mut self,
1320            decoder: &mut fidl::encoding::Decoder<'_, D>,
1321            offset: usize,
1322            _depth: fidl::encoding::Depth,
1323        ) -> fidl::Result<()> {
1324            decoder.debug_check_bounds::<Self>(offset);
1325            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1326            // Verify that padding bytes are zero.
1327            // Copy from the buffer into the object.
1328            unsafe {
1329                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 32);
1330            }
1331            Ok(())
1332        }
1333    }
1334
1335    impl fidl::encoding::ValueTypeMarker for SocketGetInfoResponse {
1336        type Borrowed<'a> = &'a Self;
1337        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1338            value
1339        }
1340    }
1341
1342    unsafe impl fidl::encoding::TypeMarker for SocketGetInfoResponse {
1343        type Owned = Self;
1344
1345        #[inline(always)]
1346        fn inline_align(_context: fidl::encoding::Context) -> usize {
1347            8
1348        }
1349
1350        #[inline(always)]
1351        fn inline_size(_context: fidl::encoding::Context) -> usize {
1352            24
1353        }
1354    }
1355
1356    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SocketGetInfoResponse, D>
1357        for &SocketGetInfoResponse
1358    {
1359        #[inline]
1360        unsafe fn encode(
1361            self,
1362            encoder: &mut fidl::encoding::Encoder<'_, D>,
1363            offset: usize,
1364            _depth: fidl::encoding::Depth,
1365        ) -> fidl::Result<()> {
1366            encoder.debug_check_bounds::<SocketGetInfoResponse>(offset);
1367            // Delegate to tuple encoding.
1368            fidl::encoding::Encode::<SocketGetInfoResponse, D>::encode(
1369                (
1370                    <fidl_fuchsia_posix_socket__common::Domain as fidl::encoding::ValueTypeMarker>::borrow(&self.domain),
1371                    <ProtocolAssociation as fidl::encoding::ValueTypeMarker>::borrow(&self.proto),
1372                ),
1373                encoder, offset, _depth
1374            )
1375        }
1376    }
1377    unsafe impl<
1378            D: fidl::encoding::ResourceDialect,
1379            T0: fidl::encoding::Encode<fidl_fuchsia_posix_socket__common::Domain, D>,
1380            T1: fidl::encoding::Encode<ProtocolAssociation, D>,
1381        > fidl::encoding::Encode<SocketGetInfoResponse, D> for (T0, T1)
1382    {
1383        #[inline]
1384        unsafe fn encode(
1385            self,
1386            encoder: &mut fidl::encoding::Encoder<'_, D>,
1387            offset: usize,
1388            depth: fidl::encoding::Depth,
1389        ) -> fidl::Result<()> {
1390            encoder.debug_check_bounds::<SocketGetInfoResponse>(offset);
1391            // Zero out padding regions. There's no need to apply masks
1392            // because the unmasked parts will be overwritten by fields.
1393            unsafe {
1394                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1395                (ptr as *mut u64).write_unaligned(0);
1396            }
1397            // Write the fields.
1398            self.0.encode(encoder, offset + 0, depth)?;
1399            self.1.encode(encoder, offset + 8, depth)?;
1400            Ok(())
1401        }
1402    }
1403
1404    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketGetInfoResponse {
1405        #[inline(always)]
1406        fn new_empty() -> Self {
1407            Self {
1408                domain: fidl::new_empty!(fidl_fuchsia_posix_socket__common::Domain, D),
1409                proto: fidl::new_empty!(ProtocolAssociation, D),
1410            }
1411        }
1412
1413        #[inline]
1414        unsafe fn decode(
1415            &mut self,
1416            decoder: &mut fidl::encoding::Decoder<'_, D>,
1417            offset: usize,
1418            _depth: fidl::encoding::Depth,
1419        ) -> fidl::Result<()> {
1420            decoder.debug_check_bounds::<Self>(offset);
1421            // Verify that padding bytes are zero.
1422            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1423            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1424            let mask = 0xffffffffffff0000u64;
1425            let maskedval = padval & mask;
1426            if maskedval != 0 {
1427                return Err(fidl::Error::NonZeroPadding {
1428                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1429                });
1430            }
1431            fidl::decode!(
1432                fidl_fuchsia_posix_socket__common::Domain,
1433                D,
1434                &mut self.domain,
1435                decoder,
1436                offset + 0,
1437                _depth
1438            )?;
1439            fidl::decode!(ProtocolAssociation, D, &mut self.proto, decoder, offset + 8, _depth)?;
1440            Ok(())
1441        }
1442    }
1443
1444    impl fidl::encoding::ValueTypeMarker for SocketGetIpHeaderIncludedResponse {
1445        type Borrowed<'a> = &'a Self;
1446        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1447            value
1448        }
1449    }
1450
1451    unsafe impl fidl::encoding::TypeMarker for SocketGetIpHeaderIncludedResponse {
1452        type Owned = Self;
1453
1454        #[inline(always)]
1455        fn inline_align(_context: fidl::encoding::Context) -> usize {
1456            1
1457        }
1458
1459        #[inline(always)]
1460        fn inline_size(_context: fidl::encoding::Context) -> usize {
1461            1
1462        }
1463    }
1464
1465    unsafe impl<D: fidl::encoding::ResourceDialect>
1466        fidl::encoding::Encode<SocketGetIpHeaderIncludedResponse, D>
1467        for &SocketGetIpHeaderIncludedResponse
1468    {
1469        #[inline]
1470        unsafe fn encode(
1471            self,
1472            encoder: &mut fidl::encoding::Encoder<'_, D>,
1473            offset: usize,
1474            _depth: fidl::encoding::Depth,
1475        ) -> fidl::Result<()> {
1476            encoder.debug_check_bounds::<SocketGetIpHeaderIncludedResponse>(offset);
1477            // Delegate to tuple encoding.
1478            fidl::encoding::Encode::<SocketGetIpHeaderIncludedResponse, D>::encode(
1479                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.value),),
1480                encoder,
1481                offset,
1482                _depth,
1483            )
1484        }
1485    }
1486    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1487        fidl::encoding::Encode<SocketGetIpHeaderIncludedResponse, D> for (T0,)
1488    {
1489        #[inline]
1490        unsafe fn encode(
1491            self,
1492            encoder: &mut fidl::encoding::Encoder<'_, D>,
1493            offset: usize,
1494            depth: fidl::encoding::Depth,
1495        ) -> fidl::Result<()> {
1496            encoder.debug_check_bounds::<SocketGetIpHeaderIncludedResponse>(offset);
1497            // Zero out padding regions. There's no need to apply masks
1498            // because the unmasked parts will be overwritten by fields.
1499            // Write the fields.
1500            self.0.encode(encoder, offset + 0, depth)?;
1501            Ok(())
1502        }
1503    }
1504
1505    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1506        for SocketGetIpHeaderIncludedResponse
1507    {
1508        #[inline(always)]
1509        fn new_empty() -> Self {
1510            Self { value: fidl::new_empty!(bool, D) }
1511        }
1512
1513        #[inline]
1514        unsafe fn decode(
1515            &mut self,
1516            decoder: &mut fidl::encoding::Decoder<'_, D>,
1517            offset: usize,
1518            _depth: fidl::encoding::Depth,
1519        ) -> fidl::Result<()> {
1520            decoder.debug_check_bounds::<Self>(offset);
1521            // Verify that padding bytes are zero.
1522            fidl::decode!(bool, D, &mut self.value, decoder, offset + 0, _depth)?;
1523            Ok(())
1524        }
1525    }
1526
1527    impl fidl::encoding::ValueTypeMarker for SocketGetIpv6ChecksumResponse {
1528        type Borrowed<'a> = &'a Self;
1529        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1530            value
1531        }
1532    }
1533
1534    unsafe impl fidl::encoding::TypeMarker for SocketGetIpv6ChecksumResponse {
1535        type Owned = Self;
1536
1537        #[inline(always)]
1538        fn inline_align(_context: fidl::encoding::Context) -> usize {
1539            8
1540        }
1541
1542        #[inline(always)]
1543        fn inline_size(_context: fidl::encoding::Context) -> usize {
1544            16
1545        }
1546    }
1547
1548    unsafe impl<D: fidl::encoding::ResourceDialect>
1549        fidl::encoding::Encode<SocketGetIpv6ChecksumResponse, D>
1550        for &SocketGetIpv6ChecksumResponse
1551    {
1552        #[inline]
1553        unsafe fn encode(
1554            self,
1555            encoder: &mut fidl::encoding::Encoder<'_, D>,
1556            offset: usize,
1557            _depth: fidl::encoding::Depth,
1558        ) -> fidl::Result<()> {
1559            encoder.debug_check_bounds::<SocketGetIpv6ChecksumResponse>(offset);
1560            // Delegate to tuple encoding.
1561            fidl::encoding::Encode::<SocketGetIpv6ChecksumResponse, D>::encode(
1562                (<Ipv6ChecksumConfiguration as fidl::encoding::ValueTypeMarker>::borrow(
1563                    &self.config,
1564                ),),
1565                encoder,
1566                offset,
1567                _depth,
1568            )
1569        }
1570    }
1571    unsafe impl<
1572            D: fidl::encoding::ResourceDialect,
1573            T0: fidl::encoding::Encode<Ipv6ChecksumConfiguration, D>,
1574        > fidl::encoding::Encode<SocketGetIpv6ChecksumResponse, D> for (T0,)
1575    {
1576        #[inline]
1577        unsafe fn encode(
1578            self,
1579            encoder: &mut fidl::encoding::Encoder<'_, D>,
1580            offset: usize,
1581            depth: fidl::encoding::Depth,
1582        ) -> fidl::Result<()> {
1583            encoder.debug_check_bounds::<SocketGetIpv6ChecksumResponse>(offset);
1584            // Zero out padding regions. There's no need to apply masks
1585            // because the unmasked parts will be overwritten by fields.
1586            // Write the fields.
1587            self.0.encode(encoder, offset + 0, depth)?;
1588            Ok(())
1589        }
1590    }
1591
1592    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1593        for SocketGetIpv6ChecksumResponse
1594    {
1595        #[inline(always)]
1596        fn new_empty() -> Self {
1597            Self { config: fidl::new_empty!(Ipv6ChecksumConfiguration, D) }
1598        }
1599
1600        #[inline]
1601        unsafe fn decode(
1602            &mut self,
1603            decoder: &mut fidl::encoding::Decoder<'_, D>,
1604            offset: usize,
1605            _depth: fidl::encoding::Depth,
1606        ) -> fidl::Result<()> {
1607            decoder.debug_check_bounds::<Self>(offset);
1608            // Verify that padding bytes are zero.
1609            fidl::decode!(
1610                Ipv6ChecksumConfiguration,
1611                D,
1612                &mut self.config,
1613                decoder,
1614                offset + 0,
1615                _depth
1616            )?;
1617            Ok(())
1618        }
1619    }
1620
1621    impl fidl::encoding::ValueTypeMarker for SocketRecvMsgResponse {
1622        type Borrowed<'a> = &'a Self;
1623        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1624            value
1625        }
1626    }
1627
1628    unsafe impl fidl::encoding::TypeMarker for SocketRecvMsgResponse {
1629        type Owned = Self;
1630
1631        #[inline(always)]
1632        fn inline_align(_context: fidl::encoding::Context) -> usize {
1633            8
1634        }
1635
1636        #[inline(always)]
1637        fn inline_size(_context: fidl::encoding::Context) -> usize {
1638            56
1639        }
1640    }
1641
1642    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SocketRecvMsgResponse, D>
1643        for &SocketRecvMsgResponse
1644    {
1645        #[inline]
1646        unsafe fn encode(
1647            self,
1648            encoder: &mut fidl::encoding::Encoder<'_, D>,
1649            offset: usize,
1650            _depth: fidl::encoding::Depth,
1651        ) -> fidl::Result<()> {
1652            encoder.debug_check_bounds::<SocketRecvMsgResponse>(offset);
1653            // Delegate to tuple encoding.
1654            fidl::encoding::Encode::<SocketRecvMsgResponse, D>::encode(
1655                (
1656                    <fidl::encoding::OptionalUnion<fidl_fuchsia_net__common::SocketAddress> as fidl::encoding::ValueTypeMarker>::borrow(&self.addr),
1657                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
1658                    <fidl_fuchsia_posix_socket__common::NetworkSocketRecvControlData as fidl::encoding::ValueTypeMarker>::borrow(&self.control),
1659                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.truncated),
1660                ),
1661                encoder, offset, _depth
1662            )
1663        }
1664    }
1665    unsafe impl<
1666            D: fidl::encoding::ResourceDialect,
1667            T0: fidl::encoding::Encode<
1668                fidl::encoding::OptionalUnion<fidl_fuchsia_net__common::SocketAddress>,
1669                D,
1670            >,
1671            T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
1672            T2: fidl::encoding::Encode<
1673                fidl_fuchsia_posix_socket__common::NetworkSocketRecvControlData,
1674                D,
1675            >,
1676            T3: fidl::encoding::Encode<u32, D>,
1677        > fidl::encoding::Encode<SocketRecvMsgResponse, D> for (T0, T1, T2, T3)
1678    {
1679        #[inline]
1680        unsafe fn encode(
1681            self,
1682            encoder: &mut fidl::encoding::Encoder<'_, D>,
1683            offset: usize,
1684            depth: fidl::encoding::Depth,
1685        ) -> fidl::Result<()> {
1686            encoder.debug_check_bounds::<SocketRecvMsgResponse>(offset);
1687            // Zero out padding regions. There's no need to apply masks
1688            // because the unmasked parts will be overwritten by fields.
1689            unsafe {
1690                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
1691                (ptr as *mut u64).write_unaligned(0);
1692            }
1693            // Write the fields.
1694            self.0.encode(encoder, offset + 0, depth)?;
1695            self.1.encode(encoder, offset + 16, depth)?;
1696            self.2.encode(encoder, offset + 32, depth)?;
1697            self.3.encode(encoder, offset + 48, depth)?;
1698            Ok(())
1699        }
1700    }
1701
1702    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketRecvMsgResponse {
1703        #[inline(always)]
1704        fn new_empty() -> Self {
1705            Self {
1706                addr: fidl::new_empty!(
1707                    fidl::encoding::OptionalUnion<fidl_fuchsia_net__common::SocketAddress>,
1708                    D
1709                ),
1710                data: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
1711                control: fidl::new_empty!(
1712                    fidl_fuchsia_posix_socket__common::NetworkSocketRecvControlData,
1713                    D
1714                ),
1715                truncated: fidl::new_empty!(u32, D),
1716            }
1717        }
1718
1719        #[inline]
1720        unsafe fn decode(
1721            &mut self,
1722            decoder: &mut fidl::encoding::Decoder<'_, D>,
1723            offset: usize,
1724            _depth: fidl::encoding::Depth,
1725        ) -> fidl::Result<()> {
1726            decoder.debug_check_bounds::<Self>(offset);
1727            // Verify that padding bytes are zero.
1728            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
1729            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1730            let mask = 0xffffffff00000000u64;
1731            let maskedval = padval & mask;
1732            if maskedval != 0 {
1733                return Err(fidl::Error::NonZeroPadding {
1734                    padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
1735                });
1736            }
1737            fidl::decode!(
1738                fidl::encoding::OptionalUnion<fidl_fuchsia_net__common::SocketAddress>,
1739                D,
1740                &mut self.addr,
1741                decoder,
1742                offset + 0,
1743                _depth
1744            )?;
1745            fidl::decode!(
1746                fidl::encoding::UnboundedVector<u8>,
1747                D,
1748                &mut self.data,
1749                decoder,
1750                offset + 16,
1751                _depth
1752            )?;
1753            fidl::decode!(
1754                fidl_fuchsia_posix_socket__common::NetworkSocketRecvControlData,
1755                D,
1756                &mut self.control,
1757                decoder,
1758                offset + 32,
1759                _depth
1760            )?;
1761            fidl::decode!(u32, D, &mut self.truncated, decoder, offset + 48, _depth)?;
1762            Ok(())
1763        }
1764    }
1765
1766    impl fidl::encoding::ValueTypeMarker for Ipv6ChecksumConfiguration {
1767        type Borrowed<'a> = &'a Self;
1768        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1769            value
1770        }
1771    }
1772
1773    unsafe impl fidl::encoding::TypeMarker for Ipv6ChecksumConfiguration {
1774        type Owned = Self;
1775
1776        #[inline(always)]
1777        fn inline_align(_context: fidl::encoding::Context) -> usize {
1778            8
1779        }
1780
1781        #[inline(always)]
1782        fn inline_size(_context: fidl::encoding::Context) -> usize {
1783            16
1784        }
1785    }
1786
1787    unsafe impl<D: fidl::encoding::ResourceDialect>
1788        fidl::encoding::Encode<Ipv6ChecksumConfiguration, D> for &Ipv6ChecksumConfiguration
1789    {
1790        #[inline]
1791        unsafe fn encode(
1792            self,
1793            encoder: &mut fidl::encoding::Encoder<'_, D>,
1794            offset: usize,
1795            _depth: fidl::encoding::Depth,
1796        ) -> fidl::Result<()> {
1797            encoder.debug_check_bounds::<Ipv6ChecksumConfiguration>(offset);
1798            encoder.write_num::<u64>(self.ordinal(), offset);
1799            match self {
1800                Ipv6ChecksumConfiguration::Disabled(ref val) => {
1801                    fidl::encoding::encode_in_envelope::<Empty, D>(
1802                        <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
1803                        encoder,
1804                        offset + 8,
1805                        _depth,
1806                    )
1807                }
1808                Ipv6ChecksumConfiguration::Offset(ref val) => {
1809                    fidl::encoding::encode_in_envelope::<i32, D>(
1810                        <i32 as fidl::encoding::ValueTypeMarker>::borrow(val),
1811                        encoder,
1812                        offset + 8,
1813                        _depth,
1814                    )
1815                }
1816            }
1817        }
1818    }
1819
1820    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1821        for Ipv6ChecksumConfiguration
1822    {
1823        #[inline(always)]
1824        fn new_empty() -> Self {
1825            Self::Disabled(fidl::new_empty!(Empty, D))
1826        }
1827
1828        #[inline]
1829        unsafe fn decode(
1830            &mut self,
1831            decoder: &mut fidl::encoding::Decoder<'_, D>,
1832            offset: usize,
1833            mut depth: fidl::encoding::Depth,
1834        ) -> fidl::Result<()> {
1835            decoder.debug_check_bounds::<Self>(offset);
1836            #[allow(unused_variables)]
1837            let next_out_of_line = decoder.next_out_of_line();
1838            let handles_before = decoder.remaining_handles();
1839            let (ordinal, inlined, num_bytes, num_handles) =
1840                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1841
1842            let member_inline_size = match ordinal {
1843                1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1844                2 => <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1845                _ => return Err(fidl::Error::UnknownUnionTag),
1846            };
1847
1848            if inlined != (member_inline_size <= 4) {
1849                return Err(fidl::Error::InvalidInlineBitInEnvelope);
1850            }
1851            let _inner_offset;
1852            if inlined {
1853                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1854                _inner_offset = offset + 8;
1855            } else {
1856                depth.increment()?;
1857                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1858            }
1859            match ordinal {
1860                1 => {
1861                    #[allow(irrefutable_let_patterns)]
1862                    if let Ipv6ChecksumConfiguration::Disabled(_) = self {
1863                        // Do nothing, read the value into the object
1864                    } else {
1865                        // Initialize `self` to the right variant
1866                        *self = Ipv6ChecksumConfiguration::Disabled(fidl::new_empty!(Empty, D));
1867                    }
1868                    #[allow(irrefutable_let_patterns)]
1869                    if let Ipv6ChecksumConfiguration::Disabled(ref mut val) = self {
1870                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
1871                    } else {
1872                        unreachable!()
1873                    }
1874                }
1875                2 => {
1876                    #[allow(irrefutable_let_patterns)]
1877                    if let Ipv6ChecksumConfiguration::Offset(_) = self {
1878                        // Do nothing, read the value into the object
1879                    } else {
1880                        // Initialize `self` to the right variant
1881                        *self = Ipv6ChecksumConfiguration::Offset(fidl::new_empty!(i32, D));
1882                    }
1883                    #[allow(irrefutable_let_patterns)]
1884                    if let Ipv6ChecksumConfiguration::Offset(ref mut val) = self {
1885                        fidl::decode!(i32, D, val, decoder, _inner_offset, depth)?;
1886                    } else {
1887                        unreachable!()
1888                    }
1889                }
1890                ordinal => panic!("unexpected ordinal {:?}", ordinal),
1891            }
1892            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1893                return Err(fidl::Error::InvalidNumBytesInEnvelope);
1894            }
1895            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1896                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1897            }
1898            Ok(())
1899        }
1900    }
1901
1902    impl fidl::encoding::ValueTypeMarker for ProtocolAssociation {
1903        type Borrowed<'a> = &'a Self;
1904        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1905            value
1906        }
1907    }
1908
1909    unsafe impl fidl::encoding::TypeMarker for ProtocolAssociation {
1910        type Owned = Self;
1911
1912        #[inline(always)]
1913        fn inline_align(_context: fidl::encoding::Context) -> usize {
1914            8
1915        }
1916
1917        #[inline(always)]
1918        fn inline_size(_context: fidl::encoding::Context) -> usize {
1919            16
1920        }
1921    }
1922
1923    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ProtocolAssociation, D>
1924        for &ProtocolAssociation
1925    {
1926        #[inline]
1927        unsafe fn encode(
1928            self,
1929            encoder: &mut fidl::encoding::Encoder<'_, D>,
1930            offset: usize,
1931            _depth: fidl::encoding::Depth,
1932        ) -> fidl::Result<()> {
1933            encoder.debug_check_bounds::<ProtocolAssociation>(offset);
1934            encoder.write_num::<u64>(self.ordinal(), offset);
1935            match self {
1936                ProtocolAssociation::Unassociated(ref val) => {
1937                    fidl::encoding::encode_in_envelope::<Empty, D>(
1938                        <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
1939                        encoder,
1940                        offset + 8,
1941                        _depth,
1942                    )
1943                }
1944                ProtocolAssociation::Associated(ref val) => {
1945                    fidl::encoding::encode_in_envelope::<u8, D>(
1946                        <u8 as fidl::encoding::ValueTypeMarker>::borrow(val),
1947                        encoder,
1948                        offset + 8,
1949                        _depth,
1950                    )
1951                }
1952            }
1953        }
1954    }
1955
1956    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ProtocolAssociation {
1957        #[inline(always)]
1958        fn new_empty() -> Self {
1959            Self::Unassociated(fidl::new_empty!(Empty, D))
1960        }
1961
1962        #[inline]
1963        unsafe fn decode(
1964            &mut self,
1965            decoder: &mut fidl::encoding::Decoder<'_, D>,
1966            offset: usize,
1967            mut depth: fidl::encoding::Depth,
1968        ) -> fidl::Result<()> {
1969            decoder.debug_check_bounds::<Self>(offset);
1970            #[allow(unused_variables)]
1971            let next_out_of_line = decoder.next_out_of_line();
1972            let handles_before = decoder.remaining_handles();
1973            let (ordinal, inlined, num_bytes, num_handles) =
1974                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1975
1976            let member_inline_size = match ordinal {
1977                1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1978                2 => <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1979                _ => return Err(fidl::Error::UnknownUnionTag),
1980            };
1981
1982            if inlined != (member_inline_size <= 4) {
1983                return Err(fidl::Error::InvalidInlineBitInEnvelope);
1984            }
1985            let _inner_offset;
1986            if inlined {
1987                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1988                _inner_offset = offset + 8;
1989            } else {
1990                depth.increment()?;
1991                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1992            }
1993            match ordinal {
1994                1 => {
1995                    #[allow(irrefutable_let_patterns)]
1996                    if let ProtocolAssociation::Unassociated(_) = self {
1997                        // Do nothing, read the value into the object
1998                    } else {
1999                        // Initialize `self` to the right variant
2000                        *self = ProtocolAssociation::Unassociated(fidl::new_empty!(Empty, D));
2001                    }
2002                    #[allow(irrefutable_let_patterns)]
2003                    if let ProtocolAssociation::Unassociated(ref mut val) = self {
2004                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
2005                    } else {
2006                        unreachable!()
2007                    }
2008                }
2009                2 => {
2010                    #[allow(irrefutable_let_patterns)]
2011                    if let ProtocolAssociation::Associated(_) = self {
2012                        // Do nothing, read the value into the object
2013                    } else {
2014                        // Initialize `self` to the right variant
2015                        *self = ProtocolAssociation::Associated(fidl::new_empty!(u8, D));
2016                    }
2017                    #[allow(irrefutable_let_patterns)]
2018                    if let ProtocolAssociation::Associated(ref mut val) = self {
2019                        fidl::decode!(u8, D, val, decoder, _inner_offset, depth)?;
2020                    } else {
2021                        unreachable!()
2022                    }
2023                }
2024                ordinal => panic!("unexpected ordinal {:?}", ordinal),
2025            }
2026            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2027                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2028            }
2029            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2030                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2031            }
2032            Ok(())
2033        }
2034    }
2035}